/* ================================================================
   XHS-JS Design System — Professional SaaS Grade
   Inspired by Linear, Notion, Vercel Dashboard
   ================================================================ */

/* ========== Reset ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ========== Design Tokens ========== */
:root {
  /* ── Primary palette ── */
  --primary: #ff2442;
  --primary-hover: #e11d48;
  --primary-active: #be123c;
  --primary-soft: #fff1f3;
  --primary-text: #be123c;
  --primary-gradient: linear-gradient(135deg, #ff2442 0%, #fb7185 100%);

  /* ── Platform colors ── */
  --xhs: #ff2442;
  --xhs-hover: #e61e3c;
  --xhs-soft: #fff1f3;
  --xhs-text: #b91c1c;
  --wechat: #07c160;
  --wechat-soft: #ecfdf5;
  --wechat-text: #15803d;

  /* ── Neutral palette — 12 steps ── */
  --gray-50: #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-300: #d4d4d8;
  --gray-400: #a1a1aa;
  --gray-500: #71717a;
  --gray-600: #52525b;
  --gray-700: #3f3f46;
  --gray-800: #27272a;
  --gray-900: #18181b;
  --gray-950: #09090b;

  /* ── Semantic colors ── */
  --success: #10b981;
  --success-hover: #059669;
  --success-soft: #ecfdf5;
  --success-text: #065f46;
  --warning: #f59e0b;
  --warning-hover: #d97706;
  --warning-soft: #fffbeb;
  --warning-text: #92400e;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: #fef2f2;
  --danger-text: #991b1b;
  --info: #3b82f6;
  --info-soft: #eff6ff;
  --info-text: #1e40af;

  /* ── Legacy aliases (backward compat) ── */
  --red: var(--xhs);
  --red-hover: var(--xhs-hover);
  --red-soft: var(--xhs-soft);
  --red-text: var(--xhs-text);
  --blue: var(--info);
  --blue-soft: var(--info-soft);
  --green: var(--success);
  --green-soft: var(--success-soft);
  --green-text: var(--success-text);
  --amber: var(--warning);
  --amber-soft: var(--warning-soft);
  --amber-text: var(--warning-text);

  /* ── Surfaces ── */
  --bg: #f5f7fb;
  --bg-app: #f5f7fb;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #f8fafc;
  --bg-active: #f1f5f9;
  --bg-inverse: #0f172a;

  /* ── Card ── */
  --card: #ffffff;

  /* ── Borders ── */
  --border: #dde3ee;
  --border-default: #dde3ee;
  --border-subtle: #edf1f7;
  --border-light: #edf1f7;
  --border-strong: #c4ccd8;
  --border-focus: var(--primary);

  /* ── Text ── */
  --text: #0f172a;
  --text-primary: #0f172a;
  --text-strong: #1e293b;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --dark: #0f172a;

  /* ── Shadows — 6 levels ── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.035);
  --shadow-card-hover: 0 12px 30px rgba(15, 23, 42, 0.07), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 24px 80px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
  --shadow-glow-lg: 0 0 40px rgba(99, 102, 241, 0.2);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.04);

  /* ── Radius ── */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* ── Typography ── */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  --font-family: var(--font-sans);
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  --tracking-tight: 0;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;

  /* ── Spacing ── */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ── Transitions ── */
  --transition-fast: 0.1s ease;
  --transition-base: 0.15s ease;
  --transition-slow: 0.25s ease;
  --transition-spring: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-smooth: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  /* ── Z-index scale ── */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-tooltip: 600;
  --z-toast: 700;

  /* ── Glass morphism ── */
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-blur: 16px;
}

/* ========== Base Styles ========== */
html,
body {
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100%;
  text-rendering: optimizeLegibility;
}

#root {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== Utility: Text helpers ========== */
.text-muted { color: var(--text-tertiary); }
.text-strong { color: var(--text-primary); font-weight: 700; }
.text-secondary { color: var(--text-secondary); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.font-mono { font-family: var(--font-mono); }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  font-size: var(--text-base);
  font-family: var(--font-sans);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
  letter-spacing: var(--tracking-normal);
}

.btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.btn:active {
  transform: scale(0.98);
  background: var(--bg-active);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm), 0 1px 2px rgba(99, 102, 241, 0.2);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-md), 0 2px 4px rgba(99, 102, 241, 0.25);
}
.btn-primary:active {
  background: var(--primary-active);
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-tertiary);
}
.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
.btn-ghost:active {
  background: var(--bg-active);
}

.btn-danger {
  background: var(--bg-card);
  border: 1px solid #fecaca;
  color: var(--danger-text);
}
.btn-danger:hover {
  background: var(--danger-soft);
  border-color: #fca5a5;
  box-shadow: var(--shadow-xs);
}
.btn-danger:active {
  background: #fee2e2;
}

