/* EmpireVault Design System */

/* ── Design Tokens ── */
:root {
  /* Primary palette — teal-driven per UI spec */
  --color-primary: #0d9488;
  --color-primary-hover: #0f766e;
  --color-primary-light: #ccfbf1;
  --color-accent: #2dd4bf;
  --color-accent-hover: #14b8a6;
  --color-accent-light: #ccfbf1;

  /* Slate scale */
  --color-slate-50: #f8fafc;
  --color-slate-100: #f1f5f9;
  --color-slate-200: #e2e8f0;
  --color-slate-300: #cbd5e1;
  --color-slate-400: #94a3b8;
  --color-slate-500: #64748b;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;

  /* Semantic text */
  --color-text-primary: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;

  /* Surfaces */
  --color-surface: #ffffff;
  --color-background: #f8fafc;
  --color-border: #e2e8f0;

  /* Status colors */
  --color-success: #10b981;
  --color-success-light: #dcfce7;
  --color-success-dark: #166534;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-warning-dark: #92400e;
  --color-danger: #ef4444;
  --color-danger-light: #fee2e2;
  --color-danger-dark: #991b1b;
  --color-info: #2563eb;
  --color-info-light: #dbeafe;
  --color-info-dark: #1e40af;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* ── Base ── */
body { font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; margin: 0; background: var(--color-background); color: var(--color-text-primary); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--color-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { text-decoration: underline; color: var(--color-primary-hover); }

/* ── Shell Layout ── */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--color-surface); border-right: 1px solid var(--color-border); padding: var(--space-md); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-bottom { margin-top: var(--space-lg); }
.sidebar .brand { font-weight: 700; font-size: 18px; margin-bottom: 12px; color: var(--color-text-primary); letter-spacing: -0.01em; }
.sidebar nav { position: relative; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; margin: 2px 8px; font-size: 13.5px; color: var(--color-text-secondary); transition: all var(--transition-fast); font-weight: 500; position: relative; }
.sidebar nav a:hover { background: var(--color-slate-100); color: var(--color-text-primary); text-decoration: none; }
.sidebar nav a.nav-active { background: rgba(13, 148, 136, 0.15); color: #0d9488; font-weight: 600; }
.sidebar nav a.nav-active::before { content: ''; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; background: #0d9488; border-radius: 9999px; }
.sidebar nav a .nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.sidebar nav a.nav-active .nav-icon { opacity: 1; }

.main { flex: 1; min-width: 0; background: #f1f5f9; }

/* ── Topbar ── */
.topbar { height: 60px; background: var(--color-surface); border-bottom: 1px solid var(--color-border); display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-xl); }
.topbar span { font-size: 13px; color: var(--color-text-secondary); }
.topbar-meta { font-size: 13px; color: var(--color-text-secondary); display: flex; align-items: center; gap: 8px; }
.topbar-meta strong { color: var(--color-text-primary); font-weight: 600; }
.topbar button, .topbar input[type="submit"] { background: var(--color-slate-100); color: var(--color-text-secondary); border: 1px solid var(--color-border); padding: 6px 14px; font-size: 13px; border-radius: var(--radius-md); }
.topbar button:hover, .topbar input[type="submit"]:hover { background: var(--color-slate-200); color: var(--color-text-primary); opacity: 1; }

/* ── Breadcrumb ── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--color-text-secondary); }
.breadcrumb a { color: var(--color-text-secondary); text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { color: var(--color-primary); text-decoration: none; }
.breadcrumb .separator { color: var(--color-text-muted); margin: 0 2px; font-size: 16px; }
.breadcrumb .current { color: var(--color-text-primary); font-weight: 600; }

/* ── Page ── */
.page { padding: var(--space-lg) var(--space-xl); background: #f1f5f9; }

/* ── Page Header ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: var(--space-lg); }
.page-meta { font-size: 13px; color: var(--color-text-secondary); margin-top: 4px; }

/* ── Cards ── */
.card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 20px; max-width: 640px; box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06); transition: all var(--transition-normal); }
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06); transform: translateY(-1px); }
.card-hover:hover { box-shadow: var(--shadow-md); }
.h1 { font-size: 24px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.02em; color: var(--color-text-primary); }
.muted { color: var(--color-text-secondary); margin: 0 0 var(--space-md); font-size: 14px; }

