/* ============================================================================
   COMMAND CENTER - Jarvis HUD for the Hermes F&B agency
   Token layer merges the UI-Designer visual system + Jarvis-core palette.
   Re-theme from :root only. Light theme via [data-theme="light"] overrides.
   ========================================================================= */

:root {
  /* ── BLACK BACKGROUND RAMP (Jarvis, near-black with cool whisper) ── */
  --bg-1:#040406;
  --bg-app: linear-gradient(160deg,#000000 0%,#050507 55%,#08080e 100%);

  /* ── PANEL SURFACES (charcoal so cards lift off the black) ── */
  --surface-1:#0d0d13; --surface-2:#15151c; --surface-3:#0a0a10;
  --surface-rail:#0b0b11;
  --panel-grad: linear-gradient(180deg,#16161e 0%,#0c0c12 100%);

  /* ── ACCENT (electric blue) ── */
  --accent:#ff7a1a; --accent-bright:#ff9b4d; --accent-deep:#e8650c;
  --accent-soft: rgba(255,122,26,.14);
  --accent-line: rgba(255,122,26,.40);

  /* ── HAIRLINES ── */
  --hairline: rgba(255,150,80,.12);
  --hairline-soft: rgba(255,150,80,.08);
  --hairline-hover: rgba(255,150,80,.22);

  /* ── STATUS ── */
  --status-working:#34d399; --status-waiting:#fbbf24; --status-idle:#64748b;
  --status-idle-txt:#94a3c4;
  --status-working-soft: rgba(52,211,153,.12);
  --status-waiting-soft: rgba(251,191,36,.12);
  --status-idle-soft: rgba(100,116,139,.12);
  --down:#f87171;

  /* ── GLOWS ── */
  --glow: rgba(255,122,26,.45);
  --glow-accent: 0 0 22px rgba(255,122,26,.45);
  --glow-accent-strong: 0 0 28px rgba(255,122,26,.55);
  --glow-working: 0 0 10px rgba(52,211,153,.9);
  --glow-waiting: 0 0 9px rgba(251,191,36,.85);

  /* ── TEXT (>=4.5:1 on navy) ── */
  --text-hi:#e6ecff; --text-mid:#aeb9dd; --text-lo:#7e8cb2;
  --text-dim:#8190b8; --text-on-accent:#1a0d00;
  --text-accent: var(--accent-bright);   /* small accent TEXT (passes contrast on dark) */

  /* ── TYPE ── */
  --font-hud:'Share Tech Mono','Fira Code',ui-monospace,monospace;
  --font-data:'Fira Code',ui-monospace,monospace;
  --font-body:'Inter',system-ui,-apple-system,sans-serif;
  --fs-2xs:.625rem; --fs-xs:.6875rem; --fs-sm:.8125rem; --fs-md:.9375rem;
  --fs-lg:1.0625rem; --fs-xl:1.375rem; --fs-2xl:1.875rem;
  --lh-body:1.55;
  --tracking-hud:.12em; --tracking-pill:.08em;

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

  /* ── RADIUS ── */
  --r-sm:8px; --r-md:11px; --r-lg:14px; --r-xl:18px; --r-pill:999px;

  /* ── MOTION ── */
  --t-fast:180ms ease; --t-base:240ms cubic-bezier(.4,0,.2,1); --t-slow:300ms cubic-bezier(.4,0,.2,1);

  --topbar-h:56px;
  --topbar-total: calc(var(--topbar-h) + env(safe-area-inset-top));
}

/* ── LIGHT THEME ── (kept in the same blue family, frosted) */
[data-theme="light"] {
  --bg-1:#e6ecfa;
  --bg-app: linear-gradient(160deg,#eef2fc 0%,#e6ecfa 55%,#dce4f6 100%);
  --surface-1:#ffffff; --surface-2:#ffffff; --surface-3:#f1f5ff;
  --surface-rail:#f6f9ff;
  --accent:#ff7a1a; --accent-bright:#e8650c; --accent-deep:#c2410c;
  --accent-soft: rgba(255,122,26,.10);
  --accent-line: rgba(255,122,26,.34);
  --hairline: rgba(200,90,20,.14);
  --hairline-soft: rgba(200,90,20,.08);
  --hairline-hover: rgba(200,90,20,.26);
  --status-idle-txt:#5b6680;
  --status-working-soft: rgba(16,150,100,.12);
  --status-waiting-soft: rgba(190,130,10,.14);
  --status-idle-soft: rgba(90,105,135,.12);
  --status-working:#0f9d63; --status-waiting:#b07c0a; --down:#d8453f;
  --glow: rgba(255,122,26,.30);
  --glow-accent: 0 0 18px rgba(255,122,26,.22);
  --glow-accent-strong: 0 0 24px rgba(255,122,26,.32);
  --glow-working: 0 0 8px rgba(16,150,100,.6);
  --glow-waiting: 0 0 7px rgba(190,130,10,.55);
  --panel-grad: linear-gradient(180deg,#ffffff 0%,#f3f6ff 100%);
  --text-hi:#10193a; --text-mid:#33406b; --text-lo:#5b6688;
  --text-dim:#8593b5; --text-on-accent:#1a0d00;
  --text-accent: var(--accent-deep);   /* light theme: deeper orange clears 4.5:1 on white */
}

/* ============================================================================
   BASE
   ========================================================================= */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-app);
  background-attachment: fixed;
  color: var(--text-mid);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  overflow-x: hidden;
}

/* blueprint grid texture, fades downward, never interferes with layout */
body::before {
  content:""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,150,80,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,150,80,.05) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: .6;
  -webkit-mask-image: linear-gradient(180deg,#000 0%,transparent 78%);
          mask-image: linear-gradient(180deg,#000 0%,transparent 78%);
}
[data-theme="light"] body::before { opacity: .9; }

/* corner radial glows for depth */
body::after {
  content:""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(620px 440px at 80% -10%, rgba(255,122,26,.18), transparent 60%),
    radial-gradient(520px 520px at -8% 110%, rgba(255,140,66,.10), transparent 60%);
}
[data-theme="light"] body::after {
  background:
    radial-gradient(620px 440px at 80% -10%, rgba(255,122,26,.10), transparent 60%),
    radial-gradient(520px 520px at -8% 110%, rgba(255,122,26,.06), transparent 60%);
}

::selection { background: var(--accent-soft); color: var(--text-hi); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--hairline-hover) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--hairline-hover); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* icons */
.ic { width: 18px; height: 18px; display: inline-block; flex-shrink: 0; }
.ic-sm { width: 14px; height: 14px; }

/* universal focus */
:where(a,button,input,textarea,select,[tabindex]):focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============================================================================
   TOPBAR
   ========================================================================= */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
  padding-top: env(safe-area-inset-top); padding-bottom: 0;
  padding-left: max(var(--sp-5), env(safe-area-inset-left));
  padding-right: max(var(--sp-5), env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg-1) 78%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
}
.topbar__brand {
  display: flex; align-items: center; gap: var(--sp-3);
  text-decoration: none; cursor: pointer;
  background: none; border: 0; padding: 0; font: inherit; color: inherit;   /* it is a <button> now (opens the nav menu) */
  margin-left: 6px; margin-right: auto;   /* nudge off the left edge; controls stay right */
}
.topbar__brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-sm); }
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--accent-bright);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  box-shadow: var(--glow-accent);
  animation: breathe-soft 4s ease-in-out infinite;
}
.brand-mark .ic { width: 18px; height: 18px; }   /* match the drawer (rail) nav icon size */
.brand-word {
  font-family: var(--font-hud); font-size: var(--fs-sm);
  letter-spacing: var(--tracking-hud); color: var(--text-hi);
}
.topbar__right { display: flex; align-items: center; gap: var(--sp-3); }

/* master pause/play - the owner controls when agents work */
.master {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 34px; padding: 0 14px 0 11px;
  font-family: var(--font-hud); font-size: var(--fs-xs); letter-spacing: var(--tracking-pill);
  text-transform: uppercase; cursor: pointer;
  border-radius: var(--r-pill);
  /* PAUSED (default): calm idle styling */
  color: var(--status-idle-txt);
  background: var(--status-idle-soft);
  border: 1px solid rgba(100,116,139,.32);
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.master:hover { border-color: var(--accent-line); color: var(--text-hi); }
.master__icon { display: inline-flex; }
.master__icon .ic { width: 14px; height: 14px; }
.master .master-ic-pause { display: none; }
.master .master-ic-play  { display: block; }
/* RUNNING: green, glowing, alive */
.master[aria-pressed="true"] {
  color: var(--status-working);
  background: var(--status-working-soft);
  border-color: rgba(52,211,153,.42);
  box-shadow: var(--glow-working);
}
.master[aria-pressed="true"] .master-ic-play  { display: none; }
.master[aria-pressed="true"] .master-ic-pause { display: block; }
.master[aria-pressed="true"] .master__icon .ic { animation: pulse 1.6s ease-in-out infinite; }

/* paused banner shown on Core + Agents */
.paused-banner {
  display: flex; align-items: center; gap: var(--sp-3);
  margin: var(--sp-4) auto 0; max-width: 580px;
  padding: 10px 16px; border-radius: var(--r-pill);
  font-family: var(--font-hud); font-size: var(--fs-xs); letter-spacing: .03em;
  color: var(--status-idle-txt);
  background: var(--status-idle-soft);
  border: 1px solid rgba(100,116,139,.32);
}
.paused-banner .ic { width: 15px; height: 15px; flex: none; color: var(--text-mid); }
.paused-banner b { color: var(--text-hi); font-weight: 600; }
.view .paused-banner { max-width: none; margin: 0 0 var(--sp-5); }

.live { display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-hud); font-size: var(--fs-2xs);
  letter-spacing: var(--tracking-hud); text-transform: uppercase;
  color: var(--status-working); }
.live__dot { width: 7px; height: 7px; border-radius: 50%;
  background: var(--status-working); box-shadow: var(--glow-working);
  animation: pulse 1.6s ease-in-out infinite; }

/* scope dropdown */
.scope { position: relative; }
.scope__btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-hud); font-size: var(--fs-xs); letter-spacing: .04em;
  color: var(--text-mid); cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--hairline);
  border-radius: var(--r-pill); padding: 7px 12px;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.scope__btn:hover { color: var(--text-hi); border-color: var(--accent-line); }
.scope__btn .ic { color: var(--accent-bright); }
.scope__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope__menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  min-width: 220px; list-style: none; margin: 0; padding: 6px;
  background: var(--surface-2); border: 1px solid var(--hairline-hover);
  border-radius: var(--r-md); box-shadow: 0 18px 50px -18px rgba(0,0,0,.7), var(--glow-accent);
}
.scope__opt {
  display: flex; align-items: center; gap: var(--sp-2);
  width: 100%; text-align: left; cursor: pointer;
  font-family: var(--font-body); font-size: var(--fs-sm); color: var(--text-mid);
  background: none; border: 0; border-radius: var(--r-sm); padding: 9px 10px;
  transition: background var(--t-fast), color var(--t-fast);
}
.scope__opt:hover { background: var(--accent-soft); color: var(--text-hi); }
.scope__opt.is-active { color: var(--text-accent); }
.scope__opt .mono { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-dim); margin-left: auto; }

/* theme toggle (cycles dark -> light -> system) */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  height: 34px; padding: 0 10px;
  background: transparent; border: 1px solid var(--hairline);
  border-radius: var(--r-sm); color: var(--text-lo); cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.theme-toggle { width: 38px; padding: 0; }
.theme-toggle:hover { color: var(--accent-bright); border-color: var(--accent-line); }
.theme-toggle .ic { display: none; }
[data-theme-pref="dark"]   .theme-ic-dark   { display: block; }
[data-theme-pref="light"]  .theme-ic-light  { display: block; }
[data-theme-pref="system"] .theme-ic-system { display: block; }

/* ============================================================================
   APP SHELL + RAIL
   ========================================================================= */
.app-shell { position: relative; z-index: 1; display: flex; min-height: calc(100vh - var(--topbar-total)); }
/* nav drawer toggle + scrim: only used on phones (rail is always visible on desktop) */
.nav-toggle { display: none; place-items: center; width: 36px; height: 36px; flex-shrink: 0;
  border: 1px solid var(--hairline); border-radius: var(--r-sm); background: transparent; color: var(--text-mid);
  cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast); }
.nav-toggle:hover { color: var(--text-hi); border-color: var(--hairline-hover); }
.rail-scrim { display: none; }

