/* ============================================================
   SocialMind — Design System
   Tailwind v4 · Dark Command Center · Obsidian + Electric Indigo
   Fonts: Clash Display (display) · DM Sans (body)
   ============================================================ */

@import "tailwindcss";

/* ─── Design Tokens ──────────────────────────────────────────
   Tailwind v4 reads @theme and generates utility classes from
   every token. E.g. --color-obsidian-800 → bg-obsidian-800,
   text-obsidian-800, border-obsidian-800 etc. automatically.
   ──────────────────────────────────────────────────────────── */
@theme {

  /* ── Colour: Obsidian scale ──────────────────────────────── */
  --color-obsidian-900: #0a0b0f;
  --color-obsidian-800: #111318;
  --color-obsidian-700: #181c24;
  --color-obsidian-600: #1e232e;
  --color-obsidian-500: #252b38;
  --color-obsidian-400: #2e3748;
  --color-obsidian-300: #3d4a60;
  --color-obsidian-200: #536072;

  /* ── Colour: Indigo ──────────────────────────────────────── */
  --color-indigo-600: #4f46e5;
  --color-indigo-500: #6366f1;
  --color-indigo-400: #818cf8;
  --color-indigo-300: #a5b4fc;

  /* ── Colour: Emerald ─────────────────────────────────────── */
  --color-emerald-500: #10b981;
  --color-emerald-400: #34d399;

  /* ── Colour: Amber ───────────────────────────────────────── */
  --color-amber-500: #f59e0b;
  --color-amber-400: #fbbf24;

  /* ── Colour: Rose ────────────────────────────────────────── */
  --color-rose-500: #f43f5e;
  --color-rose-400: #fb7185;

  /* ── Colour: Text ────────────────────────────────────────── */
  --color-text-primary:   #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted:     #64748b;

  /* ── Colour: Borders ─────────────────────────────────────── */
  --color-border-subtle: rgba(255,255,255,0.06);
  --color-border-medium: rgba(255,255,255,0.10);
  --color-border-strong: rgba(255,255,255,0.16);

  /* ── Colour: Surfaces (semantic aliases) ─────────────────── */
  --color-surface-1: var(--color-obsidian-700);
  --color-surface-2: var(--color-obsidian-600);
  --color-surface-3: var(--color-obsidian-500);

  /* ── Colour: Glow tints (for bg / glow effects) ─────────── */
  --color-indigo-glow:   rgba(99, 102, 241, 0.15);
  --color-emerald-glow:  rgba(16, 185, 129, 0.12);
  --color-rose-glow:     rgba(244, 63, 94, 0.12);
  --color-amber-glow:    rgba(245, 158, 11, 0.10);

  /* ── Typography ──────────────────────────────────────────── */
  --font-display: 'Clash Display', 'Georgia', serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-sans:    'DM Sans', system-ui, sans-serif;
  --font-mono:    ui-monospace, 'Fira Code', monospace;

  /* ── Font sizes ──────────────────────────────────────────── */
  --text-xs:   11px;
  --text-sm:   12px;
  --text-base: 13.5px;
  --text-md:   14px;
  --text-lg:   15px;
  --text-xl:   18px;
  --text-2xl:  22px;
  --text-3xl:  26px;
  --text-4xl:  32px;

  /* ── Spacing (maps to Tailwind's spacing scale override) ─── */
  --spacing-1:  4px;
  --spacing-2:  8px;
  --spacing-3:  12px;
  --spacing-4:  16px;
  --spacing-5:  20px;
  --spacing-6:  24px;
  --spacing-8:  32px;
  --spacing-10: 40px;
  --spacing-12: 48px;
  --spacing-16: 64px;

  /* ── Border Radius ───────────────────────────────────────── */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* ── Shadows ─────────────────────────────────────────────── */
  --shadow-sm:           0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:           0 4px 12px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg:           0 10px 30px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.4);
  --shadow-glow-indigo:  0 0 24px rgba(99, 102, 241, 0.35);
  --shadow-glow-emerald: 0 0 20px rgba(16, 185, 129, 0.30);
  --shadow-glow-rose:    0 0 20px rgba(244, 63, 94, 0.25);

  /* ── Transitions ─────────────────────────────────────────── */
  --ease-ui:   cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 350ms;

  /* ── Layout ──────────────────────────────────────────────── */
  --sidebar-width: 240px;
}