.btn-sm {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  border-radius: var(--radius-xs);
  font-weight: 600;
}

.btn-lg {
  height: 48px;
  padding: 0 var(--space-8);
  font-size: var(--text-lg);
  border-radius: var(--radius-md);
}

.btn-icon {
  width: 40px;
  padding: 0;
}
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-lg { width: 48px; }

/* ========== Badges ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-sans);
  white-space: nowrap;
  letter-spacing: 0.02em;
  line-height: 1.6;
}
.badge-default {
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}
.badge-red {
  background: var(--danger-soft);
  color: var(--danger-text);
}
.badge-green {
  background: var(--success-soft);
  color: var(--success-text);
}
.badge-amber {
  background: var(--warning-soft);
  color: var(--warning-text);
}
.badge-blue {
  background: var(--info-soft);
  color: var(--info-text);
}
.badge-dark {
  background: var(--gray-900);
  color: var(--text-inverse);
}
.badge-primary {
  background: var(--primary-soft);
  color: var(--primary-text);
}

/* ========== Cards ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
  transition:
    box-shadow var(--transition-base),
    border-color var(--transition-base),
    transform var(--transition-base);
}

.card-flat {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

/* ========== Panel ========== */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
}

.panel-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  letter-spacing: var(--tracking-tight);
}

/* ========== App Sidebar — Dark Theme (Linear/Notion style) ========== */

/* ── Sidebar Shell ── */
.sidebar-dark {
  width: 248px;
  height: 100%;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition:
    width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
}
.sidebar-dark--collapsed {
  width: 60px;
}

/* ── Brand Area ── */
.sidebar-dark-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
  flex-shrink: 0;
}
.sidebar-dark-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff2442 0%, #fb7185 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 20px rgba(255, 36, 66, 0.22);
}
.sidebar-dark-logo:hover {
  transform: scale(1.08);
}
.sidebar-dark-brand-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.sidebar-dark-brand-name {
  font-size: 15px;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-dark-brand-version {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  background: rgba(100, 116, 139, 0.15);
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.sidebar-dark-collapse-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.sidebar-dark-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

/* ── Quick Actions ── */
.sidebar-dark-actions {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.sidebar-dark-new-btn {
  height: 36px;
  border-radius: 8px;
  border: none;
  background: #ff2442;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
  box-shadow: 0 8px 18px rgba(255, 36, 66, 0.18);
}
.sidebar-dark-new-btn:hover {
  background: #e11d48;
  box-shadow: 0 10px 22px rgba(255, 36, 66, 0.24);
}
.sidebar-dark-new-btn:active {
  transform: scale(0.98);
}
.sidebar-dark-search-btn {
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  font-weight: 600;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}
.sidebar-dark-search-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.15);
}
.sidebar-dark-kbd {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  line-height: 1.4;
}

/* ── Collapsed Actions ── */
.sidebar-dark-actions-collapsed {
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.sidebar-dark-icon-btn {
  width: 40px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.sidebar-dark-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

/* ── Platform Switcher ── */
.sidebar-dark-platform {
  padding: 0 12px 10px;
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.sidebar-dark-platform-btn {
  flex: 1;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: #64748b;
  font-weight: 600;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}
.sidebar-dark-platform-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}
.sidebar-dark-platform-btn--active {
  border-color: rgba(255, 255, 255, 0.1);
  font-weight: 700;
}
.sidebar-dark-platform-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: box-shadow 0.2s ease;
}
.sidebar-dark-platform-collapsed {
  padding: 0 10px 8px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-dark-platform-dot-lg {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* ── Scrollable Area ── */
.sidebar-dark-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}
/* Dark scrollbar */
.sidebar-dark-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-dark-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-dark-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
}
.sidebar-dark-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Navigation Group ── */
.sidebar-dark-group {
  margin-bottom: 4px;
}
.sidebar-dark-group-label {
  font-size: 10px;
  color: #475569;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 14px 4px;
  user-select: none;
}
.sidebar-dark-group-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 8px 12px;
}
.sidebar-dark-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 12px 14px 4px;
  font-family: var(--font-sans);
}
.sidebar-dark-group-count {
  font-size: 10px;
  font-weight: 700;
  color: #475569;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
}
.sidebar-dark-group-chevron {
  margin-left: auto;
  color: #475569;
  transition: transform 0.2s ease;
  display: flex;
}

/* ── Navigation Item ── */
.sidebar-dark-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 8px;
}
.sidebar-dark-nav-item {
  height: 32px;
  border: none;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: #94a3b8;
  background: transparent;
  font-family: var(--font-sans);
  text-align: left;
  position: relative;
  transition:
    background 0.12s ease,
    color 0.12s ease;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-dark-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}
