/* ============================================================
   SELF-HOSTED FONTS — Track 1 Visual Identity (no CDN, PDF-safe)
   ============================================================ */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/syntora/admin/assets/fonts/Geist-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/syntora/admin/assets/fonts/Geist-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/syntora/admin/assets/fonts/Geist-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/syntora/admin/assets/fonts/Geist-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'InterVariable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/syntora/admin/assets/fonts/InterVariable.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/syntora/admin/assets/fonts/JetBrainsMono-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/syntora/admin/assets/fonts/JetBrainsMono-Medium.woff2') format('woff2');
}

/* ============================================================
   SYNTORA — Web Product Design System (FORK)
   Independent identity: cosmic dark + cyan/violet/magenta neon
   Mirrors the visual language of the public landing page.
   ============================================================ */

/* --- Tokens -------------------------------------------------- */
:root {
  /* Surfaces — deeper, more cosmic than m2p-pulse */
  --bg:            #050816;
  --bg-2:          #0a0f1e;
  --surface:       #0e1426;
  --surface-2:     #161d33;
  --surface-3:     #1f2942;
  --border:        #1f2942;
  --border-strong: #2f3a5b;
  --border-glow:   rgba(34, 211, 238, 0.25);

  /* Text */
  --text:          #f1f5fb;
  --text-muted:    #94a3b8;
  --text-subtle:   #64748b;
  --text-faint:    #475569;

  /* Brand accent — cyan from the landing animation */
  --accent:        #22d3ee;
  --accent-hover:  #06b6d4;
  --accent-dim:    rgba(34, 211, 238, 0.12);
  --accent-glow:   0 0 28px rgba(34, 211, 238, 0.35);

  /* Gradient palette (used in headlines, KPIs, buttons CTAs) */
  --grad-1:        linear-gradient(120deg, #22d3ee 0%, #818cf8 50%, #ec4899 100%);
  --grad-2:        linear-gradient(135deg, #67e8f9 0%, #c4b5fd 50%, #f0abfc 100%);
  --grad-fog:      radial-gradient(circle at 50% 0%, rgba(34, 211, 238, 0.08) 0%, transparent 50%);

  /* Semantic */
  --positive:      #10b981;
  --positive-dim:  rgba(16, 185, 129, 0.12);
  --negative:      #ef4444;
  --negative-dim:  rgba(239, 68, 68, 0.12);
  --warning:       #f59e0b;
  --warning-dim:   rgba(245, 158, 11, 0.12);
  --info:          #818cf8;
  --info-dim:      rgba(129, 140, 248, 0.12);

  /* Sentiment chip colors (match the HTML report tokens) */
  --sentiment-pos: #10b981;
  --sentiment-neg: #ef4444;
  --sentiment-neu: #6b7280;
  --sentiment-mix: #f59e0b;

  /* Tier badge colors */
  --tier-premium:  #a855f7;
  --tier-vertical: #06b6d4;
  --tier-regional: #0ea5e9;
  --tier-ai:       #ec4899;

  /* Layout */
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;
  --radius-xl:     20px;

  --sidebar-w:     260px;
  --topbar-h:      64px;
  --content-pad:   28px;

  --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:        0 4px 14px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg:     0 12px 36px rgba(0, 0, 0, 0.55);
  --shadow-glow:        0 0 24px rgba(34, 211, 238, 0.10);
  --shadow-glow-strong: 0 0 36px rgba(34, 211, 238, 0.22);
  --surface-5:          #2a3454;

  /* Typography — Track 1 Visual Identity */
  --font-display:  'Geist', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans:     'InterVariable', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:     'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Legacy aliases — kept for back-compat with older rules */
  --fs-xs:         11px;
  --fs-sm:         12px;
  --fs-base:       14px;
  --fs-md:         16px;
  --fs-lg:         20px;
  --fs-xl:         26px;
  --fs-2xl:        34px;
  --fs-3xl:        44px;

  /* New Track 1 type scale (editorial cinema) */
  --t-3xl: 44px;   /* hero/briefing display title */
  --t-2xl: 32px;   /* page H1 */
  --t-xl:  24px;   /* section H2 / briefing strip */
  --t-lg:  18px;   /* H3 / key numbers in standard cards */
  --t-base:14px;   /* body */
  --t-sm:  12px;   /* secondary */
  --t-xs:  11px;   /* labels */
}

/* Tabular numerals — apply to any element holding aligned numbers */
.tabular { font-feature-settings: 'tnum'; font-variant-numeric: tabular-nums; }

/* --- Reset --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.005em;
}
::-webkit-scrollbar       { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

img, svg { display: block; max-width: 100%; }

input, textarea, select {
  font-family: inherit; font-size: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ============================================================
   LAYOUT
   ============================================================ */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}
.app::before {
  /* subtle radial fog at top, evoking the landing aesthetic */
  content: "";
  position: fixed; inset: 0; top: 0;
  background: var(--grad-fog);
  pointer-events: none;
  z-index: 0;
}

/* --- Sidebar --- */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  z-index: 5;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar .brand .logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--grad-1);
  box-shadow: var(--accent-glow);
  display: grid; place-items: center;
  color: #050816;
  font-family: var(--font-display);
  font-weight: 700; font-size: 18px;
  letter-spacing: -0.04em;
}
.sidebar .brand .name {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 600;
  letter-spacing: -0.02em; color: var(--text);
  line-height: 1.1;
}
.sidebar .brand .name small {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400; color: var(--text-faint);
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-top: 4px;
}
.sidebar .nav-section {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint);
  padding: 12px 12px 6px;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-muted);
  transition: all 0.15s;
}
.sidebar nav a:hover {
  background: var(--surface);
  color: var(--text);
}
.sidebar nav a.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}
.sidebar nav a .ico {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
}

/* --- Topbar --- */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--content-pad);
  border-bottom: 1px solid var(--border);
  background: rgba(5, 8, 22, 0.85);
  backdrop-filter: blur(12px);
  position: sticky; top: 0;
  z-index: 4;
}
.topbar .crumbs {
  font-size: 12px; color: var(--text-muted);
  letter-spacing: 0.02em;
}
.topbar .crumbs strong { color: var(--text); font-weight: 500; }
.topbar .user {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
}
.topbar .user .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  color: var(--accent);
}
.topbar .user .meta { line-height: 1.3; }
.topbar .user .meta strong { display: block; color: var(--text); font-weight: 500; }
.topbar .user .meta span { color: var(--text-subtle); font-size: 11px; }
.topbar .user a.logout {
  margin-left: 8px;
  font-size: 11px; color: var(--text-subtle);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.topbar .user a.logout:hover { color: var(--negative); }

/* --- Main content --- */
.main {
  position: relative;
  z-index: 1;
}
.content {
  padding: var(--content-pad);
  max-width: 1500px;
  margin: 0 auto;
}

/* ============================================================
   COMPONENTS
   ============================================================ */

/* --- Page header --- */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: var(--fs-2xl);
  font-weight: 300;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.page-header h1 em {
  font-style: normal;
  background: var(--grad-2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 500;
}
.page-header .subtitle {
  font-size: var(--fs-sm); color: var(--text-muted);
  margin-top: 6px;
}
.page-header .actions { display: flex; gap: 10px; }

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: var(--border-strong); }
.card.glow {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}
.card .label {
  font-size: var(--fs-xs); text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-faint);
  margin-bottom: 6px;
}
.card .value {
  font-size: var(--fs-xl); font-weight: 600;
  letter-spacing: -0.02em; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.card .delta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }
.card .delta.up   { color: var(--positive); }
.card .delta.down { color: var(--negative); }

/* --- KPI grid --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-primary {
  background: var(--accent);
  color: #050816;
  border: none;
  font-weight: 600;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  color: #050816;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }
.btn-danger {
  background: var(--negative-dim);
  color: var(--negative);
  border: 1px solid transparent;
}
.btn-danger:hover { background: var(--negative); color: white; }
.btn .ico { width: 14px; height: 14px; }

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.badge-success { background: var(--positive-dim); color: var(--positive); }
.badge-danger  { background: var(--negative-dim); color: var(--negative); }
.badge-warning { background: var(--warning-dim);  color: var(--warning); }
.badge-info    { background: var(--info-dim);     color: var(--info); }
.badge-accent  { background: var(--accent-dim);   color: var(--accent); }
.badge-muted   { background: var(--surface-2);    color: var(--text-muted); }

/* --- Tables --- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table thead th {
  background: var(--surface-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table tbody td {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  vertical-align: top;
}
.table tbody tr:hover { background: var(--surface-2); }
.table .mono {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Sentiment dot --- */
.sentiment-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.sentiment-dot.positive { background: var(--sentiment-pos); }
.sentiment-dot.negative { background: var(--sentiment-neg); }
.sentiment-dot.neutral  { background: var(--sentiment-neu); }
.sentiment-dot.mixed    { background: var(--sentiment-mix); }

/* --- Alerts (flash messages) --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  border-left: 3px solid;
}
.alert-success { background: var(--positive-dim); color: var(--positive); border-color: var(--positive); }
.alert-danger  { background: var(--negative-dim); color: var(--negative); border-color: var(--negative); }
.alert-warning { background: var(--warning-dim);  color: var(--warning);  border-color: var(--warning); }
.alert-info    { background: var(--info-dim);     color: var(--info);     border-color: var(--info); }

/* --- Empty state --- */
.empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty .ico {
  width: 60px; height: 60px;
  margin: 0 auto 16px;
  opacity: 0.4;
}
.empty h3 {
  font-size: var(--fs-lg);
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}
.empty p { font-size: var(--fs-sm); margin-bottom: 18px; }