/* ── Forms ── */
label { display: block; font-weight: 500; margin: 10px 0 6px; font-size: 14px; color: var(--color-text-primary); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], input[type="tel"], input[type="search"] {
  width: 100%; max-width: 420px; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--color-border); font-size: 14px; font-family: inherit; background: var(--color-surface); color: var(--color-text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input[type="text"]::placeholder, input[type="email"]::placeholder, input[type="search"]::placeholder { color: var(--color-text-muted); }
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="number"]:focus, input[type="url"]:focus, input[type="tel"]:focus, input[type="search"]:focus {
  outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
select {
  padding: 8px 10px; border-radius: var(--radius-md); border: 1px solid var(--color-border); font-size: 14px; font-family: inherit; background: var(--color-surface); color: var(--color-text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15); }
textarea {
  border-radius: var(--radius-md); border: 1px solid var(--color-border); font-size: 14px; font-family: inherit; color: var(--color-text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15); }

/* ── Base Buttons ── */
button, input[type="submit"] { background: var(--color-primary); color: #fff; border: 0; border-radius: var(--radius-md); padding: 10px 16px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all var(--transition-fast); }
button:hover, input[type="submit"]:hover { background: var(--color-primary-hover); opacity: 1; }

/* ── Flash Messages ── */
.flash { max-width: 900px; margin-bottom: 12px; padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-surface); box-shadow: var(--shadow-sm); font-size: 14px; }
.flash.notice { border-color: #bbf7d0; background: #f0fdf4; color: var(--color-success-dark); }
.flash.alert { border-color: #fecaca; background: #fef2f2; color: var(--color-danger-dark); }

/* ── Utility ── */
.hidden { display: none !important; }
.link { color: var(--color-info); text-decoration: underline; }

/* ── Focus & Accessibility ── */
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .form-input:focus-visible { outline: none; }

/* ── Button Variants ── */
.btn { display: inline-flex; align-items: center; gap: var(--space-sm); padding: 10px 20px; border-radius: var(--radius-md); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; transition: all var(--transition-fast); border: none; }
.btn:hover { text-decoration: none; }
.btn-primary { background: #0d9488; color: #fff; box-shadow: 0 1px 3px rgba(13,148,136,0.3), 0 1px 2px rgba(0,0,0,0.06); }
.btn-primary:hover { background: #0f766e; color: #fff; text-decoration: none; box-shadow: 0 4px 8px rgba(13,148,136,0.3), 0 2px 4px rgba(0,0,0,0.06); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-accent { background: var(--color-accent); color: var(--color-slate-900); font-weight: 600; box-shadow: var(--shadow-sm); }
.btn-accent:hover { background: var(--color-accent-hover); color: var(--color-slate-900); text-decoration: none; box-shadow: var(--shadow-md); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; text-decoration: none; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; text-decoration: none; }
.btn-outline { background: var(--color-surface); color: var(--color-text-primary); border: 1px solid var(--color-border); }
.btn-outline:hover { background: var(--color-background); border-color: var(--color-text-secondary); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--color-text-secondary); }
.btn-ghost:hover { background: var(--color-background); color: var(--color-text-primary); text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ── Icon Button ── */
.icon-btn { width: 32px; height: 32px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; background: transparent; border: none; color: var(--color-text-secondary); cursor: pointer; padding: 0; transition: all var(--transition-fast); }
.icon-btn:hover { background: var(--color-background); color: var(--color-text-primary); }

/* ── Badges ── */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-full); transition: all var(--transition-fast); letter-spacing: 0.02em; text-transform: uppercase; }
.badge-active { background: var(--color-success-light); color: var(--color-success-dark); }
.badge-inactive { background: var(--color-slate-100); color: var(--color-text-secondary); }
.badge-revoked { background: var(--color-danger-light); color: var(--color-danger-dark); }
.badge-open { background: var(--color-info-light); color: var(--color-info); }
.badge-pending { background: var(--color-warning-light); color: var(--color-warning-dark); }
.badge-closed, .badge-resolved { background: var(--color-slate-100); color: var(--color-text-secondary); }
.badge-high, .badge-urgent { background: var(--color-danger-light); color: var(--color-danger); }
.badge-medium { background: var(--color-warning-light); color: var(--color-warning-dark); }
.badge-low { background: var(--color-info-light); color: var(--color-info); }

/* ── Credential Rows ── */
.credential-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--color-slate-100); }
.credential-row:last-child { border-bottom: none; }
.credential-label { width: 110px; font-size: 13px; font-weight: 600; color: var(--color-text-secondary); flex-shrink: 0; }
.credential-value { display: flex; align-items: center; gap: 8px; flex: 1; }
.credential-value code { font-family: 'Courier New', monospace; font-size: 13px; background: var(--color-background); padding: 4px 8px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); letter-spacing: 0.02em; }
.copy-btn, .toggle-btn { font-size: 12px; padding: 4px 10px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-secondary); transition: all var(--transition-fast); }
.copy-btn:hover, .toggle-btn:hover { background: var(--color-slate-100); }

/* ── Context File List ── */
.context-file-list { list-style: none; margin: 0; padding: 0; }
.context-file-list li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--color-slate-100); }
.context-file-list li:last-child { border-bottom: none; }