/* ─── Raw CSS vars (referenced by JS / non-Tailwind contexts)
   Keep in sync with @theme above.
   ──────────────────────────────────────────────────────────── */
:root {
  --indigo-glow:   rgba(99, 102, 241, 0.15);
  --emerald-glow:  rgba(16, 185, 129, 0.12);
  --rose-glow:     rgba(244, 63, 94, 0.12);
  --sidebar-width: 240px;
  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  /* Alias without 'color-' prefix for inline style usage */
  --obsidian-900: #0a0b0f;
  --obsidian-800: #111318;
  --obsidian-700: #181c24;
  --obsidian-600: #1e232e;
  --obsidian-500: #252b38;
  --obsidian-400: #2e3748;
  --obsidian-300: #3d4a60;
  --obsidian-200: #536072;
  --indigo-600: #4f46e5;
  --indigo-500: #6366f1;
  --indigo-400: #818cf8;
  --indigo-300: #a5b4fc;
  --emerald-500: #10b981;
  --emerald-400: #34d399;
  --amber-500:   #f59e0b;
  --amber-400:   #fbbf24;
  --rose-500:    #f43f5e;
  --rose-400:    #fb7185;
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --border-subtle:  rgba(255,255,255,0.06);
  --border-medium:  rgba(255,255,255,0.10);
  --border-strong:  rgba(255,255,255,0.16);
  --surface-1: var(--obsidian-700);
  --surface-2: var(--obsidian-600);
  --surface-3: var(--obsidian-500);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.4);
  --shadow-glow-indigo:  0 0 24px rgba(99, 102, 241, 0.35);
  --shadow-glow-emerald: 0 0 20px rgba(16, 185, 129, 0.30);
  --font-display: 'Clash Display', 'Georgia', serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;
  --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;
}

/* ─── Base Layer ─────────────────────────────────────────────
   Global resets and element defaults.
   ──────────────────────────────────────────────────────────── */
@layer base {
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    font-family: var(--font-body);
    background-color: var(--obsidian-900);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
  }

  /* Subtle radial gradient ambient lighting — not a mesh, just atmosphere */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
      radial-gradient(ellipse 80% 50% at 20% 0%,   rgba(99,102,241,0.08) 0%, transparent 60%),
      radial-gradient(ellipse 60% 40% at 80% 80%,  rgba(16,185,129,0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
  }

  /* Typography scale */
  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text-primary);
  }

  a { color: inherit; text-decoration: none; }

  /* Custom scrollbar — matches the dark theme */
  ::-webkit-scrollbar       { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--obsidian-400);
    border-radius: 3px;
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--obsidian-300); }

  /* Focus visible — accessible, on-brand */
  :focus-visible {
    outline: 2px solid var(--indigo-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
  }
}

/* ─── Animations ─────────────────────────────────────────────
   Defined at root scope so @apply can reference them anywhere.
   ──────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1;   box-shadow: 0 0 8px  rgba(52,211,153,0.6); }
  50%       { opacity: 0.7; box-shadow: 0 0 16px rgba(52,211,153,0.9); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

/* ─── Component Layer ────────────────────────────────────────
   BEM components. Use @apply for Tailwind utilities where it
   saves significant lines. Keep custom values as raw CSS.
   ──────────────────────────────────────────────────────────── */