/* ============================================================
   LOGIN PAGE (cosmic full-bleed)
   ============================================================ */
.login-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(168, 85, 247, 0.10) 0%, transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(34, 211, 238, 0.08) 0%, transparent 50%),
    var(--bg);
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--grad-1);
}
.login-card .brand-block {
  margin-bottom: 28px;
}
.login-card .brand-block .logo {
  width: 56px; height: 56px;
  border-radius: 12px;
  background: var(--grad-1);
  box-shadow: var(--accent-glow);
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
  color: #050816;
  letter-spacing: -0.05em;
}
.login-card h1 {
  font-size: var(--fs-xl); font-weight: 400;
  letter-spacing: -0.02em; color: var(--text);
  margin-bottom: 6px;
}
.login-card h1 em {
  font-style: normal;
  background: var(--grad-2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 600;
}
.login-card .subtitle {
  font-size: var(--fs-sm); color: var(--text-muted);
  margin-bottom: 28px;
}
.login-card .google-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px; font-weight: 500;
  transition: all 0.2s;
}
.login-card .google-btn:hover {
  background: var(--surface-3);
  border-color: var(--accent);
  box-shadow: var(--accent-glow);
}
.login-card .google-btn svg { width: 18px; height: 18px; }
.login-card .legal {
  margin-top: 24px;
  font-size: var(--fs-xs);
  color: var(--text-faint);
}
.login-card .legal a { color: var(--text-muted); }

/* ============================================================
   UTILITIES
   ============================================================ */
.flex   { display: flex; }
.grid   { display: grid; }
.gap-2  { gap: 8px;  }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.mt-2   { margin-top: 8px;  }
.mt-3   { margin-top: 12px; }
.mt-4   { margin-top: 16px; }
.mt-6   { margin-top: 24px; }
.mb-2   { margin-bottom: 8px;  }
.mb-3   { margin-bottom: 12px; }
.mb-4   { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-faint { color: var(--text-faint); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* ── Desktop default: mobile topbar hidden ─────────────────── */
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }

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

  /* Mobile topbar — visible only on small screens, fixed at top */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 60;
    padding: 12px 16px;
    background: rgba(10, 14, 31, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    height: 56px;
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
  }
  .mobile-brand-mark {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent, #22d3ee), #818cf8);
    border-radius: 6px;
    color: #050816;
    font-weight: 700;
    font-size: 14px;
  }
  .mobile-brand-text {
    font-weight: 600;
    font-size: 15px;
    background: linear-gradient(120deg, var(--accent, #22d3ee), #818cf8, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
  .mobile-page-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 8px;
  }
  .mobile-menu-btn {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    min-width: 40px;
    min-height: 40px;
  }
  .mobile-menu-btn:active { background: var(--surface-2); }

  /* Sidebar becomes a slide-in overlay panel on mobile */
  .sidebar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(85vw, 320px);
    z-index: 70;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    height: 100vh;
    /* Make tap targets bigger inside the panel */
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar nav a {
    padding: 12px 16px;          /* more touch-friendly than desktop */
    font-size: 15px;
    border-radius: 6px;
    margin-bottom: 2px;
  }

  /* Backdrop overlay when sidebar is open */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 22, 0.6);
    z-index: 65;
    backdrop-filter: blur(2px);
  }
  .sidebar-backdrop.is-visible { display: block; }

  .topbar { padding: 0 16px; }
  .content { padding: 16px; }

  /* When sidebar is open, prevent body scroll behind */
  body.menu-open { overflow: hidden; }
}

/* ============================================================
   FASE 2a/2b additions: section tabs, accordion, dismiss UI,
   super-admin nav, impersonation banner, config editor
   ============================================================ */

/* --- Section tabs (PR / Social / All) --- */
.section-tabs {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 18px;
  width: fit-content;
}
.section-tab {
  background: transparent;
  border: 0;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-sans);
  text-align: left;
  transition: all 0.15s;
}
.section-tab:hover { color: var(--text); }
.section-tab.active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.3);
}
.section-tab .label { display: block; font-size: 13px; font-weight: 600; }
.section-tab .sub   { display: block; font-size: 10px; color: var(--text-faint); margin-top: 2px; }

/* --- Mentions row accordion --- */
.mention-detail {
  margin: 0;
  padding: 0;
  background: var(--bg-2);
}
.mention-detail summary {
  cursor: pointer;
  padding: 8px 14px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px dashed var(--border);
  user-select: none;
  list-style: none;
}
.mention-detail summary::before {
  content: "▸"; display: inline-block; margin-right: 6px; transition: transform 0.15s;
}
.mention-detail[open] summary::before { transform: rotate(90deg); }
.mention-detail .body {
  padding: 14px 18px;
  font-size: 12px;
  line-height: 1.6;
}
.mention-detail dl {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 14px;
  margin: 0;
}
.mention-detail dt { color: var(--text-faint); font-weight: 500; }
.mention-detail dd { margin: 0; color: var(--text); word-break: break-word; }
.mention-detail pre {
  margin-top: 12px; padding: 10px 12px;
  background: var(--surface); border-radius: 6px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted);
  max-height: 240px; overflow: auto;
}

/* --- Dismiss button + dismissed-row styling --- */
.btn-dismiss {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-faint);
  padding: 6px 10px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-dismiss:hover {
  background: var(--negative-dim);
  border-color: var(--negative);
  color: var(--negative);
}
.row-dismissed { opacity: 0.45; }
.row-dismissed td { text-decoration: line-through; text-decoration-color: var(--negative); }

/* --- Super-admin nav section + badge --- */
.nav-section.super {
  color: var(--tier-ai);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.12em;
  margin-top: 16px;
}
.badge-super {
  background: linear-gradient(120deg, #ec4899, #a855f7);
  color: white;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-left: 6px;
}

/* --- Impersonation banner --- */
.impersonation-banner {
  background: var(--warning-dim);
  border: 1px solid var(--warning);
  color: var(--warning);
  padding: 10px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

/* --- Brief markdown rendering --- */
.brief-md {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 36px;
  line-height: 1.7;
}
.brief-md h1, .brief-md h2, .brief-md h3 {
  margin-top: 28px; margin-bottom: 12px;
}
.brief-md h1 { font-size: 22px; }
.brief-md h2 { font-size: 18px; color: var(--accent); }
.brief-md h3 { font-size: 15px; color: var(--text-muted); }
.brief-md p { margin: 0 0 14px 0; color: var(--text); }
.brief-md ul, .brief-md ol { padding-left: 22px; margin: 8px 0 16px 0; }
.brief-md li { margin: 4px 0; }
.brief-md code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.brief-md strong { color: var(--accent); }
.brief-md hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.brief-md blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 12px 0;
  color: var(--text-muted);
}

/* --- Forms (used across team, brand, config) --- */
.form-row { display: grid; grid-template-columns: 160px 1fr; gap: 18px; margin-bottom: 14px; align-items: center; }
.form-row label { font-size: 12px; color: var(--text-muted); }
.form-row input[type=text], .form-row input[type=email], .form-row select, .form-row textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-sans);
  width: 100%;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* --- Config editor (CodeMirror) --- */