/* ── Data Table ── */
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--color-border); box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06); }
.data-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--color-text-secondary); padding: 12px 16px; background: #f1f5f9; border-bottom: 1px solid var(--color-border); text-transform: uppercase; letter-spacing: 0.05em; }
.data-table td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--color-border); color: var(--color-text-primary); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--color-background); }
.site-row:hover { background: var(--color-slate-100); }
.site-row-selected, .site-row-selected:hover { background: #eff6ff; }

/* ── Table (generic — used by 12+ views) ── */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--color-border); box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06); }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--color-text-secondary); padding: 12px 16px; background: #f1f5f9; border-bottom: 1px solid var(--color-border); text-transform: uppercase; letter-spacing: 0.05em; }
.table td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--color-border); color: var(--color-text-primary); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--color-background); }

/* ── Table name cell with avatar ── */
.name-cell { display: flex; align-items: center; gap: 12px; }
.name-avatar { width: 36px; height: 36px; border-radius: var(--radius-md); background: var(--color-primary-light); color: var(--color-primary); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.name-cell .name-text { font-weight: 600; color: var(--color-text-primary); }
.name-cell .name-sub { font-size: 12px; color: var(--color-text-muted); margin-top: 1px; }

/* ── Contact count badge ── */
.count-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; }
.count-badge--has { background: var(--color-primary-light); color: var(--color-primary); }
.count-badge--empty { background: var(--color-slate-100); color: var(--color-text-muted); }

/* ── Table actions cell ── */
.actions-cell { text-align: right; }

/* ── Empty State ── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-2xl); text-align: center; background: var(--color-surface); border: 1px dashed var(--color-slate-300); border-radius: var(--radius-lg); max-width: 640px; }
.empty-state-icon { width: 80px; height: 80px; border-radius: var(--radius-full); background: var(--color-background); display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-lg); color: var(--color-text-muted); }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--color-text-primary); margin: 0 0 var(--space-sm); }
.empty-state p { font-size: 14px; color: var(--color-text-secondary); margin: 0 0 var(--space-lg); max-width: 360px; }

/* ── Context Editor Tabs ── */
.context-editor { max-width: 860px; }
.tab-strip { display: flex; gap: 4px; border-bottom: 2px solid var(--color-border); }
.tab-item { padding: 8px 16px; font-size: 14px; font-weight: 500; color: var(--color-text-secondary); border-radius: 8px 8px 0 0; text-decoration: none; transition: all var(--transition-fast); }
.tab-item:hover { background: var(--color-slate-100); color: var(--color-text-primary); text-decoration: none; }
.tab-active { background: var(--color-surface); color: var(--color-text-primary); border: 2px solid var(--color-border); border-bottom: 2px solid var(--color-surface); margin-bottom: -2px; font-weight: 600; }

/* ── Context Textarea ── */
.context-textarea { width: 100%; box-sizing: border-box; padding: 12px; border: 1px solid var(--color-border); border-radius: var(--radius-md); font-size: 13px; line-height: 1.6; resize: vertical; outline: none; }
.context-textarea:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15); }

/* ── Dashboard ── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 900px; }
@media (max-width: 768px) { .dashboard-grid { grid-template-columns: 1fr; } }
.dashboard-card { max-width: none; padding: 20px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -0.01em; color: var(--color-text-primary); }
.card-detail { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.detail-label { font-size: 13px; font-weight: 600; color: var(--color-text-secondary); }
.detail-value { font-size: 13px; color: var(--color-text-primary); }
.card-body-text { font-size: 14px; color: var(--color-text-secondary); margin: 0 0 12px; }
.card-actions { margin-top: 8px; }
.card-muted { opacity: 0.6; }

/* ── Stat Cards ── */
.stat-card { max-width: none; text-align: center; padding: 24px 20px; border-top: 3px solid var(--color-primary); }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--color-text-primary); margin: 0; letter-spacing: -0.02em; }
.stat-card .stat-label { font-size: 12px; color: var(--color-text-secondary); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.stat-card--blue { border-top-color: var(--color-info); }
.stat-card--green { border-top-color: var(--color-success); }
.stat-card--amber { border-top-color: var(--color-warning); }
.stat-card--red { border-top-color: var(--color-danger); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
@media (max-width: 768px) { .stat-grid { grid-template-columns: 1fr 1fr; } }

/* ── Card Border Variants ── */
.card-border-blue { border-left: 4px solid var(--color-info); }
.card-border-green { border-left: 4px solid var(--color-success); }
.card-border-amber { border-left: 4px solid var(--color-warning); }
.card-border-red { border-left: 4px solid var(--color-danger); }
.card-border-teal { border-left: 4px solid var(--color-primary); }

/* ── Inline Edit Form ── */
.org-form label { margin: 0 0 4px; font-size: 13px; }
.inline-edit { display: flex; align-items: center; gap: 8px; }
.inline-input { flex: 1; padding: 8px 10px; font-size: 14px; max-width: 300px; }

/* ── Trial Badge & Meter ── */
.badge-trial { background: var(--color-warning-light); color: var(--color-warning-dark); }
.trial-status { margin-top: 4px; }
.trial-meter { height: 8px; background: var(--color-slate-100); border-radius: var(--radius-full); overflow: hidden; margin-bottom: 8px; }
.trial-bar { height: 100%; background: var(--color-warning); border-radius: var(--radius-full); transition: width 0.3s; }
.trial-text { font-size: 14px; color: var(--color-text-primary); margin: 0; }
.muted-sm { font-size: 12px; color: var(--color-text-secondary); }
.trial-expired-text { font-size: 14px; color: var(--color-danger); margin: 0; font-weight: 500; }

/* ── Form Row ── */
.form-row { margin-bottom: 8px; }

/* ── Welcome Row ── */
.welcome-row { display: flex; align-items: center; gap: 12px; }
.btn-settings { background: var(--color-slate-100); color: var(--color-text-secondary); border: 1px solid var(--color-border); font-size: 12px; }
.btn-settings:hover { background: var(--color-slate-200); color: var(--color-text-primary); text-decoration: none; }

/* ── Sidebar Divider ── */
.sidebar-divider { height: 1px; background: var(--color-border); margin: 8px 0; }

/* ── Sidebar Section Label ── */
.sidebar-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); padding: 20px 12px 8px; font-weight: 600; margin-top: 4px; }