@layer components {

  /* ── Layout ─────────────────────────────────────────────── */

  .main-content {
    position: relative;
    z-index: 1;
    min-height: 100vh;
  }

  .main-content--with-sidebar {
    margin-left: var(--sidebar-width);
    padding: var(--space-8);
    max-width: 1400px;
  }

  /* ── Mobile Header ───────────────────────────────────────── */
  /* Previously missing — now defined */
  .mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--obsidian-800);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 200;
  }

  .mobile-header__logo {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .mobile-header__logo-mark {
    width: 28px;
    height: 28px;
    background: var(--indigo-500);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
  }

  .mobile-header__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition-fast);
  }

  .mobile-header__toggle:hover {
    background: var(--surface-3);
    color: var(--text-primary);
  }

  /* ── Sidebar ─────────────────────────────────────────────── */

  .sidebar {
    position: fixed;
    inset-y: 0;
    left: 0;
    width: var(--sidebar-width);
    background: var(--obsidian-800);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    transition: transform var(--transition-slow);
  }

  .sidebar__logo {
    padding: var(--space-6) var(--space-6) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
  }

  .sidebar__logo-mark {
    width: 36px;
    height: 36px;
    background: var(--indigo-500);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    box-shadow: var(--shadow-glow-indigo);
    flex-shrink: 0;
  }

  .sidebar__logo-text {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    display: block;
    line-height: 1.2;
  }

  .sidebar__logo-tagline {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: block;
    margin-top: 2px;
  }

  /* Business switcher */
  .sidebar__business {
    margin: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--obsidian-700);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base);
    text-decoration: none;
    display: block;
    flex-shrink: 0;
  }

  .sidebar__business:hover {
    background: var(--obsidian-600);
    border-color: var(--border-medium);
  }

  .sidebar__business-name {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar__business-plan {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
    display: block;
  }

  /* Nav */
  .sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3) 0;
  }

  .nav-section {
    padding: var(--space-4) var(--space-4) var(--space-2);
  }

  .nav-section__label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.10em;
    padding: 0 var(--space-2);
    display: block;
    margin-bottom: var(--space-2);
  }

  .nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 400;
    transition: color var(--transition-fast), background var(--transition-fast);
    position: relative;
    margin-bottom: 2px;
  }

  .nav-item:hover {
    color: var(--text-primary);
    background: var(--obsidian-600);
  }

  .nav-item.active {
    color: var(--indigo-400);
    background: var(--indigo-glow);
    font-weight: 500;
  }

  /* Active left-border indicator */
  .nav-item.active::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--indigo-500);
    border-radius: 0 3px 3px 0;
  }

  .nav-item__icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
    color: var(--text-muted);
  }

  .nav-item.active .nav-item__icon,
  .nav-item:hover  .nav-item__icon {
    color: inherit;
  }

  .nav-item__badge {
    margin-left: auto;
    background: var(--rose-500);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
  }

  /* Sidebar footer */
  .sidebar__footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
  }

  .sidebar__user {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-2);
    margin-top: var(--space-3);
  }

  .sidebar__user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
  }

  .sidebar__user-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar__signout {
    font-size: 11px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: var(--font-body);
    transition: color var(--transition-fast);
  }

  .sidebar__signout:hover { color: var(--rose-400); }

  /* ── Auto-Pilot ──────────────────────────────────────────── */

  .autopilot-status {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--obsidian-700);
    border: 1px solid transparent;
    transition: background var(--transition-base), border-color var(--transition-base);
  }

  .autopilot-status--on {
    background: var(--emerald-glow);
    border-color: rgba(16, 185, 129, 0.2);
  }

  .autopilot-status__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: background var(--transition-base);
  }

  .autopilot-status--on .autopilot-status__dot {
    background: var(--emerald-400);
    animation: pulse-dot 2s infinite;
  }

  .autopilot-status__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    line-height: 1.3;
  }

  .autopilot-status__sub {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
  }

  /* Autopilot toggle (dashboard header) */
  .autopilot-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-medium);
    background: var(--surface-1);
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-body);
  }

  .autopilot-toggle--on {
    background: var(--emerald-glow);
    border-color: rgba(16,185,129,0.3);
    color: var(--emerald-400);
    box-shadow: var(--shadow-glow-emerald);
  }

  .autopilot-toggle__switch {
    width: 36px;
    height: 20px;
    background: var(--obsidian-400);
    border-radius: var(--radius-full);
    position: relative;
    transition: background var(--transition-base);
    flex-shrink: 0;
  }

  .autopilot-toggle--on .autopilot-toggle__switch { background: var(--emerald-500); }

  .autopilot-toggle__switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-sm);
  }

  .autopilot-toggle--on .autopilot-toggle__switch::after {
    transform: translateX(16px);
  }

  /* ── Dashboard ───────────────────────────────────────────── */

  .command-center {
    animation: fadeInUp 0.4s ease both;
  }

  .cmd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-8);
    gap: var(--space-4);
  }

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

  .cmd-header__title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--text-primary);
  }

  .cmd-header__sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
  }

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

  .business-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--indigo-600);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
  }

  .avatar-initials {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
  }

  /* ── KPI Grid ────────────────────────────────────────────── */

  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
  }

  .kpi-card {
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
  }

  /* Decorative corner circle */
  .kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.06;
    transform: translate(30%, -30%);
    pointer-events: none;
  }

  .kpi-card--posts::before       { background: var(--indigo-500); }
  .kpi-card--reach::before       { background: var(--emerald-500); }
  .kpi-card--engagement::before  { background: var(--amber-500); }
  .kpi-card--pending::before     { background: var(--rose-500); }

  .kpi-card--attention {
    border-color: rgba(244, 63, 94, 0.25);
  }

  .kpi-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }

  .kpi-card__icon {
    font-size: 20px;
    margin-bottom: var(--space-3);
    display: block;
    color: var(--text-muted);
  }

  .kpi-card__value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
  }

  .kpi-card__label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
  }

  .kpi-card__cta {
    display: inline-block;
    margin-top: var(--space-2);
    font-size: 12px;
    color: var(--rose-400);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
  }

  .kpi-card__cta:hover { color: var(--rose-500); }

  /* ── Content Grid ────────────────────────────────────────── */

  .content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    align-items: start;
  }

  .content-grid__left,
  .content-grid__right {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
  }

  /* ── Cards ───────────────────────────────────────────────── */

  .card {
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: border-color var(--transition-base);
  }

  .card:hover { border-color: var(--border-medium); }

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

  .card__title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
  }

  .card__link {
    font-size: 12px;
    color: var(--indigo-400);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
  }

  .card__link:hover {
    color: var(--indigo-300);
    text-decoration: underline;
  }

  /* Intel Brief card variant */
  .brief-card {
    border-color: rgba(99, 102, 241, 0.15);
  }

  .brief-date {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--obsidian-500);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-weight: 500;
  }

  .brief-content { display: flex; flex-direction: column; gap: var(--space-4); }

  .brief-section h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
    font-family: var(--font-body);
  }

  .brief-section p {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.65;
  }

  .brief-section--highlight {
    background: var(--indigo-glow);
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: var(--radius-md);
    padding: var(--space-4);
  }

  .brief-section--highlight h4 { color: var(--indigo-400); }
  .brief-section--highlight p  { color: var(--indigo-300); }

  .brief-actions {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
  }

  /* ── Forms ───────────────────────────────────────────────── */

  .generate-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  .form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
  }

  .form-control {
    background: var(--obsidian-600);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    padding: var(--space-3) var(--space-4);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
    width: 100%;
  }

  .form-control:focus {
    border-color: var(--indigo-500);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  }

  .form-control::placeholder { color: var(--text-muted); }

  textarea.form-control { resize: vertical; }

  select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%2364748b'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
  }

  /* Platform pill checkboxes */
  .platform-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .platform-check input { display: none; }

  .platform-check__label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
    user-select: none;
  }

  .platform-check__label:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
  }

  .platform-check input:checked + .platform-check__label {
    border-color: var(--indigo-500);
    background: var(--indigo-glow);
    color: var(--indigo-300);
  }

  /* ── Buttons ─────────────────────────────────────────────── */

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    line-height: 1;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition:
      background   var(--transition-fast),
      border-color var(--transition-fast),
      box-shadow   var(--transition-fast),
      transform    var(--transition-fast),
      color        var(--transition-fast);
    white-space: nowrap;
    padding: 10px var(--space-5);
  }

  .btn:active { transform: scale(0.98); }

  .btn--primary {
    background: var(--indigo-500);
    color: white;
  }

  .btn--primary:hover {
    background: var(--indigo-600);
    box-shadow: var(--shadow-glow-indigo);
    transform: translateY(-1px);
  }

  .btn--emerald {
    background: var(--emerald-500);
    color: white;
  }

  .btn--emerald:hover {
    background: #0da271;
    box-shadow: var(--shadow-glow-emerald);
    transform: translateY(-1px);
  }

  .btn--accent {
    background: linear-gradient(135deg, var(--indigo-500), var(--emerald-500));
    color: white;
    font-weight: 600;
  }

  .btn--accent:hover {
    box-shadow: var(--shadow-glow-indigo);
    transform: translateY(-1px);
  }

  .btn--ghost {
    background: transparent;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
  }

  .btn--ghost:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-primary);
  }

  .btn--danger {
    background: transparent;
    border: 1px solid rgba(244,63,94,0.3);
    color: var(--rose-400);
  }

  .btn--danger:hover {
    background: var(--rose-glow);
    border-color: var(--rose-400);
  }

  .btn--full  { width: 100%; }
  .btn--sm    { font-size: 13px; padding: 8px var(--space-4); }
  .btn--xs    { font-size: 12px; padding: 6px var(--space-3); border-radius: var(--radius-sm); }

  /* Loading state */
  .btn.loading {
    pointer-events: none;
    opacity: 0.75;
  }

  .btn.loading::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
    margin-right: var(--space-2);
  }

  /* ── Post Queue ──────────────────────────────────────────── */

  .post-queue {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .pending-post-card {
    background: var(--obsidian-600);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    transition: border-color var(--transition-base);
  }

  .pending-post-card:hover { border-color: var(--border-medium); }

  .pending-post-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
  }

  .pending-post-card__score {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
  }

  .score--high {
    background: var(--emerald-glow);
    color: var(--emerald-400);
    border: 1px solid rgba(16,185,129,0.2);
  }

  .score--mid {
    background: var(--amber-glow);
    color: var(--amber-400);
    border: 1px solid rgba(245,158,11,0.2);
  }

  .pending-post-card__body {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-3);
  }

  .pending-post-card__meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
  }

  .pending-post-card__actions {
    display: flex;
    gap: var(--space-2);
  }

  /* ── Scheduled List ──────────────────────────────────────── */

  .scheduled-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .scheduled-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  .scheduled-item:last-child { border-bottom: none; }

  .scheduled-item__time {
    min-width: 50px;
    text-align: center;
    flex-shrink: 0;
  }

  .scheduled-item__time strong {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
  }

  .scheduled-item__time span {
    font-size: 11px;
    color: var(--text-muted);
  }

  .scheduled-item__content {
    flex: 1;
    min-width: 0;
  }

  .scheduled-item__body {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .platform-icons {
    display: flex;
    gap: var(--space-2);
    margin-top: 4px;
  }

  .platform-icon {
    font-size: 12px;
    color: var(--text-muted);
  }

  /* ── Post Cards (index) ──────────────────────────────────── */

  .posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-4);
  }

  .post-card {
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
  }

  .post-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }

  .post-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
  }

  .post-card__body {
    padding: var(--space-5);
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.65;
  }

  .post-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    background: var(--obsidian-600);
    border-top: 1px solid var(--border-subtle);
  }

  .post-card__stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
  }

  .post-card__stat strong {
    color: var(--text-primary);
    font-weight: 600;
  }

  /* ── Top Posts ───────────────────────────────────────────── */

  .top-posts { display: flex; flex-direction: column; gap: var(--space-4); }

  .top-post {
    padding: var(--space-4);
    background: var(--obsidian-600);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
  }

  .top-post__body {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: var(--space-3);
  }

  .top-post__stats {
    display: flex;
    gap: var(--space-4);
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
  }

  /* ── Analytics ───────────────────────────────────────────── */

  .analytics-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-8);
    gap: var(--space-4);
  }

  .analytics-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-6);
  }

  .period-select {
    display: flex;
    gap: var(--space-2);
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 4px;
  }

  .period-btn {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
    font-family: var(--font-body);
  }

  .period-btn.active,
  .period-btn:hover {
    background: var(--obsidian-500);
    color: var(--text-primary);
  }

  /* ── Posts Tabs ──────────────────────────────────────────── */

  .posts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    gap: var(--space-4);
  }

  .posts-tabs {
    display: flex;
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 4px;
    overflow-x: auto;
    gap: 2px;
  }

  .posts-tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
  }

  .posts-tab:hover { background: var(--obsidian-500); color: var(--text-primary); }
  .posts-tab.active { background: var(--obsidian-500); color: var(--indigo-300); }

  /* ── Badges ──────────────────────────────────────────────── */

  .badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.4;
  }

  .badge--scheduled  { background: var(--indigo-glow);   color: var(--indigo-300);  border: 1px solid rgba(99,102,241,0.2); }
  .badge--published  { background: var(--emerald-glow);  color: var(--emerald-400); border: 1px solid rgba(16,185,129,0.2); }
  .badge--draft      { background: var(--obsidian-400);  color: var(--text-muted); }
  .badge--failed     { background: var(--rose-glow);     color: var(--rose-400);    border: 1px solid rgba(244,63,94,0.2); }

  /* ── Alerts ──────────────────────────────────────────────── */

  .alert-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    border-left: 3px solid;
    margin-bottom: var(--space-3);
    animation: slideIn 0.3s ease both;
  }

  .alert-card--warning  { background: rgba(245,158,11,0.08); border-color: var(--amber-500); }
  .alert-card--critical { background: rgba(244,63,94,0.08);  border-color: var(--rose-500); }
  .alert-card--info     { background: var(--indigo-glow);    border-color: var(--indigo-500); }

  .alert-card__icon  { font-size: 16px; margin-top: 1px; flex-shrink: 0; }
  .alert-card__title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
  .alert-card__body  { font-size: 12.5px; color: var(--text-secondary); }

  /* ── Flash Toasts ────────────────────────────────────────── */

  .flash {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    max-width: 400px;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 500;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease both;
  }

  .flash--notice { background: var(--emerald-500); color: white; }
  .flash--alert  { background: var(--rose-500);    color: white; }

  .flash__close {
    background: none;
    border: none;
    color: currentColor;
    opacity: 0.7;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: opacity var(--transition-fast);
  }

  .flash__close:hover { opacity: 1; }

  /* ── Notification Bell ───────────────────────────────────── */

  .notif-bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    font-size: 16px;
  }

  .notif-bell:hover {
    background: var(--surface-3);
    border-color: var(--border-medium);
    color: var(--text-primary);
  }

  .notif-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--rose-500);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--obsidian-800);
    line-height: 1;
  }

  /* ── Tables ──────────────────────────────────────────────── */

  .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
  }

  .data-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-body);
  }

  .data-table td {
    padding: var(--space-3) var(--space-4);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
  }

  .data-table tr:hover td { background: var(--obsidian-600); }
  .data-table tr:last-child td { border-bottom: none; }

  /* ── Onboarding / Auth ───────────────────────────────────── */

  .onboarding-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
  }

  .onboarding-card {
    width: 100%;
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
  }

  .onboarding-card__header {
    padding: var(--space-8);
    background: linear-gradient(135deg, var(--indigo-glow), transparent);
    border-bottom: 1px solid var(--border-subtle);
    text-align: center;
  }

  /* Logo mark — proper icon, not emoji */
  .onboarding-card__logo {
    width: 56px;
    height: 56px;
    background: var(--indigo-500);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    margin: 0 auto var(--space-4);
    box-shadow: var(--shadow-glow-indigo);
  }

  .onboarding-card__title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
  }

  .onboarding-card__sub {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
  }

  .onboarding-card__body { padding: var(--space-8); }

  /* Step progress dots */
  .onboarding-steps {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
  }

  .onboarding-step {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--obsidian-400);
    transition: width var(--transition-base), background var(--transition-base), border-radius var(--transition-base);
  }

  .onboarding-step.active {
    background: var(--indigo-500);
    width: 24px;
    border-radius: 4px;
  }

  /* ── Loading Spinner ─────────────────────────────────────── */

  .loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.25);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
  }

  /* ── Skeleton / Shimmer ──────────────────────────────────── */

  .skeleton {
    background: var(--obsidian-500);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
  }

  .skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(255,255,255,0.04) 50%,
      transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
  }

}