.rail {
  width: 200px; flex-shrink: 0;
  background: color-mix(in srgb, var(--surface-rail) 72%, transparent);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--hairline);
  padding: var(--sp-5) var(--sp-3);
  display: flex; flex-direction: column; justify-content: space-between;
  position: sticky; top: var(--topbar-total); height: calc(100vh - var(--topbar-total));
}
.rail__nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.rail__item {
  display: flex; align-items: center; gap: var(--sp-3);
  font-family: var(--font-hud); font-size: var(--fs-sm); letter-spacing: .03em;
  color: var(--text-lo); text-decoration: none; cursor: pointer;
  padding: var(--sp-3); border-radius: var(--r-md);
  position: relative; border: 1px solid transparent;
  min-height: 44px;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.rail__item .ic { color: currentColor; }
.rail__item:hover { color: var(--text-hi); background: var(--accent-soft); }
.rail__item.is-active {
  color: var(--text-hi);
  background: linear-gradient(90deg, var(--accent-soft), transparent 85%);
  border-color: var(--accent-line);
}
.rail__item.is-active .ic { color: var(--accent-bright); }
.rail__item.is-active::before {
  content:""; position: absolute; left: -1px; top: 14%; bottom: 14%;
  width: 2px; border-radius: var(--r-pill);
  background: var(--accent-bright); box-shadow: var(--glow-accent);
}
.rail__badge, .owner__badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-grid; place-items: center;
  font-family: var(--font-hud); font-size: var(--fs-2xs);
  color: #08210a; background: var(--status-waiting);
  border-radius: var(--r-pill); box-shadow: var(--glow-waiting);
}
.rail__foot { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); padding-top: var(--sp-4); border-top: 1px solid var(--hairline-soft); }
.rail__owner { position: relative; text-decoration: none; }
.owner__avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-hud); font-size: var(--fs-sm); color: var(--accent-bright);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.owner__badge { position: absolute; top: -4px; right: -6px; margin: 0; }

/* ============================================================================
   MAIN + VIEWS
   ========================================================================= */
.main { flex: 1; min-width: 0; padding: var(--sp-8) var(--sp-8) var(--sp-12); }
.view { max-width: 1320px; margin: 0 auto; animation: fade-in var(--t-slow); }
.view[hidden] { display: none; }
.view--core { max-width: 760px; }

/* section header pattern */
.sec-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-4); margin-bottom: var(--sp-6); flex-wrap: wrap;
}
.sec-head__l { display: flex; flex-direction: column; gap: 4px; }
.sec-title { font-family: var(--font-body); font-weight: 700; font-size: var(--fs-xl);
  color: var(--text-hi); letter-spacing: -.01em; margin: 0; }
.sec-sub { font-size: var(--fs-sm); color: var(--text-lo); margin: 0; }
.eyebrow {
  font-family: var(--font-hud); font-size: var(--fs-2xs);
  letter-spacing: var(--tracking-hud); text-transform: uppercase;
  color: var(--text-accent); margin: 0;
}
/* section-header CTA: keep it flat on the page, just tame the loud glow + size */
.sec-head .btn--primary {
  min-height: 36px; padding: 8px 14px;
  box-shadow: 0 6px 18px -10px rgba(255,122,26,.8); }
.sec-head .btn--primary:hover:not(:disabled) {
  box-shadow: 0 9px 22px -10px rgba(255,122,26,.95); }

/* ============================================================================
   PANELS + SHARED ATOMS
   ========================================================================= */
.panel { position: relative; border-radius: var(--r-lg); padding: 1px;
  background: linear-gradient(140deg, rgba(255,122,26,.45) 0%, rgba(255,150,80,.08) 45%, rgba(255,122,26,.28) 100%); }
.panel > .panel__body { background: var(--panel-grad); border-radius: calc(var(--r-lg) - 1px); padding: var(--sp-5); height: 100%; }
.hud-label { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: var(--tracking-hud);
  text-transform: uppercase; color: var(--text-accent); margin: 0 0 var(--sp-3); }

/* status pill */
.pill { display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: var(--tracking-pill);
  text-transform: uppercase; padding: 4px 10px; border-radius: var(--r-pill);
  border: 1px solid currentColor; white-space: nowrap; }
.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill--working { color: var(--status-working); background: var(--status-working-soft); border-color: rgba(52,211,153,.38); }
.pill--working .pill__dot { box-shadow: var(--glow-working); animation: pulse 1.6s ease-in-out infinite; }
.pill--waiting { color: var(--status-waiting); background: var(--status-waiting-soft); border-color: rgba(251,191,36,.38); }
.pill--waiting .pill__dot { box-shadow: var(--glow-waiting); }
.pill--idle { color: var(--status-idle-txt); background: var(--status-idle-soft); border-color: rgba(100,116,139,.32); }
.pill--idle .pill__dot { background: var(--status-idle); }

/* stage tag (content pipeline) */
.stage { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: var(--tracking-pill);
  text-transform: uppercase; padding: 3px 9px; border-radius: var(--r-pill); border: 1px solid currentColor; white-space: nowrap; }
.stage--idea           { color: var(--status-idle-txt); background: var(--status-idle-soft); border-color: rgba(100,116,139,.32); }
.stage--scripted       { color: var(--accent-bright); background: var(--accent-soft); border-color: var(--accent-line); }
.stage--approved_script{ color: #a78bfa; background: rgba(167,139,250,.12); border-color: rgba(167,139,250,.35); }
.stage--shot           { color: #7dd3fc; background: rgba(125,211,252,.12); border-color: rgba(125,211,252,.35); }
.stage--ready_for_review { color: var(--status-waiting); background: var(--status-waiting-soft); border-color: rgba(251,191,36,.38); }
.stage--approved       { color: var(--status-working); background: var(--status-working-soft); border-color: rgba(52,211,153,.38); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--font-hud); font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase;
  padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer; min-height: 40px;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), border-color var(--t-fast); }
.btn .ic { width: 15px; height: 15px; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--primary { color: var(--text-on-accent); background: linear-gradient(180deg, var(--accent-bright), var(--accent-deep)); box-shadow: var(--glow-accent); }
.btn--primary:hover:not(:disabled) { box-shadow: var(--glow-accent-strong); transform: translateY(-1px); }
.btn--ghost { color: var(--text-mid); background: color-mix(in srgb, var(--surface-2) 80%, transparent); border-color: var(--hairline-hover); }
.btn--ghost:hover:not(:disabled) { color: var(--text-hi); border-color: var(--accent-line); background: var(--accent-soft); }
.btn--danger { color: #ff8a7a; background: transparent; border-color: rgba(226,87,74,.4); }
.btn--danger:hover:not(:disabled) { color: #ffb3a8; border-color: rgba(226,87,74,.7); background: rgba(226,87,74,.12); }
.btn--sm { padding: 6px 11px; min-height: 32px; font-size: var(--fs-2xs); }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--hairline); color: var(--text-lo);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast); }
.btn-icon:hover { color: var(--accent-bright); border-color: var(--accent-line); }

/* empty states */
.empty { text-align: center; padding: var(--sp-12) var(--sp-6); max-width: 460px; margin: 0 auto; }
.empty__glyph { width: 60px; height: 60px; margin: 0 auto var(--sp-4); border-radius: 50%;
  display: grid; place-items: center; color: var(--accent-bright);
  background: var(--accent-soft); border: 1px solid var(--accent-line); box-shadow: var(--glow-accent); }
.empty__glyph .ic { width: 28px; height: 28px; }
.empty--clear .empty__glyph { color: var(--status-working); background: var(--status-working-soft);
  border-color: rgba(52,211,153,.4); box-shadow: 0 0 26px rgba(52,211,153,.3); }
.empty h3 { font-family: var(--font-body); font-weight: 600; font-size: var(--fs-lg); color: var(--text-hi); margin: 0 0 var(--sp-2); }
.empty p { font-size: var(--fs-sm); color: var(--text-lo); margin: 0 0 var(--sp-5); }

/* ============================================================================
   1. COMMAND CORE
   ========================================================================= */
.core-wrap { text-align: center; padding-top: clamp(4px, 1.5vh, 14px); }
.core-eyebrow { letter-spacing: .32em; opacity: .85; }

/* live date + time */
.core-clock { display:flex; flex-direction:row; align-items:baseline; justify-content:center; gap:8px; margin-bottom: var(--sp-2); }
.core-clock__time { font-family: var(--font-hud); font-size: 1rem; font-weight:600; line-height:1; color: var(--accent-bright); letter-spacing:.06em; text-shadow: 0 0 14px var(--glow); }
.core-clock__date { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: var(--tracking-hud); text-transform: uppercase; color: var(--text-dim); }
.core-wrap.has-chat .core-clock { margin-bottom: var(--sp-2); }

.orchestrator { position: relative; width: 132px; height: 132px; margin: var(--sp-4) auto var(--sp-3);
  cursor: pointer; transform-style: preserve-3d; transition: transform .14s ease-out, filter .25s ease;
  --cy: #22d3ee; --cy-lt: #67e8f9; --mag: #d946ef; --mag-deep: #a21caf; }
.orchestrator:hover { filter: brightness(1.12); }
.orchestrator:focus-visible { outline: 2px solid var(--cy); outline-offset: 6px; border-radius: 50%; }
/* outer cyan tick ring for HUD depth */
.orchestrator::before { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(var(--cy) 0 1.1deg, transparent 1.1deg 9deg);
  -webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, #0000 calc(100% - 3px), #000 calc(100% - 3px));
  opacity: .45; animation: spin 20s linear infinite; }
/* listening: a pulse ring radiates out, core glows brighter */
.orchestrator.is-listening::after { content: ""; position: absolute; inset: 6px; border-radius: 50%;
  border: 2px solid var(--cy); pointer-events: none; animation: listen-pulse 1.3s ease-out infinite; }
@keyframes listen-pulse { 0% { transform: scale(.82); opacity: .85; } 100% { transform: scale(1.45); opacity: 0; } }
.orchestrator.is-listening .orb { box-shadow: 0 0 42px 9px rgba(34,211,238,.5), 0 0 26px 4px rgba(217,70,239,.45); }
.orchestrator.is-speaking .orb { animation-duration: .55s; }
/* voice wave: appears over the orb while listening/speaking, hides the SAARVIZ label */
.orb-wave { position: absolute; inset: 0; z-index: 6; display: none; align-items: center; justify-content: center; gap: 4px; pointer-events: none; }
.orchestrator.is-listening .orb-wave, .orchestrator.is-speaking .orb-wave { display: flex; }
.orchestrator.is-listening .orb-label, .orchestrator.is-speaking .orb-label { opacity: 0; }
.orb-wave i { width: 3px; height: 9px; border-radius: 3px; background: var(--cy-lt); box-shadow: 0 0 8px var(--cy); animation: orb-wave-b .9s ease-in-out infinite; }
.orb-wave i:nth-child(2) { animation-delay: .15s; }
.orb-wave i:nth-child(3) { animation-delay: .3s; }
.orb-wave i:nth-child(4) { animation-delay: .1s; }
.orb-wave i:nth-child(5) { animation-delay: .22s; }
@keyframes orb-wave-b { 0%,100% { height: 8px; opacity: .55; } 50% { height: 30px; opacity: 1; } }
.ring { position: absolute; border-radius: 50%; inset: 0; }
/* cyberpunk HUD: cyan arc + magenta dashed gauge + orbiting cyan node + magenta core */
.ring-1 { inset: 3px; border: 1.5px solid var(--cy); border-top-color: transparent; border-bottom-color: transparent; opacity: .95; box-shadow: 0 0 14px 1px rgba(34,211,238,.65), 0 0 26px 4px rgba(34,211,238,.3); animation: spin 7s linear infinite; }
.ring-2 { inset: 20px; border: 1px dashed var(--mag); opacity: .75; filter: drop-shadow(0 0 4px rgba(217,70,239,.55)); animation: spin 13s linear infinite reverse; }
.ring-3 { inset: 9px; border: 0; animation: spin 9s linear infinite; }
.ring-3::before { content: ""; position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; margin-left: -4px;
  border-radius: 50%; background: var(--cy-lt); box-shadow: 0 0 12px 4px var(--cy), 0 0 24px 7px rgba(34,211,238,.55); }

/* magenta/violet energy core with a cyan scan sweep */
.orb { position: absolute; inset: 38px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 42% 32%, #ffffff 0%, #fbd0ff 14%, var(--mag) 42%, var(--mag-deep) 70%, #5b1066 94%);
  box-shadow: 0 0 26px 6px rgba(217,70,239,.6), 0 0 66px 16px rgba(217,70,239,.34),
    0 0 124px 34px rgba(168,85,247,.26), 0 0 92px 24px rgba(34,211,238,.2), inset 0 0 18px rgba(255,210,255,.5);
  animation: breathe 3.4s ease-in-out infinite; }
.orb::before { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(103,232,249,.55) 30deg, transparent 80deg, transparent 360deg);
  mix-blend-mode: screen; animation: spin 4.5s linear infinite; }