/* ── Tool Switcher ── */
.tool-switcher { margin-top: auto; padding-top: 8px; }
.tool-switcher-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); padding: 0 10px; margin-bottom: 4px; font-weight: 600; }
.tool-switcher-item { display: block; padding: 6px 10px; border-radius: var(--radius-md); font-size: 14px; color: var(--color-text-secondary); text-decoration: none; transition: all var(--transition-fast); }
.tool-switcher-item:hover { background: var(--color-slate-100); color: var(--color-text-primary); text-decoration: none; }
.tool-switcher-active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }
.tool-switcher-active:hover { background: var(--color-primary-light); }
.tool-switcher-disabled { color: var(--color-slate-300); cursor: not-allowed; }
.tool-switcher-disabled:hover { background: none; color: var(--color-slate-300); }

/* ── Account Settings ── */
.account-sections { max-width: 560px; }
.account-card { margin-bottom: 16px; max-width: none; }

/* ── Account Tabs ── */
.account-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid var(--color-border); }
.account-tab { background: none; color: var(--color-text-secondary); border: none; padding: 8px 16px; font-size: 14px; font-weight: 500; border-radius: 8px 8px 0 0; cursor: pointer; transition: all var(--transition-fast); }
.account-tab:hover { background: var(--color-slate-100); color: var(--color-text-primary); }
.account-tab-active { color: var(--color-text-primary); background: var(--color-surface); border: 2px solid var(--color-border); border-bottom: 2px solid var(--color-surface); margin-bottom: -2px; }

/* ── Tab Panels ── */
.tab-panel { display: none; }
.tab-panel-active { display: block; }

/* ── Account Forms ── */
.account-form { margin-top: 4px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--color-text-primary); margin: 0 0 6px; }
.form-input { width: 100%; max-width: 360px; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--color-border); font-size: 14px; box-sizing: border-box; color: var(--color-text-primary); background: var(--color-surface); transition: border-color var(--transition-fast), box-shadow var(--transition-fast); }
.form-input::placeholder { color: var(--color-text-muted); }
.form-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15); }
.form-input:disabled { background: var(--color-background); color: var(--color-text-muted); cursor: not-allowed; }
.form-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; display: block; }
.form-actions { margin-top: var(--space-md); }

/* ── Recovery Steps ── */
.recovery-steps { margin-top: 8px; }
.recovery-step { font-size: 14px; color: var(--color-text-secondary); margin: 0 0 8px; line-height: 1.5; }

/* ── Back Button ── */
.btn-back { background: var(--color-slate-100); color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.btn-back:hover { background: var(--color-slate-200); color: var(--color-text-primary); text-decoration: none; }

/* ── Password Reset ── */
.reset-container { max-width: 420px; margin: 60px auto; padding: 24px; }

/* ── Bulk Actions Bar ── */
.bulk-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 12px; background: var(--color-primary-light); border: 1px solid var(--color-primary); border-radius: var(--radius-md); font-size: 13px; }
.bulk-bar span { font-weight: 600; color: var(--color-primary); }
.bulk-bar form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

/* ── Content Containers ── */
.content-narrow { max-width: 720px; }
.content-medium { max-width: 860px; }
.content-wide { max-width: 1100px; }

/* ── Section Heading ── */
.section-heading { font-size: 1rem; font-weight: 600; margin: 0 0 12px; color: var(--color-text-primary); }

/* ── Back Link ── */
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-text-secondary); margin-bottom: 20px; }
.back-link:hover { color: var(--color-primary); text-decoration: none; }