.sidebar-dark-nav-item--active {
  background: rgba(255, 255, 255, 0.11);
  color: #f1f5f9;
  font-weight: 700;
}
.sidebar-dark-nav-item--collapsed {
  justify-content: center;
  padding: 0;
  margin: 0 4px;
}

/* Left accent bar for active item */
.sidebar-dark-nav-accent {
  position: absolute;
  left: -8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.sidebar-dark-nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}
.sidebar-dark-nav-item--active .sidebar-dark-nav-icon {
  color: #fb7185;
}
.sidebar-dark-nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.sidebar-dark-nav-badge {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* ── Account Section ── */
.sidebar-dark-accounts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px 8px;
}
.sidebar-dark-account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  text-align: left;
  color: #94a3b8;
  transition:
    background 0.12s ease,
    color 0.12s ease;
  width: 100%;
}
.sidebar-dark-account:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}
.sidebar-dark-account-avatar {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.sidebar-dark-account-info {
  flex: 1;
  min-width: 0;
}
.sidebar-dark-account-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-dark-account:hover .sidebar-dark-account-name {
  color: #f8fafc;
}
.sidebar-dark-account-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #64748b;
  margin-top: 1px;
}
.sidebar-dark-account-platform-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sidebar-dark-account-type {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  flex-shrink: 0;
}
.sidebar-dark-account-type--peer {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}
.sidebar-dark-account-viewall {
  width: 100%;
  padding: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}
.sidebar-dark-account-viewall:hover {
  color: var(--primary);
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.06);
}
.sidebar-dark-account-empty {
  text-align: center;
  padding: 12px 0;
  color: #475569;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.sidebar-dark-account-empty button {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}
.sidebar-dark-account-empty button:hover {
  border-color: rgba(99, 102, 241, 0.3);
  color: #e2e8f0;
}

/* ── Bottom Section ── */
.sidebar-dark-bottom {
  flex-shrink: 0;
  padding: 8px 8px 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-dark-expand-btn {
  width: 40px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px auto 0;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.sidebar-dark-expand-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

/* ── Tooltip ── */
.sidebar-tooltip-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
}
.sidebar-tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--gray-900);
  color: #f1f5f9;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.sidebar-tooltip::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: var(--gray-900);
}
.sidebar-tooltip--top {
  left: 50%;
  top: auto;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
}
.sidebar-tooltip--top::before {
  top: 100%;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--gray-900);
}
.sidebar-tooltip-wrapper:hover .sidebar-tooltip { opacity: 1; }

/* ========== Inputs ========== */
.input {
  height: 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  padding: 0 14px;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  width: 100%;
  font-size: var(--text-base);
  font-family: var(--font-sans);
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}
.input::placeholder {
  color: var(--text-tertiary);
}
.input:hover {
  border-color: var(--border-strong);
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

textarea.input {
  height: auto;
  padding: var(--space-3) 14px;
  line-height: var(--leading-relaxed);
  min-height: 80px;
  resize: vertical;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.input-error {
  border-color: var(--danger);
}
.input-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

/* ========== Tabs ========== */
.tabs {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.tab {
  padding: 7px 14px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition:
    color var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast);
}
.tab:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}
.tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: transparent;
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}

/* ========== Progress bar ========== */
.progress {
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  transition: width 0.4s var(--ease-out);
}
.progress-bar-success { background: var(--success); }
.progress-bar-warning { background: var(--warning); }
.progress-bar-danger { background: var(--danger); }

/* ========== Tables ========== */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  padding: var(--space-3) 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--gray-50);
  border-bottom: 1px solid var(--border-default);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.table tbody td {
  padding: var(--space-3) 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-strong);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr {
  transition: background var(--transition-fast);
}
.table tbody tr:hover { background: var(--bg-hover); }

/* ========== Status dots ========== */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.status-dot.green { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot.amber { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.status-dot.red { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.status-dot.blue { background: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}
::-webkit-scrollbar-corner { background: transparent; }

/* ========== Layout shell (page container) ========== */
.page {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-header {
  padding: var(--space-6) 28px var(--space-5);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-shrink: 0;
}
.page-header h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  margin-bottom: 4px;
}
.page-header .page-sub {
  font-size: var(--text-base);
  color: var(--text-tertiary);
  line-height: var(--leading-normal);
}
.page-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-shrink: 0;
}

.page-body {
  flex: 1;
  overflow: auto;
  padding: 0 28px 28px;
}

/* ========== Metric grid cards ========== */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.metric {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition:
    box-shadow var(--transition-base),
    border-color var(--transition-base),
    transform var(--transition-base);
  position: relative;
  overflow: hidden;
}
.metric::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity var(--transition-base);
}
.metric:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.metric:hover::before {
  opacity: 1;
}
.metric .label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.metric .value {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: var(--space-2);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}
.metric .delta {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}
.metric .delta.positive { color: var(--success); }
.metric .delta.negative { color: var(--danger); }
.metric-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  background: var(--primary-soft);
  flex-shrink: 0;
}
.metric-icon-fallback {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  font-size: 13px;
  flex-shrink: 0;
}