.config-editor { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.CodeMirror { height: 600px; font-family: var(--font-mono); font-size: 12px; background: var(--surface) !important; color: var(--text) !important; }
.CodeMirror-gutters { background: var(--surface-2) !important; border-right: 1px solid var(--border) !important; }
.CodeMirror-linenumber { color: var(--text-faint) !important; }
.cm-s-default .cm-string  { color: #f0abfc !important; }
.cm-s-default .cm-atom    { color: #c4b5fd !important; }
.cm-s-default .cm-number  { color: #67e8f9 !important; }
.cm-s-default .cm-keyword { color: #22d3ee !important; }
.cm-s-default .cm-comment { color: var(--text-faint) !important; font-style: italic; }
.cm-s-default .cm-meta    { color: var(--text-muted) !important; }

.config-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.validate-result {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 3px solid;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
}
.validate-result.ok   { background: var(--positive-dim); color: var(--positive); border-color: var(--positive); }
.validate-result.fail { background: var(--negative-dim); color: var(--negative); border-color: var(--negative); }

/* ============================================================
   FOUNDATION (Fase 2 polish): design tokens · toast · modal ·
   skeleton · spacing/typography scale. Everything below here
   is the "market-grade" bar — no inline styles, native feel.
   ============================================================ */

:root {
  /* Spacing scale (multiples of 4px) */
  --s-0: 0;     --s-1: 4px;  --s-2: 8px;  --s-3: 12px;
  --s-4: 16px;  --s-5: 20px; --s-6: 24px; --s-8: 32px;
  --s-10: 40px; --s-12: 48px;

  /* Type scale tokens (already present as --fs-* — alias for new code) */
  --t-xs:  var(--fs-xs);
  --t-sm:  var(--fs-sm);
  --t-base:var(--fs-base);
  --t-lg:  var(--fs-lg);
  --t-xl:  var(--fs-xl);
  --t-2xl: 24px;
  --t-3xl: 30px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in:  cubic-bezier(0.4, 0.0, 1, 1);
  --time-fast: 120ms;
  --time-base: 180ms;
  --time-slow: 260ms;
}

/* --- Toast ------------------------------------------------- */
.toast-host {
  position: fixed;
  top: var(--s-4);
  right: var(--s-4);
  z-index: 1100;
  display: flex; flex-direction: column; gap: var(--s-2);
  pointer-events: none;
  max-width: min(420px, calc(100vw - var(--s-8)));
}
.toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: var(--t-sm);
  color: var(--text);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity var(--time-base) var(--ease-out),
              transform var(--time-base) var(--ease-out);
}
.toast.in  { opacity: 1; transform: translateY(0) scale(1); }
.toast.out { opacity: 0; transform: translateY(-8px) scale(0.98); }
.toast .toast-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
}
.toast-success .toast-icon { background: var(--positive-dim); color: var(--positive); }
.toast-error   .toast-icon { background: var(--negative-dim); color: var(--negative); }
.toast-warning .toast-icon { background: var(--warning-dim);  color: var(--warning); }
.toast-info    .toast-icon { background: var(--accent-dim);   color: var(--accent); }
.toast-close {
  background: transparent; border: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  color: var(--text-muted); font-size: 18px; line-height: 1;
  cursor: pointer;
  transition: all var(--time-fast);
}
.toast-close:hover { background: var(--surface-2); color: var(--text); }
.toast-success { border-left: 3px solid var(--positive); }
.toast-error   { border-left: 3px solid var(--negative); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info    { border-left: 3px solid var(--accent); }

/* --- Modal ------------------------------------------------- */
.modal-host {
  position: fixed; inset: 0;
  z-index: 1000;
  display: grid; place-items: center;
  opacity: 0;
  transition: opacity var(--time-base) var(--ease-out);
}
.modal-host.in  { opacity: 1; }
.modal-host.out { opacity: 0; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 8, 22, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(34, 211, 238, 0.08);
  min-width: 320px;
  max-width: min(560px, calc(100vw - var(--s-8)));
  max-height: calc(100vh - var(--s-12));
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(12px) scale(0.97);
  transition: transform var(--time-base) var(--ease-out);
}
.modal-host.in .modal { transform: translateY(0) scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: var(--t-base); font-weight: 600; margin: 0; }
.modal-close {
  background: transparent; border: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  color: var(--text-muted); font-size: 20px; line-height: 1;
  cursor: pointer;
  transition: all var(--time-fast);
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body {
  padding: var(--s-5);
  font-size: var(--t-sm);
  color: var(--text);
  overflow-y: auto;
}
.modal-body p { margin: 0 0 var(--s-3) 0; }
.modal-body .prompt-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--s-2) var(--s-3);
  color: var(--text);
  font-size: var(--t-sm);
  font-family: var(--font-sans);
}
.modal-body .prompt-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.modal-footer {
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}

/* --- Skeleton ---------------------------------------------- */
.skeleton-stack {
  display: flex; flex-direction: column; gap: var(--s-2);
}
.skeleton-line {
  height: 12px;
  background: linear-gradient(
    90deg,
    var(--surface-2)  0%,
    var(--surface-3) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  border-radius: 4px;
  animation: skeleton-shimmer 1.4s infinite linear;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Filter bar (extracted partial) ------------------------ */
.filter-bar {
  display: flex; gap: var(--s-2); flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--s-4);
}
.filter-bar input[type=search],
.filter-bar input[type=text],
.filter-bar select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: var(--t-sm);
  color: var(--text);
  font-family: var(--font-sans);
  transition: border-color var(--time-fast), box-shadow var(--time-fast);
}
.filter-bar input[type=search]:focus,
.filter-bar input[type=text]:focus,
.filter-bar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.filter-bar input[type=search] { flex: 1; min-width: 220px; }
.filter-bar .checkbox-label {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--t-xs); color: var(--text-muted);
}

/* --- Native focus rings (consistent across all controls) -- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --- KPI card (extracted, refined) ------------------------- */
.kpi-grid { gap: var(--s-3); }
.card { transition: border-color var(--time-base), box-shadow var(--time-base), transform var(--time-fast); }
.card:hover { transform: translateY(-1px); }

/* --- Toolbar (page-header refined) ------------------------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s-5);
  gap: var(--s-3);
}
.toolbar .left  { display: flex; flex-direction: column; gap: var(--s-1); }
.toolbar .right { display: flex; gap: var(--s-2); }

/* --- Responsive: better mobile experience ------------------ */
@media (max-width: 900px) {
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input[type=search] { min-width: 0; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .right { justify-content: flex-end; }
  .table { font-size: var(--t-xs); }
  .table thead th, .table tbody td { padding: 8px 10px; }
  .impersonation-banner { flex-direction: column; gap: 8px; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .section-tabs { flex-wrap: wrap; }
  .section-tab { flex: 1 1 100px; }
}

/* --- Inline-style elimination utilities ------------------- */
.stack-2 > * + * { margin-top: var(--s-2); }
.stack-3 > * + * { margin-top: var(--s-3); }
.stack-4 > * + * { margin-top: var(--s-4); }
.stack-6 > * + * { margin-top: var(--s-6); }
.row    { display: flex; gap: var(--s-2); align-items: center; }
.row-3  { display: flex; gap: var(--s-3); align-items: center; }
.row-end { display: flex; gap: var(--s-2); justify-content: flex-end; }
.gap-2 { gap: var(--s-2); }
.mt-6 { margin-top: var(--s-6); }
.mt-8 { margin-top: var(--s-8); }

/* --- Quiet pre block (used in raw_metadata accordion) ------ */
pre.code-block {
  margin: 0;
  padding: var(--s-3);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--text-muted);
  max-height: 240px;
  overflow: auto;
}

/* --- Mentions table extras (post-refactor) ---------------- */
.actions-cell        { white-space: nowrap; }
.actions-cell .btn,
.actions-cell .btn-dismiss { margin-right: 4px; }
.detail-row > td     { padding: 0; border-top: 0; background: var(--bg-2); }
.detail-block        { margin-top: var(--s-3); }
.detail-label        { color: var(--text-faint); font-size: var(--t-xs); margin-bottom: 4px; }
.detail-text         { color: var(--text-muted); }
.reasoning           { margin-top: 4px; color: var(--text-muted); font-size: var(--t-xs); }
.btn-dismiss.is-restore { border-color: var(--positive); color: var(--positive); }
.btn-dismiss.is-restore:hover { background: var(--positive-dim); }

/* Override the old .mention-detail pre styling with the shared .code-block */
.mention-detail pre { /* legacy — superseded by .code-block */ }
.mention-detail dl  { margin-bottom: 0; }
.mention-detail .body .badge { margin-left: var(--s-1); }

/* --- Pagination ------------------------------------------ */
.pagination {
  margin-top: var(--s-4);
  display: flex; gap: var(--s-2); justify-content: center;
  align-items: center;
}
.page-indicator {
  padding: 9px 16px;
  color: var(--text-muted);
  font-size: var(--t-sm);
}

/* --- Report iframe embed --------------------------------- */
.report-embed { padding: 0; overflow: hidden; }
.report-embed iframe { width: 100%; height: 720px; border: 0; background: #fff; display: block; }

/* --- Collapsible card (details with polished summary) ---- */
details.collapsible {
  transition: border-color var(--time-base);
}
details.collapsible > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
  user-select: none;
  padding: 4px 0;
  display: flex; align-items: center;
}
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: var(--s-2);
  transition: transform var(--time-fast) var(--ease-out);
  color: var(--text-faint);
}
details.collapsible[open] > summary::before { transform: rotate(90deg); }
details.collapsible[open] > .form-stack,
details.collapsible[open] > form { margin-top: var(--s-4); }

/* --- Form stack (vertical form spacing) ------------------ */
.form-stack > * + * { margin-top: var(--s-3); }

/* --- Refined .badge accents for super pages -------------- */
.badge { transition: background var(--time-fast); }

/* --- Inline forms (action buttons in tables) ------------- */
.inline-form { display: inline-block; margin-right: 4px; }

/* ============================================================
   INTEGRATIONS PAGE — channel cards, status pills, toggles
   ============================================================ */
.integrations-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
  max-width: 720px;
}
.channel-card {
  padding: var(--s-5) var(--s-6);
  position: relative;
}
.channel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.channel-head h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text);
}
.channel-head p {
  margin: 0;
  font-size: var(--t-xs);
}
.channel-head a { color: var(--accent); }

.status-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.status-pill.on  { background: var(--positive-dim); color: var(--positive); }
.status-pill.off { background: var(--surface-2);    color: var(--text-faint); }
.status-pill.untested { background: var(--surface-2); color: var(--text-faint); }

.last-test {
  font-size: var(--t-xs);
  font-family: var(--font-mono);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius-sm);
  margin-top: var(--s-2);
}
.last-test.test-ok    { background: var(--positive-dim); color: var(--positive); }
.last-test.test-fail  { background: var(--negative-dim); color: var(--negative); }

/* --- Toggle (used in integrations + future scheduling) --- */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-sm);
  color: var(--text-muted);
  cursor: pointer;
}
.toggle input[type=checkbox] {
  appearance: none;
  width: 36px;
  height: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: all var(--time-base) var(--ease-out);
}
.toggle input[type=checkbox]::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--time-base) var(--ease-out);
}
.toggle input[type=checkbox]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle input[type=checkbox]:checked::after {
  left: 18px;
  background: #050816;
}
.toggle input[type=checkbox]:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ============================================================
   SHARE MODAL — channel checklist + note input
   ============================================================ */
.share-modal-body { min-width: 380px; }
.share-payload {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-4);
  font-size: var(--t-sm);
}
.share-payload .label {
  color: var(--text-faint);
  text-transform: uppercase;
  font-size: var(--t-xs);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.share-payload .title {
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.share-channels { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
.share-channel-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: background var(--time-fast);
}
.share-channel-row:hover { background: var(--surface-3); }
.share-channel-row input[type=checkbox] { margin: 0; }
.share-channel-row.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--surface-2) !important;
}
.share-channel-row .name { font-weight: 600; font-size: var(--t-sm); }
.share-channel-row .hint { font-size: var(--t-xs); color: var(--text-faint); margin-left: auto; }
.share-note {
  width: 100%;
  min-height: 70px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--s-2) var(--s-3);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--t-sm);
  resize: vertical;
}
.share-note:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ============================================================
   SHARE BUTTON (in tables and cards)
   ============================================================ */