/* ── Detail Grid ── */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; font-size: 14px; }
.detail-grid .detail-field-label { color: var(--color-text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.detail-grid .detail-field-value { color: var(--color-text-primary); }

/* ── Inline Badge (for status/type indicators) ── */
.inline-badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; }
.inline-badge--pending { background: var(--color-slate-100); color: var(--color-text-secondary); }
.inline-badge--info { background: var(--color-info-light); color: var(--color-info-dark); }
.inline-badge--warning { background: var(--color-warning-light); color: var(--color-warning-dark); }
.inline-badge--success { background: var(--color-success-light); color: #15803d; }
.inline-badge--danger { background: var(--color-danger-light); color: var(--color-danger); }
.inline-badge--purple { background: #f3e8ff; color: #7c3aed; }
.inline-badge--teal { background: var(--color-primary-light); color: var(--color-primary); }
.inline-badge--neutral { background: var(--color-slate-100); color: var(--color-text-secondary); }
.inline-badge--vip { background: var(--color-danger-light); color: var(--color-danger-dark); }

/* ── Score Badge ── */
.score-badge { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius-md); color: #fff; font-size: 12px; font-weight: 700; }

/* ── List Row ── */
.list-row { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--color-slate-100); padding: 8px 0; }
.list-row:last-child { border-bottom: none; }

/* ── Timeline Entry ── */
.timeline-entry { display: flex; align-items: flex-start; gap: 10px; border-bottom: 1px solid var(--color-slate-100); padding: 8px 0; }
.timeline-entry:last-child { border-bottom: none; }
.timeline-content { flex: 1; min-width: 0; }
.timeline-description { font-size: 13px; color: var(--color-text-primary); }
.timeline-details { font-size: 12px; color: var(--color-text-secondary); margin-top: 2px; }
.timeline-timestamp { font-size: 11px; color: var(--color-text-muted); white-space: nowrap; }

/* ── Meta Text ── */
.text-meta { font-size: 11px; color: var(--color-text-muted); }
.text-small { font-size: 13px; }
.text-muted { color: var(--color-text-secondary); }
.text-danger { color: var(--color-danger); }

/* ── Action Link ── */
.action-link { font-size: 13px; font-weight: 600; color: var(--color-primary); }
.action-link:hover { text-decoration: underline; color: var(--color-primary-hover); }
.action-link--muted { color: var(--color-text-secondary); }
.action-link--info { color: var(--color-info); }
.action-link--danger { color: var(--color-danger); }

/* ── File Row ── */
.file-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.file-row:last-child { border-bottom: none; }

/* ── Card Spacing ── */
.card + .card, .card-mb { margin-bottom: 16px; }

/* ── Dark Sidebar ── */
.sidebar-dark { background: var(--color-slate-800); border-right: none; box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15); }
.sidebar-dark .brand { color: #fff; font-size: 20px; letter-spacing: 0.02em; padding-bottom: 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 16px; }
.sidebar-dark nav a { color: var(--color-slate-400); margin: 2px 8px; border-radius: 8px; }
.sidebar-dark nav a .nav-icon { color: var(--color-slate-400); }
.sidebar-dark nav a:hover { background: rgba(255, 255, 255, 0.08); color: var(--color-slate-200); }
.sidebar-dark nav a.nav-active { background: rgba(45, 212, 191, 0.15); color: #5eead4; border-left: 3px solid #14b8a6; padding-left: 9px; }
.sidebar-dark nav a.nav-active .nav-icon { color: #5eead4; opacity: 1; }
.sidebar-dark .sidebar-divider { background: rgba(255, 255, 255, 0.08); }
.sidebar-dark .sidebar-section-label { color: rgba(255, 255, 255, 0.3); border-top: 1px solid rgba(255, 255, 255, 0.06); padding-top: 16px; margin-top: 8px; }
.sidebar-dark .tool-switcher-label { color: rgba(255, 255, 255, 0.3); }
.sidebar-dark .tool-switcher-item { color: var(--color-slate-400); }
.sidebar-dark .tool-switcher-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar-dark .tool-switcher-active { background: rgba(13, 148, 136, 0.15); color: var(--color-primary); }
.sidebar-dark .tenant-switcher { margin-bottom: 4px; }
.sidebar-dark .tenant-switcher .tool-switcher-label { color: rgba(255, 255, 255, 0.3); }
.sidebar-dark .tenant-switcher .tool-switcher-item { color: var(--color-slate-400); }
.sidebar-dark .tenant-switcher .tool-switcher-active { color: var(--color-primary); }
.sidebar-dark .tenant-switcher button.tool-switcher-item { background: none; border: none; color: var(--color-slate-400); }
.sidebar-dark .tenant-switcher button.tool-switcher-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

/* ── Sidebar User Profile (bottom) ── */
.sidebar-profile { padding: 12px; margin: 8px -4px -4px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: flex; align-items: center; gap: 10px; }
.sidebar-profile-avatar { width: 32px; height: 32px; border-radius: var(--radius-full); background: rgba(13, 148, 136, 0.2); color: var(--color-primary); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-profile-info { flex: 1; min-width: 0; }
.sidebar-profile-email { font-size: 12px; color: var(--color-slate-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-profile-actions { display: flex; gap: 8px; margin-top: 4px; }
.sidebar-profile-actions a, .sidebar-profile-actions button { font-size: 11px; color: var(--color-slate-400); background: none; border: none; padding: 0; cursor: pointer; transition: color var(--transition-fast); }
.sidebar-profile-actions a:hover, .sidebar-profile-actions button:hover { color: #fff; text-decoration: none; }

/* ── App Cards (Dashboard launcher) ── */
.app-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-lg); max-width: 1100px; }
.app-card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06); padding: var(--space-lg); transition: all var(--transition-normal); position: relative; display: flex; flex-direction: column; gap: 12px; max-width: none; }
.app-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06); border-color: #0d9488; transform: translateY(-2px); }
.app-card::before { content: ''; position: absolute; top: 0; left: var(--space-lg); right: var(--space-lg); height: 3px; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.app-card--engage::before { background: #f59e0b; }
.app-card--crm::before { background: var(--color-primary); }
.app-card--tickets::before { background: #f97316; }
.app-card--users::before { background: #6366f1; }

.app-card-icon { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.app-card-icon--engage { background: #fef3c7; color: #d97706; }
.app-card-icon--crm { background: var(--color-primary-light); color: var(--color-primary); }
.app-card-icon--tickets { background: #ffedd5; color: #ea580c; }
.app-card-icon--users { background: #e0e7ff; color: #4f46e5; }

.app-card-title { font-size: 18px; font-weight: 700; color: var(--color-text-primary); margin: 0; }
.app-card-desc { font-size: 13px; color: var(--color-text-secondary); margin: 0; }
.app-card-meta { font-size: 13px; color: var(--color-text-secondary); }
.app-card-meta strong { color: var(--color-text-primary); }

.badge-paid { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; background: #dcfce7; color: #16a34a; position: absolute; top: var(--space-md); right: var(--space-md); text-transform: uppercase; letter-spacing: 0.02em; }
.badge-trial-abs { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; background: var(--color-warning-light); color: var(--color-warning-dark); position: absolute; top: var(--space-md); right: var(--space-md); text-transform: uppercase; letter-spacing: 0.02em; }
.badge-not-active { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; background: var(--color-slate-100); color: var(--color-text-secondary); position: absolute; top: var(--space-md); right: var(--space-md); text-transform: uppercase; letter-spacing: 0.02em; }

.btn-launch { background: var(--color-primary); color: #fff; padding: 8px 16px; border-radius: var(--radius-md); font-size: 14px; font-weight: 600; border: none; cursor: pointer; box-shadow: var(--shadow-sm); transition: all var(--transition-fast); display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; text-decoration: none; }
.btn-launch:hover { background: var(--color-primary-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); color: #fff; text-decoration: none; }

/* ── Dashboard Header ── */
.dashboard-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--space-xl); }
.dashboard-title { font-size: 24px; font-weight: 700; color: var(--color-text-primary); margin: 0 0 4px; letter-spacing: -0.02em; }
.dashboard-subtitle { font-size: 14px; color: var(--color-text-secondary); margin: 0; }

/* ── Skeleton Loading ── */
@keyframes skeleton-pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
.skeleton { background: var(--color-border); border-radius: var(--radius-sm); animation: skeleton-pulse 1.5s ease-in-out infinite; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .sidebar { width: 60px; padding: 12px 8px; }
  .sidebar .brand { font-size: 0; overflow: hidden; width: 0; padding: 0; margin: 0; border: none; }
  .sidebar nav a { padding: 10px; justify-content: center; font-size: 0; gap: 0; border-left: none; }
  .sidebar nav a .nav-icon { width: 20px; height: 20px; }
  .sidebar .sidebar-section-label { font-size: 0; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.06); }
  .sidebar .tool-switcher-label { font-size: 0; }
  .sidebar .tool-switcher-item { font-size: 0; padding: 10px; text-align: center; }
  .sidebar-profile { padding: 8px; flex-direction: column; }
  .sidebar-profile-info { display: none; }
}

/* ══════════════════════════════════════════════════════════════════
   CRITICAL OVERRIDES — last in file to guarantee cascade priority.
   These fix the 3 persistent visual issues.
   ══════════════════════════════════════════════════════════════════ */

/* 1. Content area MUST be gray, not white */
.main,
.page,
.shell > .main,
.shell > .main > .page {
  background-color: #eef2f7 !important;
}

/* 2. Sidebar active: rounded pill, NOT full-width solid block */
.sidebar-dark nav a {
  margin: 2px 8px !important;
  border-radius: 8px !important;
  border-left: 3px solid transparent !important;
}
.sidebar-dark nav a.nav-active {
  background: rgba(45, 212, 191, 0.15) !important;
  color: #5eead4 !important;
  border-left: 3px solid #14b8a6 !important;
}
.sidebar-dark nav a.nav-active .nav-icon {
  color: #5eead4 !important;
}

/* 3. Cards need visible shadows */
.card,
.dashboard-card,
.app-card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}
.card:hover,
.dashboard-card:hover,
.app-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06) !important;
  transform: translateY(-2px);
}

/* ═══════════════════════════════════════════
   Calendar View
   ═══════════════════════════════════════════ */

.calendar-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px - 40px); /* minus topbar and padding */
  position: relative;
}

/* ── Week Navigation ── */

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-slate-200);
  margin-bottom: 0;
}

.calendar-nav-controls {
  display: flex;
  gap: 6px;
}

.calendar-nav-label {
  font-weight: 600;
  font-size: 1.1em;
  color: var(--color-slate-700);
}

/* ── Body: sidebar + grid ── */

.calendar-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Calendar Sidebar ── */

.calendar-sidebar {
  width: 200px;
  flex-shrink: 0;
  padding: 16px 12px;
  border-right: 1px solid var(--color-slate-200);
  overflow-y: auto;
}

.calendar-sidebar-title {
  font-weight: 600;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-slate-400);
  margin-bottom: 12px;
}

.calendar-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
  font-size: 0.9em;
  color: var(--color-slate-700);
}

.calendar-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.calendar-toggle-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calendar-toggle-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Grid Wrapper ── */

.calendar-grid-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── All-day events row ── */

.calendar-allday-row {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border-bottom: 1px solid var(--color-slate-200);
  min-height: 28px;
}

.calendar-allday-cell {
  padding: 2px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 1px solid var(--color-slate-100);
}

.calendar-allday-event {
  font-size: 0.75em;
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* ── Day headers ── */

.calendar-day-headers {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border-bottom: 1px solid var(--color-slate-200);
}

.calendar-day-header {
  text-align: center;
  padding: 8px 0;
  border-left: 1px solid var(--color-slate-100);
}

.calendar-day-name {
  display: block;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-slate-400);
}

.calendar-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 0.95em;
  font-weight: 600;
  color: var(--color-slate-700);
}

.calendar-day-number-today {
  background: var(--color-primary);
  color: #fff;
  border-radius: 50%;
}

.calendar-day-today {
  background: rgba(13, 148, 136, 0.03);
}

/* ── Scrollable time grid ── */

.calendar-grid-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.calendar-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  position: relative;
}