.orb::after { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 36% 26%, rgba(255,255,255,.9), rgba(255,255,255,0) 30%);
  box-shadow: inset 0 -5px 12px rgba(40,0,40,.5), inset 0 0 10px rgba(103,232,249,.4);
  animation: orb-pulse 3.4s ease-in-out infinite; }
.orb-label { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', var(--font-hud); font-weight: 700; font-size: 12px; letter-spacing: .16em; color: #fff;
  text-shadow: 0 0 10px rgba(103,232,249,.9), 0 0 18px rgba(217,70,239,.6), 0 1px 4px rgba(0,0,0,.6); pointer-events: none; }

/* state-aware: thinking quickens every layer, paused cools + freezes */
.orchestrator.is-thinking .orb { animation-duration: 1.1s; }
.orchestrator.is-thinking .orb::before { animation-duration: 1.6s; }
.orchestrator.is-thinking .ring-1 { animation-duration: 3s; }
.orchestrator.is-thinking .ring-2 { animation-duration: 5s; }
.orchestrator.is-thinking .ring-3 { animation-duration: 3.5s; }
.orchestrator.is-paused .orb { animation-play-state: paused; filter: saturate(.4) brightness(.8); }
.orchestrator.is-paused::before,
.orchestrator.is-paused .orb::before,
.orchestrator.is-paused .orb::after,
.orchestrator.is-paused .ring-1,
.orchestrator.is-paused .ring-2,
.orchestrator.is-paused .ring-3 { animation-play-state: paused; }
.orchestrator.is-paused .ring-3::before { background: var(--status-idle); box-shadow: none; }
.core-status { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-lo); margin: 0; }
.core-status .ok { color: var(--status-working); }
.core-status.is-idle .ok { color: var(--status-idle-txt); }

.core-title { font-family: var(--font-body); font-weight: 600; font-size: clamp(1.05rem, 3vw, 1.25rem);
  letter-spacing: -.01em; margin: var(--sp-3) 0 var(--sp-5); color: var(--text-hi); }
.core-sub { font-size: var(--fs-sm); color: var(--text-lo); margin: 0 0 var(--sp-6); }

/* command bar */
.cmdbar { display: flex; align-items: center; gap: var(--sp-3);
  max-width: 580px; margin: 0 auto; padding: 6px 6px 6px 16px; border-radius: var(--r-lg);
  background: linear-gradient(var(--surface-2), var(--surface-1));
  border: 1px solid var(--hairline-hover);
  box-shadow: 0 0 0 1px rgba(255,122,26,.10), 0 18px 50px -22px var(--glow);
  transition: box-shadow var(--t-slow), border-color var(--t-slow); }
.cmdbar.is-thinking, .cmdbar:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 1px var(--accent), 0 0 34px -6px var(--glow), 0 18px 50px -20px var(--glow); }
.cmdbar__core { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--status-working); box-shadow: var(--glow-working);
  animation: pulse 1.6s ease-in-out infinite; }
.cmdbar.is-thinking .cmdbar__core { animation-duration: .7s; }
.core-wrap.is-paused .cmdbar__core { background: var(--status-idle); box-shadow: none; animation: none; }
.cmdbar__input { flex: 1; min-width: 0; background: none; border: 0; outline: 0;
  color: var(--text-hi); font: 14.5px var(--font-body); }
.cmdbar__input::placeholder { color: var(--text-dim); }
.cmdbar__send { width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: var(--r-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--text-on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-bright)); box-shadow: var(--glow-accent);
  transition: transform var(--t-fast), filter var(--t-fast); }
.cmdbar__send:hover { filter: brightness(1.12); }
.cmdbar__send:active { transform: scale(.94); }
/* attach button + attachment chips */
.cmdbar__attach { width: 34px; height: 34px; flex-shrink: 0; border: 0; border-radius: var(--r-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--text-mid); background: transparent;
  transition: color var(--t-fast), background var(--t-fast); }
.cmdbar__attach:hover { color: var(--accent-bright); background: var(--accent-soft); }
.cmdbar__attach .ic { width: 19px; height: 19px; }
.cmd-attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.cmd-attachments[hidden] { display: none; }   /* hidden attr must win over display:flex (no phantom 8px strip) */
.cmd-chip, .att-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--accent-bright);
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r-pill); padding: 4px 6px 4px 9px; }
.cmd-chip .ic, .att-chip .ic { width: 13px; height: 13px; flex-shrink: 0; }
.cmd-chip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.cmd-chip button { display: inline-flex; border: 0; background: none; color: var(--text-dim); cursor: pointer; padding: 2px; border-radius: 4px; }
.cmd-chip button:hover { color: var(--accent-bright); }
.cmd-chip button .ic { width: 12px; height: 12px; }
.att-chip { margin-top: 4px; }


/* suggested prompts + hints */
.suggest-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-5); }
.chip { display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-hud); font-size: var(--fs-xs); letter-spacing: .03em; color: var(--text-mid); cursor: pointer;
  background: var(--accent-soft); border: 1px solid var(--hairline); border-radius: var(--r-pill);
  padding: 7px 13px; min-height: 36px;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast), transform var(--t-fast); }
.chip:hover { color: var(--text-hi); border-color: var(--accent-line); background: rgba(255,122,26,.18); transform: translateY(-1px); }
.chip .ic { color: var(--accent-bright); width: 14px; height: 14px; }

/* live agency strip */
.core-strip { margin: var(--sp-8) auto 0; max-width: 580px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-lo);
  padding-top: var(--sp-5); border-top: 1px solid var(--hairline-soft); }
.core-strip .seg { background: none; border: 0; cursor: pointer; color: var(--text-mid);
  font: inherit; padding: 2px 4px; border-radius: 4px; transition: color var(--t-fast); }
.core-strip .seg:hover { color: var(--accent-bright); }
.core-strip .sep { color: var(--text-dim); }
.core-strip .seg b { color: var(--accent-bright); font-weight: 400; }

/* ============================================================================
   2. AGENTS
   ========================================================================= */
.mesh-tally { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-lo); margin: 0; }
.mesh-tally .w { color: var(--status-working); } .mesh-tally .q { color: var(--status-waiting); } .mesh-tally .i { color: var(--status-idle-txt); }

.agent-filter { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3);
  border: 1px solid var(--hairline); border-radius: var(--r-pill); }
.agent-filter button { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-lo); background: none; border: 0; border-radius: var(--r-pill); padding: 6px 12px; cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast); min-height: 32px; }
.agent-filter button:hover { color: var(--text-hi); }
.agent-filter button.is-on { color: var(--text-hi); background: var(--accent-soft); }

.lead-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.agent-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); }

/* agent card */
.agent { position: relative; border-radius: var(--r-lg); padding: 1px; cursor: pointer;
  background: linear-gradient(140deg, var(--accent-line), var(--hairline) 70%);
  transition: transform var(--t-base), filter var(--t-base); }
.agent__body { background: var(--panel-grad); border-radius: calc(var(--r-lg) - 1px); padding: var(--sp-4); height: 100%; }
.agent:hover { transform: translateY(-2px); filter: brightness(1.06); }
.agent:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.agent:focus-visible .agent__body { box-shadow: 0 0 0 1px var(--accent-bright), var(--glow-accent); }
.agent[data-status="working"] { background: linear-gradient(140deg, rgba(52,211,153,.5), var(--hairline) 70%); box-shadow: 0 0 22px -8px rgba(52,211,153,.5); }
.agent[data-status="waiting"] { background: linear-gradient(140deg, rgba(251,191,36,.45), var(--hairline) 70%); }
.agent[data-status="idle"] { background: linear-gradient(140deg, rgba(100,116,139,.4), var(--hairline-soft) 70%); }
[data-theme="dark"] .agent[data-status="idle"] .agent__body { opacity: .9; }
.agent--lead .agent__body { padding: var(--sp-5); }
.agent--ceo { background: linear-gradient(140deg, var(--accent), rgba(255,140,66,.15) 70%); }
/* CEO keeps its orange identity glow only when idle; status owns working/waiting glows */
.agent--ceo[data-status="idle"] { background: linear-gradient(140deg, var(--accent), rgba(255,140,66,.15) 70%); box-shadow: var(--glow-accent); }
.agent--ceo[data-status="waiting"] { box-shadow: 0 0 22px -8px rgba(251,191,36,.5); }

.agent__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.agent__id { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.agent__icon { width: 26px; height: 26px; flex-shrink: 0; border-radius: var(--r-sm); display: grid; place-items: center;
  color: var(--accent-bright); background: var(--accent-soft); border: 1px solid var(--hairline); }
.agent__icon .ic { width: 15px; height: 15px; }
.agent--lead .agent__icon { width: 32px; height: 32px; }
.agent__name { font-family: var(--font-hud); font-size: var(--fs-sm); letter-spacing: .04em; color: var(--text-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent--lead .agent__name { font-size: var(--fs-md); }
.agent__role { font-size: var(--fs-xs); color: var(--text-lo); line-height: var(--lh-body); margin: 0; }
.agent__task { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--text-mid);
  margin-top: var(--sp-3); padding-top: var(--sp-2); border-top: 1px solid var(--hairline-soft); }
.agent__task .ic { width: 14px; height: 14px; flex-shrink: 0; }
.agent[data-status="working"] .agent__task .ic { color: var(--status-working); }
.agent[data-status="waiting"] .agent__task .ic { color: var(--status-waiting); }
.agent[data-status="idle"] .agent__task { color: var(--text-lo); }
.agent[data-status="idle"] .agent__task .ic { color: var(--status-idle-txt); }
.agent__client { margin-left: auto; font-family: var(--font-hud); font-size: 9px; color: var(--text-dim); }
/* live work progress (card + drawer) */
.agent__prog { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.agent__prog-track, .agent-prog-track { flex: 1; height: 5px; border-radius: 3px; background: var(--hairline); overflow: hidden; }
.agent__prog-track > span, .agent-prog-track > span { display: block; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright)); box-shadow: 0 0 8px var(--glow); transition: width .8s ease; }
.agent__prog-pct, .agent-prog-pct { font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--accent-bright); min-width: 32px; text-align: right; }
.agent__activity { font-family: var(--font-hud); font-size: 10px; letter-spacing: .03em; color: var(--text-dim); margin: 6px 0 0; }
.agent-prog { display: flex; align-items: center; gap: 10px; }
.agent-prog-track { height: 7px; border-radius: 4px; }
.agent-prog-pct { font-size: var(--fs-sm); min-width: 40px; }
/* agent work history (drawer) */
.task-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.task-hist__item { padding: 10px 12px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--surface-1); }
.task-hist__item.is-live { border-color: var(--accent-line); }
.task-hist__top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.task-hist__task { font-size: var(--fs-sm); color: var(--text-hi); font-weight: 500; }
.task-hist__time { flex-shrink: 0; font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-dim); }
.task-hist__result { margin: 5px 0 0; font-size: var(--fs-xs); line-height: 1.5; color: var(--text-lo); }
.task-hist__item.is-live .task-hist__result { color: var(--accent-bright); }

/* ============================================================================
   3. CLIENTS
   ========================================================================= */
.card-grid { display: grid; gap: var(--sp-5); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.client { border-radius: var(--r-lg); padding: 1px; cursor: pointer;
  background: linear-gradient(140deg, var(--accent-line), var(--hairline) 72%);
  transition: transform var(--t-base), filter var(--t-base); }
.client:hover { transform: translateY(-3px); filter: brightness(1.05); }
.client:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.client:focus-visible .client__body { box-shadow: 0 0 0 1px var(--accent-bright), var(--glow-accent); }
.client__body { background: var(--panel-grad); border-radius: calc(var(--r-lg) - 1px); padding: var(--sp-5); height: 100%;
  display: flex; flex-direction: column; gap: var(--sp-3); }
.client__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.client__name { font-family: var(--font-body); font-weight: 700; font-size: var(--fs-lg); color: var(--text-hi); margin: 0; }
.client__handle { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-accent); }
.client__type { width: 38px; height: 38px; border-radius: var(--r-sm); flex-shrink: 0; display: grid; place-items: center;
  color: var(--accent-bright); background: var(--accent-soft); border: 1px solid var(--hairline); }