.btn-share {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-faint);
  padding: 6px 10px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--time-fast);
}
.btn-share:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Narrative cards (post-share-refactor) ---------------- */
.narrative-title  { font-size: 16px; line-height: 1.3; margin-top: 6px; }
.narrative-desc   { margin-top: var(--s-2); }
.narrative-terms  { margin-top: var(--s-3); color: var(--text-faint); font-size: var(--t-xs); }
.narrative-sites  { margin-top: 6px; color: var(--text-muted); font-size: var(--t-xs); }
.narrative-actions {
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}

/* ============================================================
   SCHEDULING + run status panel
   ============================================================ */
.schedule-card { padding: var(--s-6) var(--s-6); max-width: 540px; }
.schedule-card .form-row { grid-template-columns: 140px 1fr; }
.schedule-card select { width: 100%; max-width: 320px; }

.hidden { display: none !important; }

.run-status-head {
  display: flex; align-items: center; gap: var(--s-3);
  margin-bottom: var(--s-2);
}
.run-status-body { font-family: var(--font-mono); font-size: var(--t-xs); }

/* ============================================================
   SNAPSHOT button (in mentions actions cell)
   ============================================================ */
.btn-snap {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-faint);
  padding: 6px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--time-fast);
  text-decoration: none;
  display: inline-block;
  margin-right: 4px;
}
.btn-snap:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-snap.is-done {
  background: var(--positive-dim);
  border-color: var(--positive);
  color: var(--positive);
}
.btn-snap.is-done:hover { filter: brightness(1.15); }
.btn-snap.is-busy {
  background: var(--warning-dim);
  border-color: var(--warning);
  color: var(--warning);
  animation: btn-snap-pulse 1.4s ease-in-out infinite;
  cursor: progress;
}
.btn-snap.is-failed {
  background: var(--negative-dim);
  border-color: var(--negative);
  color: var(--negative);
}
@keyframes btn-snap-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* ============================================================
   SIGNAL ITERATE — chips, editor modal, narrative card extras
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 10px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: var(--t-xs);
  font-family: var(--font-mono);
  margin: 2px 4px 2px 0;
  transition: all var(--time-fast);
}
.chip-remove {
  background: transparent; border: 0;
  color: var(--accent);
  width: 16px; height: 16px;
  border-radius: 50%;
  cursor: pointer; padding: 0;
  font-size: 14px; line-height: 1;
  opacity: 0.6;
}
.chip-remove:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.chip-empty {
  font-size: var(--t-xs); color: var(--text-faint);
  font-style: italic;
}
.signal-editor { margin-top: var(--s-2); }
.signal-chips { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: var(--s-2); }
.signal-controls {
  display: flex; gap: var(--s-2); align-items: center;
  font-size: var(--t-xs);
}

/* Chip picker (used in modal) */
.chip-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
  margin-top: var(--s-3);
}
.chip-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--t-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  transition: all var(--time-fast);
  user-select: none;
}
.chip-toggle:hover { border-color: var(--border-strong); }
.chip-toggle input { margin: 0; appearance: none; width: 0; }
.chip-toggle.checked {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.chip-toggle.checked span::before { content: "✓ "; }
.custom-signals-input {
  width: 100%; margin-top: var(--s-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--s-2) var(--s-3);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
}
.custom-signals-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* Tiny inline buttons (used in signal-editor + narrative cards) */
.btn-tiny {
  padding: 3px 8px;
  font-size: var(--t-xs);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--time-fast);
}
.btn-tiny:hover { border-color: var(--accent); color: var(--accent); }
.btn-tiny-ghost { background: transparent; color: var(--text-faint); }

/* Narrative card additions */
.narrative-notes {
  margin-top: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: var(--t-xs);
  color: var(--text-muted);
}
.narrative-notes .label {
  color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-size: 10px; font-weight: 600;
}
.narrative-override {
  margin-top: var(--s-2);
  display: flex; gap: var(--s-2); align-items: center;
}
.narrative-card .narrative-actions {
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border);
  display: flex; gap: var(--s-2); justify-content: flex-end;
  flex-wrap: wrap;
}
.narrative-card a.btn-tiny { text-decoration: none; display: inline-block; }

/* ============================================================
   BOARDS CRUD
   ============================================================ */
.board-card { position: relative; }
.board-label    { font-size: 16px; line-height: 1.3; margin-top: 4px; }
.board-slug     { margin-top: 4px; }
.board-desc     { margin-top: var(--s-2); }
.board-rules    { margin-top: var(--s-3); display: flex; flex-direction: column; gap: 4px; }
.rule-line {
  display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap;
  padding: 4px 0;
  font-size: var(--t-xs);
}
.rule-key {
  color: var(--text-faint);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.06em;
  margin-right: 6px;
  min-width: 70px;
}
.board-actions {
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border);
  display: flex; gap: var(--s-2); justify-content: flex-end;
}
.chip-picker-inline {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 0;
}

/* ============================================================
   CHAT — flagship conversational interface
   ============================================================ */
.chat-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--s-4);
  height: calc(100vh - 220px);
  min-height: 540px;
}
.chat-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.chat-sidebar-head {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--t-sm);
}
.thread-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-2);
}
.thread-row {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 2px;
  transition: background var(--time-fast);
}
.thread-row:hover { background: var(--surface-2); }
.thread-row.active {
  background: var(--accent-dim);
  box-shadow: inset 2px 0 0 var(--accent);
}
.thread-preview {
  font-size: var(--t-sm);
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.thread-meta {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 2px;
}

.chat-main {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-5);
  display: flex; flex-direction: column;
  gap: var(--s-4);
}
.chat-welcome {
  text-align: center;
  padding: var(--s-8) var(--s-5);
  color: var(--text-muted);
}
.chat-welcome h3 {
  font-size: 22px;
  margin: 0 0 var(--s-3);
  background: var(--grad-1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
.prompt-suggestions {
  display: flex; flex-direction: column; gap: var(--s-2);
  margin-top: var(--s-4);
  max-width: 580px;
  margin-left: auto;
  margin-right: auto;
}
.prompt-suggestion {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-size: var(--t-sm);
  transition: all var(--time-fast);
  font-family: var(--font-sans);
}
.prompt-suggestion:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface-3);
}

.msg {
  display: flex;
  max-width: 88%;
  animation: msg-in var(--time-base) var(--ease-out);
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-user { align-self: flex-end; }
.msg-assistant { align-self: flex-start; }
.msg-error .msg-body {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-left: 3px solid #ef4444;
}
.msg-body {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius);
  font-size: var(--t-sm);
  line-height: 1.55;
  background: var(--surface-2);
  color: var(--text);
}
.msg-user .msg-body {
  background: var(--accent-dim);
  color: var(--text);
  border: 1px solid rgba(34, 211, 238, 0.25);
}
.msg-body p { margin: 0 0 var(--s-2); }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body ul { padding-left: 22px; margin: var(--s-2) 0; }
.msg-body li { margin: 2px 0; }
.msg-body a { color: var(--accent); }
.msg-body code {
  background: var(--bg-2);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: var(--t-xs);
}
.msg-tools {
  margin-top: var(--s-3);
  padding-top: var(--s-2);
  border-top: 1px dashed var(--border);
  font-size: var(--t-xs);
  color: var(--text-faint);
}
.msg-tools summary {
  cursor: pointer;
  list-style: none;
}
.msg-tools summary::before { content: "▸ "; }
.msg-tools[open] summary::before { content: "▾ "; }
.msg-tools ul { padding-left: 14px; margin: 6px 0 0; }
.msg-tools li { font-family: var(--font-mono); margin: 2px 0; }

/* Typing dots */
.typing-dots {
  display: inline-flex; gap: 5px;
}
.typing-dots span {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%           { opacity: 1;   transform: translateY(-3px); }
}

.chat-input-row {
  border-top: 1px solid var(--border);
  padding: var(--s-3) var(--s-4);
  display: flex; gap: var(--s-3);
  align-items: flex-end;
}
.chat-input-row textarea {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--s-3);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--t-sm);
  resize: none;
  min-height: 42px;
  max-height: 200px;
  line-height: 1.4;
}
.chat-input-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.chat-input-row textarea:disabled { opacity: 0.6; }

/* Mobile */
@media (max-width: 900px) {
  .chat-shell { grid-template-columns: 1fr; height: auto; }
  .chat-sidebar { max-height: 200px; }
  .chat-main { height: calc(100vh - 380px); min-height: 400px; }
}

/* ============================================================
   KPI delta arrows (Track 2)
   ============================================================ */
.delta-positive { color: var(--positive); }
.delta-negative { color: var(--negative); }
.delta-neutral  { color: var(--text-muted); }
.delta-label    { color: var(--text-faint); font-size: 10px; margin-left: 6px; }

/* ============================================================
   TODAY page (Track 2)
   ============================================================ */
.briefing-strip {
  background: linear-gradient(135deg, rgba(34,211,238,0.10), rgba(129,140,248,0.10));
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-5);
}
.briefing-eyebrow {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.briefing-body {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}
.briefing-actions { margin-top: var(--s-3); display: flex; gap: var(--s-2); }
.btn-tiny {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: var(--radius-sm);
}

.smart-inbox { display: flex; flex-direction: column; gap: 4px; margin-top: var(--s-3); }
.smart-row {
  display: grid;
  grid-template-columns: 18px 180px 1fr 80px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-decoration: none;
  color: var(--text);
  transition: all var(--time-fast);
}
.smart-row:hover { border-color: var(--accent); background: var(--surface-2); }
.smart-site { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smart-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smart-score { font-family: var(--font-mono); font-size: 11px; color: var(--accent); text-align: right; }
.smart-reasons { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.today-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--s-4);
  margin-top: var(--s-6);
}

.narrative-list { display: flex; flex-direction: column; gap: 6px; }
.narrative-row {
  display: grid;
  grid-template-columns: 60px 1fr 120px;
  gap: 10px;
  align-items: center;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.narrative-name { font-weight: 500; }
.narrative-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); text-align: right; }