/* ── Time column ── */

.calendar-time-column {
  /* Empty — just defines the column */
}

.calendar-time-label {
  height: 60px;
  font-size: 0.7em;
  color: var(--color-slate-400);
  text-align: right;
  padding-right: 8px;
  padding-top: 0;
  line-height: 1;
  position: relative;
  top: -6px;
}

/* ── Day columns ── */

.calendar-day-column {
  position: relative;
  border-left: 1px solid var(--color-slate-100);
  cursor: pointer;
}

.calendar-day-today-col {
  background: rgba(13, 148, 136, 0.02);
}

.calendar-hour-cell {
  height: 60px;
  border-bottom: 1px solid var(--color-slate-100);
}

.calendar-hour-cell:hover {
  background: rgba(13, 148, 136, 0.04);
}

/* ── Event blocks ── */

.calendar-event {
  position: absolute;
  left: 2px;
  right: 2px;
  border-left: 3px solid var(--color-primary);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.8em;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
  transition: box-shadow 0.15s;
}

.calendar-event:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

.calendar-event--dragging {
  opacity: 0.5;
}

.calendar-event-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.calendar-event-time {
  font-size: 0.85em;
  color: var(--color-slate-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-event-resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
}

/* ── Current time indicator ── */

.calendar-time-indicator {
  position: absolute;
  height: 2px;
  background: var(--color-danger);
  z-index: 3;
  pointer-events: none;
}

.calendar-time-indicator::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  background: var(--color-danger);
  border-radius: 50%;
}