/* ========== Grid layouts ========== */
.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

@media (max-width: 1280px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ========== Section heading ========== */
.section-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  letter-spacing: var(--tracking-tight);
}

/* ========== Tag / chip ========== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: var(--text-sm);
  font-weight: 700;
  transition: background var(--transition-fast);
}

/* ========== Empty state ========== */
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-tertiary);
}
.empty-icon {
  font-size: 44px;
  margin-bottom: var(--space-3);
  opacity: 0.5;
}
.empty-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}
.empty-text {
  font-size: 13px;
  line-height: var(--leading-relaxed);
}

/* ========== Global Search / Modal ========== */
.global-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  animation: fadeIn 0.15s var(--ease-out);
}
.global-search-modal {
  width: 100%;
  max-width: 640px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  border: 1px solid var(--border-default);
  animation: modalSlideIn 0.2s var(--ease-out);
}
.global-search-input-wrapper {
  display: flex;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-2);
}
.global-search-input {
  flex: 1;
  border: 0;
  outline: 0;
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  font-family: var(--font-sans);
}
.global-search-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}
.global-search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-1) 0;
}
.global-search-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.global-search-item:hover {
  background: var(--bg-subtle);
}

/* ========== Layout Shell ========== */
.layout-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.layout-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.layout-main {
  flex: 1;
  overflow: auto;
  background: var(--bg);
  position: relative;
  transition: min-width 0.2s ease;
}
.layout-context-toggle {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 50;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  box-shadow: var(--shadow-xs);
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}
.layout-context-toggle:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.layout-context-panel-wrapper {
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Context Panel — Upgraded ========== */
.ctx-panel {
  width: 320px;
  flex-shrink: 0;
  height: 100%;
  background: var(--bg-subtle);
  border-left: 1px solid var(--border-default);
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.ctx-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}
.ctx-panel-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ctx-panel-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.ctx-panel-close {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.ctx-panel-close:hover {
  background: var(--gray-200);
  color: var(--text-primary);
}

/* ── Card ── */
.ctx-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.ctx-card:hover {
  border-color: var(--border-strong);
}
.ctx-card-header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--text-primary);
}
.ctx-card-body {
  margin-top: var(--space-2);
}
.ctx-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.ctx-card-chevron {
  margin-left: auto;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--text-tertiary);
}
.ctx-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--success-text);
  background: var(--success-soft);
  padding: 1px 8px;
  border-radius: var(--radius-full);
}

/* ── Stats grid 2x2 ── */
.ctx-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.ctx-stat-item {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  text-align: center;
  transition: background 0.15s ease;
}
.ctx-stat-item:hover {
  background: var(--gray-100);
}
.ctx-stat-value {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}
.ctx-stat-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ── Key-value list ── */
.ctx-kv-list { margin-top: var(--space-2); }
.ctx-kv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
}
.ctx-kv-row-last { border-bottom: none; }
.ctx-kv-key { color: var(--text-tertiary); }
.ctx-kv-value { color: var(--text-primary); font-weight: 700; }

/* ── Status dot ── */
.ctx-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── AI source cards ── */
.ctx-ai-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.ctx-ai-card {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
  cursor: pointer;
}
.ctx-ai-card:hover {
  border-color: var(--border-default);
  background: var(--bg-card);
}
.ctx-ai-card--active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.1);
}
.ctx-ai-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ctx-ai-card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ctx-ai-card-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
}
.ctx-ai-card-active-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: auto;
}
.ctx-ai-card-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* ── Empty ── */
.ctx-empty {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
  text-align: center;
  padding: var(--space-2) 0;
}
.ctx-more {
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 4px;
}