@media (max-width: 900px) {
  .smart-row { grid-template-columns: 18px 1fr 60px; }
  .smart-row .smart-site, .smart-row .smart-reasons { display: none; }
  .today-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   INBOX (renamed from mentions) — chip filters + priority
   ============================================================ */
.inbox-chips {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: var(--s-4);
}
.inbox-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--t-xs);
  text-decoration: none;
  transition: all var(--time-fast);
}
.inbox-chip:hover { border-color: var(--accent); color: var(--text); }
.inbox-chip.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.inbox-chip .chip-count {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 10px;
  color: var(--text-faint);
}
.inbox-chip.active .chip-count { background: rgba(34,211,238,0.18); color: var(--accent); }

/* Track 7 — collaboration chip variants + triage badges + assignee pill */
.inbox-chip.assigned-mine.active   { background: rgba(139, 92, 246, 0.18); border-color: #a78bfa; color: #a78bfa; }
.inbox-chip.status-open.active     { background: rgba(34, 211, 238, 0.18); border-color: var(--accent); color: var(--accent); }
.inbox-chip.status-resolved.active { background: rgba(34, 197, 94, 0.18);  border-color: #22c55e; color: #22c55e; }

.triage-badge {
  margin-left: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.assignee-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 6px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 999px;
  font-size: 10px;
  color: #c4b5fd;
  font-family: var(--font-mono);
}

/* Collaboration block inside the mention accordion */
.collab-block {
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 1px dashed var(--border);
}
.collab-toolbar {
  display: flex; gap: var(--s-6); flex-wrap: wrap;
  margin-bottom: var(--s-3);
}
.collab-toolbar > div { display: flex; flex-direction: column; gap: 4px; }
.collab-toolbar select {
  padding: 4px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: var(--t-sm);
}
.collab-comments { margin: var(--s-3) 0; display: flex; flex-direction: column; gap: 8px; }
.collab-comment {
  padding: 8px 12px;
  background: var(--surface-2);
  border-left: 2px solid var(--border);
  border-radius: 4px;
}
.collab-comment.mine { border-left-color: var(--accent); }
.collab-comment-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
  font-size: var(--t-xs);
}
.collab-comment-body { font-size: var(--t-sm); line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.at-mention {
  color: var(--accent);
  background: rgba(34, 211, 238, 0.1);
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 500;
}
.collab-compose {
  display: flex; gap: 8px; align-items: flex-end;
}
.collab-compose textarea {
  flex: 1;
  min-height: 48px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: var(--t-sm);
  font-family: inherit;
  resize: vertical;
}
.btn-sm { padding: 4px 12px; font-size: var(--t-sm); }

/* ============================================================
   TRENDS GEO TABS
   ============================================================ */
.trends-geo-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--s-4);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.trends-geo-tab {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  font-size: var(--t-sm);
  font-weight: 500;
  transition: all 0.15s ease;
}
.trends-geo-tab:hover { color: var(--text); background: rgba(255,255,255,0.02); }
.trends-geo-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: rgba(34,211,238,0.05);
}

/* ============================================================
   BRAND BRANDING (Sprint 4 S4.3)
   ============================================================ */