.client__meta { margin: 0; font-family: var(--font-hud); font-size: var(--fs-xs); letter-spacing: .04em; color: var(--text-lo); text-transform: uppercase; }
.client__voice { margin: 0; font-size: var(--fs-sm); font-style: italic; color: var(--text-mid); }
.client__voice::before { content: '“'; } .client__voice::after { content: '”'; }
.client__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--hairline-soft); }
.client__pulse { display: flex; align-items: baseline; gap: var(--sp-2); font-family: var(--font-data); }
.client__pulse .num { font-size: var(--fs-lg); font-weight: 600; color: var(--text-hi); }
.client__pulse .trend { font-family: var(--font-hud); font-size: var(--fs-xs); }
.trend.up { color: var(--status-working); } .trend.down { color: var(--down); }
.client__flight { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-lo); }
.client__flight b { color: var(--text-accent); font-weight: 400; }
/* a delegated agent is actively working this account */
.client__task { display: inline-flex; align-items: center; gap: 5px; margin-top: var(--sp-2);
  font-family: var(--font-hud); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 999px; padding: 3px 9px; width: fit-content; }
.client__task svg { width: 12px; height: 12px; }
.client.is-working { border-color: color-mix(in srgb, var(--accent) 35%, var(--hairline-soft)); }

/* ============================================================================
   4. CALENDAR
   ========================================================================= */
.cal-controls { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.cal-month { display: inline-flex; align-items: center; gap: var(--sp-3); }
.cal-month__name { font-family: var(--font-hud); font-size: var(--fs-md); letter-spacing: .06em; color: var(--text-hi); min-width: 140px; text-align: center; }
.view-toggle { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-md); }
.view-toggle button { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-lo); background: none; border: 0; border-radius: var(--r-sm); padding: 7px 13px; cursor: pointer; min-height: 32px;
  transition: color var(--t-fast), background var(--t-fast); }
.view-toggle button.is-on { color: var(--text-hi); background: var(--accent-soft); }
.view-toggle button:hover { color: var(--text-hi); }

.stage-legend { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-5) 0; }
.legend-chip { display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-lo); background: none; border: 1px solid var(--hairline); border-radius: var(--r-pill); padding: 5px 11px; min-height: 30px;
  transition: color var(--t-fast), border-color var(--t-fast), opacity var(--t-fast); }
.legend-chip .dot { width: 8px; height: 8px; border-radius: 2px; }
.legend-chip.is-off { opacity: .4; }
.legend-chip:hover { color: var(--text-hi); border-color: var(--accent-line); }

/* month grid */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
  background: var(--hairline); border: 1px solid var(--hairline); border-radius: var(--r-lg); overflow: hidden; }
.cal-dow { background: var(--surface-1); padding: var(--sp-2); text-align: center;
  font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }
.cal-cell { background: var(--surface-1); min-height: 104px; padding: var(--sp-2); display: flex; flex-direction: column; gap: 5px; }
.cal-cell.is-out { background: color-mix(in srgb, var(--surface-1) 60%, transparent); }
.cal-cell.is-today { background: var(--accent-soft); }
.cal-date { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-lo); }
.cal-cell.is-today .cal-date { color: var(--accent-bright); }
.cal-pill { display: flex; align-items: center; gap: 5px; cursor: pointer; text-align: left;
  font-family: var(--font-body); font-size: var(--fs-2xs); color: var(--text-mid);
  background: var(--surface-2); border: 0; border-left: 3px solid var(--status-idle); border-radius: 5px;
  padding: 4px 6px; width: 100%; overflow: hidden; transition: background var(--t-fast), transform var(--t-fast); }
.cal-pill:hover { background: var(--surface-3); transform: translateX(1px); }
.cal-pill .ic { width: 11px; height: 11px; flex-shrink: 0; color: var(--text-lo); }
.cal-pill .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-pill.glows { box-shadow: 0 0 12px -3px var(--status-waiting); }
.cal-pill[data-stage="idea"] { border-left-color: var(--status-idle); }
.cal-pill[data-stage="scripted"] { border-left-color: var(--accent); }
.cal-pill[data-stage="approved_script"] { border-left-color: #a78bfa; }
.cal-pill[data-stage="shot"] { border-left-color: #7dd3fc; }
.cal-pill[data-stage="ready_for_review"] { border-left-color: var(--status-waiting); }
.cal-pill[data-stage="approved"] { border-left-color: var(--status-working); }

/* pipeline (kanban) */
.pipeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: var(--sp-3); overflow-x: auto; padding-bottom: var(--sp-2); }
.pipe-col { background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); min-height: 200px; }
.pipe-col__head { display: flex; align-items: center; justify-content: space-between; padding-bottom: var(--sp-2); border-bottom: 1px solid var(--hairline-soft); }
.pipe-col__count { font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-dim); }
.pipe-card { cursor: pointer; text-align: left; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: var(--sp-3); display: flex; flex-direction: column; gap: 6px; transition: border-color var(--t-fast), transform var(--t-fast); }
.pipe-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.pipe-card__title { font-size: var(--fs-sm); color: var(--text-hi); font-weight: 500; }
.pipe-card__meta { display: flex; align-items: center; gap: 6px; font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-dim); }

/* agenda (mobile) */
.agenda { display: flex; flex-direction: column; gap: var(--sp-4); }
.agenda__day { font-family: var(--font-hud); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-bright); margin: 0 0 var(--sp-2); }
.agenda__item { display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; width: 100%; text-align: left;
  background: var(--surface-1); border: 1px solid var(--hairline); border-left-width: 3px; border-radius: var(--r-md); padding: var(--sp-3); margin-bottom: var(--sp-2); }
.agenda__item .ic { width: 16px; height: 16px; color: var(--text-lo); }

/* ============================================================================
   5. APPROVALS
   ========================================================================= */
.appr-stack { display: flex; flex-direction: column; gap: var(--sp-4); max-width: 760px; }
.appr-card { border-radius: var(--r-lg); padding: 1px;
  background: linear-gradient(140deg, rgba(251,191,36,.4), var(--hairline) 70%);
  transition: opacity var(--t-base), transform var(--t-base); }
.appr-card.is-leaving { opacity: 0; transform: translateX(40px); }
.appr-card__body { background: var(--panel-grad); border-radius: calc(var(--r-lg) - 1px); padding: var(--sp-5); }
.appr-card__head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.appr-type { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-bright); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 5px; padding: 3px 8px; }
.appr-title { font-family: var(--font-body); font-weight: 600; font-size: var(--fs-md); color: var(--text-hi); }
.appr-client { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-lo); }
.appr-body { display: flex; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.appr-thumb { width: 84px; height: 84px; flex-shrink: 0; border-radius: var(--r-md); display: grid; place-items: center;
  color: var(--text-lo); background: var(--surface-3); border: 1px solid var(--hairline); }
.appr-thumb .ic { width: 26px; height: 26px; }
.appr-preview { flex: 1; min-width: 0; }
.appr-preview .quote { font-size: var(--fs-sm); color: var(--text-hi); line-height: var(--lh-body); margin: 0 0 var(--sp-2); }
.appr-preview .orig { font-size: var(--fs-xs); color: var(--text-lo); border-left: 2px solid var(--hairline); padding-left: var(--sp-3); margin: 0 0 var(--sp-2); }
.appr-preview .meta { font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-dim); }
.appr-preview .meta b { color: var(--text-mid); font-weight: 400; }
.appr-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); }
.appr-prov { margin-right: auto; font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-dim); }
.appr-prov b { color: var(--accent-bright); font-weight: 400; }
.sendback-note { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--hairline-soft); }
.sendback-note input { flex: 1; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-sm);
  padding: 9px 12px; color: var(--text-hi); font: var(--fs-sm) var(--font-body); outline: none; }
.sendback-note input:focus { border-color: var(--accent-line); }
.appr-toolbar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.appr-toolbar .chip.is-on { border-color: var(--accent-line); color: var(--text-hi); background: rgba(255,122,26,.18); }

/* ============================================================================
   6. ANALYTICS
   ========================================================================= */
.kpi-band { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: var(--sp-5); }
.kpi { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: var(--sp-4); }
.kpi__label { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: var(--tracking-hud); text-transform: uppercase; color: var(--text-dim); margin: 0 0 var(--sp-2); }
.kpi__value { font-family: var(--font-data); font-weight: 600; font-size: var(--fs-2xl); color: var(--text-hi); line-height: 1; }
.kpi__row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-2); margin-top: var(--sp-2); }
.kpi__delta { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--status-working); }
.kpi__delta.down { color: var(--down); }
.kpi__spark { height: 26px; }
.kpi--ghost { border-style: dashed; }
.kpi--ghost .kpi__value { color: var(--text-dim); }

.chart-panel .panel__body { padding: var(--sp-5); }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.series-toggles { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.series-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: .05em; text-transform: uppercase; color: var(--text-lo);
  background: none; border: 1px solid var(--hairline); border-radius: var(--r-pill); padding: 5px 11px; min-height: 30px; transition: opacity var(--t-fast), color var(--t-fast); }
.series-btn .dot { width: 9px; height: 9px; border-radius: 50%; }
.series-btn.is-off { opacity: .4; }
.series-btn:hover { color: var(--text-hi); }
.chart-svg { width: 100%; height: auto; display: block; }
.range-ctl { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-md); }
.range-ctl button { font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-lo); background: none; border: 0; border-radius: var(--r-sm); padding: 6px 12px; cursor: pointer; min-height: 30px; }
.range-ctl button.is-on { color: var(--text-hi); background: var(--accent-soft); }

.byclient { margin-top: var(--sp-5); }
.byclient__row { display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; width: 100%; text-align: left;
  background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-2);
  transition: border-color var(--t-fast); }
.byclient__row:hover { border-color: var(--accent-line); }
.byclient__name { font-family: var(--font-hud); font-size: var(--fs-sm); color: var(--text-hi); }
.byclient__handle { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-dim); }
.byclient__num { margin-left: auto; font-family: var(--font-data); font-size: var(--fs-md); color: var(--text-hi); }

.report-callout { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-5);
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r-md); padding: var(--sp-4); }
.report-callout .ic { color: var(--accent-bright); }
.report-callout p { margin: 0; font-size: var(--fs-sm); color: var(--text-mid); }
.report-callout b { color: var(--text-hi); }

/* ============================================================================
   DRAWER
   ========================================================================= */
.drawer-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(4,8,18,.62); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity var(--t-slow); }   /* match the drawer's 300ms so both leave together */
.drawer-scrim.is-open { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; z-index: 61; width: min(440px, 92vw); height: 100vh; height: 100dvh;
  background: var(--surface-1); border-left: 1px solid var(--hairline-hover);
  box-shadow: -24px 0 60px -20px rgba(0,0,0,.7);
  transform: translateX(100%); transition: transform var(--t-slow); overflow-y: auto; }
.drawer.is-open { transform: translateX(0); }
.drawer:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: -2px; }
.drawer__inner { padding: var(--sp-6); padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom)); }
.drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.drawer__eyebrow { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: var(--tracking-hud); text-transform: uppercase; color: var(--text-accent); margin: 0 0 4px; }
.drawer__title { font-family: var(--font-body); font-weight: 700; font-size: var(--fs-xl); color: var(--text-hi); margin: 0; }
.drawer__sub { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-lo); margin: 4px 0 0; }
.drawer__section { margin-bottom: var(--sp-5); }
.drawer__section h4 { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: var(--tracking-hud); text-transform: uppercase; color: var(--text-dim); margin: 0 0 var(--sp-2); }
.drawer__section p { font-size: var(--fs-sm); color: var(--text-mid); margin: 0; line-height: var(--lh-body); }
.drawer__row { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--hairline-soft); font-size: var(--fs-sm); }
.drawer__row .k { color: var(--text-lo); } .drawer__row .v { color: var(--text-hi); text-align: right; }
.drawer__statusrow { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.drawer__about { font-size: var(--fs-sm); line-height: var(--lh-body); color: var(--text-mid); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent-bright); background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--r-pill); padding: 3px 10px; white-space: nowrap; }
.tag--muted { color: var(--text-lo); background: var(--surface-3); border-color: var(--hairline); }
.drawer__script { font-family: var(--font-data); font-size: var(--fs-xs); color: var(--text-mid); background: var(--surface-3);
  border: 1px solid var(--hairline); border-radius: var(--r-md); padding: var(--sp-3); line-height: 1.6; white-space: pre-wrap; }