/* ── Compliance ── */
.ctx-compliance {
  background: var(--warning-soft);
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}
.ctx-compliance-text {
  font-size: var(--text-sm);
  color: var(--warning-text);
  line-height: 1.55;
}
.ctx-compliance-btn {
  display: block;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid #fde68a;
  background: var(--bg-card);
  color: var(--warning-text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s ease;
}
.ctx-compliance-btn:hover {
  background: #fefce8;
}

/* ========== Chat ========== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6) 28px;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.chat-message {
  display: flex;
  gap: var(--space-3);
  animation: slideInUp 0.25s var(--ease-out);
  align-items: flex-start;
}
.chat-message-user {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  font-weight: 800;
  flex-shrink: 0;
}
.chat-avatar-ai {
  background: var(--gray-900);
  color: var(--text-inverse);
}
.chat-avatar-user {
  background: var(--primary-gradient);
  color: var(--text-inverse);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.chat-bubble {
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-5);
  line-height: var(--leading-relaxed);
  font-size: var(--text-base);
  word-break: break-word;
  max-width: 720px;
}
.chat-bubble-assistant {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}
.chat-bubble-user {
  background: var(--primary-gradient);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm), 0 2px 8px rgba(99, 102, 241, 0.2);
}

.chat-welcome-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  margin-bottom: var(--space-1);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}
.chat-welcome-desc {
  font-size: var(--text-base);
  color: var(--text-tertiary);
  margin-bottom: var(--space-5);
  line-height: var(--leading-relaxed);
}

.chat-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.chat-quick-card {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  text-align: left;
}
.chat-quick-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 4px 12px rgba(99, 102, 241, 0.1);
}
.chat-quick-card:active {
  transform: translateY(0);
}
.chat-quick-card-icon { font-size: 20px; margin-bottom: var(--space-1); }
.chat-quick-card-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.chat-quick-card-desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* ── Chat content styling ── */
.chat-content h2,
.chat-content h3 {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--text-primary);
  margin: 4px 0 var(--space-2);
}
.chat-content p {
  margin: 4px 0;
  line-height: var(--leading-relaxed);
}
.chat-content ul,
.chat-content ol {
  padding-left: 20px;
  margin: var(--space-1) 0;
}
.chat-content li {
  margin: 3px 0;
  line-height: 1.65;
}

/* ── Chat task/table ── */
.chat-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-2) 0;
  font-size: 13px;
}
.chat-content th,
.chat-content td {
  padding: var(--space-2) var(--space-2);
  border: 1px solid var(--border-subtle);
}
.chat-content th {
  background: var(--gray-50);
  font-weight: 700;
  color: var(--text-tertiary);
}

/* ── Chat input area ── */
.chat-input-area {
  padding: var(--space-4) 28px 22px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
}
.chat-input-wrapper {
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}
.chat-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}
.chat-input-toolbar {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3) 0;
  gap: var(--space-2);
}
.chat-input-row {
  display: flex;
  align-items: flex-end;
  padding: var(--space-2) var(--space-3) var(--space-3) var(--space-3);
  gap: var(--space-2);
}
.chat-input {
  flex: 1;
  border: 0;
  outline: 0;
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: transparent;
  resize: none;
  min-height: 28px;
  line-height: 1.6;
}
.chat-input::placeholder {
  color: var(--text-tertiary);
}
.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--gray-100);
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  flex-shrink: 0;
}
.chat-send-btn:hover {
  background: var(--gray-200);
  color: var(--text-secondary);
}
.chat-send-btn-active {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.chat-send-btn-active:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}
.chat-send-btn:active {
  transform: scale(0.92);
}

/* ========== Electron titlebar drag regions ========== */
.titlebar-drag { -webkit-app-region: drag; }
.titlebar-no-drag { -webkit-app-region: no-drag; }

/* ========== Admin layout ========== */
.admin-layout {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 260px 1fr;
  overflow: hidden;
}
.admin-aside {
  background: var(--gray-950);
  color: #94a3b8;
  padding: var(--space-5);
  overflow-y: auto;
}
.admin-brand {
  color: var(--text-inverse);
  font-weight: 800;
  font-size: var(--text-xl);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 6px;
  letter-spacing: var(--tracking-tight);
}
.admin-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}
.admin-nav-group {
  font-size: var(--text-xs);
  color: #475569;
  font-weight: 700;
  margin: 20px 10px var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.admin-nav-item {
  display: block;
  width: 100%;
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  margin: 2px 0;
  font-size: var(--text-base);
  color: #94a3b8;
  cursor: pointer;
  font-weight: 500;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
  text-align: left;
  border: 0;
  background: transparent;
  font-family: var(--font-sans);
}
.admin-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-inverse);
}
.admin-nav-item.active {
  background: var(--primary);
  color: var(--text-inverse);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.admin-main {
  background: var(--bg-app);
  overflow-y: auto;
}
.admin-topbar {
  height: 68px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
}
.admin-topbar h1 {
  font-size: var(--text-xl);
  margin: 0;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}
.admin-content {
  padding: var(--space-6) 28px;
}

/* ========== List row ========== */
.list-row {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-3);
  transition: background var(--transition-fast);
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--bg-hover); }