.brand-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--s-4);
  margin-top: var(--s-4);
}
@media (max-width: 1100px) {
  .brand-card-grid { grid-template-columns: 1fr 1fr; }
}
.brand-applied-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--t-sm);
  color: var(--text);
  line-height: 1.7;
}
.brand-applied-list li {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.brand-applied-list li:last-child { border-bottom: 0; }
.brand-applied-list .brand-applied-muted {
  color: var(--text-muted);
  font-style: italic;
  font-size: var(--t-xs);
  margin-top: 8px;
}
@media (max-width: 768px) {
  .brand-card-grid { grid-template-columns: 1fr; }
}
.brand-logo-preview {
  margin-top: var(--s-3);
  padding: var(--s-4);
  background: var(--surface-2, #050816);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 80px;
  display: flex; align-items: center; justify-content: center;
}
.brand-logo-preview img {
  max-height: 80px;
  max-width: 240px;
  object-fit: contain;
}
.brand-logo-empty {
  font-size: var(--t-xs);
  color: var(--text-muted);
}
.color-input-row {
  display: flex; align-items: center; gap: 12px;
}
.color-input-row input[type=color] {
  height: 36px; width: 60px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
}
.briefing-tenant-logo {
  text-align: left;
  margin: 0 0 var(--s-5);
}
.briefing-tenant-logo img {
  max-height: 56px;
  max-width: 200px;
  object-fit: contain;
}
.briefing-footer-syntora {
  margin-top: var(--s-8);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border);
  font-size: var(--t-xs);
  color: var(--text-muted);
  text-align: center;
}

/* ============================================================
   BOARD TEMPLATES PICKER (Sprint 4 S4.2)
   ============================================================ */
.board-tpl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  margin-top: var(--s-3);
}
@media (max-width: 640px) {
  .board-tpl-grid { grid-template-columns: 1fr; }
}
.board-tpl-card {
  text-align: left;
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text);
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.board-tpl-card:hover {
  border-color: var(--accent);
  background: var(--surface-hover, var(--surface));
  transform: translateY(-1px);
}
.board-tpl-emoji { font-size: 24px; line-height: 1; }
.board-tpl-name {
  font-size: var(--t-base);
  font-weight: 600;
  color: var(--text);
}
.board-tpl-desc {
  font-size: var(--t-xs);
  color: var(--text-muted);
  line-height: 1.5;
}
.board-tpl-alert {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.board-tpl-blank { border-style: dashed; opacity: 0.85; }
.board-tpl-blank:hover { opacity: 1; }

/* ============================================================
   WAR ROOM (Sprint 4 S4.1)
   ============================================================ */
.board-card-warroom {
  border-color: rgba(239,68,68,.45);
  border-left: 3px solid #ef4444;
  background: linear-gradient(180deg, rgba(239,68,68,.06) 0%, var(--surface) 60%);
}
.board-card-warroom-resolved {
  opacity: 0.78;
  border-left-color: var(--text-faint);
}
.board-card-warroom-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #ef4444;
  background: rgba(239,68,68,.14);
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.board-card-warroom-resolved .board-card-warroom-tag {
  color: #16a34a;
  background: rgba(22,163,74,.14);
}

.war-room-banner {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-5);
  background: linear-gradient(90deg, rgba(239,68,68,.16) 0%, rgba(239,68,68,.04) 100%);
  border: 1px solid rgba(239,68,68,.45);
  border-left: 4px solid #ef4444;
  border-radius: var(--radius);
}
.war-room-banner__icon { font-size: 28px; line-height: 1; }
.war-room-banner__body { flex: 1; min-width: 0; }
.war-room-banner__title {
  font-size: var(--t-base);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.war-room-banner__score {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: var(--t-xs);
  font-weight: 500;
  color: #ef4444;
  background: rgba(239,68,68,.14);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.war-room-banner__desc {
  font-size: var(--t-sm);
  color: var(--text-muted);
  line-height: 1.5;
}
.war-room-banner__link {
  color: #ef4444;
  text-decoration: none;
  margin-left: 4px;
  font-weight: 500;
}
.war-room-banner__link:hover { text-decoration: underline; }
.btn-warroom-resolve {
  background: #ef4444;
  color: #fff;
  border: 1px solid #dc2626;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: var(--t-sm);
  cursor: pointer;
  white-space: nowrap;
}
.btn-warroom-resolve:hover { background: #dc2626; }
@media (max-width: 640px) {
  .war-room-banner { flex-direction: column; align-items: flex-start; }
  .btn-warroom-resolve { width: 100%; }
}

/* ============================================================
   BOARD DETAIL — three-column layout (Track 7 Checkpoint B)
   ============================================================ */
.board-detail-grid {
  display: grid;
  grid-template-columns: 240px 1fr 340px;
  gap: var(--s-5);
  align-items: start;
}
@media (max-width: 1100px) {
  .board-detail-grid { grid-template-columns: 1fr; }
}
.board-detail-aside .card,
.board-detail-aside { display: flex; flex-direction: column; gap: var(--s-4); }
.board-stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0;
  font-size: var(--t-sm);
}
.board-detail-main { min-width: 0; }
.board-mention-list { display: flex; flex-direction: column; gap: var(--s-3); }
.board-mention-card {
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.bm-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.bm-title {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.bm-title:hover { color: var(--accent); }
.bm-meta { font-size: var(--t-xs); color: var(--text-muted); margin-bottom: 4px; }
.bm-note {
  padding: 6px 10px;
  background: var(--accent-dim);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  font-size: var(--t-sm);
  color: var(--text);
  margin: 6px 0;
}
.bm-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

.board-chat-panel {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 600px;
  max-height: 70vh;
}
.board-chat-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
}
.board-chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-3);
  display: flex; flex-direction: column; gap: 8px;
}
.board-chat-msg {
  padding: 8px 12px;
  background: var(--surface-2);
  border-left: 2px solid var(--border);
  border-radius: 6px;
}
.board-chat-msg.mine { border-left-color: var(--accent); }
.bcm-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; font-size: var(--t-xs); }
.bcm-body { font-size: var(--t-sm); line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.board-chat-compose {
  display: flex; gap: 8px;
  padding: var(--s-3);
  border-top: 1px solid var(--border);
  align-items: flex-end;
}
.board-chat-compose textarea {
  flex: 1;
  min-height: 36px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: var(--t-sm);
  font-family: inherit;
  resize: vertical;
}
.board-label-link {
  text-decoration: none;
  color: var(--text);
}
.board-label-link:hover { color: var(--accent); }
.empty-compact { padding: var(--s-4); }

/* ============================================================
   AEO PAGE — Sprint 3 S3.1 (per-engine + prompts + responses)
   ============================================================ */
.aeo-disambig-alert {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 18px;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: var(--s-4);
}
.disambig-icon { font-size: 20px; flex-shrink: 0; }

.aeo-engine-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.aeo-engine-card {
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left-width: 3px;
}
.aeo-engine-card.is-empty { border-left-color: var(--border); opacity: 0.6; }
.aeo-engine-card.is-low   { border-left-color: #ef4444; }
.aeo-engine-card.is-mid   { border-left-color: #f59e0b; }
.aeo-engine-card.is-good  { border-left-color: #22c55e; }

.aeo-engine-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.aeo-engine-emoji { font-size: 24px; }
.aeo-engine-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.aeo-engine-value {
  font-size: 36px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1;
}
.aeo-engine-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.aeo-engine-detail {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 6px;
  font-family: var(--font-mono);
}

.aeo-prompts-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aeo-prompts-list li {
  display: flex; gap: 12px;
  font-size: 14px;
  color: var(--text);
}
.prompt-num {
  color: var(--text-faint);
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.prompt-text { flex: 1; }

.aeo-responses {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aeo-response {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left-width: 3px;
  overflow: hidden;
}
.aeo-response.is-cited   { border-left-color: #22c55e; }
.aeo-response.is-missing { border-left-color: #94a3b8; opacity: 0.85; }

.aeo-response summary {
  cursor: pointer;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  list-style: none;
  flex-wrap: wrap;
}
.aeo-response summary::-webkit-details-marker { display: none; }
.aeo-response[open] summary {
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.aeo-response-site { font-size: 12px; min-width: 100px; }
.aeo-response-prompt {
  flex: 1;
  min-width: 200px;
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aeo-response-body {
  padding: 16px;
}
.aeo-response-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

@media (max-width: 768px) {
  .aeo-engine-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   DAILY DIGEST — Sprint 1 S1.5 (per-user multi-channel subscription)
   ============================================================ */
.section-divider {
  height: 1px;
  background: var(--border);
  margin: var(--s-6) 0;
}
.alerts-digest-card {
  margin-bottom: var(--s-5);
}
.alerts-digest-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}
.digest-channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-3);
}
.digest-channel-card {
  padding: var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.digest-channel-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.digest-channel-icon { font-size: 18px; }
.digest-channel-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.digest-channel-controls select {
  padding: 2px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  margin: 0 4px;
}

/* ============================================================
   CRISIS RADAR PAGE — Sprint 1 S1.4
   ============================================================ */
.crisis-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-6);
  padding: var(--s-5) var(--s-6);
  margin-bottom: var(--s-5);
  background: linear-gradient(135deg, rgba(34,211,238,0.05), rgba(129,140,248,0.04));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.crisis-hero-main {
  display: flex; align-items: center; gap: var(--s-5);
}
.crisis-hero-emoji { font-size: 64px; line-height: 1; }
.crisis-hero-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.crisis-hero-score {
  font-size: 64px;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1;
  color: var(--text);
}
.crisis-hero-score.is-accent  { color: var(--accent); }
.crisis-hero-score.is-warning { color: #f59e0b; }
.crisis-hero-score.is-danger  { color: #ef4444; }
.crisis-hero-max { font-size: 24px; color: var(--text-faint); font-weight: 400; }
.crisis-hero-severity {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-muted);
}
.crisis-hero-severity.is-accent  { color: var(--accent); }
.crisis-hero-severity.is-warning { color: #f59e0b; }
.crisis-hero-severity.is-danger  { color: #ef4444; }
.crisis-hero-meta { display: flex; flex-direction: column; gap: 12px; min-width: 280px; }
.crisis-hero-delta {
  display: flex; gap: 6px; align-items: baseline; font-size: 14px;
}
.delta-arrow.is-warning { color: #f59e0b; font-weight: 700; }
.delta-arrow.is-success { color: #22c55e; font-weight: 700; }
.crisis-bands {
  display: flex; gap: 4px;
  flex-wrap: wrap;
}
.band-tick {
  padding: 4px 8px;
  background: var(--surface-2);
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-faint);
  border: 1px solid transparent;
}
.band-tick.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.crisis-sparkline-card { margin-bottom: var(--s-5); padding: var(--s-4) var(--s-5); }
.crisis-sparkline {
  width: 100%; height: 160px; display: block;
}
.card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: var(--s-3);
}

.crisis-explain-card {
  margin-bottom: var(--s-5);
  border-left: 3px solid var(--accent);
  background: linear-gradient(135deg, rgba(34,211,238,0.05), rgba(129,140,248,0.03));
}
.explain-body { line-height: 1.55; color: var(--text); }
.explain-body p { margin: 0 0 8px; }

.crisis-components {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.crisis-component {
  padding: var(--s-4);
}
.crisis-component.has-signal {
  border-left: 3px solid #f59e0b;
}
.component-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.contrib-pct {
  font-size: 12px;
  color: var(--text-muted);
}
.contrib-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.contrib-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f59e0b);
  transition: width var(--time-fast);
}

@media (max-width: 768px) {
  .crisis-hero { grid-template-columns: 1fr; }
  .crisis-hero-main { flex-direction: column; align-items: flex-start; gap: var(--s-3); }
  .crisis-hero-emoji { font-size: 48px; }
  .crisis-hero-score { font-size: 48px; }
}

/* ============================================================
   SAVED SEARCHES — Sprint 1 S1.3 (Inbox filter presets)
   ============================================================ */
.saved-searches-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: var(--s-3);
  flex-wrap: wrap;
}
.saved-searches-dropdown { position: relative; }
.saved-searches-dropdown .dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 320px;
  max-width: 480px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 100;
  padding: 6px 0;
}
.dropdown-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 8px 12px 4px;
  font-weight: 600;
}
.saved-search-item {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}
.saved-search-item:last-child { border-bottom: none; }
.saved-search-link {
  flex: 1;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}
.saved-search-link:hover { background: var(--surface-2); }
.saved-search-name { font-size: var(--t-sm); font-weight: 500; }
.saved-search-meta {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved-search-item .btn-tiny { margin-right: 8px; }

/* ============================================================
   AUTO-HEADLINE — Sprint 1 S1.2 (LLM-generated narrative)
   ============================================================ */
.auto-headline {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: var(--s-5);
  background: linear-gradient(135deg, rgba(34,211,238,0.08), rgba(129,140,248,0.05));
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.45;
}
.auto-headline-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.auto-headline-text {
  flex: 1;
  color: var(--text);
  font-weight: 500;
  min-width: 0;
}
.auto-headline-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .auto-headline { font-size: 13px; }
  .auto-headline-meta { display: none; }
}

/* ============================================================
   SHARE OF VOICE dashboard (Track 6.3)
   ============================================================ */
.sov-trend-card { padding: var(--s-4) var(--s-5); }
.sov-trend-svg { width: 100%; height: 220px; display: block; }
.trend-key {
  display: inline-block; width: 18px; height: 3px;
  vertical-align: middle; margin-right: 4px;
  border-radius: 2px;
}
.trend-key.brand { background: var(--accent); }
.trend-key.comp  { background: #f59e0b; }

.sov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
}
.sov-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: var(--s-4);
}
.sov-card-brand {
  border-left: 3px solid var(--accent);
}
.sov-card.tier-1 { border-left: 3px solid #ef4444; }
.sov-card.tier-2 { border-left: 3px solid #f59e0b; }
.sov-card.tier-3 { border-left: 3px solid #eab308; }
.sov-card.tier-4 { border-left: 3px solid #94a3b8; }
.sov-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px;
}
.sov-card-title {
  font-size: 14px; font-weight: 600; margin: 0;
  color: var(--text);
}
.sov-card-share {
  font-size: 18px; font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
}
.sov-card-counts {
  font-size: var(--t-xs);
  color: var(--text-muted);
}
.tier-badge {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: var(--surface-2);
  border-radius: 3px;
  color: var(--text-muted);
}
.sov-sentiment-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface-2);
}
.sov-sentiment-bar .seg { height: 100%; }
.sov-sentiment-bar .seg.pos { background: #22c55e; }
.sov-sentiment-bar .seg.neu { background: #64748b; }
.sov-sentiment-bar .seg.neg { background: #ef4444; }
.sov-signals { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip-sm { font-size: 10px; padding: 1px 6px; }

.priority-cell { width: 60px; white-space: nowrap; text-align: center; }
.priority-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--warning-dim);
  color: var(--warning);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
}

/* EMV column — Track 6.1 */
.emv-cell {
  width: 78px;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-size: 12px;
}
.emv-cell .text-faint { font-size: 14px; }

/* Sortable column header */
.table thead th a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted transparent;
}
.table thead th a:hover { border-bottom-color: var(--text-muted); }
.table thead th a.sort-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ============================================================
   BRIEFING page (executive view)
   ============================================================ */
.briefing-hero {
  background: linear-gradient(135deg, rgba(34,211,238,0.12), rgba(129,140,248,0.12), rgba(236,72,153,0.08));
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--s-6) var(--s-8);
  margin-bottom: var(--s-6);
}
.briefing-hero-2col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: var(--s-6);
  align-items: center;
}
.briefing-hero-text { min-width: 0; }
.briefing-hero-orbe {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
}
.briefing-hero-orbe canvas,
.briefing-hero-orbe svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
.briefing-hero-eyebrow {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--s-2);
}
.briefing-hero-headline {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--text);
}
.briefing-hero-meta {
  margin-top: var(--s-3);
  font-size: var(--t-xs);
  color: var(--text-faint);
  font-family: var(--font-mono);
}
@media (max-width: 900px) {
  .briefing-hero-2col {
    grid-template-columns: 1fr;
  }
  .briefing-hero-orbe {
    width: 160px;
    height: 160px;
    margin: 0 auto;
  }
}

.key-numbers {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--s-3);
  margin-bottom: var(--s-6);
}
@media (max-width: 1200px) {
  .key-numbers { grid-template-columns: repeat(3, 1fr); }
}
.key-number {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-5) var(--s-4);
  text-align: center;
}
.key-num {
  font-size: 48px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}
.key-num.is-warning { color: var(--negative); }
@media (max-width: 900px) {
  .key-num { font-size: 36px; }
}
.key-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: var(--s-2);
}
.briefing-narratives {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-6);
}
@media (max-width: 900px) {
  .key-numbers { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   TYPOGRAPHY APPLICATION — Track 1
   ============================================================ */

/* Briefing surfaces use Geist Display */
.briefing-strip .briefing-body,
.briefing-hero-headline,
.toolbar .left h1,
.brand .name {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.025em;
}

/* All H1/H2/H3 use Geist */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* KPI card values use Geist with tabular nums */
.card .value {
  font-family: var(--font-display);
  font-weight: 600;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* Metadata + mono content uses JetBrains Mono */
.mono,
.smart-row .smart-site,
.smart-row .smart-score,
.smart-row .smart-reasons,
.priority-badge,
.briefing-eyebrow,
.briefing-hero-eyebrow,
.briefing-hero-meta,
.run-status-body,
.thread-meta,
table.table .mono,
.delta-label {
  font-family: var(--font-mono);
}

/* Labels — Inter 500 uppercase */
.label,
.key-lbl,
.card .label,
.kpi-grid .label {
  font-family: var(--font-sans);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--t-xs);
}

/* Briefing eyebrow gets accent color treatment */
.briefing-eyebrow {
  font-size: var(--t-xs) !important;
  color: var(--accent) !important;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

/* Briefing accent — italic gradient highlight for narrative names */
.briefing-accent {
  font-style: italic;
  font-weight: 500;
  background: var(--grad-1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: var(--font-display);
}

/* Gradient text — opt-in helper (use sparingly; reserve for hero moments) */
.gradient-text {
  background: var(--grad-1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ════════════════════════════════════════════════════════════════════════
   TRACK 3 — Speed of Work
   ════════════════════════════════════════════════════════════════════════ */

/* ── Command palette ─────────────────────────────────────────────────── */
.palette-host {
  position: fixed; inset: 0; z-index: 1000; display: none;
}
.palette-host.is-open { display: block; }
.palette-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.palette-panel {
  position: relative;
  margin: 12vh auto 0;
  max-width: 600px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.palette-input-wrap {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.palette-icon {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 16px;
}
.palette-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
}
.palette-list {
  max-height: 480px;
  overflow-y: auto;
  padding: 8px 0;
}
.palette-group-header {
  padding: 8px 16px 4px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.1em;
}
.palette-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background-color 0.08s;
}
.palette-row.is-active {
  background: var(--surface-3);
  border-left-color: var(--accent);
}
.palette-label { font-size: 14px; color: var(--text); }
.palette-kbd { display: inline-flex; gap: 4px; }

kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 16px;
  text-align: center;
}

/* ── Hotkey buffer toast ─────────────────────────────────────────────── */
.hotkey-buffer-toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 999;
}
.hotkey-buffer-toast.is-visible { opacity: 1; }

/* ── Bulk select ─────────────────────────────────────────────────────── */
.bulk-row { position: relative; }
.bulk-checkbox {
  display: inline-block;
  width: 14px; height: 14px;
  margin-right: 8px;
  border: 1.5px solid var(--border-strong);
  border-radius: 3px;
  background: transparent;
  vertical-align: middle;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.12s;
}
.bulk-row:hover .bulk-checkbox,
.bulk-row.is-selected .bulk-checkbox { opacity: 1; }
.bulk-row.is-selected .bulk-checkbox {
  background: var(--accent);
  border-color: var(--accent);
  position: relative;
}
.bulk-row.is-selected .bulk-checkbox::after {
  content: '✓';
  color: #050816;
  font-size: 10px;
  line-height: 12px;
  display: block;
  text-align: center;
  font-weight: 700;
}
.bulk-row.is-selected {
  background: rgba(34, 211, 238, 0.04);
}

.bulk-action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow-strong);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 800;
}
.bulk-action-bar.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.bulk-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  padding-right: 8px;
  border-right: 1px solid var(--border);
}
.bulk-action-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-sans);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.08s, border-color 0.08s;
}
.bulk-action-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.bulk-action-btn[disabled] { opacity: 0.5; cursor: wait; }
.bulk-action-btn.bulk-clear {
  border-color: transparent;
  color: var(--text-muted);
}
.bulk-action-icon { font-size: 14px; line-height: 1; }