/* ─── Utility Layer ──────────────────────────────────────────
   Custom utilities not covered by Tailwind core.
   ──────────────────────────────────────────────────────────── */
@layer utilities {

  /* Truncation */
  .truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Font families */
  .font-display { font-family: var(--font-display); }
  .font-body    { font-family: var(--font-body); }

  /* Glow utilities */
  .glow-indigo  { box-shadow: var(--shadow-glow-indigo); }
  .glow-emerald { box-shadow: var(--shadow-glow-emerald); }
  .glow-rose    { box-shadow: var(--shadow-glow-rose); }

  /* Text color utilities (aliased for inline use) */
  .text-brand   { color: var(--indigo-400); }
  .text-success { color: var(--emerald-400); }
  .text-warn    { color: var(--amber-400); }
  .text-danger  { color: var(--rose-400); }

}

/* ─── Responsive ─────────────────────────────────────────────
   Kept outside @layer so specificity is predictable.
   ──────────────────────────────────────────────────────────── */

/* Tablet — collapse to 2-col KPI, single content column */
@media (max-width: 1200px) {
  .kpi-grid      { grid-template-columns: repeat(2, 1fr); }
  .content-grid  { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
}

/* Mobile — sidebar slides off canvas, header appears */
@media (max-width: 900px) {
  .mobile-header { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    /* JS adds .open to show */
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  /* Overlay behind open sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
  }

  .sidebar-overlay.open { display: block; }

  .main-content--with-sidebar {
    margin-left: 0;
    padding: var(--space-6);
  }
}

/* Small mobile */
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3); }

  .main-content--with-sidebar { padding: var(--space-4); }

  .cmd-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .posts-grid { grid-template-columns: 1fr; }

  .flash {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
    max-width: none;
  }

  .onboarding-wrap { padding: var(--space-4); }

  .onboarding-card__header,
  .onboarding-card__body { padding: var(--space-6); }

  .analytics-header { flex-direction: column; align-items: flex-start; }

  .posts-header { flex-direction: column; align-items: flex-start; }

  /* Country/timezone selects stack on narrow screens */
  .signup-grid-2 { grid-template-columns: 1fr !important; }
}