/* ========== Animations ========== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ========== Platform Toggle ========== */
.platform-toggle {
  display: inline-flex;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

/* ========== Modal / Overlay ========== */
.modal-overlay {
  animation: fadeIn 0.15s var(--ease-out);
}
.modal-container {
  animation: modalSlideIn 0.2s var(--ease-out);
}

/* ========== Drawer ========== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9000;
  animation: fadeIn 0.15s var(--ease-out);
}
.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9001;
  background: var(--bg-card);
  box-shadow: var(--shadow-2xl);
  animation: slideInRight 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--border-default);
}
.drawer-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5) var(--space-6);
}
.drawer-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-default);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* ========== Tooltip ========== */
.tooltip-wrapper {
  position: relative;
  display: inline-flex;
}
.tooltip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: var(--text-inverse);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 9999;
  box-shadow: var(--shadow-lg);
}
.tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--gray-900);
}
.tooltip-wrapper:hover .tooltip-content { opacity: 1; }

/* ========== Spinner ========== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}
.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

/* ========== Progress Ring ========== */
.progress-ring {
  transition: stroke-dashoffset 0.35s;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* ========== Data Table ========== */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.data-table thead th {
  padding: 14px var(--space-4);
  text-align: left;
  font-weight: 700;
  color: var(--text-tertiary);
  background: var(--gray-50);
  border-bottom: 1px solid var(--border-default);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.data-table tbody td {
  padding: 14px var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13px;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr {
  transition: background var(--transition-fast);
}
.data-table tbody tr:hover { background: var(--bg-hover); }

/* ========== Search Input ========== */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrapper .search-icon {
  position: absolute;
  left: var(--space-3);
  color: var(--text-tertiary);
  font-size: var(--text-base);
  pointer-events: none;
}
.search-input-wrapper input {
  padding-left: 36px;
}

/* ========== Focus Visible (Accessibility) ========== */
.btn:focus-visible,
.input:focus-visible,
.tab:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ========== Notification Dot ========== */
.notification-dot {
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  position: absolute;
  top: -2px;
  right: -2px;
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.2);
}

/* ========== Tag Input ========== */
.tag-input-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  min-height: 40px;
  align-items: center;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}
.tag-input-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.tag-input-container input {
  border: 0;
  outline: 0;
  font-size: var(--text-base);
  flex: 1;
  min-width: 80px;
  background: transparent;
  font-family: var(--font-sans);
  color: var(--text-primary);
}

/* ========== Glass Morphism Utilities ========== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ========== Gradient Utilities ========== */
.gradient-primary {
  background: var(--primary-gradient);
  color: var(--text-inverse);
}
.gradient-xhs {
  background: linear-gradient(135deg, #ff2442 0%, #ff6b81 100%);
  color: var(--text-inverse);
}
.gradient-success {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: var(--text-inverse);
}

/* ========== Chart / Data Visualization ========== */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.chart-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}

.chart-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.chart-legend {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ========== Skeleton / Loading ========== */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}
.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-1);
}
.skeleton-heading {
  height: 24px;
  width: 60%;
  margin-bottom: var(--space-2);
}
.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
}

/* ========== Divider ========== */
.divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-4) 0;
}
.divider-subtle {
  background: var(--border-subtle);
}

/* ========== KBD (Keyboard shortcut) ========== */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  background: var(--gray-100);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  box-shadow: 0 1px 0 var(--border-default);
}

/* ========== Avatar ========== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-weight: 700;
  color: var(--text-inverse);
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-sm { width: 28px; height: 28px; font-size: var(--text-xs); }
.avatar-md { width: 36px; height: 36px; font-size: var(--text-sm); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-lg); }
.avatar-xl { width: 64px; height: 64px; font-size: var(--text-xl); }

/* ========== Switch / Toggle ========== */
.switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--gray-300);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
  border: none;
  padding: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--bg-card);
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.switch.active {
  background: var(--primary);
}
.switch.active::after {
  transform: translateX(20px);
}

/* ========== Dropdown ========== */
.dropdown-menu {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  min-width: 180px;
  z-index: var(--z-dropdown);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-xs);
  font-size: var(--text-base);
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
  font-weight: 500;
}
.dropdown-item:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
.dropdown-item-danger {
  color: var(--danger-text);
}
.dropdown-item-danger:hover {
  background: var(--danger-soft);
  color: var(--danger-text);
}
.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-1) 0;
}

/* ========== Toast / Alert ========== */
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-base);
  animation: slideInUp 0.25s var(--ease-out);
}
.toast-success {
  border-color: #a7f3d0;
  background: var(--success-soft);
}
.toast-warning {
  border-color: #fde68a;
  background: var(--warning-soft);
}
.toast-danger {
  border-color: #fecaca;
  background: var(--danger-soft);
}
.toast-info {
  border-color: #bfdbfe;
  background: var(--info-soft);
}

/* ========== Metric card accent variants ========== */
.metric-accent-primary {
  border-top: 3px solid var(--primary);
}
.metric-accent-success {
  border-top: 3px solid var(--success);
}
.metric-accent-warning {
  border-top: 3px solid var(--warning);
}
.metric-accent-danger {
  border-top: 3px solid var(--danger);
}
.metric-accent-info {
  border-top: 3px solid var(--info);
}