.mini-cmd { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.mini-cmd input { flex: 1; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-sm);
  padding: 9px 12px; color: var(--text-hi); font: var(--fs-sm) var(--font-body); outline: none; }
.mini-cmd input:focus { border-color: var(--accent-line); }

/* form fields (add-client / new-item) */
.field { margin-bottom: var(--sp-4); }
.field label { display: block; font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-lo); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; background: var(--surface-3); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); padding: 10px 12px; color: var(--text-hi); font: var(--fs-sm) var(--font-body); outline: none;
  transition: border-color var(--t-fast); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent-line); }
.field textarea { resize: vertical; min-height: 64px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.drawer__actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-6); }

/* ============================================================================
   TOAST
   ========================================================================= */
.toast-region { position: fixed; right: var(--sp-6); bottom: var(--sp-6); z-index: 90; display: flex; flex-direction: column; gap: var(--sp-2); pointer-events: none; }
.toast { display: flex; align-items: center; gap: var(--sp-3); pointer-events: auto;
  font-family: var(--font-hud); font-size: var(--fs-sm); letter-spacing: .02em; color: var(--text-hi);
  background: var(--surface-2); border: 1px solid var(--accent-line); border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-5); box-shadow: var(--glow-accent);
  transform: translateX(20px); opacity: 0; animation: toast-in var(--t-base) forwards; max-width: 360px; }
.toast.is-out { animation: toast-out var(--t-base) forwards; }
.toast .ic { color: var(--accent-bright); width: 16px; height: 16px; flex-shrink: 0; }
.toast--ok { border-color: rgba(52,211,153,.5); box-shadow: 0 0 22px rgba(52,211,153,.3); }
.toast--ok .ic { color: var(--status-working); }
.toast__undo { margin-left: var(--sp-2); font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-bright); background: none; border: 0; cursor: pointer; padding: 4px 6px; }
.toast__undo:hover { text-decoration: underline; }

/* ============================================================================
   KEYFRAMES
   ========================================================================= */
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.7); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe {
  0%,100% { transform: scale(1); box-shadow:
    0 0 26px 6px rgba(217,70,239,.60),
    0 0 66px 16px rgba(217,70,239,.34),
    0 0 124px 34px rgba(168,85,247,.26),
    0 0 92px 24px rgba(34,211,238,.20),
    inset 0 0 18px rgba(255,210,255,.50); }
  50% { transform: scale(1.05); box-shadow:
    0 0 36px 9px rgba(217,70,239,.80),
    0 0 92px 24px rgba(217,70,239,.46),
    0 0 168px 52px rgba(168,85,247,.36),
    0 0 124px 34px rgba(34,211,238,.30),
    inset 0 0 24px rgba(255,228,255,.66); } }
@keyframes breathe-soft { 0%,100% { box-shadow: var(--glow-accent); } 50% { box-shadow: var(--glow-accent-strong); } }
@keyframes orb-pulse {
  0%,100% { box-shadow: inset 0 -6px 14px rgba(0,0,0,.5), inset 0 4px 10px rgba(255,200,150,.4); opacity: .95; }
  50% { box-shadow: inset 0 -7px 17px rgba(0,0,0,.55), inset 0 5px 13px rgba(255,210,160,.55); opacity: 1; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-in { to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { to { transform: translateX(20px); opacity: 0; } }

/* ============================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1024px) {
  .rail { width: 76px; }
  .rail__label, .rail__badge { display: none; }
  .rail__item { justify-content: center; padding: var(--sp-3) 0; }
  .lead-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --topbar-h: 52px; }
  .topbar {
    padding-left: max(var(--sp-4), env(safe-area-inset-left));
    padding-right: max(var(--sp-4), env(safe-area-inset-right));
  }
  .brand-word { display: none; }
  .live__txt { display: none; }
  .main { padding: var(--sp-5) var(--sp-4); }
  /* cap the scope label so 'All accounts' never wraps on phones */
  .scope__label { max-width: 120px; }
  /* iOS Safari auto-zooms on focus when input text < 16px; force 16px on narrow viewports */
  .cmdbar__input,
  .field input, .field select, .field textarea,
  .sendback-note input,
  .mini-cmd input,
  .sched__times input[type=time] { font-size: 16px; }
  .toast-region { right: 12px; left: 12px; bottom: 12px; }
  .toast { max-width: none; }
  /* the menu toggle appears; the rail becomes a slim ICON-ONLY slide-out drawer */
  .nav-toggle { display: grid; }
  .main { padding: var(--sp-5) var(--sp-4); }
  .rail { position: fixed; left: 0; top: var(--topbar-total); z-index: 60;
    width: 64px; height: calc(100dvh - var(--topbar-total));
    padding: var(--sp-3) 5px; padding-left: max(5px, env(safe-area-inset-left));
    transform: translateX(-101%); transition: transform var(--t-base);
    box-shadow: 14px 0 44px -12px rgba(0,0,0,.75); background: color-mix(in srgb, var(--surface-rail) 96%, transparent); }
  body.nav-open .rail { transform: translateX(0); }
  .rail__item { flex-direction: column; gap: 0; padding: 12px 2px; justify-content: center; }
  .rail__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rail__foot { display: flex; }
  .owner__avatar { width: 34px; height: 34px; font-size: var(--fs-2xs); }
  .rail-scrim { display: block; position: fixed; left: 0; right: 0; bottom: 0; top: var(--topbar-total); z-index: 55;
    background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity var(--t-base); }
  body.nav-open .rail-scrim { opacity: 1; pointer-events: auto; }
  .lead-row { grid-template-columns: 1fr; }
  .agent-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  /* when the agents header wraps, let the status filter span full width with even buttons */
  #view-agents .sec-head { align-items: stretch; }
  .agent-filter { display: flex; width: 100%; }
  .agent-filter button { flex: 1; text-align: center; }
  .kpi-band { grid-template-columns: 1fr 1fr; }
  /* month grid: scroll horizontally so day columns stay readable instead of squishing to 7 on a phone */
  #cal-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cal-grid { min-width: 600px; font-size: var(--fs-2xs); }
  .cal-cell { min-height: 78px; }
}

@media (max-width: 480px) {
  .agent-grid, .card-grid { grid-template-columns: 1fr; }
  .kpi-band { grid-template-columns: 1fr; }
  .appr-actions { flex-direction: column-reverse; align-items: stretch; }
  .appr-actions .btn { width: 100%; }
  .appr-prov { margin: 0 0 var(--sp-2); text-align: center; }
  .appr-body { flex-direction: column; }
  .appr-thumb { width: 100%; height: 120px; }
  .field-row { grid-template-columns: 1fr; }
}

/* very narrow phones: collapse the master pill to its icon so the topbar
   right-cluster (theme toggle) is never clipped off-screen */
@media (max-width: 400px) {
  .topbar { padding-left: 10px; padding-right: 10px; }
  .topbar__right { gap: 8px; }
  .master__txt { display: none; }
  .master { padding: 0 11px; }
}

/* ============================================================================
   REDUCED MOTION
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; }
  .orb { box-shadow: 0 0 30px 6px rgba(217,70,239,.55), 0 0 84px 24px rgba(168,85,247,.28), 0 0 60px 16px rgba(34,211,238,.18), inset 0 0 18px rgba(255,210,255,.5); }
  /* hide the conic sweep so it does not freeze mid-rotation as a static wedge;
     the lit-sphere specular dot + rim on ::after stays for a tasteful calm look */
  .orb::before { opacity: 0; }
}

/* Command Core conversation: bounded panel that scrolls inside itself */
.chat-panel { max-width: 640px; margin: var(--sp-6) auto 0; text-align: left;
  border: 1px solid var(--hairline); border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(var(--surface-1), rgba(0,0,0,.18));
  box-shadow: 0 22px 60px -34px var(--glow); }
.chat-head { display:flex; align-items:center; justify-content:space-between;
  padding: 9px 14px; border-bottom: 1px solid var(--hairline-soft); background: rgba(255,122,26,.05); }
.chat-head__t { display:inline-flex; align-items:center; gap:7px; font-family: var(--font-hud);
  font-size: var(--fs-2xs); letter-spacing: var(--tracking-hud); text-transform: uppercase; color: var(--text-lo); }
.chat-head__t .ic { width:13px; height:13px; color: var(--accent-bright); }
.chat-head__ctl { display:inline-flex; align-items:center; gap:4px; }
.chat-head__clear { background:none; border:0; cursor:pointer; color: var(--text-dim);
  font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing:.04em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 4px; transition: color var(--t-fast); }
.chat-head__clear:hover { color: var(--accent-bright); }
/* reversible message-order toggle: arrow flips when newest-first is active */
.chat-head__order { display:grid; place-items:center; width:24px; height:24px; background:none; border:0;
  cursor:pointer; color: var(--text-dim); border-radius: 4px; transition: color var(--t-fast), transform var(--t-fast); }
.chat-head__order .ic { width:13px; height:13px; }
.chat-head__order:hover { color: var(--accent-bright); }
.chat-head__order[aria-pressed="true"] { color: var(--accent-bright); transform: rotate(180deg); }
/* left history icon (opens the popover) + the new-chat button */
.chat-head { position: relative; }   /* anchor the history popover */
.chat-head__hist { display:grid; place-items:center; width:26px; height:26px; flex-shrink:0; background:none; border:0;
  cursor:pointer; color: var(--accent-bright); border-radius: 6px; transition: background var(--t-fast), color var(--t-fast); }
.chat-head__hist .ic { width:14px; height:14px; }
.chat-head__hist:hover { background: var(--surface-3); }
.chat-head__hist[aria-expanded="true"] { background: rgba(255,122,26,.14); }
.chat-head__new, .chat-head__min { display:grid; place-items:center; width:24px; height:24px; background:none; border:0;
  cursor:pointer; color: var(--text-dim); border-radius: 4px; transition: color var(--t-fast); }
.chat-head__new .ic, .chat-head__min .ic { width:14px; height:14px; transition: transform var(--t-fast); }
.chat-head__new:hover, .chat-head__min:hover { color: var(--accent-bright); }
/* minimized: drop the conversation away, leave only the search bar, and make Saarviz bigger.
   has-chat is forced off when minimized, so the header + messages already hide; we just hide
   the attachments tray, drop the panel chrome, and enlarge the orb. tapping the bar maximizes. */
.core-wrap.is-min .chat-panel .cmd-attachments { display: none; }
.core-wrap.is-min .chat-panel { background: transparent; border: 0; box-shadow: none; }
.core-wrap.is-min .cmdbar { cursor: pointer; }
.core-wrap.is-min .cmdbar__input { cursor: pointer; }
/* minimized: the panel chrome is gone, so give the command bar its own visible border + frame */
.core-wrap.is-min .chat-panel .cmdbar {
  border: 1px solid var(--hairline-hover); border-radius: var(--r-lg);
  background: linear-gradient(var(--surface-2), var(--surface-1));
  box-shadow: 0 0 0 1px rgba(255,122,26,.10), 0 18px 50px -22px var(--glow); }
.core-wrap.is-min .chat-panel .cmdbar:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 1px var(--accent), 0 0 34px -6px var(--glow), 0 18px 50px -20px var(--glow); }
.core-wrap.is-min .orchestrator { width: 168px; height: 168px; margin: var(--sp-5) auto var(--sp-4); }
.core-wrap.is-min .orb { inset: 48px; }
/* smooth motion between minimized (home) and maximized (chat): the orb resizes via the
   transitions above; the elements that appear in each state fade + rise in */