/* ── Popover ── */

.calendar-popover {
  position: fixed;
  z-index: 100;
  width: 320px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-slate-200);
}

.calendar-popover-content {
  padding: 16px;
}

.calendar-popover-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calendar-popover-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-slate-200);
  border-radius: var(--radius-md);
  font-size: 0.9em;
  box-sizing: border-box;
}

.calendar-popover-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}

.calendar-popover-input--half {
  width: 48%;
}

.calendar-popover-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-slate-200);
  border-radius: var(--radius-md);
  font-size: 0.9em;
  box-sizing: border-box;
  background: #fff;
}

.calendar-popover-row {
  display: flex;
  gap: 8px;
}

.calendar-popover-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ── Detail popover ── */

.calendar-popover-detail {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calendar-popover-detail-color {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  margin-bottom: 4px;
}

.calendar-popover-detail-title {
  font-weight: 600;
  font-size: 1.05em;
  color: var(--color-slate-800);
}

.calendar-popover-detail-meta {
  font-size: 0.9em;
  color: var(--color-slate-500);
}

.calendar-popover-detail-desc {
  font-size: 0.85em;
  color: var(--color-slate-600);
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--color-slate-100);
}

.calendar-popover-detail-calendar {
  font-size: 0.8em;
  color: var(--color-slate-400);
  margin-top: 4px;
}