/* ========== Selection ========== */
::selection {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-primary);
}

/* ========== Print ========== */
@media print {
  .sidebar-dark,
  .admin-aside,
  .ctx-panel {
    display: none;
  }
  body {
    background: white;
  }
}

/* ========== Professional UI pass ========== */
.layout-main {
  min-width: 0;
  background: #f6f8fb;
}

.layout-context-toggle {
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

@media (max-width: 1440px) {
  .layout-context-panel-wrapper {
    display: none;
  }
}

.page-header {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.72);
}

.page-header h1 {
  font-size: 22px;
  line-height: 1.25;
}

.page-header .page-sub {
  color: var(--text-secondary);
}

.metric,
.panel,
.card,
.data-table,
.chart-container {
  border-radius: 10px;
}

.metric {
  padding: 18px;
}

.metric .label {
  font-size: 12px;
  text-transform: none;
  color: var(--text-secondary);
}

.metric .value {
  font-size: 26px;
}

.table,
.data-table {
  font-size: 13px;
}

.table thead th,
.data-table thead th {
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  background: #f8fafc;
}

.table tbody td,
.data-table tbody td {
  color: #1f2937;
}

.btn,
.tab,
.badge {
  letter-spacing: 0;
}

.dashboard-shell {
  background: #f6f8fb;
}

.dashboard-topbar {
  min-height: 64px;
  padding: 14px 24px !important;
  border-bottom-color: var(--border-subtle) !important;
  background: rgba(255, 255, 255, 0.92) !important;
}

.dashboard-workspace {
  gap: 0;
  background: #f6f8fb;
}

.dashboard-chat-pane {
  width: 58% !important;
  min-width: 520px;
  background: #f8fafc !important;
}

.dashboard-insight-pane {
  width: 42% !important;
  min-width: 420px;
  background: #ffffff !important;
}

.dashboard-chat-messages {
  padding: 22px 28px !important;
}

.chat-bubble {
  border-radius: 12px !important;
}

.chat-welcome-title {
  font-size: 18px !important;
  letter-spacing: 0 !important;
}

.chat-welcome-desc {
  color: var(--text-secondary) !important;
}

.chat-input-wrapper {
  border-radius: 12px !important;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.dashboard-insight-scroll {
  padding: 22px 24px !important;
}

.dashboard-insight-scroll > div > div:first-child {
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--text-secondary) !important;
}

@media (max-width: 1180px) {
  .dashboard-workspace {
    flex-direction: column;
  }
  .dashboard-chat-pane,
  .dashboard-insight-pane {
    width: 100% !important;
    min-width: 0;
  }
  .dashboard-insight-pane {
    min-height: 42%;
    border-left: 0 !important;
    border-top: 1px solid var(--border-default);
  }
}

.admin-layout {
  grid-template-columns: 248px 1fr;
  background: #f6f8fb;
}

.admin-aside {
  background: #0f172a;
  padding: 16px 12px;
}

.admin-brand {
  margin-bottom: 18px;
  font-size: 18px;
  padding: 0 8px;
}

.admin-nav-group {
  margin: 18px 10px 8px;
  color: #64748b;
  letter-spacing: 0.03em;
}