/* ── Help modal ───────────────────────────────────────────────────── */
.help-modal-host {
  position: fixed; inset: 0; z-index: 900; display: none;
}
.help-modal-host.is-open { display: block; }
.help-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.help-modal-panel {
  position: relative;
  margin: 8vh auto 0;
  max-width: 720px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.help-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.help-modal-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}
.help-modal-close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.help-modal-close:hover { color: var(--text); }
.help-modal-body { padding: 16px 20px 20px; }
.help-modal-body section { margin-bottom: 20px; }
.help-modal-body section:last-child { margin-bottom: 0; }
.help-modal-body h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 8px;
  font-weight: 500;
}
.help-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.help-row:last-child { border-bottom: 0; }
.help-kbd { display: inline-flex; gap: 4px; }
.help-kbd .palette-only {
  font-style: italic;
  color: var(--text-faint);
  font-size: 11px;
}

/* ── Focused row (j/k navigation) — applies to both .smart-row and .inbox-row ── */
.smart-row.is-focused,
.inbox-row.is-focused {
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  background: var(--surface-2);
}
.inbox-row.is-focused td:first-child { padding-left: 8px; }

/* KPI chart slot — sized inside .card under .delta/.subtitle */
.kpi-chart {
  margin-top: 10px;
  min-height: 28px;
  display: block;
}
.kpi-chart svg {
  display: block;
  vertical-align: top;
}
.card .kpi-chart[data-chart="sparkline"] {
  height: 40px;
  margin-top: 12px;
}
.card .kpi-chart[data-chart="sparkline"] svg {
  height: 40px;
  width: 100%;
}
.card .kpi-chart[data-chart="sentiment"] {
  margin-top: 12px;
}
.card .kpi-chart[data-chart="radial"] {
  position: absolute;
  top: 16px;
  right: 16px;
  margin: 0;
  min-height: 0;
}
.card { position: relative; }

/* Stagger fade-in for hero number values (Track 1) */
.fade-in-stagger > * {
  opacity: 0;
  transform: translateY(6px);
  animation: stagger-fade-in 400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.fade-in-stagger > *:nth-child(1) { animation-delay: 0ms; }
.fade-in-stagger > *:nth-child(2) { animation-delay: 80ms; }
.fade-in-stagger > *:nth-child(3) { animation-delay: 160ms; }
.fade-in-stagger > *:nth-child(4) { animation-delay: 240ms; }
.fade-in-stagger > *:nth-child(5) { animation-delay: 320ms; }
@keyframes stagger-fade-in {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in-stagger > *,
  .fade-in-stagger > *:nth-child(n) {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* Crisis alert — decoration for KPI card when count > 0 */
.crisis-active {
  border-color: var(--negative);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.15);
}
.crisis-active .value { color: var(--negative); }
.crisis-active .label::after {
  content: " ●";
  color: var(--negative);
  animation: crisis-pulse 1.8s ease-in-out infinite;
}
@keyframes crisis-pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* ════════════════════════════════════════════════════════════════════════
   TRACK 4 — Alerts
   ════════════════════════════════════════════════════════════════════════ */
.alerts-grid {
  display: grid;
  grid-template-columns: 40% 1fr;
  gap: var(--s-6);
  margin-top: var(--s-4);
}
@media (max-width: 1100px) {
  .alerts-grid { grid-template-columns: 1fr; }
}

/* Rules column */
.alerts-rule-list { display: flex; flex-direction: column; gap: 12px; }
.alerts-rule {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: opacity 0.15s, border-color 0.15s;
}
.alerts-rule.is-disabled { opacity: 0.5; border-color: var(--border); }
.alerts-rule-head { display: flex; justify-content: space-between; align-items: center; }
.alerts-rule-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}
.alerts-rule-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-muted); font-family: var(--font-mono);
}
.alerts-rule-meta { color: var(--text-muted); }
.alerts-rule-channels { display: flex; gap: 6px; flex-wrap: wrap; }
.alerts-rule-actions { display: flex; gap: 6px; margin-top: 4px; }
.btn-tiny { padding: 4px 10px; font-size: 12px; }