@keyframes soft-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.core-wrap.is-min .core-title,
.core-wrap.is-min .core-eyebrow { animation: soft-rise .55s cubic-bezier(.22,1,.36,1) both; }
.core-wrap.has-chat .chat-head,
.core-wrap.has-chat .core-chat { animation: soft-rise .42s cubic-bezier(.22,1,.36,1) both; }
.core-wrap.is-min .cmdbar { animation: soft-rise .5s cubic-bezier(.22,1,.36,1) both; }
/* the head now shows the active conversation title: natural case, fills the middle, truncates */
.chat-head__t { flex:1; min-width:0; text-transform: none; letter-spacing: .01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- history popover: pick an old chat ---- */
.chat-hist-pop { position:absolute; top: calc(100% + 6px); left: 8px; z-index: 50;
  width: min(304px, calc(100% - 16px)); max-height: 340px; display:flex; flex-direction:column;
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  box-shadow: 0 18px 44px rgba(0,0,0,.55); overflow:hidden; animation: fade-in var(--t-fast); }
.chat-hist-pop[hidden] { display:none; }   /* attribute-hidden must beat display:flex */
.chat-hist-pop__head { display:flex; align-items:center; justify-content:space-between; gap:8px; padding: 9px 12px;
  border-bottom: 1px solid var(--hairline-soft); font-family: var(--font-hud); font-size: var(--fs-2xs);
  letter-spacing: var(--tracking-hud); text-transform: uppercase; color: var(--text-dim); }
.chat-hist-pop__new { display:inline-flex; align-items:center; gap:5px; background:none; border:0; cursor:pointer;
  color: var(--accent-bright); font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing:.04em;
  text-transform: uppercase; padding: 3px 7px; border-radius: 5px; transition: background var(--t-fast); }
.chat-hist-pop__new .ic { width:12px; height:12px; }
.chat-hist-pop__new:hover { background: var(--surface-3); }
.hist-list { overflow-y:auto; padding: 6px; display:flex; flex-direction:column; gap: 3px;
  scrollbar-width: thin; scrollbar-color: var(--accent-line) transparent; }
.hist-list::-webkit-scrollbar { width: 7px; }
.hist-list::-webkit-scrollbar-thumb { background: var(--accent-line); border-radius: 7px; }
.hist-row { display:flex; align-items:stretch; border-radius: var(--r-sm); transition: background var(--t-fast); }
.hist-row:hover { background: var(--surface-3); }
.hist-row.is-active { background: rgba(255,122,26,.08); }
.hist-row__open { flex:1; min-width:0; display:flex; align-items:center; gap: 8px; background:none; border:0;
  cursor:pointer; text-align:left; padding: 8px 10px; color: inherit; }
.hist-row__open .ic { width:13px; height:13px; flex-shrink:0; color: var(--text-dim); }
.hist-row.is-active .hist-row__open .ic { color: var(--accent-bright); }
.hist-row__title { flex:1; min-width:0; font-size: var(--fs-sm); color: var(--text-hi);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.hist-row.is-active .hist-row__title { color: var(--accent-bright); font-weight: 600; }
.hist-row__time { flex-shrink:0; font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-dim); }
.hist-row__del { display:grid; place-items:center; width:30px; flex-shrink:0; background:none; border:0; cursor:pointer;
  color: var(--text-dim); opacity:0; transition: opacity var(--t-fast), color var(--t-fast); }
.hist-row__del .ic { width:13px; height:13px; }
.hist-row:hover .hist-row__del { opacity:1; }
.hist-row__del:hover { color: var(--down); }
.hist-empty { padding: 16px; text-align:center; font-size: var(--fs-xs); color: var(--text-dim); margin:0; }
@media (max-width: 768px) { .hist-row__del { opacity:1; } .chat-hist-pop { width: calc(100% - 16px); } }

.core-chat { display:flex; flex-direction:column; gap:12px; text-align:left;
  max-height: clamp(240px, 44vh, 480px); overflow-y:auto; padding: 16px 14px;
  scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--accent-line) transparent; }
.core-chat::-webkit-scrollbar { width: 8px; }
.core-chat::-webkit-scrollbar-thumb { background: var(--accent-line); border-radius: 8px; }
.core-chat::-webkit-scrollbar-track { background: transparent; }

.chat-msg { display:flex; flex-direction:column; gap:3px; max-width:88%; animation: chatIn .22s ease-out; }
.chat-msg--you { align-self:flex-end; align-items:flex-end; }
.chat-msg--agent { align-self:flex-start; }
.chat-msg--sys { align-self:center; max-width:100%; }
.chat-who { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: var(--tracking-hud); text-transform: uppercase; color: var(--text-dim); }
.chat-msg--you .chat-who { color: var(--accent-bright); }
.chat-body { font-size: var(--fs-sm); line-height:1.55; padding:10px 14px; border-radius: var(--r-lg); border:1px solid var(--hairline); }
.chat-msg--you .chat-body { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text-hi); }
.chat-msg--agent .chat-body { background: var(--surface-2); color: var(--text-mid); }
/* ── rendered markdown inside agent/CEO replies (user bubbles stay plain) ── */
.chat-msg--agent .chat-body > :first-child { margin-top: 0; }
.chat-msg--agent .chat-body > :last-child { margin-bottom: 0; }
.chat-msg--agent .chat-body p { margin: 0 0 .55em; }
.chat-msg--agent .chat-body h1,
.chat-msg--agent .chat-body h2,
.chat-msg--agent .chat-body h3 {
  font-family: var(--font-hud); font-weight: 600; line-height: 1.25;
  color: var(--text-hi); margin: .85em 0 .4em; letter-spacing: .01em; }
.chat-msg--agent .chat-body h1 { font-size: 1.08rem; color: var(--accent-bright); }
.chat-msg--agent .chat-body h2 { font-size: .98rem; }
.chat-msg--agent .chat-body h3 { font-size: .9rem; color: var(--text-accent); }
.chat-msg--agent .chat-body ul,
.chat-msg--agent .chat-body ol { margin: .35em 0 .6em; padding-left: 1.35em; }
.chat-msg--agent .chat-body li { margin: .2em 0; }
.chat-msg--agent .chat-body li::marker { color: var(--accent-bright); }
.chat-msg--agent .chat-body strong { color: var(--text-hi); font-weight: 600; }
.chat-msg--agent .chat-body em { font-style: italic; }
.chat-msg--agent .chat-body hr {
  border: 0; height: 1px; margin: .8em 0;
  background: linear-gradient(90deg, var(--accent-line), transparent 85%); }
.chat-msg--agent .chat-body code {
  font-family: var(--font-data); font-size: .85em;
  color: var(--accent-bright); background: var(--surface-3);
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  padding: .08em .4em; word-break: break-word; }
/* in-chat typing indicator (replaces the old "Saarviz is thinking" line) */
.chat-body.is-typing { padding: 12px 14px; }
.chat-body .typing { display: inline-flex; gap: 5px; align-items: center; }
.chat-body .typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-bright); animation: typing-bounce 1.2s ease-in-out infinite; }
.chat-body .typing i:nth-child(2) { animation-delay: .18s; }
.chat-body .typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typing-bounce { 0%,80%,100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-4px); opacity: 1; } }
.chat-sys { display:inline-flex; align-items:center; gap:6px; padding: 3px 11px;
  font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing:.04em; text-transform: uppercase;
  color: var(--text-dim); border: 1px dashed var(--hairline); border-radius: var(--r-pill); }
.chat-sys .ic { width:11px; height:11px; color: var(--accent-bright); }

@keyframes chatIn { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform:none; } }

/* once a conversation is open, compress the hero so the thread leads */
.core-wrap.has-chat { padding-top: clamp(8px, 2vh, 20px); }
.core-wrap.has-chat .orchestrator { width:76px; height:76px; margin: var(--sp-3) auto var(--sp-2); }
.core-wrap.has-chat .ring-1 { inset:1px; }
.core-wrap.has-chat .ring-2 { inset:11px; }
.core-wrap.has-chat .ring-3 { inset:4px; }
.core-wrap.has-chat .ring-3::before { width:6px; height:6px; margin-left:-3px; top:-3px; }
.core-wrap.has-chat .orb { inset:22px; }
.core-wrap.has-chat .orb-label { font-size:9px; letter-spacing:.1em; }
.core-wrap.has-chat .core-eyebrow,
.core-wrap.has-chat .core-title,
.core-wrap.has-chat .core-sub { display:none; }
.core-wrap.has-chat .core-strip { margin-top: var(--sp-6); }

/* composer docked at the bottom of the conversation panel (chat-app style) */
.chat-panel .cmdbar { max-width: none; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; padding: 6px 8px; }
.chat-panel .cmdbar__send { width: 34px; height: 34px; }
.chat-panel .cmdbar__attach { width: 30px; height: 30px; }
.chat-panel .cmdbar__input { font-size: 14px; }
.chat-panel .cmdbar:focus-within, .chat-panel .cmdbar.is-thinking { border: 0; box-shadow: none; }
.chat-panel:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent), 0 0 30px -10px var(--glow), 0 22px 60px -34px var(--glow); }
/* empty state: the panel is just the composer (no header, no message list) */
.core-wrap:not(.has-chat) .chat-head,
.core-wrap:not(.has-chat) .core-chat { display: none; }
/* once chatting: divide the messages from the composer */
.core-wrap.has-chat .chat-panel .cmdbar { border-top: 1px solid var(--hairline-soft); }

@media (prefers-reduced-motion: reduce) { .chat-msg { animation: none; } .core-chat { scroll-behavior: auto; } }

/* Working-hours schedule popover */
.sched { position: relative; }
.sched__btn { display:grid; place-items:center; width:36px; height:36px; border-radius: var(--r-sm); border:1px solid var(--hairline); background:transparent; color: var(--text-mid); cursor:pointer; transition: var(--t-fast); }
.sched__btn:hover { border-color: var(--hairline-hover); color: var(--text-hi); }
.sched__pop { position:absolute; top:calc(100% + 8px); right:0; z-index:60; width:270px; padding:14px; background: var(--surface-2); border:1px solid var(--accent-line); border-radius: var(--r-lg); box-shadow: var(--glow-accent), 0 14px 40px -12px rgba(0,0,0,.7); display:flex; flex-direction:column; gap:10px; text-align:left; }
/* the `hidden` attribute must win over display:flex, or the popover never closes */
.sched__pop[hidden] { display: none; }
.sched__title { font-family: var(--font-hud); font-size: var(--fs-xs); letter-spacing: var(--tracking-hud); text-transform:uppercase; color: var(--accent-bright); margin:0; }
.sched__chk { display:flex; gap:8px; align-items:flex-start; font-size: var(--fs-sm); color: var(--text-mid); line-height:1.4; cursor:pointer; }
.sched__times { display:flex; gap:10px; }
.sched__times label { display:flex; flex-direction:column; gap:4px; font-size: var(--fs-xs); color: var(--text-dim); flex:1; }
.sched__times input[type=time] { background: var(--surface-3); border:1px solid var(--hairline); border-radius: var(--r-sm); color: var(--text-hi); padding:6px 8px; font-family: var(--font-data); }
.sched__save { width:100%; justify-content:center; }
/* mobile: the 270px dropdown overflows off the left of a narrow topbar.
   Pin it as a sheet inside the viewport instead. */
@media (max-width: 600px) {
  .sched__pop { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; max-width: none; z-index: 80; }
}

/* ── Admin · token budget ── */
.budget-pools { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.pool-card { background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5); }
.pool-card__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.pool-card__name { font-family: var(--font-hud); font-size: var(--fs-sm); color: var(--text-hi); letter-spacing: .03em; }
.pool-card__pct { font-family: var(--font-hud); font-size: var(--fs-sm); color: var(--accent-bright); }
.pool-card__pct.is-hot { color: var(--status-waiting); }
.pool-bar { height: 8px; border-radius: 4px; background: var(--hairline); overflow: hidden; }
.pool-bar > span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); box-shadow: 0 0 8px var(--glow); }
.pool-card__nums { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: var(--fs-xs); color: var(--text-lo); }
.pool-card__nums label { display: inline-flex; align-items: center; gap: 6px; }
.pool-input { width: 112px; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-sm); color: var(--text-hi); padding: 5px 8px; font-family: var(--font-data); font-size: var(--fs-sm); }
.admin-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.alloc-list { display: flex; flex-direction: column; gap: 8px; }
.alloc-row { display: grid; grid-template-columns: 150px 1fr 92px; align-items: center; gap: var(--sp-4); padding: 10px 14px; background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-md); }
.alloc-row.is-over { border-color: rgba(226,87,74,.5); }
.alloc-row__id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alloc-row__name { font-size: var(--fs-sm); color: var(--text-hi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alloc-row__prov { font-family: var(--font-hud); font-size: 9px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.alloc-row__meter { display: flex; align-items: center; gap: 10px; min-width: 0; }
.alloc-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--hairline); overflow: hidden; }
.alloc-bar > span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); }
.alloc-row.is-over .alloc-bar > span { background: linear-gradient(90deg, #e2574a, #ff8a7a); }
.alloc-row__use { font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-lo); min-width: 84px; text-align: right; }
.alloc-cap { width: 88px; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-sm); color: var(--text-hi); padding: 5px 7px; font-family: var(--font-data); font-size: var(--fs-xs); }
@media (max-width: 600px) {
  .budget-pools { grid-template-columns: 1fr; }
  .alloc-row { grid-template-columns: 1fr 78px; grid-template-areas: "id cap" "meter meter"; row-gap: 8px; }
  .alloc-row__id { grid-area: id; } .alloc-cap { grid-area: cap; } .alloc-row__meter { grid-area: meter; }
}