/* ─── Auth-specific components ───────────────────────────────
   Added to support sessions/new and registrations/new.
   Paste these into the @layer components block in production.
   ──────────────────────────────────────────────────────────── */

/* Two-column form row — stacks on mobile via .signup-grid-2 */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Label row: label left, forgot-password link right */
.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* Inline label (inside form-label-row — no bottom margin) */
.form-label-inline {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0;
}

/* Larger submit button */
.btn--lg {
  font-size: 15px;
  padding: 13px var(--space-6);
}

/* Auth links */
.auth-link {
  color: var(--indigo-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.auth-link:hover { color: var(--indigo-300); }

.auth-link--sm {
  font-size: 12px;
}

.auth-link--strong {
  font-weight: 500;
}

/* Terms copy below submit */
.auth-terms {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
  line-height: 1.65;
}

/* Sign in / sign up footer link row */
.auth-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.auth-footer__text {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Sidebar collapse (desktop) ─────────────────────────────
   Added to support sidebar_controller#toggleCollapse.
   ──────────────────────────────────────────────────────────── */

.sidebar__collapse-btn {
  margin-left: auto;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
}

.sidebar__collapse-btn:hover {
  color: var(--text-primary);
  background: var(--obsidian-600);
}

/* Collapsed state — icon-only rail */
.sidebar.collapsed {
  width: 60px;
}

.sidebar.collapsed .sidebar__logo-text,
.sidebar.collapsed .sidebar__logo-tagline,
.sidebar.collapsed .sidebar__business,
.sidebar.collapsed .nav-section__label,
.sidebar.collapsed .nav-item__label,
.sidebar.collapsed .nav-item__badge,
.sidebar.collapsed .autopilot-status__label,
.sidebar.collapsed .autopilot-status__sub,
.sidebar.collapsed .sidebar__user-name,
.sidebar.collapsed .sidebar__signout span {
  display: none;
}

.sidebar.collapsed .sidebar__logo {
  justify-content: center;
  padding: var(--space-5) var(--space-3);
}

.sidebar.collapsed .sidebar__logo-mark {
  margin: 0;
}

.sidebar.collapsed .sidebar__collapse-btn {
  display: none; /* hidden when collapsed — click icon to expand */
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: var(--space-3);
}

.sidebar.collapsed .nav-item__icon {
  width: auto;
  font-size: 16px;
}

/* Tooltip on collapsed nav items */
.sidebar.collapsed .nav-item {
  position: relative;
}

.sidebar.collapsed .nav-item::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--obsidian-500);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  border: 1px solid var(--border-medium);
  z-index: 200;
}

.sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
}