/* ── Toast ── */

.calendar-toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9em;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: calendar-toast-in 0.2s ease;
}

.calendar-toast--error {
  background: var(--color-danger);
  color: #fff;
}

.calendar-toast--success {
  background: #10b981;
  color: #fff;
}

@keyframes calendar-toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Help Widget ─────────────────────────────────────── */

.help-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: inherit;
}

.help-widget__btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-teal, #0d9488);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background 0.15s, transform 0.15s;
}

.help-widget__btn:hover {
  background: #0f766e;
  transform: scale(1.05);
}

.help-widget__panel {
  position: absolute;
  bottom: 64px;
  right: 0;
  width: 380px;
  height: 500px;
  background: #fff;
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.help-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-teal, #0d9488);
  color: #fff;
}

.help-widget__title {
  font-weight: 600;
  font-size: 0.95em;
}

.help-widget__header-actions {
  display: flex;
  gap: 4px;
}

.help-widget__header-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.help-widget__header-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.help-widget__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-widget__welcome {
  background: #f0fdfa;
  border-radius: var(--radius-md, 8px);
  padding: 12px;
  font-size: 0.9em;
  color: var(--color-slate-700, #334155);
}

.help-widget__welcome p {
  margin: 0 0 4px;
}

.help-widget__welcome p:last-child {
  margin-bottom: 0;
}

.help-widget__msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9em;
  line-height: 1.5;
  word-wrap: break-word;
}

.help-widget__msg--user {
  align-self: flex-end;
  background: var(--color-teal, #0d9488);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.help-widget__msg--assistant {
  align-self: flex-start;
  background: #f1f5f9;
  color: var(--color-slate-800, #1e293b);
  border-bottom-left-radius: 4px;
}

.help-widget__msg--assistant a {
  color: var(--color-teal, #0d9488);
  text-decoration: underline;
}

.help-widget__msg--assistant strong {
  font-weight: 600;
}

.help-widget__msg--assistant ul,
.help-widget__msg--assistant ol {
  margin: 4px 0;
  padding-left: 20px;
}

.help-widget__msg--assistant code {
  background: #e2e8f0;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.9em;
}

.help-widget__sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.help-widget__source-chip {
  display: inline-block;
  font-size: 0.78em;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.15s;
}

.help-widget__source-chip:hover {
  background: #bae6fd;
}

.help-widget__feedback {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.help-widget__feedback-btn {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.78em;
  cursor: pointer;
  color: var(--color-slate-500, #64748b);
  transition: all 0.15s;
}

.help-widget__feedback-btn:hover {
  border-color: var(--color-teal, #0d9488);
  color: var(--color-teal, #0d9488);
}

.help-widget__feedback-btn--active {
  background: var(--color-teal, #0d9488);
  color: #fff;
  border-color: var(--color-teal, #0d9488);
}

.help-widget__escalate-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 14px;
  background: #fff;
  color: var(--color-teal, #0d9488);
  border: 1px solid var(--color-teal, #0d9488);
  border-radius: 6px;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.15s;
}

.help-widget__escalate-btn:hover {
  background: var(--color-teal, #0d9488);
  color: #fff;
}

.help-widget__typing {
  padding: 8px 16px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.help-widget__typing span {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: help-typing 1.2s infinite;
}

.help-widget__typing span:nth-child(2) { animation-delay: 0.2s; }
.help-widget__typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes help-typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

.help-widget__input-area {
  display: flex;
  padding: 12px;
  border-top: 1px solid #e2e8f0;
  gap: 8px;
}

.help-widget__input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.9em;
  outline: none;
  transition: border-color 0.15s;
}

.help-widget__input:focus {
  border-color: var(--color-teal, #0d9488);
}

.help-widget__input:disabled {
  background: #f8fafc;
  color: #94a3b8;
}

.help-widget__send-btn {
  background: var(--color-teal, #0d9488);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background 0.15s;
}

.help-widget__send-btn:hover {
  background: #0f766e;
}

.help-widget__send-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.help-widget__rate-limit {
  padding: 8px 16px;
  font-size: 0.85em;
  color: var(--color-slate-500, #64748b);
  text-align: center;
}