/* ── Admin · voice settings ── */
.voice-cfg { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 560px; }
.vf { display: flex; flex-direction: column; gap: 5px; font-size: var(--fs-xs); color: var(--text-lo); }
.vf > span { font-family: var(--font-hud); letter-spacing: .03em; text-transform: uppercase; }
.vf select, .vf input { background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-sm); color: var(--text-hi); padding: 9px 11px; font: 14px var(--font-body); }
.vf select { text-transform: capitalize; }
.voice-presets { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* ============================================================================
   RESEARCH + ACTIVITY (real agent output)
   ========================================================================= */
.research-list { display: grid; gap: var(--sp-4); }
.reports-band { margin-bottom: var(--sp-6); } .reports-band .hud-label { margin: 0 0 var(--sp-3); }
.analytics-ctl { display: flex; align-items: center; gap: var(--sp-3); }
/* a designed graphic links straight to Canva to open/edit */
.appr-thumb--link { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; cursor: pointer; color: var(--accent-bright); transition: border-color var(--t-fast), background var(--t-fast); }
.appr-thumb--link span { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: .03em; }
.appr-thumb--link:hover { border-color: var(--accent-line); background: var(--accent-soft); }
/* a real rendered design preview (re-hosted Canva PNG), click to open in Canva */
.appr-thumb--img { padding: 0; overflow: hidden; display: block; width: 116px; height: 116px; flex-shrink: 0;
  border-radius: var(--r-md); border: 1px solid var(--hairline); background: var(--surface-3); cursor: pointer;
  transition: border-color var(--t-fast); }
.appr-thumb--img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.appr-thumb--img:hover { border-color: var(--accent-line); }
/* due-to-post reminders banner (you publish manually) */
.due-band { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-5); padding: var(--sp-4) var(--sp-5);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-2)); border: 1px solid var(--accent-line); border-radius: var(--r-lg); }
.due-band__title { display: flex; align-items: center; gap: 7px; margin: 0; font-family: var(--font-hud); font-size: var(--fs-2xs);
  letter-spacing: var(--tracking-hud); text-transform: uppercase; color: var(--accent-bright); }
.due-band__title svg { width: 13px; height: 13px; }
.due-row { display: flex; align-items: baseline; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--text-mid); }
.due-row b { color: var(--text-hi); font-weight: 600; }
.due-row .when { margin-left: auto; flex-shrink: 0; font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-dim); }
.due-row.is-today .when { color: var(--accent-bright); }
.research-card { background: var(--surface-2); border: 1px solid var(--hairline-soft); border-radius: var(--r-lg); padding: var(--sp-5); }
.research-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.research-card__topic { font-family: var(--font-body); font-weight: 600; font-size: var(--fs-md); color: var(--text-hi); }
.research-card__meta { flex-shrink: 0; font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-dim); }
.research-card__body { font-size: var(--fs-sm); color: var(--text-mid); line-height: var(--lh-body); max-height: 340px; overflow-y: auto; }

/* shared markdown body (research + reports), mirrors the in-chat markdown pass */
.md-body p { margin: 0 0 .55em; } .md-body > :last-child { margin-bottom: 0; }
.md-body h1, .md-body h2, .md-body h3 { font-family: var(--font-hud); font-weight: 600; line-height: 1.25; color: var(--text-hi); margin: .85em 0 .4em; }
.md-body h1 { font-size: 1.05rem; color: var(--accent-bright); } .md-body h2 { font-size: .96rem; } .md-body h3 { font-size: .88rem; color: var(--text-accent); }
.md-body ul, .md-body ol { margin: .35em 0 .6em; padding-left: 1.35em; } .md-body li { margin: .2em 0; } .md-body li::marker { color: var(--accent-bright); }
.md-body strong { color: var(--text-hi); font-weight: 600; } .md-body em { font-style: italic; }
.md-body hr { border: 0; height: 1px; margin: .8em 0; background: linear-gradient(90deg, var(--accent-line), transparent 85%); }
.md-body code { font-family: var(--font-data); font-size: .85em; color: var(--accent-bright); background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: .08em .4em; }

/* Activity = agency comms thread: each item is the brief sent to an agent + its full reply */
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.comms { padding: var(--sp-4) 0; border-bottom: 1px solid var(--hairline-soft); }
.comms__brief { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.comms__to { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-hud); font-size: var(--fs-xs);
  letter-spacing: .04em; text-transform: uppercase; color: var(--accent-bright); }
.comms__to .ic { width: 12px; height: 12px; }
.comms__time { margin-left: auto; flex-shrink: 0; font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-dim); }
.comms__ask { flex-basis: 100%; margin: 4px 0 0; font-size: var(--fs-sm); color: var(--text-mid); }
.comms__reply { margin: 8px 0 0; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); font-size: var(--fs-sm); color: var(--text-mid); }
.comms.is-working .comms__reply, .comms__empty { color: var(--text-dim); }
.comms__empty { margin: 6px 0 0; font-size: var(--fs-xs); font-style: italic; }
.comms__live { display: inline-flex; align-items: center; gap: 8px; margin: 6px 0 0; font-family: var(--font-hud);
  font-size: var(--fs-2xs); letter-spacing: .04em; text-transform: uppercase; color: var(--accent-bright); }
.comms__live .typing { display: inline-flex; gap: 4px; }
.comms__live .typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-bright); animation: typing-bounce 1.2s ease-in-out infinite; }
.comms__live .typing i:nth-child(2) { animation-delay: .18s; }
.comms__live .typing i:nth-child(3) { animation-delay: .36s; }

/* marketing files pulled from Google Drive, shown in the account drawer */
.drive-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.drive-item a { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--text-mid); border: 1px solid transparent; transition: background var(--t-fast), border-color var(--t-fast); }
.drive-item a:hover { background: var(--surface-2); border-color: var(--hairline); color: var(--text-hi); }
.drive-item .ic { width: 15px; height: 15px; flex-shrink: 0; color: var(--text-lo); }
.drive-item.is-folder .ic { color: var(--accent-bright); }
.drive-item__name { flex: 1; min-width: 0; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drive-item__tag { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent-bright); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r-pill); padding: 1px 7px; }
.client__auditdue { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-hud); font-size: var(--fs-2xs);
  letter-spacing: .03em; color: var(--text-dim); }
.client__auditdue svg { width: 12px; height: 12px; color: var(--accent-bright); }

/* ── mini Drive browser ── */
.drive-browser { display: flex; flex-direction: column; gap: var(--sp-3); }
.drive-crumb { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; min-height: 28px; }
.drive-crumb__btn { background: none; border: none; padding: 3px 7px; border-radius: var(--r-sm); font-family: var(--font-hud);
  font-size: var(--fs-xs); color: var(--text-lo); cursor: pointer; transition: color var(--t-fast), background var(--t-fast);
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-crumb__btn:hover { color: var(--text-hi); background: var(--surface-2); }
.drive-crumb__btn.is-current { color: var(--text-hi); font-weight: 600; cursor: default; }
.drive-crumb__sep { color: var(--text-lo); font-size: var(--fs-xs); padding: 0 1px; user-select: none; }
.drive-folders { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--sp-2); }
.drive-folder { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px;
  background: none; border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer; text-align: left;
  color: var(--text-mid); transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast); }
.drive-folder:hover { background: var(--surface-2); border-color: var(--hairline); color: var(--text-hi); }
.drive-folder .ic { width: 15px; height: 15px; flex-shrink: 0; color: var(--accent-bright); }
.drive-folder__name { flex: 1; font-size: var(--fs-sm); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-folder__count { font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-lo); flex-shrink: 0; }
.drive-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: var(--sp-2); }
.drive-cell { position: relative; aspect-ratio: 1; padding: 0; border: 0; overflow: hidden;
  border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; display: block; }
.drive-thumb { width: 100%; height: 100%; object-fit: cover; display: block;
  transition: opacity var(--t-fast), transform var(--t-fast); }
.drive-cell:hover .drive-thumb { opacity: .82; transform: scale(1.03); }
.drive-cell__play { position: absolute; inset: 0; margin: auto; width: 38px; height: 38px;
  display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,.55);
  color: #fff; pointer-events: none; }
.drive-cell__play .ic { width: 18px; height: 18px; margin-left: 2px; }
.drive-cell--extra { display: none; }                               /* hidden until "+N more" is clicked */
.drive-grid.is-expanded .drive-cell--extra { display: block; }
.drive-more { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-lo);
  text-align: center; padding: var(--sp-2); display: block; width: 100%;
  background: none; border: 1px dashed var(--accent-line); border-radius: var(--r-sm);
  cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast); }
.drive-more:hover { color: var(--accent-bright); border-color: var(--accent); }
.drive-empty { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-lo); padding: var(--sp-2) 0; }
.drive-loading { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--text-lo);
  padding: var(--sp-2) 0; display: flex; align-items: center; gap: 8px; }
.drive-loading::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--accent-line); border-top-color: var(--accent-bright); animation: spin .7s linear infinite; }

/* ── Instagram connection section ── */
.ig-connected { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--hairline); background: var(--surface-1); }
.ig-connected__info { display: flex; flex-direction: column; gap: 2px; }
.ig-handle { font-family: var(--font-hud); font-size: var(--fs-sm); font-weight: 600; color: var(--accent-bright); letter-spacing: .02em; }
.ig-followers { font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-lo); letter-spacing: .04em; text-transform: uppercase; }
.btn--xs { padding: 3px 10px; font-size: var(--fs-xs); }
.ig-connect-btn { width: 100%; justify-content: center; }

/* ── full-page drive view ── */
.drive-browser--page { padding: 0; }
.drive-browser--page .drive-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.drive-browser--page .drive-cell { aspect-ratio: 1; }
.drive-browser--page .drive-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px; }

/* ── media viewer (lightbox) ── */
.mv { position: fixed; inset: 0; z-index: 1000; display: none; background: rgba(8,6,4,.94);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.mv.is-open { display: grid; grid-template-rows: auto 1fr; }
.mv__bar { grid-row: 1; grid-column: 1 / -1; display: flex; align-items: center; gap: var(--sp-3);
  padding: 12px 16px; z-index: 2; }
.mv__name { flex: 1; min-width: 0; font-family: var(--font-hud); font-size: var(--fs-sm);
  color: var(--text-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv__open { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--accent-bright);
  display: inline-flex; align-items: center; gap: 4px; text-decoration: none; white-space: nowrap; }
.mv__open:hover { color: var(--text-hi); }
.mv__open .ic { width: 13px; height: 13px; }
.mv__btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--hairline); background: rgba(0,0,0,.35); color: var(--text-hi);
  cursor: pointer; font-family: var(--font-hud); font-size: var(--fs-xs);
  transition: background var(--t-fast), border-color var(--t-fast); }
.mv__btn:hover { background: rgba(255,122,26,.18); border-color: var(--accent); color: var(--accent-bright); }
.mv__btn .ic { width: 16px; height: 16px; }
.mv__stage { grid-row: 2; grid-column: 1 / -1; display: grid; place-items: center;
  overflow: hidden; padding: 0 16px 16px; min-height: 0; }
/* size against the viewport (minus the top bar) so portrait media + its controls always fit */
.mv__img, .mv__video { max-width: calc(100vw - 32px); max-height: calc(100vh - 84px); }
.mv__img { object-fit: contain; user-select: none;
  transform-origin: center center; transition: transform .12s ease; cursor: zoom-in; }
.mv__img.is-zoomed { cursor: grab; transition: none; }
.mv__video { background: #000; border-radius: var(--r-sm); }
.mv__nav { position: fixed; top: 50%; transform: translateY(-50%); z-index: 3;
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--hairline); background: rgba(0,0,0,.45); color: var(--text-hi); cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast); }
.mv__nav:hover { background: rgba(255,122,26,.2); border-color: var(--accent); color: var(--accent-bright); }
.mv__nav .ic { width: 22px; height: 22px; }
.mv__nav--prev { left: 16px; }
.mv__nav--next { right: 16px; }
.mv__nav[hidden] { display: none; }
.mv__zoom { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 6px; padding: 5px; border-radius: 999px;
  background: rgba(0,0,0,.55); border: 1px solid var(--hairline); }