.admin-nav-item {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.admin-nav-item.active {
  background: #ff2442;
  box-shadow: 0 8px 18px rgba(255, 36, 66, 0.18);
}

.admin-topbar {
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.admin-content {
  padding: 24px 28px 32px;
}

.admin-content .panel {
  padding: 20px;
}

.admin-content .metrics {
  gap: 14px;
}

.admin-content .metric {
  min-height: 92px;
}

button:has(> span),
.btn,
.tab,
.sidebar-dark-nav-item,
.admin-nav-item {
  -webkit-font-smoothing: antialiased;
}

/* ========== Product-grade visual redesign ========== */
.marketing-shell {
  background: #f7f8fb !important;
  color: #111827 !important;
}

.marketing-shell nav {
  height: 68px !important;
  padding: 0 72px !important;
  border-bottom: 1px solid rgba(221, 227, 238, 0.9) !important;
  background: rgba(255, 255, 255, 0.86) !important;
  backdrop-filter: blur(18px) !important;
}

.marketing-shell nav > div:first-child {
  font-size: 18px !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
}

.marketing-shell nav > div:first-child > div,
.marketing-shell div[style*="background: #ff2442"] {
  border-radius: 10px !important;
  box-shadow: 0 10px 24px rgba(255, 36, 66, 0.18) !important;
}

.marketing-shell nav button,
.marketing-shell section button {
  height: 42px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  box-shadow: none !important;
}

.marketing-shell nav + section {
  padding: 56px 72px 34px !important;
  grid-template-columns: minmax(0, 1fr) 620px !important;
  gap: 56px !important;
  max-width: 1480px !important;
}

.marketing-shell h1 {
  max-width: 720px !important;
  font-size: 54px !important;
  line-height: 1.08 !important;
  letter-spacing: 0 !important;
  font-weight: 950 !important;
}

.marketing-shell h2 {
  letter-spacing: 0 !important;
}

.marketing-shell p {
  color: #5f6b7a !important;
}

.marketing-shell section div[style*="borderRadius: 26"],
.marketing-shell section div[style*="borderRadius: 20"],
.marketing-shell section div[style*="borderRadius: 24"] {
  border-radius: 16px !important;
}

.marketing-shell section div[style*="boxShadow: '0 30px 80px"],
.marketing-shell section div[style*="boxShadow: '0 8px 28px"] {
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12) !important;
}

.marketing-shell section:nth-of-type(2) > div,
.marketing-shell section:nth-of-type(4) > div > div {
  border-color: #dde3ee !important;
}

.marketing-shell footer {
  display: none !important;
}

.titlebar-drag {
  backdrop-filter: blur(14px);
}

.sidebar-dark {
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-dark-group-label {
  color: #75849a;
  letter-spacing: 0.04em;
}

.sidebar-dark-nav-item {
  color: #b0bbca;
}

.sidebar-dark-nav-item--active {
  color: #ffffff;
}

.sidebar-dark-nav-accent {
  background: #ff2442;
  box-shadow: 0 0 14px rgba(255, 36, 66, 0.45);
}

.sidebar-dark-platform-btn--active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.page,
.dashboard-shell {
  background: #f5f7fb;
}

.page-body,
.admin-content,
.dashboard-insight-scroll {
  scrollbar-gutter: stable;
}

.page-header {
  min-height: 82px;
}

.page-actions .btn,
.page-header button,
.admin-topbar .btn {
  border-radius: 10px !important;
}

.metrics {
  gap: 14px;
}

.metric {
  border-color: #dde3ee;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}

.metric::before {
  opacity: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), rgba(255, 36, 66, 0));
}

.metric:hover {
  transform: translateY(-2px);
}

.panel,
.card,
.chart-container,
.data-table,
.chat-input-wrapper,
.ctx-card,
.global-search-modal {
  border-color: #dde3ee !important;
}

.panel,
.card,
.chart-container,
.ctx-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%) !important;
}

.tabs {
  background: #eef2f7;
  border: 1px solid #dde3ee;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.tab {
  min-height: 30px;
  border-radius: 8px;
  padding: 6px 12px;
}

.tab.active {
  background: #ffffff;
  color: var(--primary-text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.table,
.data-table {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #dde3ee;
}

.table thead th,
.data-table thead th {
  height: 42px;
  background: #f7f9fc;
  color: #667085;
  font-weight: 800;
}

.table tbody td,
.data-table tbody td {
  height: 48px;
}

input,
select,
textarea {
  border-color: #d8e0ec !important;
  border-radius: 10px !important;
  color: #172033 !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 36, 66, 0.58) !important;
  box-shadow: 0 0 0 4px rgba(255, 36, 66, 0.08) !important;
}

.dashboard-topbar {
  border-bottom: 1px solid #dde3ee !important;
}

.dashboard-topbar h1 {
  font-size: 19px !important;
}

.dashboard-chat-pane {
  background: #f3f6fb !important;
}

.dashboard-insight-pane {
  border-left: 1px solid #dde3ee !important;
}

.dashboard-insight-scroll > div {
  margin-bottom: 20px !important;
}

.chat-bubble-assistant {
  border: 1px solid #dde3ee !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05) !important;
}

.chat-bubble-user {
  background: #172033 !important;
}

.chat-send-btn-active {
  background: var(--primary) !important;
  box-shadow: 0 10px 22px rgba(255, 36, 66, 0.18) !important;
}

.admin-aside {
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}

.admin-brand-mark {
  background: var(--primary-gradient);
  border-radius: 10px;
}

.admin-topbar h1 {
  font-size: 20px !important;
  letter-spacing: 0 !important;
}

.admin-main {
  background: #f5f7fb;
}

.global-search-overlay {
  background: rgba(17, 24, 39, 0.38);
}

.global-search-modal {
  border-radius: 16px;
}

.global-search-icon,
.empty-icon {
  filter: grayscale(1);
}

@media (max-width: 980px) {
  .marketing-shell nav {
    padding: 0 22px !important;
  }
  .marketing-shell nav > div:nth-child(2) {
    display: none !important;
  }
  .marketing-shell nav + section,
  .marketing-shell section {
    padding-left: 22px !important;
    padding-right: 22px !important;
    grid-template-columns: 1fr !important;
  }
  .marketing-shell h1 {
    font-size: 40px !important;
  }
}