/* Log column */
.alerts-log-list { display: flex; flex-direction: column; gap: 8px; }
.alerts-log-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.alerts-log-row.log-fired      { border-left-color: var(--accent); }
.alerts-log-row.log-suppressed { border-left-color: var(--text-muted); }
.alerts-log-row.log-failed     { border-left-color: var(--negative); }
.alerts-log-row.log-skipped    { border-left-color: var(--text-faint); }
.alerts-log-row.log-dry        { border-left-color: #818cf8; }

.alerts-log-head {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 4px;
}
.alerts-log-rule { font-size: 13px; color: var(--text); font-weight: 500; }
.alerts-log-preview {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
  line-height: 1.4;
}
.alerts-log-error { color: var(--negative); margin-top: 4px; }

/* Alert edit form */
.form-vert { display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
.form-vert label { display: flex; flex-direction: column; gap: 4px; }
.form-vert label > span { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }
.form-vert input[type="text"],
.form-vert input[type="number"],
.form-vert select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
}
.form-vert input:focus, .form-vert select:focus {
  outline: 0; border-color: var(--accent);
}
.form-vert fieldset.thr-block {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
}
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}
.channel-check {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.form-actions { display: flex; gap: 8px; margin-top: 12px; }
.checkbox-label { display: inline-flex; align-items: center; gap: 8px; }

/* ════════════════════════════════════════════════════════════════════════
   TRACK 5 — Google Drive integration + Storage page
   ════════════════════════════════════════════════════════════════════════ */
.drive-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 13px;
}
.drive-status strong {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 4px;
}
.drive-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 12px 0 0;
}
.drive-progress {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.drive-progress.hidden { display: none; }
.drive-progress-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.drive-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  transition: width 0.2s;
}
.drive-progress-label { color: var(--text-muted); }

.channel-status.is-empty { color: var(--text-faint); }
.channel-status.is-ok    { color: var(--positive); }

/* Super-admin storage page */
.storage-grid { margin-top: 16px; }
.storage-grid .table { width: 100%; border-collapse: collapse; }
.storage-grid .table th,
.storage-grid .table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 13px;
}
.storage-grid .table th { color: var(--text-faint); font-family: var(--font-mono); text-transform: uppercase; font-size: 11px; letter-spacing: 0.08em; }
.storage-grid .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.storage-grid .table td.actions { white-space: nowrap; }
.storage-grid .table tfoot td { background: var(--surface-2); }

/* ============================================================
   MOBILE AUDIT FIXES — systematic sweep for iPhone 375-390px
   (Sprint follow-up to mobile nav fix in cc36ae2)
   ============================================================ */

/* ── Universal table scroll wrapper ─────────────────────────── */
/* Wide tables (inbox, audit, super lists) get horizontal scroll
   inside the wrapper instead of breaking the page layout */
.table-responsive {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* Subtle shadow at edges hints scrollability */
  background:
    linear-gradient(to right, var(--surface), var(--surface)) left center / 20px 100% no-repeat,
    linear-gradient(to right, transparent, var(--surface)) right center / 20px 100% no-repeat,
    radial-gradient(farthest-side at left, rgba(0,0,0,0.4), transparent) left center / 8px 100% no-repeat,
    radial-gradient(farthest-side at right, rgba(0,0,0,0.4), transparent) right center / 8px 100% no-repeat;
  background-attachment: local, local, scroll, scroll;
  border-radius: var(--radius);
}

@media (max-width: 640px) {

  /* ── Hide low-priority inbox table columns on phones ─────────
     Column order: 1=When 2=Mod 3=Site 4=Title 5=Pri 6=EMV 7=Sent
                   8=Boards 9=Narrative 10=Actions
     Hide: Mod (redundant w/ site_tier badge), EMV (in accordion),
           Boards, Narrative (both in accordion) */
  .table.inbox-table thead th:nth-child(2),
  .table.inbox-table thead th:nth-child(6),
  .table.inbox-table thead th:nth-child(8),
  .table.inbox-table thead th:nth-child(9),
  .table.inbox-table tbody td:nth-child(2),
  .table.inbox-table tbody td:nth-child(6),
  .table.inbox-table tbody td:nth-child(8),
  .table.inbox-table tbody td:nth-child(9) {
    display: none;
  }

  /* ── Smart-row (Today + Briefing high-priority list) stacks ── */
  .smart-row {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px !important;
    padding: 12px !important;
    align-items: flex-start !important;
  }
  .smart-row .sentiment-dot { margin-top: 6px; flex-shrink: 0; }
  .smart-row .smart-site {
    font-size: 11px;
    color: var(--text-muted);
    order: 1;
    flex-basis: 100%;
  }
  .smart-row .smart-title {
    font-size: 14px !important;
    line-height: 1.4;
    flex-basis: 100%;
    order: 2;
  }
  .smart-row .smart-score,
  .smart-row .smart-reasons {
    font-size: 10px;
    color: var(--text-faint);
    order: 3;
  }

  /* ── Filter bar + saved-searches bar wrap behavior ───────────── */
  .saved-searches-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .saved-searches-bar .btn { width: 100%; justify-content: center; }
  .saved-searches-dropdown .dropdown-menu {
    left: 0;
    right: 0;
    min-width: 0;
    max-width: none;
  }
  .filter-bar .btn { width: 100%; }
  .filter-bar select { width: 100%; }

  /* ── Inbox chips wrap tighter ─────────────────────────────── */
  .inbox-chips {
    gap: 4px;
  }
  .inbox-chip {
    padding: 5px 10px;
    font-size: 11px;
  }
  .inbox-chip .chip-count {
    margin-left: 2px;
    padding: 0 4px;
  }

  /* ── Collab block toolbar stacks 1-col ────────────────────── */
  .collab-toolbar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  .collab-toolbar > div { width: 100%; }
  .collab-toolbar select { width: 100%; }

  /* ── Briefing hero hides decorative orbe on mobile ──────────── */
  .briefing-hero-orbe { display: none; }
  .briefing-hero-2col {
    grid-template-columns: 1fr;
  }

  /* ── Toolbar (page-header alt) actions stack ────────────────── */
  .toolbar { padding: 12px 0; }
  .toolbar .right {
    flex-wrap: wrap;
    gap: 6px;
  }
  .toolbar .right .btn {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    padding: 8px 12px;
  }

  /* ── Page header actions wrap ──────────────────────────────── */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-header > form,
  .page-header > div:last-child {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── Bm-meta (board mention card) wraps wider ─────────────── */
  .bm-meta {
    line-height: 1.6;
  }
  .bm-meta .badge { font-size: 9px; }

  /* ── Board chat panel: shorter on mobile (don't take whole screen) ─ */
  .board-chat-panel {
    height: 400px;
    max-height: 50vh;
  }

  /* ── Hero KPIs in onboarding/admin shrink fonts ───────────── */
  .crisis-hero-emoji { font-size: 44px; }
  .crisis-hero-score { font-size: 44px; }
  .crisis-hero-max  { font-size: 18px; }
  .crisis-bands { gap: 2px; }
  .band-tick { padding: 3px 6px; font-size: 9px; }

  /* ── SOV cards: more compact on mobile ────────────────────── */
  .sov-card-share { font-size: 14px; }
  .sov-card { padding: 12px; gap: 6px; }

  /* ── AEO engine value smaller ─────────────────────────────── */
  .aeo-engine-value { font-size: 26px; }
  .aeo-engine-emoji { font-size: 18px; }

  /* ── Forms (brand, config, integrations): inputs full-width ─ */
  .form-row,
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  input[type="text"],
  input[type="email"],
  input[type="url"],
  input[type="search"],
  input[type="number"],
  textarea,
  select {
    width: 100%;
    max-width: none;
  }

  /* ── Modal: full-width on phone ───────────────────────────── */
  .modal-card,
  .modal {
    max-width: 95vw !important;
    margin: 16px;
  }

  /* ── Toast doesn't extend beyond viewport ─────────────────── */
  .toast {
    left: 16px !important;
    right: 16px !important;
    max-width: none !important;
    bottom: 16px;
  }

  /* ── Reduce overall content padding ───────────────────────── */
  .content { padding: 12px !important; }
  section.card { padding: 16px !important; }

  /* ── Wizard step labels can be skipped on cramped screens ── */
  .wizard-step .step-label { font-size: 10px; }

  /* ── EMV cell + priority cell in inbox: hide labels keep numbers ─ */
  .table.inbox-table .priority-cell { width: auto; min-width: 36px; }
  .emv-cell { width: auto; }

  /* ── Detail row (accordion) full-width ─────────────────────── */
  .detail-row td { padding: 12px !important; }
  .mention-detail dl {
    grid-template-columns: 1fr !important;
    gap: 4px;
  }
  .mention-detail dl dt { font-size: 11px; color: var(--text-muted); }

  /* ── Action buttons in inbox row: compress ─────────────────── */
  .actions-cell {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
  }
  .actions-cell .btn,
  .actions-cell button {
    padding: 6px 8px;
    font-size: 12px;
    min-width: 32px;
  }
  .actions-cell .btn-share { font-size: 0; }
  .actions-cell .btn-share::before { content: "↗"; font-size: 14px; }

  /* ── Pricing in landing already handled in landing.css ─────── */
}

@media (max-width: 480px) {
  /* Briefing key-numbers: 6→2 already; force 1-col below 480 for legibility */
  .key-numbers { grid-template-columns: 1fr !important; }

  /* Confirm hero KPI on Today wraps as single col */
  .kpi-grid { grid-template-columns: 1fr !important; }

  /* Section titles smaller */
  .section-title { font-size: 22px !important; }
  h1 { font-size: clamp(20px, 6vw, 28px) !important; }
}

/* ── Universal: every table that's not already wrapped gets
      overflow-x via parent .content selector. Safe fallback. ─── */
@media (max-width: 900px) {
  .content > .table,
  .content > .card > .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