.sidebar.collapsed .autopilot-status {
  justify-content: center;
  padding: var(--space-3);
}

.sidebar.collapsed .sidebar__user {
  justify-content: center;
}

.sidebar.collapsed .sidebar__user-avatar {
  margin: 0;
}

/* User avatar — initials circle */
.sidebar__user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--indigo-500);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ─── Collapsed sidebar expand fix ───────────────────────────
   When collapsed, the logo mark becomes the expand button.
   The collapse-btn is repositioned to be icon-only, always visible.
   ──────────────────────────────────────────────────────────── */

/* Override — don't hide the collapse btn, reposition it */
.sidebar.collapsed .sidebar__collapse-btn {
  display: flex !important;
  margin: 0 auto;
  width: 32px;
  height: 32px;
}

/* Logo area when collapsed — stack logo mark above collapse btn */
.sidebar.collapsed .sidebar__logo {
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-3);
  align-items: center;
}

/* Collapsed sidebar — clicking the logo mark also expands */
.sidebar.collapsed .sidebar__logo-mark {
  cursor: pointer;
}

/* Transition the sidebar width smoothly */
.sidebar {
  transition: width var(--transition-slow), transform var(--transition-slow);
}

/* Transition main content margin */
.main-content--with-sidebar {
  transition: margin-left var(--transition-slow);
}