.mv__zoom[hidden] { display: none; }
.mv.is-asking .mv__zoom { display: none; }                  /* prompt is up: give it the bottom */
/* "Send to agent" pill in the top bar */
.mv__send { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-family: var(--font-hud); font-size: var(--fs-xs); padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--accent-line); background: rgba(255,122,26,.1); color: var(--accent-bright);
  cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast); }
.mv__send:hover, .mv__send.is-active { background: rgba(255,122,26,.22); border-color: var(--accent); }
.mv__send .ic { width: 14px; height: 14px; }
/* the command prompt (chat-style bar at the bottom) */
.mv__ask { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 8px; width: min(640px, calc(100vw - 32px));
  padding: 6px 6px 6px 14px; border-radius: 999px; background: var(--surface-1);
  border: 1px solid var(--accent-line); box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.mv__ask[hidden] { display: none; }
.mv__ask-to { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--accent-bright); }
.mv__ask-to .ic { width: 14px; height: 14px; }
.mv__ask-input { flex: 1; min-width: 0; background: none; border: 0; outline: none;
  color: var(--text-hi); font-family: var(--font-body); font-size: var(--fs-sm); }
.mv__ask-input::placeholder { color: var(--text-lo); }
.mv__ask-send { flex-shrink: 0; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; border: 0; background: var(--accent); color: #1a0d00; cursor: pointer;
  transition: filter var(--t-fast); }
.mv__ask-send:hover { filter: brightness(1.1); }
.mv__ask-send .ic { width: 16px; height: 16px; }
.drive-browser--page .drive-folder { border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 12px 14px; }
.drive-browser--page .drive-crumb { margin-bottom: var(--sp-3); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--hairline); }

/* ── login gate (public VPS only) ── */
.auth-gate { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2); padding: var(--sp-6); text-align: center; background: var(--bg-1); }
.auth-orb { width: 92px; height: 92px; border-radius: 50%; margin-bottom: var(--sp-4);
  background: radial-gradient(circle at 40% 32%, #fbd0ff, #d946ef 50%, #5b1066 92%);
  box-shadow: 0 0 40px 8px rgba(217,70,239,.5), 0 0 90px 24px rgba(34,211,238,.2); animation: breathe-soft 4s ease-in-out infinite; }
.auth-eyebrow { font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: var(--tracking-hud); text-transform: uppercase; color: var(--accent-bright); margin: 0; }
.auth-title { font-family: var(--font-body); font-weight: 700; font-size: var(--fs-xl); color: var(--text-hi); margin: 0 0 var(--sp-5); }
.auth-form { display: flex; gap: var(--sp-2); width: min(340px, 100%); }
.auth-form input { flex: 1; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-lg); color: var(--text-hi); padding: 12px 14px; font: 15px var(--font-body); outline: none; }
.auth-form input:focus { border-color: var(--accent-line); box-shadow: var(--glow-accent); }
.auth-err { min-height: 1.2em; font-size: var(--fs-sm); color: var(--down); margin: var(--sp-2) 0 0; }

/* ── Skeleton loading states ── */
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-1) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-md);
}
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; background: var(--surface-2); } }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-3); padding: var(--sp-3) 0; }
.skeleton-card { height: 130px; }
.skeleton-row { height: 14px; margin-bottom: var(--sp-2); }
.skeleton-row--wide { width: 70%; }
.skeleton-row--mid  { width: 50%; }
.skeleton-row--short { width: 35%; }
.skeleton-list { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3) 0; }
.skeleton-block { height: 64px; }

/* ── Bridge offline banner ── */
.bridge-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  display: flex; align-items: center; gap: var(--sp-2); padding: 10px var(--sp-4);
  background: #2d1800; border-bottom: 1px solid rgba(255,122,26,.35);
  font-family: var(--font-body); font-size: var(--fs-sm); color: var(--accent-bright);
}
.bridge-banner[hidden] { display: none !important; }
.bridge-banner .ic { flex-shrink: 0; width: 16px; height: 16px; }
.bridge-banner span { flex: 1; }
.bridge-banner code { font-family: var(--font-hud); font-size: .8em; background: rgba(255,122,26,.12); padding: 1px 5px; border-radius: 3px; }
.bridge-banner__retry {
  flex-shrink: 0; background: var(--accent); color: #fff; border: none; border-radius: var(--r-md);
  padding: 4px 12px; font: 500 var(--fs-sm)/1 var(--font-body); cursor: pointer;
  transition: opacity .15s;
}
.bridge-banner__retry:hover { opacity: .85; }
.bridge-banner:not([hidden]) ~ .topbar,
.bridge-banner:not([hidden]) ~ .app-shell { padding-top: 44px; }

/* ── IG status badge on client cards ── */
.client__ig { display: flex; align-items: center; gap: 5px; margin-top: var(--sp-1); }
.client__ig .ic { width: 13px; height: 13px; color: var(--accent); flex-shrink: 0; }
.client__ig-handle { font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--accent-bright); letter-spacing: .02em; }
.client__ig-exp { font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--down); letter-spacing: .02em; margin-left: auto; }

/* ── IG token expiry warning ── */
.ig-expiry-warn { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--down);
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--r-md); padding: 6px 10px; margin-top: var(--sp-2); }
.ig-expiry-ok { font-family: var(--font-hud); font-size: var(--fs-xs); color: var(--up); }

/* ── Admin Instagram connections table ── */
.ig-admin-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); margin-top: var(--sp-2); }
.ig-admin-table th { text-align: left; padding: 8px 10px; font-family: var(--font-hud); font-size: var(--fs-2xs);
  letter-spacing: var(--tracking-hud); text-transform: uppercase; color: var(--text-lo);
  border-bottom: 1px solid var(--hairline); }
.ig-admin-table td { padding: 10px 10px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.ig-admin-table tr:last-child td { border-bottom: none; }
.ig-admin-name { display: block; font-weight: 600; color: var(--text-hi); }
.ig-admin-handle { font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-lo); letter-spacing: .02em; }

/* ── Global search modal (Cmd+K) ── */
.search-modal {
  position: fixed; inset: 0; z-index: 2000;
  width: min(620px, calc(100vw - 32px)); max-height: 80vh; margin: 80px auto auto;
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--r-xl); box-shadow: 0 24px 64px rgba(0,0,0,.7); padding: 0;
  overflow: hidden;
}
.search-modal::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.search-modal__inner { display: flex; flex-direction: column; max-height: inherit; }
.search-modal__bar {
  display: flex; align-items: center; gap: var(--sp-2); padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
}
.search-modal__bar .ic { flex-shrink: 0; width: 18px; height: 18px; color: var(--text-lo); }
.search-modal__bar input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-hi); font: 400 var(--fs-md)/1.5 var(--font-body);
}
.search-modal__bar input::placeholder { color: var(--text-lo); }
.search-esc {
  flex-shrink: 0; font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-lo);
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 4px;
  padding: 2px 6px; letter-spacing: .04em;
}
.search-results { overflow-y: auto; max-height: calc(80vh - 57px); padding: var(--sp-2) 0; }
.search-empty { padding: var(--sp-4) var(--sp-4); font-size: var(--fs-sm); color: var(--text-lo); margin: 0; }
.search-group { padding: var(--sp-1) 0; }
.search-group__label {
  font-family: var(--font-hud); font-size: var(--fs-2xs); letter-spacing: var(--tracking-hud);
  text-transform: uppercase; color: var(--text-lo); padding: 6px 16px 4px; margin: 0;
}
.search-hit {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 16px; background: none; border: none; cursor: pointer; text-align: left;
  color: var(--text-hi); transition: background .1s;
}
.search-hit:hover, .search-hit:focus { background: var(--surface-2); outline: none; }
.search-hit .ic { flex-shrink: 0; width: 16px; height: 16px; color: var(--accent); }
.search-hit__main { font-size: var(--fs-sm); font-weight: 500; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hit__sub { font-size: var(--fs-xs); color: var(--text-lo); white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════ */
.login-page {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-1); padding: var(--sp-4);
}
.login-page::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(255,122,26,.07) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  width: min(400px, 100%); background: var(--surface-1);
  border: 1px solid var(--hairline); border-radius: var(--r-xl);
  padding: var(--sp-8) var(--sp-6); position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
}
.login-brand {
  display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-6);
}
.login-logo { width: 28px; height: 28px; color: var(--accent); flex-shrink: 0; }
.login-wordmark {
  font-family: var(--font-hud); font-size: var(--fs-sm); font-weight: 700;
  letter-spacing: var(--tracking-hud); color: var(--text-hi); margin: 0;
}
.login-product {
  font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-lo);
  letter-spacing: .06em; text-transform: uppercase; margin: 0;
}
.login-title {
  font-size: var(--fs-xl); font-weight: 700; color: var(--text-hi);
  margin: 0 0 var(--sp-5);
}
.login-form .field { margin-bottom: var(--sp-3); }
.login-form .field label {
  display: block; font-size: var(--fs-sm); color: var(--text-lo);
  margin-bottom: 6px; font-weight: 500;
}
.login-form input[type="email"],
.login-form input[type="password"],
.login-form input[type="text"] {
  width: 100%; box-sizing: border-box;
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-md);
  color: var(--text-hi); padding: 11px 14px;
  font: 400 var(--fs-md)/1 var(--font-body); outline: none; transition: border-color .15s;
}
.login-form input:focus { border-color: var(--accent-line); box-shadow: var(--glow-accent); }
.field-pw { position: relative; }
.field-pw input { padding-right: 68px; }
.pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font: 500 var(--fs-xs)/1 var(--font-hud); color: var(--text-lo);
  letter-spacing: .04em; text-transform: uppercase; padding: 4px 6px;
}
.pw-toggle:hover { color: var(--accent); }
.btn--full { width: 100%; justify-content: center; margin-top: var(--sp-2); }
.login-err {
  font-size: var(--fs-sm); color: var(--down); min-height: 1.4em;
  margin: var(--sp-2) 0 0; text-align: center;
}
.login-footer {
  font-size: var(--fs-xs); color: var(--text-lo);
  text-align: center; margin: var(--sp-5) 0 0;
}

/* ═══════════════════════════════════════════════════════════
   USER MANAGEMENT TABLE
   ═══════════════════════════════════════════════════════════ */
.user-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--fs-sm); margin-top: var(--sp-2);
}
.user-table th {
  text-align: left; padding: 8px 10px;
  font-family: var(--font-hud); font-size: var(--fs-2xs);
  letter-spacing: var(--tracking-hud); text-transform: uppercase;
  color: var(--text-lo); border-bottom: 1px solid var(--hairline);
}
.user-table td {
  padding: 11px 10px; border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}
.user-table tr:last-child td { border-bottom: none; }
.user-table tr.is-inactive td { opacity: .4; }
.user__name { font-weight: 600; color: var(--text-hi); display: inline-flex; align-items: center; gap: 6px; }
.user__email { font-family: var(--font-hud); font-size: var(--fs-2xs); color: var(--text-lo); }
.user__you {
  font-family: var(--font-hud); font-size: var(--fs-2xs);
  color: var(--accent); letter-spacing: .04em; font-weight: 700;
}
.role-badge {
  font-family: var(--font-hud); font-size: var(--fs-2xs);
  letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--r-md); display: inline-block;
}
.role-badge--admin  { background: rgba(255,122,26,.15); color: var(--accent-bright); }
.role-badge--viewer { background: var(--surface-2); color: var(--text-lo); }
.user-actions { display: flex; gap: var(--sp-1); }
.btn--danger { color: var(--down); }
.btn--danger:hover { background: rgba(239,68,68,.1); }

/* user add/edit form inside drawer */
.user-form .field { margin-bottom: var(--sp-3); }
.user-form .field label {
  display: block; font-size: var(--fs-sm); font-weight: 500;
  color: var(--text-lo); margin-bottom: 6px;
}
.user-form input,
.user-form select {
  width: 100%; box-sizing: border-box;
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-md); color: var(--text-hi); padding: 10px 12px;
  font: 400 var(--fs-sm)/1 var(--font-body); outline: none;
  transition: border-color .15s;
}
.user-form input:focus,
.user-form select:focus { border-color: var(--accent-line); box-shadow: var(--glow-accent); }
.user-form__actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); }
.user-form__err { font-size: var(--fs-sm); color: var(--down); min-height: 1.2em; margin: var(--sp-2) 0 0; }
