/* ═══════════════════════════════════════════
   PSB DASHBOARD — design tokens + component CSS
   Stage 1 of the 4-tab redesign. Stage 2 tab modules use ONLY the
   classes below via components.js — no inline styles except --pct.

   Palette gate (dataviz skill): validate_palette.js
   "#3987e5,#199e70,#c98500,#008300,#9085e9,#e66767,#d55181,#d95926"
   --mode dark --surface "#14151F"  →  ALL CHECKS PASS (2026-07-11).
   Final categorical hexes = as listed (no snapping needed). CVD worst
   adjacent ΔE 10.3 sits in the legal floor band; mitigation = icons +
   labels always accompany color (Comp.badge auto-prefixes ✓ ⚠ ⏳ ⛔).
   ═══════════════════════════════════════════ */
:root {
  /* HSL System for Precision (seed kept from v1) */
  --h-indigo: 235;
  --h-violet: 265;
  --h-emerald: 160;
  --h-amber: 40;
  --h-rose: 350;

  /* Shared accent (used by .tx-* etc.) */
  --accent: hsl(var(--h-indigo), 70%, 55%);
  --bg-hover: hsla(var(--h-indigo), 20%, 14%, 0.8);

  /* Backgrounds */
  --bg-primary: hsl(var(--h-indigo), 30%, 4%);
  --bg-secondary: hsl(var(--h-indigo), 25%, 7%);
  --bg-card: hsla(var(--h-indigo), 20%, 10%, 0.6);
  --bg-card-hover: hsla(var(--h-indigo), 20%, 14%, 0.8);
  --bg-input: rgba(255, 255, 255, 0.03);
  --bg-glass: rgba(255, 255, 255, 0.04);

  /* Text */
  --text-primary: hsl(var(--h-indigo), 15%, 94%);
  --text-secondary: hsl(var(--h-indigo), 12%, 65%);
  --text-muted: hsl(var(--h-indigo), 10%, 45%);
  --text-accent: hsl(var(--h-violet), 80%, 85%);

  /* Priority Colors */
  --p0: hsl(var(--h-rose), 90%, 65%);
  --p0-bg: hsla(var(--h-rose), 90%, 65%, 0.1);
  --p0-border: hsla(var(--h-rose), 90%, 65%, 0.25);

  --p1: hsl(var(--h-amber), 90%, 60%);
  --p1-bg: hsla(var(--h-amber), 90%, 60%, 0.1);
  --p1-border: hsla(var(--h-amber), 90%, 60%, 0.25);

  --p2: hsl(210, 90%, 65%);
  --p2-bg: hsla(210, 90%, 65%, 0.1);
  --p2-border: hsla(210, 90%, 65%, 0.25);

  /* Client Colors */
  --work: hsl(var(--h-emerald), 70%, 55%);
  --work-bg: hsla(var(--h-emerald), 70%, 55%, 0.08);
  --work-border: hsla(var(--h-emerald), 70%, 55%, 0.2);

  --secondary: hsl(var(--h-violet), 70%, 75%);
  --secondary-bg: hsla(var(--h-violet), 70%, 75%, 0.08);
  --secondary-border: hsla(var(--h-violet), 70%, 75%, 0.2);

  /* Borders & Surfaces */
  --border: rgba(255, 255, 255, 0.07);
  --border-active: rgba(255, 255, 255, 0.14);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 80px hsla(var(--h-violet), 50%, 50%, 0.05);

  /* Sizing */
  --radius: 20px;
  --radius-sm: 12px;
  --radius-xs: 8px;

  /* ── Status palette (fixed, reserved — never themed, never color-alone) ── */
  --st-good: #0CA30C;
  --st-warn: #FAB219;
  --st-serious: #EC835A;
  --st-crit: #D03B3B;
  --st-good-bg: rgba(12, 163, 12, 0.12);
  --st-warn-bg: rgba(250, 178, 25, 0.12);
  --st-serious-bg: rgba(236, 131, 90, 0.12);
  --st-crit-bg: rgba(208, 59, 59, 0.12);

  /* ── Categorical palette (fixed order, never cycled) ──
     project map: 1 Marketplace · 2 B2C · 3 PIM · 4 Seller Portal ·
     5 Example Program · 6 Work ID · 7 Ecommerce · 8 Other */
  --cat-1: #3987E5;
  --cat-2: #199E70;
  --cat-3: #C98500;
  --cat-4: #008300;
  --cat-5: #9085E9;
  --cat-6: #E66767;
  --cat-7: #D55181;
  --cat-8: #D95926;

  --surface-opaque: #14151F;   /* chart/validator surface */

  /* ── RGB ambient tokens — chrome/decoration ONLY, never data encoding.
     Status + categorical palettes above stay reserved for data marks.
     First stop == last stop so the hue-rotate cycle loops seamlessly. ── */
  --rgb-grad: linear-gradient(90deg, #ff3b6b, #ff8a00, #ffe000, #3bff6f, #00e5ff, #6a8bff, #c86bff, #ff3b6b);
  --rgb-conic: conic-gradient(from 0deg, #ff3b6b, #ff8a00, #ffe000, #3bff6f, #00e5ff, #6a8bff, #c86bff, #ff3b6b);

  /* ── Spacing scale ── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* ── Type scale ── */
  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 26px;
  --fs-hero: 36px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, monospace;
}

/* ═══════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* aurora mesh v2 — lives on a fixed pseudo so it can drift without
   repainting the page. z-index:-1 paints above the canvas (body bg
   propagates to the canvas) but behind ALL content. Brightened per the owner
   ("RGB gaming rig meets command center") — visible color pools, text
   contrast untouched. Static under reduced motion. */
body::before {
  content: "";
  position: fixed;
  inset: -12%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 520px at 80% -10%, hsla(var(--h-violet), 75%, 52%, 0.17), transparent 62%),
    radial-gradient(900px 520px at 0% 0%, hsla(210, 85%, 48%, 0.15), transparent 58%),
    radial-gradient(760px 480px at 55% 112%, hsla(var(--h-emerald), 70%, 45%, 0.12), transparent 62%),
    radial-gradient(620px 440px at 22% 78%, hsla(var(--h-rose), 80%, 55%, 0.09), transparent 60%);
}

@media (prefers-reduced-motion: no-preference) {
  body::before {
    will-change: transform, filter;
    animation: aurora-drift 45s ease-in-out infinite alternate;
  }
  @keyframes aurora-drift {
    from { transform: translate3d(-1.5%, -1%, 0) rotate(-0.5deg); filter: hue-rotate(0deg); }
    to   { transform: translate3d(1.5%, 1.5%, 0) rotate(0.75deg); filter: hue-rotate(55deg); }
  }
}

a { color: var(--text-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.num, .tab-count { font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════
   APP SHELL — header + nav + tab panels
   ═══════════════════════════════════════════ */
.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-5) 80px;
}

.app-header {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-4);
}

/* ── SIGNATURE RGB ELEMENT: 2px spectrum hairline under the header,
   always on. ::after = the crisp line, ::before = its blurred glow halo.
   Static rainbow under reduced motion (gradient stays, cycle stops). ── */
.app-header::after,
.app-header::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  pointer-events: none;
  background: var(--rgb-grad);
  background-size: 200% 100%;
}
.app-header::before {
  height: 9px;
  bottom: -4px;
  filter: blur(8px);
  opacity: 0.6;
}

.app-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  /* brand glow — hue cycles under no-preference; static violet fallback */
  filter: drop-shadow(0 0 14px hsla(var(--h-violet), 90%, 65%, 0.55));
}

.app-date { color: var(--text-secondary); font-size: var(--fs-sm); }

.app-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.btn-refresh {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  background: var(--bg-glass);
  transition: border-color .15s, color .15s;
}
.btn-refresh:hover { border-color: var(--border-active); color: var(--text-primary); }
.btn-refresh.is-busy { opacity: .5; pointer-events: none; }

/* ── Tab nav ── */
.tab-nav {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab-btn {
  position: relative;
  padding: var(--sp-2) var(--sp-4) 10px;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.is-active {
  color: var(--text-primary);
  border-bottom-color: transparent;   /* the RGB ::after IS the underline */
  /* subtle glow underline — static (not motion), so it survives reduced-motion */
  box-shadow: 0 16px 22px -16px hsla(var(--h-violet), 80%, 70%, 0.55);
  text-shadow: 0 0 20px hsla(var(--h-violet), 80%, 75%, 0.35);
}
/* active tab: animated RGB gradient underline (static rainbow fallback).
   background-size 100% = the FULL spectrum loop across the tab width */
.tab-btn.is-active::after {
  content: "";
  position: absolute;
  left: var(--sp-2);
  right: var(--sp-2);
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  pointer-events: none;
  background: var(--rgb-grad);
  background-size: 100% 100%;
}

.tab-btn .tab-dot {
  position: absolute;
  top: 6px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--st-crit);
  box-shadow: 0 0 6px var(--st-crit);
  display: none;
}
.tab-btn.has-alert .tab-dot { display: block; }

.tab-panel { display: none; animation: fadeIn .18s ease; }
.tab-panel.is-active { display: block; }

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

/* ── Layout grids ── */
.hero-row {
  /* auto-fit: Today has 5 tiles, System has 4 — both fill the full width */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
  margin-bottom: var(--sp-4);
}

.stack { display: flex; flex-direction: column; gap: var(--sp-4); }

.grid-cards {
  display: grid;
  /* ≥300px so initiative/team names breathe (truncation policy) */
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-3);
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-3);
}

/* ═══════════════════════════════════════════
   STAT TILE — the glanceable hero number
   ═══════════════════════════════════════════ */
.stat-tile {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-4);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, background .15s, transform .1s;
}
a.stat-tile:hover {
  text-decoration: none;
  border-color: var(--border-active);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}

.stat-value {
  font-size: var(--fs-hero);
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.stat-sub {
  margin-top: var(--sp-1);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 17px;
}

.stat--good     { }
.stat--good .stat-value { color: var(--text-secondary); }
.stat--good .stat-sub   { color: var(--st-good); }
.stat--warn .stat-value    { color: var(--st-warn); }
.stat--warn .stat-sub      { color: var(--st-warn); }
.stat--serious .stat-value { color: var(--st-serious); }
.stat--serious .stat-sub   { color: var(--st-serious); }
.stat--serious { border-color: rgba(236, 131, 90, 0.3); background: linear-gradient(180deg, var(--st-serious-bg), var(--bg-card) 70%); }
.stat--critical .stat-value { color: var(--st-crit); }
.stat--critical .stat-sub   { color: var(--st-crit); }
.stat--critical { border-color: rgba(208, 59, 59, 0.35); background: linear-gradient(180deg, var(--st-crit-bg), var(--bg-card) 70%); }

/* ═══════════════════════════════════════════
   CARD — collapsible domain card (<details class="card">)
   ═══════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  --wash: transparent;
}

.card > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-4);
  background: linear-gradient(180deg, var(--wash), transparent);
  user-select: none;
}
.card > summary::-webkit-details-marker { display: none; }
.card > summary:hover { background: linear-gradient(180deg, var(--wash), var(--bg-glass)); }

.card-icon { font-size: var(--fs-md); line-height: 1; }

/* TRUNCATION POLICY: titles/names wrap up to 2 lines, NEVER single-line
   ellipsis — the owner must be able to read "ExampleCo …" / "Catal…" in full.
   The title column shrinks (min-width:0) instead of pushing badges out. */
.card-title {
  font-size: var(--fs-md);
  font-weight: 650;
  letter-spacing: -0.01em;
  min-width: 0;
  flex: 0 1 auto;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.card-count {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card-spacer { flex: 1; }

/* EXPAND AFFORDANCE (v4): the chevron is a visible circled button-like
   chip — the owner couldn't tell cards were clickable when it was a bare
   faint glyph. ▸ rotates to ▾ (90°) when open, brightens on hover. */
.card-chevron {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1;
  transition: transform .18s ease, color .15s, border-color .15s, background .15s;
}
.card > summary:hover .card-chevron {
  color: var(--text-primary);
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}
.card[open] > summary .card-chevron { transform: rotate(90deg); }

.card-body { padding: 0 var(--sp-4) var(--sp-4); }

/* soft hue wash per domain (0.07 alpha of the categorical hue) */
.card[data-key="tracker"] > summary,
.card[data-key="top-tickets"] > summary,
.card[data-key="freshness"] > summary,
.card[data-key="activity"] > summary        { --wash: rgba(57, 135, 229, 0.07); }
.card[data-key="meetings"] > summary,
.card[data-key="meetings-today"] > summary,
.card[data-key="moms"] > summary,
.card[data-key="routines"] > summary,
.card[data-key="health"] > summary          { --wash: rgba(25, 158, 112, 0.07); }
.card[data-key="commitments"] > summary,
.card[data-key="cost"] > summary            { --wash: rgba(201, 133, 0, 0.07); }
.card[data-key="portfolio"] > summary       { --wash: rgba(0, 131, 0, 0.07); }
.card[data-key="decisions"] > summary,
.card[data-key="harness"] > summary         { --wash: rgba(144, 133, 233, 0.07); }
.card[data-key="people"] > summary          { --wash: rgba(213, 81, 129, 0.07); }
.card[data-key="bots"] > summary            { --wash: rgba(217, 89, 38, 0.07); }

/* ═══════════════════════════════════════════
   LIST ROW — one item inside a card
   ═══════════════════════════════════════════ */
.rows { display: flex; flex-direction: column; }

.row, details.row > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2);
  border-radius: var(--radius-xs);
  min-height: 36px;
}
.row + .row, .rows > * + * { border-top: 1px solid rgba(255,255,255,0.04); }

details.row { display: block; padding: 0; }
details.row > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
details.row > summary::-webkit-details-marker { display: none; }
details.row > summary:hover, div.row:hover { background: var(--bg-glass); }
details.row[open] > summary { background: var(--bg-glass); }

/* EXPAND AFFORDANCE (v4): expandable rows get the same circled chevron
   as cards — previously they had NO visual tell at all. Pure CSS, so
   every listRow/taskRow with expandBody grows it automatically; plain
   div.row never does (chevron === "click to expand", unmistakable). */
details.row > summary::after {
  content: "▸";
  flex: none;
  margin-left: var(--sp-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1;
  transition: transform .18s ease, color .15s, border-color .15s, background .15s;
}
/* rows without a .row-right: the chevron itself hugs the right edge */
details.row > summary:not(:has(.row-right))::after { margin-left: auto; }
details.row > summary:hover::after {
  color: var(--text-primary);
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}
details.row[open] > summary::after { transform: rotate(90deg); }

/* anything that opens the Drawer is clickable — always show it */
[data-drawer-path] { cursor: pointer; }

.row-icon { flex: none; font-size: var(--fs-sm); width: 20px; text-align: center; }

.row-title {
  font-size: var(--fs-base);
  color: var(--text-primary);
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.row-badges { display: inline-flex; gap: var(--sp-1); flex: none; flex-wrap: wrap; }

.row-meta {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  /* shrinkable (v4): a badge-heavy row used to crush the title to 0px and
     push the expand chevron outside the card — meta gives way first */
  flex: 0 1 auto;
  min-width: 36px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 32%;
}

.row-right { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: var(--sp-2); }

.row-expand {
  padding: var(--sp-2) var(--sp-3) var(--sp-3) 34px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  border-top: 1px solid rgba(255,255,255,0.04);
}
.row-expand p + p { margin-top: var(--sp-2); }

.row.is-dim, .row .is-dim { opacity: 0.55; }

.row-note { color: var(--text-secondary); white-space: pre-wrap; }

/* muted xs context line that WRAPS (never truncates) — belongs to the row
   directly above it inside .rows (no divider between them), or sits inside
   a .row-expand as a supplementary note */
.row-subtext {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.rows > .row-subtext {
  border-top: 0;                          /* .rows > * + * divider stays off */
  padding: 0 var(--sp-2) var(--sp-2) 34px; /* aligns under the row title */
  margin-top: -2px;
}
.row-expand .row-subtext { margin-top: var(--sp-2); }

.comment-list { margin-top: var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-1); }
.comment-item { font-size: var(--fs-xs); color: var(--text-muted); }
.comment-item b { color: var(--text-secondary); font-weight: 600; }

/* ═══════════════════════════════════════════
   BADGE — status (icon + label, never color alone),
   priority, categorical, muted
   ═══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge--good     { color: var(--st-good);    background: var(--st-good-bg);    border-color: rgba(12,163,12,0.25); }
.badge--warn     { color: var(--st-warn);    background: var(--st-warn-bg);    border-color: rgba(250,178,25,0.25); }
.badge--serious  { color: var(--st-serious); background: var(--st-serious-bg); border-color: rgba(236,131,90,0.25); }
.badge--critical { color: var(--st-crit);    background: var(--st-crit-bg);    border-color: rgba(208,59,59,0.3); }

.badge--p0 { color: var(--p0); background: var(--p0-bg); border-color: var(--p0-border); }
.badge--p1 { color: var(--p1); background: var(--p1-bg); border-color: var(--p1-border); }
.badge--p2 { color: var(--p2); background: var(--p2-bg); border-color: var(--p2-border); }

.badge--muted { color: var(--text-muted); background: var(--bg-glass); border-color: var(--border); }

/* categorical badges: neutral text + colored identity dot (text never wears data color) */
.badge--cat { color: var(--text-secondary); background: var(--bg-glass); border-color: var(--border); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.badge--cat-1 .badge-dot { background: var(--cat-1); }
.badge--cat-2 .badge-dot { background: var(--cat-2); }
.badge--cat-3 .badge-dot { background: var(--cat-3); }
.badge--cat-4 .badge-dot { background: var(--cat-4); }
.badge--cat-5 .badge-dot { background: var(--cat-5); }
.badge--cat-6 .badge-dot { background: var(--cat-6); }
.badge--cat-7 .badge-dot { background: var(--cat-7); }
.badge--cat-8 .badge-dot { background: var(--cat-8); }

/* ═══════════════════════════════════════════
   PROGRESS — bar + conic ring (fill % via --pct custom prop,
   the ONLY allowed inline style form)
   ═══════════════════════════════════════════ */
.progress { display: inline-flex; align-items: center; gap: var(--sp-2); }

.progress-label { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }

.progress-bar {
  --pct: 0;
  width: 120px;
  max-width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(57, 135, 229, 0.18);   /* lighter step of the same ramp */
  overflow: hidden;
  position: relative;
}
.progress-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  width: calc(var(--pct) * 1%);
  border-radius: 999px;
  background: var(--cat-1);
  transition: width .3s ease;
}

.progress-ring {
  --pct: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: conic-gradient(var(--cat-1) calc(var(--pct) * 1%), rgba(57, 135, 229, 0.15) 0);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
  mask: radial-gradient(closest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
  flex: none;
}

/* ═══════════════════════════════════════════
   PERSON CHIP
   ═══════════════════════════════════════════ */
.person-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: left;
  width: 100%;
}
.person-chip:hover { border-color: var(--border-active); background: var(--bg-card-hover); }

.person-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
  background: hsla(var(--h-violet), 50%, 55%, 0.25);
}

.person-name { font-size: var(--fs-base); font-weight: 600; line-height: 1.25; }
.person-role {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.person-main { min-width: 0; flex: 1; }
.person-counts {
  flex: none;
  display: inline-flex;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.person-counts span { display: inline-flex; align-items: center; gap: 3px; }

/* ═══════════════════════════════════════════
   EMPTY STATE — calm, single line
   ═══════════════════════════════════════════ */
.empty-state {
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
  color: var(--text-muted);
}
.empty-icon { font-size: 22px; margin-bottom: var(--sp-2); opacity: 0.7; }
.empty-title { font-size: var(--fs-base); color: var(--text-secondary); font-weight: 550; }
.empty-hint { font-size: var(--fs-xs); margin-top: var(--sp-1); }

/* ═══════════════════════════════════════════
   STALENESS — badge + dim, content never hidden
   ═══════════════════════════════════════════ */
.is-dim { opacity: 0.55; }

.stale-wrap { position: relative; }
.stale-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: var(--sp-2);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--st-warn);
  background: var(--st-warn-bg);
  border: 1px solid rgba(250,178,25,0.25);
}
.stale-note--dead {
  color: var(--st-serious);
  background: var(--st-serious-bg);
  border-color: rgba(236,131,90,0.25);
}

/* ═══════════════════════════════════════════
   SPARKLINE — recessive inline SVG
   ═══════════════════════════════════════════ */
.spark { display: inline-block; vertical-align: middle; }
.spark polyline {
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ═══════════════════════════════════════════
   ESCALATION STRIP (Today) — absent when empty
   ═══════════════════════════════════════════ */
.escalation-strip {
  border: 1px solid rgba(236, 131, 90, 0.3);
  background: linear-gradient(180deg, var(--st-serious-bg), var(--bg-card));
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
}
.escalation-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--st-serious);
  margin-bottom: var(--sp-2);
}

/* Meetings health strip reuses the strip layout but must stay neutral —
   an alarm-colored frame around healthy status chips would lie */
.escalation-strip[data-key="meetings-health"] {
  border-color: var(--border);
  background: var(--bg-card);
}
.escalation-strip[data-key="meetings-health"] .escalation-title { color: var(--text-muted); }
.escalation-strip[data-key="meetings-health"] .chips { margin-bottom: 0; }

/* ═══════════════════════════════════════════
   ACTION BAR — inline ticket edit (status/priority/comment/save)
   ═══════════════════════════════════════════ */
.action-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid rgba(255,255,255,0.05);
}

.action-bar select, .action-bar input[type="text"] {
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 5px 8px;
  outline: none;
}
.action-bar select:focus, .action-bar input:focus { border-color: var(--border-active); }
.action-bar select option { background: var(--surface-opaque); color: var(--text-primary); }
.action-bar input[type="text"] { flex: 1; min-width: 140px; }

.action-save {
  padding: 5px 14px;
  border-radius: var(--radius-xs);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--bg-primary);
  background: var(--text-accent);
  transition: opacity .15s;
}
.action-save:hover { opacity: 0.85; }
.action-save:disabled { opacity: 0.4; cursor: default; }

/* ═══════════════════════════════════════════
   FILTER CHIPS (Work tab)
   ═══════════════════════════════════════════ */
.chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }

.chip {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  font-weight: 600;
  transition: all .15s;
}
.chip:hover { border-color: var(--border-active); color: var(--text-primary); }
.chip.is-active {
  color: var(--bg-primary);
  background: var(--text-accent);
  border-color: var(--text-accent);
}

/* ═══════════════════════════════════════════
   DRAWER — right-side file viewer
   ═══════════════════════════════════════════ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(680px, 92vw);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-active);
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
  z-index: 41;
  transform: translateX(102%);
  transition: transform .22s ease;
  display: flex;
  flex-direction: column;
}

.drawer-root.is-open .drawer-overlay { opacity: 1; pointer-events: auto; }
.drawer-root.is-open .drawer { transform: none; }

/* centered full modal variant (Agent detail): near-fullscreen popup in the
   middle of the screen instead of the right-side slide-over. Unlike the base
   drawer (which hides via translateX(102%)), this variant can't slide off
   screen horizontally - it must fade out: opacity 0 + pointer-events none
   when closed, or the box lingers centered and blocks clicks underneath. */
.drawer.drawer--full {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -47%) scale(.98);
  width: min(1180px, 96vw);
  max-height: 92vh;
  border-radius: 14px;
  border: 1px solid var(--border-active);
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s ease, opacity .18s ease;
}
.drawer-root.is-open .drawer.drawer--full {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.drawer-title {
  font-size: var(--fs-md);
  font-weight: 650;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.drawer-close {
  margin-left: auto;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: var(--fs-md);
  line-height: 1;
  background: var(--bg-glass);
}
.drawer-close:hover { color: var(--text-primary); background: var(--bg-card-hover); }

.drawer-body { padding: var(--sp-5); overflow-y: auto; flex: 1; }
/* drawer adalah SURFACE BACA (AI result, prep card, PRD) — naikkan tipografi
   di atas ukuran list-row biar nyaman dibaca (the owner: "font kekecilan") */
.drawer-body .md { font-size: 15.5px; line-height: 1.75; }
.drawer-body .md h1 { font-size: 22px; }
.drawer-body .md h2 { font-size: 18px; }
.drawer-body .md h3 { font-size: 16px; }
.drawer-body .md code { font-size: 0.9em; }
.drawer-body .md li { margin-bottom: 8px; }

/* ── escalation draft (drawer body): editable plain-prose textarea ── */
.draft-area {
  width: 100%;
  font: inherit;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: var(--sp-3);
  resize: vertical;
  outline: none;
}
.draft-area:focus { border-color: var(--border-active); }

/* ── rendered markdown (drawer + expanded notes) ── */
.md { font-size: var(--fs-base); color: var(--text-secondary); line-height: 1.65; }
.md h1, .md h2, .md h3 { color: var(--text-primary); margin: var(--sp-4) 0 var(--sp-2); line-height: 1.3; }
.md h1 { font-size: var(--fs-lg); }
.md h2 { font-size: var(--fs-md); }
.md h3 { font-size: var(--fs-base); }
.md h1:first-child, .md h2:first-child, .md h3:first-child { margin-top: 0; }
.md p { margin: 0 0 var(--sp-2); }
.md ul, .md ol { margin: 0 0 var(--sp-2); padding-left: 22px; }
.md li { margin-bottom: 6px; }
.md ol > li { padding-left: 4px; margin-bottom: 10px; }
.md ol > li::marker { color: var(--text-primary); font-weight: 700; }
.md strong { color: var(--text-primary); }
/* briefing lead-in ("> Selasa, morning update di-run …") + any quoted block:
   left-railed callout instead of merging into the body wall */
.md blockquote {
  margin: 0 0 var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-left: 3px solid var(--border-active);
  border-radius: 0 8px 8px 0;
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}
.md blockquote p { margin: 0 0 4px; }
.md blockquote p:last-child { margin-bottom: 0; }
.md hr { border: none; border-top: 1px solid var(--border); margin: var(--sp-4) 0; }
/* section headers inside a long briefing get breathing room + a hairline */
.md h3 { padding-top: var(--sp-2); border-top: 1px solid var(--border); }
.md h3:first-child { padding-top: 0; border-top: none; }
/* relative-path doc links inside rendered markdown (BRD/PRD/notes) open in the
   Drawer, not a new tab — no href, so give them the link affordance manually */
.md a.doc-link { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.md a.doc-link::after { content: " ↗"; font-size: 0.85em; opacity: 0.7; }

.md code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ═══════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════ */
.toast-root {
  position: fixed;
  bottom: var(--sp-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: center;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  background: var(--surface-opaque);
  border: 1px solid var(--border-active);
  box-shadow: var(--shadow-card);
  animation: toastIn .18s ease;
}
.toast--ok  { border-color: rgba(12,163,12,0.4); }
.toast--err { border-color: rgba(208,59,59,0.5); }
.toast.is-leaving { opacity: 0; transition: opacity .25s; }
/* toasts carrying an Undo/action button stay clickable + linger longer */
.toast.has-action { pointer-events: auto; }
.toast-action {
  margin-left: 6px;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-active);
  background: transparent;
  color: var(--text-primary);
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
}
.toast-action:hover { background: var(--bg-glass); }

/* ── 📥 Inbox: riwayat percakapan di drawer (satu bubble per pesan) ── */
.ibx-thread { display: flex; flex-direction: column; gap: 8px; }
.ibx-msg {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  font-size: 14.5px;
  line-height: 1.6;
}
.ibx-msg-head { display: block; margin-bottom: 2px; color: var(--text-primary); }
.ibx-msg-ts { font-size: var(--fs-sm); color: var(--text-secondary); margin-left: 6px; }
.ibx-msg-text { color: var(--text-secondary); word-break: break-word; }
.ibx-msg-text.md { font-size: 14.5px; line-height: 1.6; }
.ibx-msg-text.md p { margin: 0 0 6px; }
.ibx-msg-text.md p:last-child { margin-bottom: 0; }
.ibx-msg-text.md ol, .ibx-msg-text.md ul { margin: 4px 0 6px; }
.ibx-msg-text.md h3 { border-top: none; padding-top: 0; }

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

/* ═══════════════════════════════════════════
   SKELETON — calendar / slow-endpoint loading
   ═══════════════════════════════════════════ */
.skeleton { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-2) 0; }
.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-80 { width: 80%; }

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── inline error (one endpoint failed; siblings keep rendering) ── */
.load-error {
  padding: var(--sp-3);
  border-radius: var(--radius-xs);
  font-size: var(--fs-sm);
  color: var(--st-serious);
  background: var(--st-serious-bg);
  border: 1px solid rgba(236,131,90,0.25);
}

/* ═══════════════════════════════════════════
   MISC — meeting rows, activity, section label
   ═══════════════════════════════════════════ */
.section-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: var(--sp-4) 0 var(--sp-2);
}

.time-pill {
  flex: none;
  font-size: var(--fs-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 3px 8px;
  min-width: 52px;
  text-align: center;
}

.prep-link {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-accent);
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-glass);
  cursor: pointer;
  white-space: nowrap;
}
.prep-link:hover { border-color: var(--border-active); }

/* ═══════════════════════════════════════════
   V2 COMPONENTS — breadcrumb, jira chip, task hierarchy,
   chase button, ring stat, duo bars, action items, log panel
   ═══════════════════════════════════════════ */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}
.breadcrumb .crumb { color: var(--text-secondary); }
.breadcrumb a.crumb:hover { color: var(--text-accent); text-decoration: none; }
.breadcrumb .crumb-current { color: var(--text-primary); font-weight: 600; }
.breadcrumb .crumb-sep { opacity: 0.55; user-select: none; }

/* jira chip — deliberately NOT a badge: mono font, squared corners */
.jira-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 7px;
  white-space: nowrap;
}
a.jira-chip:hover { border-color: var(--border-active); color: var(--text-accent); text-decoration: none; }

/* task hierarchy — depth-1 subtasks sit in a muted left rail, lighter type */
.task-children {
  margin-left: 26px;
  padding-left: var(--sp-2);
  border-left: 2px solid rgba(255, 255, 255, 0.07);
}
.task-row--sub { min-height: 30px; }
.task-row--sub .row-title { font-size: var(--fs-sm); color: var(--text-secondary); }

/* chase button — files an item into the waiting-on watchdog */
.chase-btn {
  flex: none;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--st-warn);
  background: var(--st-warn-bg);
  border: 1px solid rgba(250, 178, 25, 0.3);
  white-space: nowrap;
  transition: border-color .15s;
}
.chase-btn:hover { border-color: rgba(250, 178, 25, 0.55); }
.chase-btn:disabled { opacity: 0.55; cursor: default; }

/* ring stat — big conic ring, % in the middle (savings/completion) */
.ring-stat {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  text-align: center;
}
.ring-stat-ring {
  --pct: 0;
  position: relative;
  width: 104px;
  height: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ring-stat-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--cat-2) calc(var(--pct) * 1%), rgba(25, 158, 112, 0.14) 0);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 11px), #000 calc(100% - 10px));
  mask: radial-gradient(closest-side, transparent calc(100% - 11px), #000 calc(100% - 10px));
}
.ring-stat-pct {
  font-size: var(--fs-xl);
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.ring-stat-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ring-stat-sub { font-size: var(--fs-xs); color: var(--text-muted); }

/* duo bars — paired daily bars, categorical colors (a=spent, b=saved) */
.duo-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 64px;
  padding: var(--sp-1) 0;
}
.duo-day {
  flex: 1 1 0;
  min-width: 6px;
  max-width: 26px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
}
.duo-bar {
  --pct: 0;
  width: 5px;
  min-height: 2px;
  height: calc(var(--pct) * 1%);
  border-radius: 2px 2px 0 0;
}
.duo-bar--a { background: var(--cat-1); }
.duo-bar--b { background: var(--cat-2); }

/* action item row — "→ Jadiin ticket" */
.make-ticket-btn {
  flex: none;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-accent);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  transition: border-color .15s;
}
.make-ticket-btn:hover { border-color: var(--border-active); }
.make-ticket-btn:disabled { opacity: 0.55; cursor: default; }

/* log panel — monospace tail + heartbeat header */
.log-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.log-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.log-job { font-family: var(--font-mono); font-weight: 600; color: var(--text-secondary); }
.log-hb { margin-left: auto; font-variant-numeric: tabular-nums; }
.log-tail {
  margin: 0;
  padding: var(--sp-3);
  max-height: 260px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.55;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ═══════════════════════════════════════════
   V3 COMPONENTS — link chips, donut, distribution bar, mini bars,
   back button, shared chart-legend chips, wide drawer
   ═══════════════════════════════════════════ */

/* ── link chips (Comp.linkChips) — labeled source refs on rows/cards ── */
.link-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  align-items: center;
}
.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
a.link-chip:hover, button.link-chip:hover {
  border-color: var(--border-active);
  color: var(--text-accent);
  text-decoration: none;
}
.link-chip-ic { font-size: var(--fs-xs); line-height: 1; }
.link-chip--more { cursor: default; color: var(--text-muted); }

/* ── shared chart-kind color utility (data marks + legend dots).
   cat-* = categorical identity, p* = priority. NO status colors as
   series (dataviz rule) — there are deliberately no .k-good/.k-crit. ── */
.k-cat-1 { background: var(--cat-1); }
.k-cat-2 { background: var(--cat-2); }
.k-cat-3 { background: var(--cat-3); }
.k-cat-4 { background: var(--cat-4); }
.k-cat-5 { background: var(--cat-5); }
.k-cat-6 { background: var(--cat-6); }
.k-cat-7 { background: var(--cat-7); }
.k-cat-8 { background: var(--cat-8); }
.k-p0 { background: var(--p0); }
.k-p1 { background: var(--p1); }
.k-p2 { background: var(--p2); }

/* ── chart legend (donut + distBar) — text in text tokens, color only
   on the swatch, count muted ── */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  margin-top: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.legend-item { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.legend-dot { flex: none; width: 8px; height: 8px; border-radius: 2px; }
.legend-n { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── donut (Comp.donut) — thin 10px ring, 2px surface gaps, center total ── */
.donut-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
}
.donut-total {
  fill: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.donut-sublabel { fill: var(--text-muted); }

/* ── distribution bar (Comp.distBar) — one 100%-stacked thin row ── */
.dist-wrap { display: block; }
.dist-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}
.dist-bar {
  display: flex;
  gap: 2px;                    /* the dataviz surface gap */
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
}
.dist-seg {
  --pct: 0;
  flex: var(--pct) 1 0px;
  min-width: 3px;              /* tiny slices stay visible + hoverable */
}

/* ── mini bars (Comp.miniBars) — recessive tiny vertical series ── */
.mini-bars { display: inline-block; vertical-align: middle; }

/* ── back button (Comp.backButton) — drill-view escape hatch ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}
a.back-btn:hover, button.back-btn:hover {
  border-color: var(--border-active);
  color: var(--text-primary);
  text-decoration: none;
}

/* ── wide drawer variant (Drawer.openWide) — initiative slide-over ── */
.drawer.drawer--wide { width: min(max(680px, 72vw), 96vw); }

/* ═══════════════════════════════════════════
   V4 COMPONENTS (E2 visual foundation) — AI run button/pills,
   ticket chip, Harness Map v2, trend (momentum) card, momentum band,
   labeled spark. All animation lives in this section's own
   no-preference guard at the bottom.
   ═══════════════════════════════════════════ */

/* ── 🤖 AI button (Comp.aiButton) — violet accent, distinct from
   chase (amber) and make-ticket (neutral) ── */
.ai-btn {
  flex: none;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-accent);
  background: hsla(var(--h-violet), 60%, 60%, 0.10);
  border: 1px solid hsla(var(--h-violet), 70%, 70%, 0.35);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  transition: border-color .15s, box-shadow .15s;
}
.ai-btn:hover {
  border-color: hsla(var(--h-violet), 80%, 75%, 0.6);
  box-shadow: 0 0 12px -2px hsla(var(--h-violet), 80%, 65%, 0.4);
}
.ai-btn:disabled { opacity: 0.55; cursor: default; box-shadow: none; }

/* ── AI status pills (running = inert span, done/err = buttons) ── */
.ai-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-secondary);
  transition: border-color .15s;
}
.ai-pill--running {
  color: var(--st-warn);
  background: var(--st-warn-bg);
  border-color: rgba(250, 178, 25, 0.3);
  cursor: default;
}
.ai-pill--done {
  color: var(--st-good);
  background: var(--st-good-bg);
  border-color: rgba(12, 163, 12, 0.3);
  cursor: pointer;
}
.ai-pill--done:hover { border-color: rgba(12, 163, 12, 0.55); }
.ai-pill--err {
  color: var(--st-serious);
  background: var(--st-serious-bg);
  border-color: rgba(236, 131, 90, 0.3);
  cursor: pointer;
}
.ai-pill--err:hover { border-color: rgba(236, 131, 90, 0.55); }

/* ── 🎫 ticket chip (Comp.ticketChip) — internal twin of .jira-chip ── */
.ticket-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 7px;
  white-space: nowrap;
}
a.ticket-chip:hover { border-color: var(--border-active); color: var(--text-accent); text-decoration: none; }

/* ── 🗺 Harness Map v2 (Comp.harnessMap) — node-card columns joined by
   animated RGB bezier lanes. Dark + glowy: this is the centerpiece. ── */
.hmap {
  display: flex;
  align-items: stretch;
  gap: var(--sp-2);
}
.hmap-col {
  --hcol: var(--cat-5);
  flex: 1 1 0;
  min-width: 0;
}
.hmap-col--1 { --hcol: var(--cat-1); }   /* Indra   — blue    */
.hmap-col--2 { --hcol: var(--cat-2); }   /* Refleks — emerald */
.hmap-col--3 { --hcol: var(--cat-5); }   /* Otak    — violet  */
.hmap-col--4 { --hcol: var(--cat-3); }   /* Memori  — amber   */
.hmap-col--5 { --hcol: var(--cat-7); }   /* Tangan  — rose    */

.hmap-col-head {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--hcol);
  text-shadow: 0 0 14px color-mix(in srgb, var(--hcol) 60%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--hcol) 30%, transparent);
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-2);
  overflow-wrap: anywhere;
}

.hmap-nodes {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.hmap-node {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s, box-shadow .15s;
}
.hmap-node:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.hmap-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 4px;
  background: var(--text-muted);
}
.hmap-node-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.hmap-node-top { display: flex; align-items: baseline; gap: 6px; }
.hmap-node-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  overflow-wrap: anywhere;
}
.hmap-node-st {
  margin-left: auto;
  flex: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hmap-node-desc {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* status glow — dot + status word carry the state (never color alone:
   the word ok/warn/fail/idle/🔒 gated always renders next to it) */
.hmap-node--ok .hmap-dot { background: var(--st-good); box-shadow: 0 0 8px var(--st-good); }
.hmap-node--ok .hmap-node-st { color: var(--st-good); }
.hmap-node--warn { border-color: rgba(250, 178, 25, 0.35); }
.hmap-node--warn .hmap-dot { background: var(--st-warn); box-shadow: 0 0 8px var(--st-warn); }
.hmap-node--warn .hmap-node-st { color: var(--st-warn); }
.hmap-node--fail {
  border-color: rgba(208, 59, 59, 0.45);
  background: linear-gradient(180deg, var(--st-crit-bg), var(--bg-card) 70%);
  box-shadow: 0 0 18px -6px rgba(208, 59, 59, 0.55);
}
.hmap-node--fail .hmap-dot { background: var(--st-crit); box-shadow: 0 0 10px var(--st-crit); }
.hmap-node--fail .hmap-node-st { color: var(--st-crit); }
.hmap-node--idle { opacity: 0.75; }
.hmap-node--gated { border-color: rgba(144, 133, 233, 0.35); }
.hmap-node--gated .hmap-dot { background: var(--cat-5); box-shadow: 0 0 8px rgba(144, 133, 233, 0.7); }
.hmap-node--gated .hmap-node-st { color: var(--cat-5); }

/* connector lanes — RGB gradient beziers with a soft glow underlay;
   dash flow (animated below) shows the direction of data */
.hmap-lane {
  flex: 0 0 38px;
  align-self: stretch;
  display: flex;
}
.hmap-lane svg { width: 100%; height: 100%; min-height: 160px; display: block; }
.hmap-flow-glow { fill: none; stroke-width: 5; opacity: 0.16; }
.hmap-flow {
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-dasharray: 4 7;     /* pathLength=100 units — uniform along the curve */
  opacity: 0.9;
}
.hmap-g1 { stop-color: #00e5ff; }
.hmap-g2 { stop-color: #6a8bff; }
.hmap-g3 { stop-color: #c86bff; }

/* ── 📈 trend card (Comp.trendCard) — the "bikin seneng" momentum card.
   --tc (categorical color) arrives inline from the builder. ── */
.trend-card {
  --tc: var(--cat-1);
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  overflow: hidden;
  transition: border-color .15s, transform .12s, box-shadow .2s;
}
.trend-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--tc) 45%, rgba(255, 255, 255, 0.07));
  box-shadow: 0 6px 28px -10px color-mix(in srgb, var(--tc) 55%, transparent);
}
.trend-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}
.trend-total { display: flex; align-items: baseline; gap: 6px; }
.trend-num {
  font-size: var(--fs-xl);
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.trend-unit { font-size: var(--fs-xs); color: var(--text-muted); }
.trend-delta { margin-top: 2px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }
.trend-delta--good { color: var(--st-good); }
.trend-delta--warn { color: var(--st-warn); }
.trend-chart { display: block; width: 100%; height: auto; margin-top: var(--sp-2); }
.trend-line { fill: none; stroke: var(--tc); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.trend-area-top { stop-color: var(--tc); stop-opacity: 0.38; }
.trend-area-bot { stop-color: var(--tc); stop-opacity: 0; }
.trend-dot { fill: var(--tc); }
.trend-dot-halo { fill: var(--tc); opacity: 0.22; }

/* ── momentum band — 4 trendCards on Today, 4 → 2 → 1 ── */
.momentum-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
@media (max-width: 1100px) {
  .momentum-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .momentum-band { grid-template-columns: minmax(0, 1fr); }
}

/* ── labeled spark (Comp.spark v2) ── */
.spark-wrap { display: inline-flex; flex-direction: column; gap: 3px; min-width: 0; }
.spark-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.spark-label { font-weight: 600; letter-spacing: 0.04em; min-width: 0; overflow-wrap: anywhere; }
.spark-lastval { margin-left: auto; flex: none; color: var(--text-secondary); font-weight: 700; }
.spark--labeled polyline { stroke: var(--cat-1); }
.spark-axis { stroke: rgba(255, 255, 255, 0.09); stroke-width: 1; }
.spark-dot { fill: var(--cat-1); }

/* ── v4 responsive: map columns stack as rows under 900px, lanes hide,
   nodes re-wrap into a grid so a stacked column stays compact ── */
@media (max-width: 900px) {
  .hmap { flex-direction: column; gap: var(--sp-4); }
  .hmap-lane { display: none; }
  .hmap-nodes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

/* ── v4 motion (all guarded; global reduce kill-switch also applies).
   Flow dashes + lane hue-cycle = decoration; the fail-dot pulse and the
   running-pill breathe are SIGNALS (motion = signal). ── */
@media (prefers-reduced-motion: no-preference) {
  .hmap-flow { animation: hmap-flow-anim 1.3s linear infinite; }
  @keyframes hmap-flow-anim { to { stroke-dashoffset: -11; } }
  .hmap-lane svg { animation: rgb-hue 12s linear infinite; }
  .hmap-node--fail .hmap-dot { animation: pulse-dot 2s ease-in-out infinite; }
  .ai-pill--running { animation: ai-breathe 1.6s ease-in-out infinite; }
  @keyframes ai-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
}

/* ═══════════════════════════════════════════
   MOTION — motion = signal. Urgent things glow/move;
   healthy things stay calm. EVERY animation here sits inside
   prefers-reduced-motion: no-preference (plus the global reduce
   kill-switch at the bottom of this file). Transform/opacity only.
   ═══════════════════════════════════════════ */

/* registered so the conic sweep angle interpolates smoothly */
@property --sweep-ang {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* .border-sweep — rotating alarm border for critical/breach surfaces.
   Red→orange→red only (an alarm, not a party). Static fallback under
   reduced motion = a fixed red/orange ring. Applied automatically to
   .stat--critical; tab modules add .border-sweep to breach cards. */
.border-sweep,
.stat--critical {
  position: relative;
  box-shadow: 0 0 26px -8px rgba(208, 59, 59, 0.45);
}
.border-sweep::after,
.stat--critical::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  pointer-events: none;
  background: conic-gradient(from var(--sweep-ang, 0deg),
    var(--st-crit), #E8722E 12%, var(--st-serious) 22%, var(--st-crit) 38%,
    rgba(208, 59, 59, 0.15) 52%, rgba(208, 59, 59, 0.15) 86%, var(--st-crit));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
/* escalation strip auto-alarms when it contains a breach (⛔ badge).
   Kept as a SEPARATE rule: a browser without :has() must not drop the
   .border-sweep rule above with it. */
.escalation-strip:not([data-key="meetings-health"]):has(.badge--critical) {
  position: relative;
  box-shadow: 0 0 26px -8px rgba(208, 59, 59, 0.45);
}
.escalation-strip:not([data-key="meetings-health"]):has(.badge--critical)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  pointer-events: none;
  background: conic-gradient(from var(--sweep-ang, 0deg),
    var(--st-crit), #E8722E 12%, var(--st-serious) 22%, var(--st-crit) 38%,
    rgba(208, 59, 59, 0.15) 52%, rgba(208, 59, 59, 0.15) 86%, var(--st-crit));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

/* .pulse-dot base — standalone live/health dot (inherits currentColor;
   more specific rules like .badge--cat-N .badge-dot keep their color) */
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

@media (prefers-reduced-motion: no-preference) {
  /* 1. alarm border rotation (slow, 6s) */
  .border-sweep::after,
  .stat--critical::after {
    animation: border-sweep-rot 6s linear infinite;
  }
  .escalation-strip:not([data-key="meetings-health"]):has(.badge--critical)::after {
    animation: border-sweep-rot 6s linear infinite;
  }
  @keyframes border-sweep-rot {
    to { --sweep-ang: 360deg; }
  }

  /* 2. soft pulse — health dots + the tab alert dot */
  .pulse-dot,
  .tab-btn.has-alert .tab-dot {
    animation: pulse-dot 2s ease-in-out infinite;
  }
  @keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.3); opacity: 0.6; }
  }

  /* 5. sheen — one diagonal light sweep per hover, cards + stat tiles */
  .card, a.stat-tile, .sheen { position: relative; overflow: hidden; }
  .card::before, a.stat-tile::before, .sheen::before {
    content: "";
    position: absolute;
    top: -20%;
    bottom: -20%;
    left: 0;
    width: 45%;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.055) 50%, transparent 100%);
    transform: translateX(-130%) skewX(-18deg);
  }
  .card:hover::before, a.stat-tile:hover::before, .sheen:hover::before {
    animation: sheen-slide .6s ease forwards;
  }
  @keyframes sheen-slide {
    0%   { transform: translateX(-130%) skewX(-18deg); opacity: 0; }
    30%  { opacity: 1; }
    100% { transform: translateX(330%) skewX(-18deg); opacity: 0; }
  }
}

/* ═══════════════════════════════════════════
   RGB AMBIENT (v3) — "RGB gaming rig meets command center".
   Always-on spectrum chrome, distinct from the red .border-sweep alarm
   (which stays reserved for critical/breach). All animation is
   filter: hue-rotate on static rainbow gradients (compositor-cheap) and
   lives inside the no-preference guard; the static rainbow itself is the
   reduced-motion fallback. RGB is DECORATION — it never encodes data.

   Ring anatomy (shared): a masked ::after paints a conic rainbow in the
   1px border band of the element (padding = ring width, xor mask).
   .border-sweep / .stat--critical keep their red ::after — every RGB ring
   selector excludes them so an alarm can never be repainted rainbow.
   ═══════════════════════════════════════════ */
.card, .stat-tile { position: relative; }   /* ring anchor even under reduced motion */

/* .rgb-ring — permanent conic RGB border, any consumer may add it
   (e.g. the savings ring frame). Don't combine with .border-sweep. */
.rgb-ring:not(.border-sweep)::after,
.card:not(.border-sweep):hover::after,
.stat-tile:not(.stat--serious):not(.stat--critical):not(.border-sweep)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: var(--rgb-conic);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
/* hero tiles idle: soft always-on shimmer (status tiles serious/critical
   keep their status border treatment instead) */
.stat-tile:not(.stat--serious):not(.stat--critical):not(.border-sweep)::after { opacity: 0.55; }
/* card hover + permanent ring: full-strength */
.card:not(.border-sweep):hover::after { opacity: 0.9; }
.rgb-ring:not(.border-sweep)::after { opacity: 0.95; }

@media (prefers-reduced-motion: no-preference) {
  /* one shared hue cycle — different speeds per surface */
  @keyframes rgb-hue {
    from { filter: hue-rotate(0deg); }
    to   { filter: hue-rotate(360deg); }
  }
  @keyframes rgb-hue-blur {
    from { filter: blur(8px) hue-rotate(0deg); }
    to   { filter: blur(8px) hue-rotate(360deg); }
  }

  .app-header::after { animation: rgb-hue 10s linear infinite; }
  .app-header::before { animation: rgb-hue-blur 10s linear infinite; }
  .tab-btn.is-active::after { animation: rgb-hue 7s linear infinite; }
  .stat-tile:not(.stat--serious):not(.stat--critical):not(.border-sweep)::after {
    animation: rgb-hue 14s linear infinite;
  }
  .card:not(.border-sweep):hover::after { animation: rgb-hue 4s linear infinite; }
  .rgb-ring:not(.border-sweep)::after { animation: rgb-hue 6s linear infinite; }

  /* brand glow — 🧠 + title breathe through the spectrum */
  .app-title { animation: brand-glow 12s linear infinite; }
  @keyframes brand-glow {
    0%, 100% { filter: drop-shadow(0 0 14px rgba(255, 59, 107, 0.55)); }
    20%      { filter: drop-shadow(0 0 15px rgba(255, 224, 0, 0.5)); }
    40%      { filter: drop-shadow(0 0 15px rgba(59, 255, 111, 0.5)); }
    60%      { filter: drop-shadow(0 0 15px rgba(0, 229, 255, 0.55)); }
    80%      { filter: drop-shadow(0 0 15px rgba(200, 107, 255, 0.6)); }
  }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — single column under 900px
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
  .shell { padding: var(--sp-4) var(--sp-3) 60px; }
  /* minmax(0,…) everywhere: bare 1fr lets min-width:auto grid items blow
     the track out past the viewport when a nowrap row title is long */
  .hero-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-row > :first-child { grid-column: 1 / -1; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .grid-cards, .chip-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-value { font-size: var(--fs-xl); }
  .tab-nav { overflow-x: auto; }
  .row-meta { display: none; }
  /* badge-heavy rows wrap instead of clipping at the viewport edge */
  .row, details.row > summary { flex-wrap: wrap; row-gap: 2px; }
  /* .row-right must wrap internally too: an escalation row's button chain
     (SLA badge + owner + draft + beres + nudge) is wider than a phone
     viewport, and as a single flex:none unit it was THE driver pushing
     document scrollWidth past the viewport (558px on a 390px phone) */
  .row-right { flex-wrap: wrap; max-width: 100%; row-gap: 2px; justify-content: flex-end; }
  /* titles now wrap to 2 lines (clamp) so the count only truncates last */
  .card-count { overflow: hidden; text-overflow: ellipsis; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ═══════════════════════════════════════════
   HOURS TAB — work-hours timeline + leverage
   (colors: --cat-1..4 fixed by lane identity;
   spacers = surface rings, no data-ink borders)
   ═══════════════════════════════════════════ */
#tab-hours { position: relative; }

.hours-daynav { align-items: center; }
.hours-daynav .chip:disabled { opacity: .35; cursor: default; }
.hours-daynav .chip { cursor: pointer; }
.hours-updated { margin-left: auto; color: var(--text-muted); font-size: var(--fs-xs); }

.hours-legend {
  display: flex; flex-wrap: wrap; gap: var(--sp-4);
  align-items: center; margin-bottom: var(--sp-3);
  font-size: var(--fs-xs); color: var(--text-secondary);
}
.hours-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.hours-legend-item em { font-style: normal; color: var(--text-muted); }
.hours-legend-note { margin-left: auto; color: var(--text-muted); }
.hours-key {
  width: 10px; height: 10px; border-radius: 3px; display: inline-block;
  background: var(--text-muted);
}
.hours-key[data-lane="meetings"] { background: var(--cat-1); }
.hours-key[data-lane="work"]    { background: var(--cat-2); }
.hours-key[data-lane="you"]   { background: var(--cat-3); }
.hours-key[data-lane="other"]    { background: var(--cat-4); }
.hours-key[data-series="eff"]    { background: var(--cat-1); }
.hours-key[data-series="act"]    { background: hsl(235, 12%, 52%); }

/* ── gantt ── */
.hours-gantt { display: flex; flex-direction: column; gap: 4px; }
.hours-row { display: flex; align-items: center; gap: var(--sp-2); }
.hours-lane-label {
  flex: 0 0 108px; display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hours-track {
  position: relative; flex: 1; height: 22px; min-width: 0;
}
.hours-ruler .hours-track { height: 16px; }
.hours-tick {
  position: absolute; left: var(--l); transform: translateX(-50%);
  top: 0; font-size: 10.5px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.hours-tick.is-last { transform: translateX(-90%); }
.hours-vline {
  position: absolute; left: var(--l); top: 0; bottom: 0;
  width: 1px; background: var(--border); opacity: .5; pointer-events: none;
}
.hours-block {
  position: absolute; left: var(--l); width: var(--w);
  top: 4px; height: 14px; border-radius: 3px;
  border: 0; padding: 0; cursor: default;
  background: var(--text-muted);
  box-shadow: 0 0 0 1px hsl(235, 25%, 7%);   /* surface ring = the spacer */
  transition: filter .12s;
}
.hours-block[data-lane="meetings"] { background: var(--cat-1); }
.hours-block[data-lane="work"]    { background: var(--cat-2); }
.hours-block[data-lane="you"]   { background: var(--cat-3); }
.hours-block[data-lane="other"]    { background: var(--cat-4); }
.hours-block.is-scheduled { opacity: .5; }
/* hit target bigger than the mark: invisible padding around every block */
.hours-block::after { content: ''; position: absolute; inset: -4px -3px; }
.hours-block:hover, .hours-block:focus-visible { filter: brightness(1.35); }
.hours-hit:focus-visible { outline: 1px solid var(--text-accent); }
.hours-block:focus-visible { outline: 1px solid var(--text-accent); outline-offset: 1px; }
.hours-commit {
  position: absolute; left: var(--l); bottom: -1px;
  width: 7px; height: 7px; transform: translateX(-50%) rotate(45deg);
  background: var(--text-secondary); border: 0; padding: 0;
  border-radius: 1px; cursor: default;
  box-shadow: 0 0 0 1px hsl(235, 25%, 7%);
}
.hours-commit:hover, .hours-commit:focus-visible { background: var(--text-primary); }
.hours-nowline {
  position: absolute; left: var(--l); top: -2px; bottom: -2px;
  width: 1px; background: var(--st-warn); opacity: .8; pointer-events: none;
}
.hours-nowline i {
  position: absolute; top: -12px; left: 3px; font-style: normal;
  font-size: 9.5px; color: var(--st-warn);
}

/* ── trend svg ── */
.hours-trend-wrap { overflow-x: auto; }
.hours-trend-wrap svg { width: 100%; min-width: 520px; display: block; }
.hours-grid { stroke: var(--border); stroke-width: 1; opacity: .55; }
.hours-axis { fill: var(--text-muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.hours-axis.is-selected { fill: var(--text-primary); font-weight: 700; }
.hours-bar-eff { fill: var(--cat-1); }
.hours-bar-actual { fill: hsl(235, 12%, 52%); opacity: .75; }
.hours-bargroup.is-selected .hours-bar-eff { filter: brightness(1.25); }
.hours-hit { fill: transparent; cursor: pointer; }
.hours-hit:hover + *, .hours-hit:hover { opacity: .9; }
.hours-levlabel { fill: var(--text-secondary); font-size: 11px; font-weight: 700; }

/* ── tooltip (shared) ── */
.hours-tip {
  position: absolute; left: var(--tx, 0); top: var(--ty, 0); z-index: 40;
  max-width: 340px; padding: 8px 10px; pointer-events: none;
  background: hsl(235, 22%, 12%); border: 1px solid var(--border-active);
  border-radius: var(--radius-xs); box-shadow: var(--shadow-card);
}
.hours-tip[hidden] { display: none; }
.hours-tip-title { font-size: var(--fs-sm, 13px); font-weight: 700; color: var(--text-primary); }
.hours-tip-meta { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: 2px; font-variant-numeric: tabular-nums; }
.hours-tip-sub { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }

/* ── table twin + footnote ── */
.hours-table-wrap { overflow-x: auto; }
.hours-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.hours-table th {
  text-align: left; color: var(--text-muted); font-weight: 600;
  padding: 4px 10px 6px 0; border-bottom: 1px solid var(--border);
}
.hours-table td { padding: 5px 10px 5px 0; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.hours-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hours-td-label { max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.hours-footnote { margin-top: var(--sp-3); font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.5; }

/* hours methodology card */
.hours-method { font-size: var(--fs-xs); color: var(--text-secondary); line-height: 1.6; }
.hours-method h4 { color: var(--text-primary); font-size: var(--fs-xs); margin: var(--sp-3) 0 var(--sp-1); text-transform: uppercase; letter-spacing: .04em; }
.hours-method h4:first-child { margin-top: 0; }
.hours-method ul { margin: 0 0 var(--sp-2); padding-left: 18px; }
.hours-method li { margin-bottom: 4px; }
.hours-method a { color: var(--text-accent); }
.hours-method code { font-family: var(--font-mono); background: var(--bg-input); padding: 1px 5px; border-radius: 4px; }
.hours-method-note { color: var(--text-muted); margin-top: var(--sp-2); }

/* hours methodology: links must LOOK like links, with the real URL visible */
.hours-method a { text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.hours-method a[target="_blank"]::after { content: ' ↗'; font-size: 10px; text-decoration: none; display: inline-block; }
.hours-method-sources li { margin-bottom: 8px; }
.hours-method-url {
  display: block; color: var(--text-muted); font-family: var(--font-mono);
  font-size: 10.5px; word-break: break-all; margin-top: 1px;
}

/* hours week view: clickable day rows */
.hours-day-link { cursor: pointer; }
.hours-day-link:hover td, .hours-day-link:focus-visible td { background: var(--bg-hover); }

/* ── header quick-find (ticket / ledger lookup) ── */
.quickfind {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 8px; margin-right: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.quickfind:focus-within {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px hsla(var(--h-violet), 60%, 60%, 0.12);
}
.quickfind-icon { font-size: 12px; opacity: .7; }
.quickfind-input {
  background: transparent; border: 0; outline: 0; color: var(--text-primary);
  font-size: var(--fs-xs); width: 240px; max-width: 44vw;
}
.quickfind-input::placeholder { color: var(--text-muted); }
.quickfind-kbd {
  font: 600 10px/1 ui-monospace, monospace; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 5px; padding: 2px 5px;
}
.qf-jira {
  font-size: var(--fs-xs); color: var(--text-secondary);
  padding: 8px 10px; margin-bottom: 10px;
  background: var(--work-bg); border: 1px solid var(--work-border);
  border-radius: var(--radius-xs);
}
@media (max-width: 720px) { .quickfind-input { width: 150px; } .quickfind-kbd { display: none; } }

/* ── quick-find result detail (expandable card) ── */
.qf-detail { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); }
.qf-d-context {
  color: var(--text-primary); line-height: 1.45; margin-bottom: 6px;
  white-space: pre-wrap;
}
.qf-d-line { display: flex; gap: 8px; align-items: baseline; }
.qf-d-key {
  flex: 0 0 108px; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .03em; font-size: 10px;
}
.qf-d-val { color: var(--text-primary); }
.qf-d-breach .qf-d-val { color: var(--danger, #ef6d6d); font-weight: 600; }
.qf-d-notes { margin-top: 6px; }
.qf-d-note {
  color: var(--text-secondary); line-height: 1.4; margin-top: 2px;
  padding-left: 4px;
}
.qf-d-src { margin-top: 8px; }

/* ── token-usage period / date filter ── */
.tu-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.tu-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-xs); overflow: hidden; }
.tu-range-btn {
  background: transparent; border: 0; border-right: 1px solid var(--border);
  color: var(--text-secondary); font-size: var(--fs-xs); padding: 5px 11px;
  cursor: pointer; transition: background .12s ease, color .12s ease;
}
.tu-range-btn:last-child { border-right: 0; }
.tu-range-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.tu-range-btn.active { background: hsla(var(--h-violet), 60%, 60%, 0.18); color: var(--text-accent); }
.tu-daterange { display: inline-flex; align-items: center; gap: 6px; }
.tu-daterange input[type="date"] {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text-primary); font-size: var(--fs-xs); padding: 4px 7px;
  color-scheme: dark;
}
.tu-daterange .tu-sep { color: var(--text-muted); }
.tu-apply {
  background: var(--bg-card-hover); border: 1px solid var(--border-active);
  color: var(--text-primary); font-size: var(--fs-xs); border-radius: var(--radius-xs);
  padding: 5px 11px; cursor: pointer;
}
.tu-apply:hover { border-color: var(--text-accent); }

/* ═══════════════════════════════════════════════════════════════════
   Work Tree — domain-first hierarchy in the Work tab (tab-work.js).
   Left outline persists so the structure is always visible; right pane
   shows the selected node. Depth is unbounded, so nothing here assumes
   a fixed number of levels. Uses the shared tokens only.
   ═══════════════════════════════════════════════════════════════════ */
.wt-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.wt-toolbar-sp { flex: 1; }

.wt-split { display: grid; grid-template-columns: 292px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .wt-split { grid-template-columns: 1fr; } }

.wt-tree {
  max-height: 560px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-input); padding: 6px 0;
}
.wt-node { display: block; }
.wt-row {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 0;
  font-size: var(--fs-sm); color: var(--text-secondary);
  border-left: 2px solid transparent; line-height: 1.45;
}
.wt-row:hover { background: var(--bg-glass); color: var(--text-primary); }
.wt-row.is-sel {
  background: var(--bg-card-hover); color: var(--text-accent);
  font-weight: 600; border-left-color: var(--text-accent);
}
.wt-twist {
  flex: none; width: 13px; text-align: center; font-size: 7px; color: var(--text-muted);
  transition: transform .18s ease; display: inline-block;
}
.wt-twist.is-open { transform: rotate(90deg); }
.wt-twist.is-leaf { visibility: hidden; }
.wt-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; }
.wt-critical { background: var(--st-serious); }
.wt-risk     { background: var(--st-warn); }
.wt-ok       { background: var(--st-good); }
.wt-plan     { background: var(--text-muted); }
.wt-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wt-cnt, .wt-attn {
  flex: none; font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px; border-radius: 8px; padding: 0 5px; font-variant-numeric: tabular-nums;
}
.wt-cnt  { color: var(--text-muted); background: var(--bg-glass); }
.wt-attn { color: var(--st-serious); background: var(--st-serious-bg); font-weight: 700; }

.wt-detail { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.wt-crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: var(--fs-xs); }
.wt-crumb {
  background: none; border: 0; padding: 2px 5px; border-radius: var(--radius-xs);
  cursor: pointer; color: var(--text-secondary); font-size: var(--fs-xs);
}
.wt-crumb:hover { background: var(--bg-glass); color: var(--text-primary); }
.wt-crumb-sep { color: var(--text-muted); }
.wt-crumb-here { color: var(--text-primary); font-weight: 600; padding: 2px 5px; font-size: var(--fs-xs); }
.wt-title { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.02em; color: var(--text-primary); }
.wt-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wt-kind {
  font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 2px 6px;
}
.wt-badge-b {
  font-size: 10px; font-weight: 700; letter-spacing: .05em; padding: 2px 7px;
  border-radius: var(--radius-xs); color: var(--text-accent);
  background: var(--bg-glass); border: 1px solid var(--border-active);
}
.wt-moved { font-size: var(--fs-xs); color: var(--st-good); font-weight: 600; }
.wt-sum { margin: 0; font-size: var(--fs-sm); color: var(--text-secondary); max-width: 74ch; line-height: 1.55; }

.wt-ref {
  display: inline-block; font-family: var(--font-mono, ui-monospace, monospace); font-size: 10.5px;
  background: var(--bg-glass); border: 1px solid var(--border); border-radius: var(--radius-xs);
  padding: 1px 6px; color: var(--text-secondary); cursor: pointer;
}
.wt-ref:hover { border-color: var(--text-accent); color: var(--text-accent); }
.wt-ref-ledger { font: inherit; font-family: var(--font-mono, ui-monospace, monospace); font-size: 10.5px; }

.wt-sources { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.wt-sources-label {
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted);
}
.wt-src {
  font-size: var(--fs-xs); color: var(--text-accent); background: var(--bg-glass);
  border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 2px 8px;
}
.wt-src:hover { border-color: var(--text-accent); background: var(--bg-card-hover); }

.wt-sec-label {
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 650; margin-top: 4px;
}
.wt-kids-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 9px; }
.wt-kid {
  text-align: left; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
}
.wt-kid:hover { border-color: var(--border-active); background: var(--bg-card-hover); }
.wt-kid-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wt-kid-name { font-size: var(--fs-sm); font-weight: 620; color: var(--text-primary); }
.wt-kid-sum {
  font-size: var(--fs-xs); color: var(--text-secondary); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.wt-kid-foot { font-size: 10.5px; color: var(--text-muted); margin-top: auto; }
.wt-kid-foot b { color: var(--st-serious); }

.wt-tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.wt-table { border-collapse: collapse; width: 100%; font-size: var(--fs-xs); }
.wt-table th {
  text-align: left; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; padding: 9px 11px;
  border-bottom: 1px solid var(--border); background: var(--bg-input); white-space: nowrap;
}
.wt-table td {
  padding: 10px 11px; border-bottom: 1px solid var(--border);
  vertical-align: top; color: var(--text-secondary); line-height: 1.5;
}
.wt-table tr:last-child td { border-bottom: 0; }
.wt-th-name { display: flex; flex-direction: column; gap: 5px; min-width: 140px; }
.wt-th-name b { color: var(--text-primary); }
.wt-th-tags { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.wt-blocked { color: var(--st-serious); }
.wt-clear { color: var(--st-good); }
.wt-branch { margin-top: 5px; font-size: 10.5px; color: var(--text-accent); }
.wt-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 20px; }
@media (max-width: 700px) { .wt-fields { grid-template-columns: 1fr; } }
.wt-field { display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.55; }
.wt-flabel { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.wt-f-problem  { color: var(--st-serious); }
.wt-f-blocker  { color: var(--st-warn); }
.wt-f-progress { color: var(--st-good); }
.wt-f-next     { color: var(--text-accent); }
.wt-empty { font-size: var(--fs-sm); color: var(--text-muted); font-style: italic; }

/* ── chatbox (Ask the Second Brain, inside the Drawer shell) ── */
.chatbox { display: flex; flex-direction: column; gap: var(--sp-3); height: 100%; }
.chat-ws-line { font-size: var(--fs-xs); color: var(--text-muted); }
.chat-ws-badge {
  display: inline-block; margin-left: 4px; padding: 1px 7px;
  border: 1px solid var(--secondary-border); border-radius: 999px;
  color: var(--secondary); font-size: 10px; text-transform: uppercase;
  letter-spacing: .05em;
}
.chat-body {
  flex: 1; min-height: 260px; max-height: 48vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-3); background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.chat-msg { display: flex; }
.chat-msg-user { justify-content: flex-end; }
.chat-msg-ai { justify-content: flex-start; }
.chat-hint {
  font-size: var(--fs-xs); color: var(--text-muted); text-align: center;
  padding: 14px 10px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  margin: auto; max-width: 90%;
}
.chat-bubble {
  max-width: 82%; padding: 8px 12px; font-size: var(--fs-sm); line-height: 1.5;
  border-radius: var(--radius-xs); overflow-wrap: anywhere;
}
.chat-msg-user .chat-bubble {
  background: hsla(var(--h-violet), 70%, 60%, 0.22);
  border: 1px solid var(--secondary-border);
}
.chat-msg-ai .chat-bubble {
  background: var(--bg-card); border: 1px solid var(--border);
}
.chat-bubble .md { font-size: 13px; line-height: 1.6; }
.chat-bubble .md h1, .chat-bubble .md h2, .chat-bubble .md h3 { font-size: 14px; margin: 6px 0 3px; }
.chat-bubble .md p { margin: 3px 0; }
.chat-bubble .md li { margin-bottom: 3px; }
.chat-bubble .md code { font-size: 0.88em; }
.chat-typing { color: var(--text-muted); font-style: italic; animation: chatPulse 1.2s ease-in-out infinite; }
@keyframes chatPulse { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }

.chat-composer { position: relative; display: flex; flex-direction: column; }
.chat-palette {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0;
  display: none; flex-direction: column; gap: 2px;
  max-height: 34vh; overflow-y: auto; padding: 6px;
  background: var(--bg-secondary); border: 1px solid var(--border-active);
  border-radius: var(--radius-xs); box-shadow: var(--shadow-card);
  z-index: 5;
}
.chat-palette.is-open { display: flex; }
.chat-pal-empty { padding: 10px; font-size: var(--fs-xs); color: var(--text-muted); }
.chat-pal-item {
  display: flex; align-items: baseline; gap: 8px; width: 100%;
  padding: 7px 9px; text-align: left; cursor: pointer;
  background: transparent; border: 0; border-radius: var(--radius-xs);
  color: var(--text-primary); font-size: var(--fs-sm); line-height: 1.4;
}
.chat-pal-item:hover { background: var(--bg-card-hover); }
.chat-pal-item.is-hl { background: hsla(var(--h-violet), 60%, 60%, 0.18); }
.chat-pal-icon { flex: none; font-size: 12px; }
.chat-pal-text { flex: 1; min-width: 0; }
.chat-pal-cat {
  flex: none; font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); padding: 1px 6px; border: 1px solid var(--border);
  border-radius: 999px; white-space: nowrap;
}
.chat-input-row { display: flex; align-items: center; gap: 8px; }
.chat-input {
  flex: 1; min-width: 0; padding: 9px 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text-primary);
  font-size: var(--fs-sm); outline: 0;
  resize: none; overflow-y: auto; font-family: inherit; line-height: 1.4;
}
.chat-input:focus { border-color: var(--border-active); }
.chat-input-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-input::placeholder { color: var(--text-muted); }
.chat-sugg-btn, .chat-send-btn {
  flex: none; width: 34px; height: 34px; display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text-secondary); cursor: pointer;
  transition: border-color .15s, color .15s;
}
.chat-sugg-btn:hover, .chat-send-btn:hover { border-color: var(--border-active); color: var(--text-primary); }

/* ── Chat tab page (chatbox.js, full-page two-pane) ── */
.tab-panel.is-active > .chat-page { height: calc(100vh - 208px); min-height: 420px; }
.chat-page { display: flex; gap: var(--sp-3); }
.chat-sidebar {
  flex: none; width: 252px; display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-3); background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.chat-side-new {
  width: 100%; padding: 8px 10px; font-size: var(--fs-sm); font-weight: 600;
  background: var(--bg-glass); border: 1px solid var(--border-active);
  border-radius: var(--radius-sm); color: var(--text-primary); cursor: pointer;
  transition: background .15s;
}
.chat-side-new:hover { background: hsla(var(--h-violet), 55%, 60%, 0.15); }
.chat-sidebar-label {
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-top: 2px;
}
.chat-convos { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.chat-convo {
  display: flex; align-items: center; gap: 6px; padding: 7px 9px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer;
}
.chat-convo:hover { background: var(--bg-glass); border-color: var(--border); }
.chat-convo.is-active {
  background: hsla(var(--h-violet), 55%, 60%, 0.14);
  border-color: var(--secondary-border);
}
.chat-convo-title {
  flex: 1; min-width: 0; text-align: left; font-size: var(--fs-sm);
  color: var(--text-primary); background: none; border: 0; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0;
}
.chat-convo-ws {
  flex: none; font-size: 9px; color: var(--text-muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 6px; white-space: nowrap;
}
.chat-convo-del {
  flex: none; width: 18px; height: 18px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 10px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-muted); cursor: pointer; opacity: 0;
  transition: opacity .15s, color .15s;
}
.chat-convo:hover .chat-convo-del { opacity: 1; }
.chat-convo-del:hover { color: var(--danger, #ff6b6b); background: var(--bg-glass); }
.chat-convo-time { flex: none; font-size: 10px; color: var(--text-muted); }
.chat-sidebar-empty {
  font-size: var(--fs-xs); color: var(--text-muted); padding: 10px 4px;
}
.chat-pane {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); padding: var(--sp-3); gap: var(--sp-3);
}
.chat-body-page { flex: 1; max-height: none; min-height: 0; }
#chat-composer { position: relative; display: flex; flex-direction: column; }

.chat-ws-chips { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.chat-ws-chip {
  padding: 2px 10px; font-size: var(--fs-xs); font-weight: 600;
  border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.chat-ws-chip:hover { border-color: var(--secondary-border); color: var(--text-primary); }
.chat-ws-chip.is-active {
  background: hsla(var(--h-violet), 55%, 60%, 0.16);
  border-color: var(--secondary-border); color: var(--secondary);
}
.chat-ws-label { font-weight: 600; color: var(--text-primary); vertical-align: middle; }
.chat-ws-global {
  position: relative; margin-left: 8px; font-size: 10px; color: var(--text-muted);
  opacity: .85; vertical-align: middle;
}
.chat-modal-overlay {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  padding: var(--sp-4);
}
.chat-modal {
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface-opaque);
  border: 1px solid #3a3a46;
  border-radius: var(--radius); box-shadow: 0 20px 55px rgba(0,0,0,.6);
  padding: var(--sp-5);
}
.chat-modal-title {
  font-size: var(--fs-md); font-weight: 700; color: #f5f5f7;
}
.chat-modal-sub {
  font-size: var(--fs-sm); color: #b8b8c2; margin-bottom: 6px;
}
.chat-modal-opt {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 13px 16px; font-size: var(--fs-sm);
  background: #20202a; border: 1px solid #41414f;
  border-radius: var(--radius-sm); color: #f5f5f7;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.chat-modal-opt:hover {
  border-color: #5b5b6b;
  background: #282835;
}
.chat-modal-opt:focus-visible { outline: 2px solid #6b6b7d; outline-offset: 1px; }
.chat-modal-opt-name { font-weight: 600; color: #f5f5f7; }
.chat-modal-opt-desc { font-size: var(--fs-sm); color: #b8b8c2; line-height: 1.45; }

/* ── Memory Notes chatbox (notes-chat.js) ── */
.notes-box { display: flex; flex-direction: column; gap: var(--sp-3); height: 100%; }
.notes-hint { font-size: var(--fs-xs); color: var(--text-muted); padding: 4px 0; }
.notes-body {
  flex: 1; min-height: 260px; max-height: 52vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-3); background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.notes-empty { color: var(--text-muted); font-size: var(--fs-sm); padding: 12px 0; text-align: center; }
.notes-recent-title { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.notes-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xs); font-size: var(--fs-sm); cursor: default;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.notes-item:hover { border-color: var(--border-active); }
.notes-type-badge { flex: none; font-size: 11px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 999px; white-space: nowrap; }
.notes-item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.notes-proj { font-size: 10px; padding: 1px 5px; background: hsla(var(--h-violet), 60%, 60%, 0.15); border-radius: 999px; color: var(--secondary); }
.notes-ents { font-size: 10px; color: var(--text-muted); }
.notes-item-time { flex: none; font-size: 10px; color: var(--text-muted); }
.notes-msg { display: flex; }
.notes-msg-user { justify-content: flex-end; }
.notes-bubble {
  max-width: 82%; padding: 8px 12px; font-size: var(--fs-sm); line-height: 1.5;
  border-radius: var(--radius-xs); overflow-wrap: anywhere;
  background: hsla(var(--h-violet), 70%, 60%, 0.22); border: 1px solid var(--secondary-border);
}
.notes-result { padding: 10px 12px; border-radius: var(--radius-xs); font-size: var(--fs-sm); line-height: 1.5; }
.notes-ok { background: hsla(140, 60%, 50%, 0.12); border: 1px solid hsla(140, 60%, 50%, 0.3); }
.notes-duplicate { background: hsla(40, 80%, 60%, 0.12); border: 1px solid hsla(40, 80%, 60%, 0.3); }
.notes-error { background: hsla(0, 60%, 50%, 0.1); border: 1px solid hsla(0, 60%, 50%, 0.3); }
.notes-result-header { font-weight: 600; margin-bottom: 4px; }
.notes-result-type { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.notes-result-title { font-weight: 500; }
.notes-result-summary { color: var(--text-secondary); margin-top: 2px; }
.notes-result-detail { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }
.notes-sep { height: 1px; background: var(--border); margin: 4px 0; }
.notes-composer-placeholder { min-height: 40px; }
.notes-input-row { display: flex; align-items: center; gap: 8px; }
.notes-input {
  flex: 1; min-width: 0; padding: 9px 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text-primary);
  font-size: var(--fs-sm); outline: 0; resize: none;
  font-family: inherit; line-height: 1.5;
  min-height: 38px; max-height: 120px;
  overflow-y: auto;
}
.notes-input:focus { border-color: var(--border-active); }
.notes-input::placeholder { color: var(--text-muted); }
.notes-send-btn {
  flex: none; width: 34px; height: 34px; display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text-secondary); cursor: pointer;
  transition: border-color .15s, color .15s;
}
.notes-send-btn:hover { border-color: var(--border-active); color: var(--text-primary); }
.notes-pending { color: var(--text-muted); font-style: italic; padding: 8px 0; }


/* -- Agents / AI Architecture tab (tab-agents.js) -------------------- */
.agents-flow { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-2); }
.agents-level { display: flex; flex-direction: column; gap: var(--sp-2); }
.agents-level-label {
  font-size: var(--fs-sm); color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .08em; text-align: center;
}
.agents-band { display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: center; }
.agents-link { text-align: center; color: var(--text-muted); line-height: 1; font-size: var(--fs-sm); }
.agents-node {
  width: 230px; min-height: 108px; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-3);
  color: var(--text-primary); transition: border-color .15s, transform .15s;
}
.agents-node:hover { border-color: var(--border-active); transform: translateY(-1px); }
.agents-node-emoji { font-size: 20px; line-height: 1; }
.agents-node-emoji.big { font-size: 28px; }
.agents-node-name { font-weight: 700; }
.agents-node-name.big { font-size: var(--fs-md); }
.agents-node-status { align-self: flex-start; }
.agents-skill { font-size: var(--fs-sm); color: var(--text-muted); font-family: var(--font-mono); }
.agents-node-purpose {
  font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.agents-node-note { font-size: var(--fs-sm); color: var(--text-muted); }
.agents-detail-head { display: flex; gap: var(--sp-3); align-items: flex-start; }
.agents-detail-sub { font-size: var(--fs-sm); color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; }
.agents-list { margin: 0 0 var(--sp-2); padding-left: 22px; color: var(--text-secondary); line-height: 1.6; }
.agents-list li { margin-bottom: 6px; }
.agents-prompt-box { display: flex; flex-direction: column; gap: var(--sp-2); }
.agents-prompt-md {
  max-height: 44vh; min-height: 260px; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--bg-input); padding: var(--sp-3);
}
/* raw source view: render the file verbatim, every newline preserved.
   (U.mdToHtml would fold the frontmatter into one line - not what a prompt
   source box should do.) */
.agents-prompt-raw {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

/* ── Memory tab (tab-memory.js) ──────────────────────────────── */
.mem-container { display: flex; flex-direction: column; gap: var(--sp-3); }
.mem-section-title { margin: 0 0 var(--sp-2); font-size: var(--fs-md); font-weight: 700; }
.mem-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
@media (max-width: 860px) { .mem-two-col { grid-template-columns: 1fr; } }

.mem-search-panel, .mem-drive-panel, .mem-knowledge-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-3);
}
.mem-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-2); }
.mem-panel-header .mem-section-title { margin: 0; }

.mem-search-row, .mem-drive-search-row { display: flex; gap: 8px; margin-bottom: var(--sp-2); }
.mem-search-input {
  flex: 1; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text-primary); font-size: var(--fs-sm); outline: 0;
}
.mem-search-input:focus { border-color: var(--border-active); }
.mem-select {
  padding: 7px 10px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text-primary); font-size: var(--fs-sm);
}
.mem-search-btn {
  padding: 8px 16px; background: hsla(var(--h-violet), 70%, 60%, 0.22);
  border: 1px solid var(--secondary-border); border-radius: var(--radius-xs);
  color: var(--text-primary); font-size: var(--fs-sm); cursor: pointer; font-weight: 600;
}
.mem-search-btn:hover { background: hsla(var(--h-violet), 70%, 60%, 0.35); }
.mem-btn-sm {
  padding: 4px 10px; font-size: 11px; background: var(--bg-glass);
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text-secondary); cursor: pointer; white-space: nowrap;
}
.mem-btn-sm:hover { border-color: var(--text-accent); color: var(--text-primary); }
.mem-btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }

.mem-status-line { font-size: var(--fs-sm); color: var(--text-secondary); margin-bottom: var(--sp-2); }
.mem-ok { color: var(--st-good); font-weight: 600; }
.mem-warn { color: var(--st-warn); font-weight: 600; }
.mem-loading { color: var(--text-muted); font-style: italic; padding: var(--sp-2); }
.mem-empty { color: var(--text-muted); font-style: italic; padding: var(--sp-2); }
.mem-cached-note { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: var(--sp-2); padding: 4px 8px; background: var(--bg-glass); border-radius: var(--radius-xs); }

.mem-results { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.mem-result-card {
  padding: 10px 12px; background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-xs); display: flex; flex-direction: column; gap: 4px;
}
.mem-result-card:hover { border-color: var(--border-active); }
.mem-result-drive { border-left: 3px solid var(--h-blue, 210); }
.mem-result-knowledge { border-left: 3px solid var(--h-green, 150); }
.mem-result-state { border-left: 3px solid var(--h-amber, 36); }
.mem-result-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mem-result-icon { font-size: 14px; }
.mem-result-title { font-weight: 600; font-size: var(--fs-sm); }
.mem-result-score { margin-left: auto; }
.mem-result-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mem-result-content { font-size: var(--fs-xs); color: var(--text-secondary); line-height: 1.45; white-space: pre-wrap; word-break: break-word; }

.mem-source-badge {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em;
  padding: 1px 6px; border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-muted);
}
.mem-project-badge {
  font-size: var(--fs-xs); padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-accent); white-space: nowrap;
}
.mem-project-badge[data-pt="general"] { border-color: var(--h-amber, 36); color: var(--h-amber, 36); }
.mem-cat-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: var(--bg-glass); border: 1px solid var(--border);
  color: var(--text-secondary); white-space: nowrap;
}
.mem-date { font-size: var(--fs-xs); color: var(--text-muted); }
.mem-mime { font-size: 10px; color: var(--text-muted); }
.mem-tags { font-size: var(--fs-xs); color: var(--text-accent); }
.mem-conf { font-size: 10px; padding: 1px 5px; border-radius: 999px; }
.mem-conf-high { color: var(--st-good); }
.mem-conf-medium { color: var(--h-amber, 36); }
.mem-conf-low { color: var(--st-serious); }

.mem-categories { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: var(--sp-2); }
.mem-cat-btn {
  padding: 4px 10px; font-size: var(--fs-xs); background: var(--bg-glass);
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text-secondary); cursor: pointer;
}
.mem-cat-btn:hover { border-color: var(--text-accent); color: var(--text-primary); }
.mem-cat-count { font-weight: 600; margin-left: 3px; }

.mem-entry-card {
  padding: 8px 10px; background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}
.mem-entry-title { font-weight: 600; font-size: var(--fs-sm); margin-bottom: 2px; }
.mem-entry-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.mem-entry-preview { font-size: var(--fs-xs); color: var(--text-secondary); line-height: 1.4; white-space: pre-wrap; word-break: break-word; }

/* ═══════════════════════════════════════════
   INTELLIGENCE FEED (tab-news.js) — editorial briefing cards
   ═══════════════════════════════════════════ */
.intel-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.intel-head h2 { margin: 0 0 2px; font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.01em; }
.intel-updated { font-size: var(--fs-sm); color: var(--text-muted); }
.intel-refresh {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); font-size: var(--fs-sm); font-weight: 600;
  transition: border-color .15s, transform .15s, box-shadow .15s, opacity .15s;
}
.intel-refresh:hover:not(:disabled) {
  border-color: var(--border-active); transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.intel-refresh:disabled { opacity: .6; cursor: wait; }
.intel-refresh-spin { display: inline-block; animation: intelSpin 1s linear infinite; }
@keyframes intelSpin { to { transform: rotate(360deg); } }

/* segmented pill control for categories */
.intel-seg { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: var(--sp-4); background: var(--bg-input); border: 1px solid var(--border); border-radius: 999px; flex-wrap: wrap; }
.intel-seg a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; text-decoration: none;
  color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 500;
  transition: color .15s, background .15s;
}
.intel-seg a:hover { color: var(--text-primary); }
.intel-seg a.is-active {
  background: var(--bg-card); color: var(--text-primary); font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,.3), inset 0 0 0 1px var(--border-active);
}

/* story card: editorial numbered layout */
.intel-story {
  position: relative; overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: var(--sp-3);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.intel-story:hover { border-color: var(--border-active); transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0,0,0,.35); }
.intel-story > summary { list-style: none; cursor: pointer; user-select: none; }
.intel-story > summary::-webkit-details-marker { display: none; }
.intel-story[open] { border-color: var(--border-active); }

.intel-row { display: flex; gap: var(--sp-4); padding: var(--sp-4) var(--sp-5); align-items: flex-start; }
.intel-num {
  flex: none; min-width: 44px;
  font-size: var(--fs-xl); font-weight: 300; line-height: 1.15;
  color: var(--text-muted); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.intel-main { flex: 1; min-width: 0; }
.intel-topline { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: 6px; }
.intel-source { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-accent); }
.intel-date { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.intel-market {
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.05); border: 1px solid var(--border); color: var(--text-secondary, var(--text-muted));
}
.intel-market--US { background: rgba(45,120,220,.22); color: #7ab6ff; border-color: rgba(45,120,220,.4); }
.intel-market--IDN { background: rgba(220,60,45,.18); color: #ff9a86; border-color: rgba(220,60,45,.4); }
.intel-verdict {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 9px; border-radius: 999px;
}
.intel-verdict--try-now { background: var(--st-good-bg); color: var(--st-good); border: 1px solid rgba(12,163,12,.35); }
.intel-verdict--monitor { background: var(--st-warn-bg); color: var(--st-warn); border: 1px solid rgba(250,178,25,.35); }
.intel-verdict--ignore { background: rgba(255,255,255,.05); color: var(--text-muted); border: 1px solid var(--border); }

.intel-headline { font-size: var(--fs-md); font-weight: 650; line-height: 1.35; color: var(--text-primary); margin: 0 0 6px; letter-spacing: -0.01em; }
.intel-teaser {
  font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 8px;
}
.intel-baseline { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-muted); }

/* importance dot rating ●●●○○ */
.intel-dots { display: inline-flex; gap: 3px; align-items: center; }
.intel-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.14); }
.intel-dot.on { background: var(--text-accent); }

/* circled chevron affordance — same interaction language as app rows */
.intel-chev {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-glass);
  color: var(--text-secondary); font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .18s ease, color .15s, border-color .15s;
}
.intel-story:hover .intel-chev { color: var(--text-primary); border-color: var(--border-active); }
.intel-story[open] .intel-chev { transform: rotate(90deg); }

/* expanded briefing body */
.intel-body { padding: 0 var(--sp-5) var(--sp-5) calc(44px + var(--sp-5) + var(--sp-4)); }
@media (max-width: 640px) { .intel-body { padding-left: var(--sp-4); } }

.intel-sec { position: relative; padding: 2px 0 2px var(--sp-3); margin-bottom: var(--sp-4); }
.intel-sec::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 3px; border-radius: 2px; }
.intel-sec--news::before    { background: hsl(var(--h-indigo), 70%, 68%); }
.intel-sec--why::before     { background: hsl(var(--h-violet), 70%, 74%); }
.intel-sec--impact::before  { background: hsl(var(--h-emerald), 60%, 55%); }
.intel-sec--watch::before   { background: hsl(var(--h-amber), 85%, 60%); }
.intel-sec--market::before  { background: hsl(210, 80%, 65%); }

.intel-label {
  display: block; font-size: var(--fs-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em; margin-bottom: 4px;
}
.intel-sec--news .intel-label    { color: hsl(var(--h-indigo), 70%, 78%); }
.intel-sec--why .intel-label     { color: hsl(var(--h-violet), 70%, 82%); }
.intel-sec--impact .intel-label  { color: hsl(var(--h-emerald), 55%, 65%); }
.intel-sec--watch .intel-label   { color: hsl(var(--h-amber), 85%, 68%); }
.intel-sec--market .intel-label  { color: hsl(210, 80%, 75%); }

.intel-text { font-size: var(--fs-base); line-height: 1.6; color: var(--text-secondary); max-width: 68ch; }

/* MY TAKE: tinted analyst quote card */
.intel-take {
  background: hsla(var(--h-violet), 60%, 60%, 0.08);
  border: 1px solid hsla(var(--h-violet), 60%, 70%, 0.22);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
}
.intel-take .intel-label { color: hsl(var(--h-violet), 75%, 84%); }
.intel-take .intel-text { color: var(--text-secondary); font-style: italic; }

.intel-foot { display: flex; justify-content: flex-end; }
.intel-src-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; text-decoration: none;
  background: var(--bg-glass); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 600;
  transition: border-color .15s, color .15s;
}
.intel-src-link:hover { border-color: var(--border-active); color: var(--text-primary); }

/* ── Ask AI mini-chat (per story) ───────────────────────────── */
.intel-ask {
  margin-bottom: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  overflow: hidden;
}
.intel-ask > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: baseline; gap: 10px;
  padding: var(--sp-3) var(--sp-4);
}
.intel-ask > summary::-webkit-details-marker { display: none; }
.intel-ask > summary .intel-label { margin-bottom: 0; color: hsl(var(--h-amber), 85%, 68%); }
.intel-ask-hint { font-size: var(--fs-xs); color: var(--text-muted); }
.intel-ask[open] > summary { border-bottom: 1px solid var(--border); }
.intel-ask-body-wrap { padding: var(--sp-3) var(--sp-4); }
.intel-ask-empty { font-size: var(--fs-sm); color: var(--text-muted); padding: 2px 0 var(--sp-2); }
.intel-ask-thread { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-3); max-height: 320px; overflow-y: auto; }
.intel-ask-msg { max-width: 90%; }
.intel-ask-msg--user { align-self: flex-end; }
.intel-ask-msg--ai { align-self: flex-start; }
.intel-ask-body {
  padding: 8px 12px; border-radius: 12px; font-size: var(--fs-sm); line-height: 1.55;
  color: var(--text-primary); background: var(--bg-glass); border: 1px solid var(--border);
}
.intel-ask-msg--user .intel-ask-body { background: hsla(var(--h-amber), 70%, 60%, 0.12); border-color: hsla(var(--h-amber), 70%, 60%, 0.3); }
.intel-ask-meta { font-size: 10px; color: var(--text-muted); margin-top: 3px; }
.intel-ask-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--sp-3); }
.intel-chip {
  padding: 5px 12px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600;
  background: var(--bg-glass); border: 1px solid var(--border); color: var(--text-secondary);
  cursor: pointer; transition: border-color .15s, color .15s;
}
.intel-chip:hover { border-color: var(--border-active); color: var(--text-primary); }
.intel-ask-form { display: flex; gap: 8px; }
.intel-ask-input {
  flex: 1; padding: 8px 12px; border-radius: 999px;
  background: var(--bg-glass); border: 1px solid var(--border); color: var(--text-primary);
  font-size: var(--fs-sm); outline: none;
}
.intel-ask-input:focus { border-color: var(--border-active); }
.intel-btn {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border-active);
  background: hsla(var(--h-amber), 70%, 60%, 0.15); color: var(--text-primary);
  font-size: var(--fs-sm); font-weight: 700; cursor: pointer;
  transition: background .15s;
}
.intel-btn:hover { background: hsla(var(--h-amber), 70%, 60%, 0.25); }

/* empty / generating state */
.intel-empty { text-align: center; padding: var(--sp-8) var(--sp-4); }
.intel-empty-icon { font-size: 40px; margin-bottom: var(--sp-2); }
.intel-empty-title { font-size: var(--fs-md); font-weight: 650; margin-bottom: 6px; }
.intel-empty-hint { font-size: var(--fs-sm); color: var(--text-muted); }

/* ═══════════════════════════════════════════
   Reminders (tab + today card)
   ═══════════════════════════════════════════ */
.rem-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
}
.rem-row:last-child { border-bottom: none; }
.rem-check {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--bg-input);
  color: var(--text-muted); font-size: 13px; line-height: 1;
  cursor: pointer; transition: all .15s ease;
}
.rem-check:hover { border-color: var(--st-good); color: var(--st-good); }
.rem-row.is-done .rem-text {
  text-decoration: line-through; color: var(--text-muted);
}
.rem-row.is-done .rem-check { border-color: var(--st-good); color: var(--st-good); }
.rem-body { flex: 1; min-width: 0; }
.rem-text { font-size: var(--fs-sm); color: var(--text-primary); word-break: break-word; }
.rem-meta { margin-top: 2px; }
.rem-due { font-size: var(--fs-xs); color: var(--text-muted); }
.rem-row.is-overdue .rem-due { color: var(--st-serious); font-weight: 600; }
.rem-del {
  flex: none; width: 24px; height: 24px; border-radius: 6px;
  border: none; background: transparent; color: var(--text-muted);
  opacity: 0; cursor: pointer; font-size: 12px; transition: all .15s ease;
}
.rem-row:hover .rem-del { opacity: .7; }
.rem-del:hover { opacity: 1 !important; color: var(--st-serious); background: var(--st-serious-bg); }

.rem-add { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.rem-add-input {
  flex: 1; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-input);
  color: var(--text-primary); font-size: var(--fs-sm); outline: none;
}
.rem-add-input:focus { border-color: hsla(var(--h-indigo), 70%, 60%, 0.5); }
.rem-add-btn {
  padding: 10px 18px; border-radius: 10px; border: none;
  background: hsla(var(--h-indigo), 70%, 55%, 0.25); color: var(--text-primary);
  font-weight: 600; font-size: var(--fs-sm); cursor: pointer;
}
.rem-add-btn:hover { background: hsla(var(--h-indigo), 70%, 55%, 0.4); }
.rem-add-btn:disabled { opacity: .5; cursor: wait; }

/* ═══════════════════════════════════════════
   Finance tab
   ═══════════════════════════════════════════ */
.fin-hero {
  text-align: center; padding: var(--sp-6) var(--sp-4) var(--sp-5);
  border-radius: 16px; margin-bottom: var(--sp-4);
  background: linear-gradient(180deg, hsla(var(--h-indigo), 45%, 22%, 0.35), var(--bg-card));
  border: 1px solid var(--border);
}
.fin-hero-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.fin-hero-value {
  font-size: clamp(28px, 5vw, 40px); font-weight: 750; margin-top: 6px;
  font-variant-numeric: tabular-nums; color: var(--text-primary);
}
.fin-hero-updated { margin-top: 6px; font-size: var(--fs-xs); color: var(--text-muted); }

.fin-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3);
  padding: var(--sp-2) 0; border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-secondary);
}
.fin-row:last-child { border-bottom: none; }
.fin-row strong { font-variant-numeric: tabular-nums; color: var(--text-primary); white-space: nowrap; }
.fin-sub { color: var(--text-muted); font-size: var(--fs-xs); margin-left: 4px; }
.fin-paid { color: var(--st-good); font-size: var(--fs-xs); margin-left: 6px; }
.fin-row.is-settled { opacity: .55; }

/* overdue obligations */
.fin-row.is-overdue {
  background: linear-gradient(90deg, var(--st-serious-bg), transparent 70%);
  border-radius: 8px;
  padding-left: var(--sp-2); padding-right: var(--sp-2);
  margin: 0 calc(-1 * var(--sp-2));
}
.fin-row.is-overdue strong { color: var(--st-serious); }
.fin-late {
  display: inline-block; margin-left: 6px;
  color: var(--st-serious); background: var(--st-serious-bg);
  border-radius: 999px; padding: 1px 8px;
  font-size: var(--fs-xs); font-weight: 650; white-space: nowrap;
}
.fin-arr { margin-left: 6px; color: var(--st-warn); }

/* ═══════════════════════════════════════════
   Home tab — Top Tickets + Current news rows
   ═══════════════════════════════════════════ */
.home-section { padding: var(--sp-1) 0; }
.home-section + .home-section { border-top: 1px dashed var(--border); margin-top: var(--sp-2); padding-top: var(--sp-2); }
.home-section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: 4px;
}
.home-row {
  display: flex; align-items: baseline; gap: var(--sp-2);
  padding: 5px 0; font-size: var(--fs-sm);
}
.home-row-text {
  flex: 1; min-width: 0; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
a.home-row-text { text-decoration: none; }
a.home-row-text:hover { color: hsl(var(--h-indigo), 80%, 75%); }
.home-when {
  flex: none; font-size: var(--fs-xs); color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.home-when.is-late { color: var(--st-serious); font-weight: 650; }
.home-news-cat {
  flex: none; min-width: 150px; font-size: var(--fs-xs);
  color: var(--text-muted); white-space: nowrap;
}
.home-empty { font-size: var(--fs-xs); color: var(--text-muted); opacity: .7; padding: 2px 0; }

/* ── Invoice tab ─────────────────────────────────────────────────── */
.inv-container { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 720px; }
.inv-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--rd-lg, 10px); padding: var(--sp-3);
}
.inv-hint { font-size: var(--fs-sm); color: var(--text-muted); margin: 0 0 var(--sp-3); }
.inv-generate-row { display: flex; gap: var(--sp-2); align-items: center; }
.inv-select {
  flex: 1; max-width: 220px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-opaque); color: var(--text-primary);
}
.inv-select option { background: var(--surface-opaque); color: var(--text-primary); }
.inv-btn { padding: 8px 16px; border-radius: 8px; cursor: pointer;
  border: none; background: var(--accent, hsl(var(--h-indigo), 70%, 55%)); color: #fff; font-weight: 600; }
.inv-btn:disabled { opacity: .6; cursor: not-allowed; }
.inv-btn-sm { padding: 5px 12px; border-radius: 6px; cursor: pointer;
  border: none; background: var(--surface-opaque); color: var(--text-primary);
  text-decoration: none; font-size: var(--fs-sm); }
.inv-btn-sm:hover { background: var(--bg-card-hover); }
.inv-result { margin-top: var(--sp-2); font-size: var(--fs-sm); }
.inv-result.inv-ok { color: var(--st-ok, #4caf50); }
.inv-result.inv-err { color: var(--st-serious, #f44336); }
.inv-success { font-weight: 600; margin-bottom: var(--sp-2); }
.inv-sums { display: flex; flex-direction: column; gap: 2px; }
.inv-sum { display: flex; justify-content: space-between; max-width: 360px;
  font-variant-numeric: tabular-nums; }
.inv-sum span { color: var(--text-muted); text-transform: capitalize; }
.inv-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.inv-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: var(--sp-2); border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-opaque);
}
.inv-row-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inv-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row-meta { font-size: var(--fs-xs); color: var(--text-muted); }

/* ── Coding Agent tab ──────────────────────────────────────────────── */
.coding-intro { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1);
  margin-bottom: var(--sp-2); }
.coding-intro-sub { font-size: var(--fs-xs); color: var(--text-muted); }
.coding-intro-sub.is-warn { color: #e74c3c; }
.coding-section-title { font-size: var(--fs-md); font-weight: 650; margin: var(--sp-2) 0 var(--sp-1); }
.coding-form { display: flex; flex-direction: column; gap: var(--sp-2); }
.coding-field { display: flex; flex-direction: column; gap: 4px; }
.coding-field label { font-size: var(--fs-xs); color: var(--text-secondary); font-weight: 650; }
.coding-field select, .coding-field input[type="text"], .coding-field textarea {
  background: var(--surface-opaque); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  font: inherit; width: 100%; box-sizing: border-box; }
.coding-field select:focus, .coding-field input:focus, .coding-field textarea:focus {
  border-color: var(--border-active); outline: none; }
.coding-field textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
.coding-pill { display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: var(--fs-xs); }
.coding-pill:has(input:checked) { border-color: var(--border-active); background: var(--surface-opaque); }
.coding-btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--border); background: var(--surface-opaque); color: var(--text-primary);
  border-radius: 8px; padding: 7px 12px; font: inherit; font-size: var(--fs-xs); font-weight: 650;
  cursor: pointer; text-decoration: none; }
.coding-btn:hover { border-color: var(--border-active); }
.coding-btn:disabled { opacity: .5; pointer-events: none; }
.coding-btn--primary { background: var(--text-accent); border-color: var(--text-accent); color: #111; }
.coding-btn--danger { border-color: #c0392b; color: #e74c3c; }
.coding-btn--ghost { border-color: transparent; background: transparent; color: var(--text-muted); padding: 4px 6px; }
.coding-btn--ghost:hover { color: #e74c3c; border-color: transparent; }
.coding-actions { display: flex; flex-wrap: wrap; gap: var(--sp-1); align-items: center; }
.coding-msg { background: var(--surface-opaque); border: 1px solid var(--border); border-radius: 8px;
  padding: var(--sp-2); margin-top: var(--sp-1); }
.coding-msg .role { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 700;
  text-transform: uppercase; }
.coding-msg .body { font-size: var(--fs-xs); line-height: 1.5; margin-top: 4px; color: var(--text-secondary); }
.coding-plan { white-space: pre-wrap; font-size: var(--fs-xs); line-height: 1.5; color: var(--text-secondary);
  background: var(--surface-opaque); border: 1px solid var(--border); border-radius: 8px;
  padding: var(--sp-2); margin: 0; overflow: auto; max-height: 320px; }
.coding-diff { white-space: pre-wrap; font-size: 11px; line-height: 1.5; color: var(--text-muted);
  background: #0c0e13; border: 1px solid var(--border); border-radius: 8px; padding: var(--sp-2);
  margin: 0; max-height: 320px; overflow: auto; }
.coding-file { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px;
  color: var(--text-secondary); padding: 2px 0; }
.coding-file-open { color: var(--text-accent); margin-left: 6px; }
.coding-q { border: 1px solid #b7950b; border-radius: 8px; padding: var(--sp-2); margin-top: var(--sp-1);
  background: rgba(183, 149, 11, .08); }
.coding-q pre { white-space: pre-wrap; font-size: 10px; color: var(--text-muted);
  margin: 4px 0 8px; max-height: 120px; overflow: auto; }
.coding-hint { font-size: var(--fs-xs); color: var(--text-muted); padding: var(--sp-1) 0; }
.coding-repo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-2); margin-bottom: var(--sp-2); }
.coding-repo-card { border: 1px solid var(--border); border-radius: 8px; padding: var(--sp-2);
  cursor: pointer; background: var(--surface-opaque); }
.coding-repo-card:hover, .coding-repo-card.is-repo-selected { border-color: var(--text-accent); }
.coding-repo-card.is-repo-selected { box-shadow: 0 0 0 1px var(--text-accent) inset; }
.coding-type-label { font-size: var(--fs-xs); color: var(--text-muted); }
.coding-type-btn { border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  font: inherit; font-size: var(--fs-xs); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.coding-type-btn.is-active { background: var(--text-accent); border-color: var(--text-accent); color: #111; font-weight: 700; }
.coding-type-muted { font-size: var(--fs-xs); color: var(--text-muted); }
.coding-repo-name { font-weight: 650; font-size: var(--fs-sm); margin-bottom: 4px; }
.coding-repo-meta { font-size: var(--fs-xs); color: var(--text-muted); word-break: break-all; }
.coding-job-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  border: 1px solid var(--border); border-radius: 8px; padding: var(--sp-2); margin-bottom: var(--sp-1);
  cursor: pointer; }
.coding-job-row:hover, .coding-job-row.is-selected { border-color: var(--border-active); }
.coding-job-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.coding-job-id { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; font-weight: 650; }
.coding-job-meta { font-size: var(--fs-xs); color: var(--text-muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.coding-detail-card .card-body { display: flex; flex-direction: column; gap: var(--sp-2); }

.coding-terminal-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2); border-bottom: 1px solid var(--border); }
.coding-term-title { font-weight: 650; }
.coding-term-sub { font-size: var(--fs-xs); color: var(--text-muted); word-break: break-all;
  flex: 1 1 100%; }
.coding-mode-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden; }
.coding-mode-toggle .coding-type-btn { border: none; border-radius: 0; padding: 4px 10px; }
.coding-stream { display: flex; flex-direction: column; gap: var(--sp-1);
  max-height: 46vh; overflow-y: auto; padding: 2px; }
.coding-collapse { border: 1px solid var(--border); border-radius: 8px; padding: var(--sp-1) var(--sp-2); }
.coding-collapse summary { cursor: pointer; font-size: var(--fs-xs); color: var(--text-secondary);
  font-weight: 650; }
.coding-input { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; line-height: 1.5;
  min-height: 88px; resize: vertical; padding: 8px; }
.coding-files-list { margin-top: var(--sp-1); display: flex; flex-direction: column; gap: 2px; }
.coding-repo-card { cursor: pointer; }
.coding-repo-card:hover { transform: translateY(-1px); box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.coding-progress { font-size: var(--fs-xs); color: var(--text-accent); font-weight: 600;
  padding: 4px 0; }
.coding-live { border-left: 3px solid var(--text-accent); opacity: .95; }
.coding-live .role { color: var(--text-accent); }
.coding-preview-bar { display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2); margin-bottom: var(--sp-2); border: 1px solid
  var(--border); border-radius: var(--radius); background: var(--bg-soft); flex-wrap: wrap; }
.coding-preview-bar .coding-link { font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--text-accent); word-break: break-all; }

/* ── MODEL ROUTING (tab-settings.js) ── */
.settings-wrap { max-width: 1040px; }

/* toolbar */
.settings-toolbar { display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap; margin: var(--sp-3) 0; }
.settings-title h2 { font-size: 1.3rem; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
.settings-sub { font-size: 13px; color: var(--text-secondary); margin: 0; line-height: 1.45; }
.settings-tool-actions { display: flex; align-items: flex-end; gap: var(--sp-2); flex-wrap: wrap; }

/* fields (label above control) */
.settings-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px;
  color: var(--text-secondary); }
.settings-field > span { line-height: 1; }
.settings-field select {
  background: #000; color: #fff; border: 1px solid var(--border-active);
  border-radius: var(--radius-xs); padding: 7px 10px; font-size: 13px;
  color-scheme: dark; min-width: 130px; }
.settings-field select option { background: #000; color: #fff; }
.settings-field--ws select { min-width: 130px; }
.settings-field--inline { flex-direction: row; align-items: center; gap: 8px; }

/* bulk panel */
.settings-bulk { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-glass); padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
.settings-bulk-info { font-size: 13px; color: var(--text-secondary); }
.settings-bulk-target { font-family: var(--font-mono); color: #FFD97A; }

/* capability filter chips */
.settings-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin: 0 0 var(--sp-3); }
.settings-chips .chip { font-size: 13px; padding: 6px 14px; color: #fff; background: #000;
  border-color: var(--border-active); }
.settings-chips .chip.is-active { color: #14151F; background: #FFD97A; border-color: #FFD97A; }

/* group panels */
.settings-group { border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); margin-bottom: var(--sp-2); overflow: hidden; }
.settings-group-head { display: flex; align-items: baseline; gap: var(--sp-2); width: 100%;
  background: none; border: none; padding: 10px 14px; cursor: pointer; color: var(--text-primary);
  font-family: var(--sans); text-align: left; }
.settings-group-head:hover { background: var(--bg-glass); }
.settings-group-name { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.settings-group-count { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted);
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 8px; }
.settings-group-desc { font-size: 12.5px; color: var(--text-muted); }
.settings-chev { margin-left: auto; color: var(--text-muted); font-size: 12px; }

/* rows */
.settings-row { display: grid; grid-template-columns: minmax(220px, 1.2fr) auto minmax(140px, 1fr) auto;
  align-items: center; gap: var(--sp-2) var(--sp-3); padding: 8px 14px; cursor: pointer;
  border-top: 1px solid var(--border); }
.settings-row:hover { background: var(--bg-glass); }
.settings-row:focus-visible { outline: 2px solid rgba(232, 184, 74, 0.6); outline-offset: -2px; }
.settings-row-name { display: flex; align-items: center; gap: var(--sp-2); min-width: 0;
  font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.settings-pill { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted);
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-xs);
  padding: 1px 6px; white-space: nowrap; }
.settings-route { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono);
  font-size: 13.5px; white-space: nowrap; }
.settings-route-prov { color: #fff; }
.settings-route-arrow { color: rgba(232, 184, 74, 0.55); }
.settings-route-model { color: #FFD97A; }
.settings-row-meta { font-size: 12px; color: var(--text-muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.settings-row-side { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }

/* source dots */
.settings-source { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
  color: var(--text-secondary); text-transform: lowercase; }
.settings-source::before { content: ''; width: 8px; height: 8px; border-radius: 50%; }
.settings-source.dot-module::before { background: #E8B84A; }
.settings-source.dot-workspace::before { background: hsl(var(--h-violet), 70%, 75%); }
.settings-source.dot-capability::before { background: hsl(210, 90%, 65%); }
.settings-source.dot-system::before { background: var(--text-muted); }
.settings-source.dot-env::before { background: hsl(var(--h-emerald), 70%, 55%); }
.settings-source.dot-none::before { background: var(--text-muted); }

/* switch */
.settings-switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.settings-switch input { accent-color: #E8B84A; width: 15px; height: 15px; cursor: pointer; }
.settings-switch-label { font-size: 11.5px; color: var(--text-secondary); font-family: var(--font-mono); }

/* editor */
.settings-editor { border-top: 1px dashed var(--border); background: rgba(255, 255, 255, 0.015);
  padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.settings-editor-route { display: inline-flex; align-items: center; gap: 8px;
  align-self: flex-start; font-family: var(--font-mono); font-size: 13.5px;
  background: rgba(232, 184, 74, 0.06); border: 1px solid rgba(232, 184, 74, 0.25);
  border-radius: var(--radius-xs); padding: 6px 12px; }
.settings-editor-route-key { font-family: var(--sans); font-size: 11.5px;
  color: rgba(232, 184, 74, 0.7); }
.settings-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 14px; }
.settings-editor-actions { display: flex; gap: var(--sp-2); justify-content: flex-end;
  flex-wrap: wrap; }

/* buttons */
.btn-settings { appearance: none; font-family: var(--sans); font-size: 13px; font-weight: 600;
  background: #000; color: #fff; border: 1px solid var(--border-active); border-radius: var(--radius-xs);
  padding: 7px 14px; cursor: pointer; }
.btn-settings:hover { border-color: #fff; }
.btn-settings:focus-visible { outline: 2px solid rgba(232, 184, 74, 0.6); outline-offset: 2px; }
.btn-settings:disabled { opacity: .5; cursor: default; }
.btn-settings--primary { background: #fff; border-color: #fff; color: #14151F; }
.btn-settings--primary:hover { background: #e9e9f0; border-color: #e9e9f0; }
.btn-settings--test { border-color: rgba(232, 184, 74, 0.5); color: #FFD97A; background: rgba(232, 184, 74, 0.08); }
.btn-settings--test:hover { border-color: #E8B84A; }
.btn-settings--ghost { background: none; border-color: transparent; color: var(--text-secondary); }
.btn-settings--ghost:hover { border-color: var(--border-active); color: var(--text-primary); }

/* test result */
.settings-result { font-family: var(--font-mono); font-size: 12.5px; align-self: stretch; }
.settings-result-ok { color: var(--st-good); }
.settings-result-bad { color: var(--st-serious); }

@media (max-width: 760px) {
  .settings-row { grid-template-columns: 1fr auto; }
  .settings-row-meta { display: none; }
  .settings-toolbar { align-items: flex-start; }
}

/* ═══════════════════════════════════════════════════════════════════
   Transactions tab
   ═══════════════════════════════════════════════════════════════════ */
.tx-container { display: flex; flex-direction: column; gap: var(--sp-3); }
.tx-header { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; justify-content: space-between; }
.tx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tx-chip {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 5px 12px; font-size: var(--fs-sm); cursor: pointer; color: var(--text-secondary);
  transition: background .12s, border-color .12s;
}
.tx-chip:hover { background: var(--bg-hover); }
.tx-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.tx-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tx-select {
  background: #000; color: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 5px 10px; font-size: var(--fs-sm);
}
.tx-date { color-scheme: dark; }
.tx-dates { display: inline-flex; align-items: center; gap: 6px; }
.tx-dates[hidden] { display: none; }
.tx-range-hint { color: var(--text-muted); font-size: var(--fs-sm); padding: 0 0 var(--sp-2); }
.tx-btn-primary { background: var(--accent); color: #fff; border: none; border-radius: var(--radius); padding: 6px 14px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.tx-btn-primary:hover { filter: brightness(1.15); }
.tx-btn-outline { background: transparent; color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 14px; font-size: var(--fs-sm); cursor: pointer; }
.tx-btn-outline:hover { border-color: var(--accent); }
.tx-body { display: flex; flex-direction: column; gap: var(--sp-3); }
.tx-progress { width: 100%; height: 3px; border-radius: 2px; background: rgba(255,255,255,.06); overflow: hidden; }
.tx-progress[hidden] { display: none; }
.tx-progress-bar { width: 40%; height: 100%; background: var(--accent); border-radius: 2px; animation: tx-slide 1s ease-in-out infinite; }
@keyframes tx-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
.tx-loading { color: var(--text-muted); padding: var(--sp-3); }
.tx-error { color: var(--st-serious); padding: var(--sp-3); }
.tx-empty { color: var(--text-muted); padding: var(--sp-2); font-style: italic; }

.tx-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.tx-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; text-align: left; min-width: 0; }
.tx-stat-label { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
.tx-stat-value { font-size: clamp(1rem, 1.4vw, 1.25rem); font-weight: 700; margin-top: 3px; font-family: var(--font-mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tx-pos { color: var(--st-good); }
.tx-neg { color: var(--st-serious); }

.tx-review-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.tx-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: var(--fs-xs); font-weight: 600; }
.tx-badge-warn { background: rgba(255,170,0,.15); color: var(--st-warn); }
.tx-badge-info { background: rgba(0,150,255,.12); color: var(--st-info, #5b9bd5); }
.tx-badge-good { background: rgba(0,180,80,.12); color: var(--st-good); }
.tx-badge-muted { background: rgba(150,150,150,.12); color: var(--text-muted); }
.tx-badge-serious { background: rgba(255,70,50,.12); color: var(--st-serious); }

.tx-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-3); }
.tx-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tx-card-title { font-size: var(--fs-md); font-weight: 700; margin: 0; }

.tx-row { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,.06)); }
.tx-row:last-child { border-bottom: none; }
.tx-row-main { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tx-row-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-row-amount { font-family: var(--font-mono); font-weight: 700; white-space: nowrap; }
.tx-row-meta { display: flex; gap: 8px; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.tx-row-nature { text-transform: capitalize; }

.tx-transfer-row { display: flex; align-items: center; gap: 8px; }
.tx-arrow { color: var(--text-muted); font-size: 1.1em; }

.tx-review-row { display: flex; flex-direction: column; gap: 6px; }
.tx-review-info { display: flex; justify-content: space-between; align-items: center; }
.tx-review-actions { overflow: hidden; }
.tx-status-inner { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.tx-btn-sm { padding: 4px 10px; font-size: var(--fs-xs); border-radius: var(--radius); cursor: pointer; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary); }
.tx-btn-skip:hover { border-color: var(--text-muted); }
.tx-btn-cat:hover { border-color: var(--accent); background: rgba(255,170,0,.1); }

.tx-account-alias { font-weight: 600; }
.tx-account-provider { color: var(--text-muted); }
.tx-account-masked { font-family: var(--font-mono); color: var(--text-muted); }

.tx-import-kind { font-weight: 500; }
.tx-import-state { margin-left: auto; }
.tx-import-date { font-size: var(--fs-xs); color: var(--text-muted); }

.tx-rule-pattern { font-family: var(--font-mono); color: var(--accent); }
.tx-count { color: var(--text-muted); font-size: var(--fs-xs); }
.tx-amount { font-family: var(--font-mono); font-weight: 600; }

/* ── transaction table ─────────────────────────────────────────── */
.tx-table-wrap { overflow-x: auto; margin: 0 calc(var(--sp-3) * -1) calc(var(--sp-3) * -1); }
/* fixed layout: stable columns keep their width, Description wraps and gets
   the largest remaining share, and the table can never outgrow its container
   (no horizontal scroll on desktop) */
.tx-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.tx-col-date    { width: 14%; }
.tx-col-desc    { width: 25%; }
.tx-col-account { width: 9%; }
.tx-col-cat     { width: 21%; }
.tx-col-amount  { width: 15%; }
.tx-col-status  { width: 16%; }
.tx-table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--bg-card);
  text-align: left; font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
  padding: 10px 12px 8px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tx-table td { padding: 9px 12px; border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,.06)); vertical-align: top; }
.tx-table tbody tr:last-child td { border-bottom: none; }
.tx-table tbody tr:hover td { background: var(--bg-hover); }

.tx-th-amount, .tx-td-amount { text-align: right; }
.tx-th-status, .tx-td-status { text-align: right; }
.tx-td-date {
  white-space: nowrap; color: var(--text-secondary);
  font-variant-numeric: tabular-nums; font-size: var(--fs-xs);
}

/* description: wraps naturally so the row grows; only long unbroken IDs/text
   actually break anywhere */
.tx-td-desc { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.tx-desc-main { min-width: 0; line-height: 1.35; }
.tx-desc-sub {
  display: block; margin-top: 2px;
  font-size: var(--fs-xxs, 11px); color: var(--text-muted);
  white-space: normal; overflow-wrap: anywhere;
}

/* confidence dot */
.tx-conf {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle; flex: none;
}
.tx-conf-high   { background: var(--pos, #34d399); }
.tx-conf-medium { background: var(--warn, #f59e0b); }
.tx-conf-low    { background: var(--danger, #ef4444); }
.tx-conf-none   { background: var(--text-muted, #828282); }

/* category cell stays a table-cell (the flex row lives on the inner wrapper,
   so the column aligns with its header) */
.tx-td-cat { overflow: hidden; }
.tx-cat-wrap { display: flex; align-items: center; min-width: 0; }
.tx-cat {
  flex: 1 1 auto; width: 100%; min-width: 0;
  padding: 4px 8px;
  font-size: var(--fs-xs); font-weight: 550;
  color: #fff;
  background: #000;
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
}
.tx-cat option { background: #000; color: #fff; }
.tx-cat:hover { border-color: var(--border); background: #000; }
.tx-cat:focus { border-color: var(--accent); outline: none; }
.tx-cat-new { min-width: 180px; font-weight: 400; color: #fff; background: #000; }
.tx-cat-new::placeholder { color: rgba(255, 255, 255, 0.45); }

.tx-td-wallet, .tx-td-status { white-space: nowrap; }
.tx-td-amount { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tx-wallet {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-xs); font-weight: 650; letter-spacing: .02em;
  color: var(--text-secondary);
}
.tx-wallet-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.07); }

@media (max-width: 1100px) {
  /* tablet: 6 summary cards -> 3 per row */
  .tx-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  /* small tablet/narrow: each transaction becomes a stacked card instead of a
     squeezed table, so every column stays readable (label + value per line) */
  .tx-table-wrap { overflow: visible; margin: 0; }
  .tx-table, .tx-table tbody, .tx-table tr, .tx-table td { display: block; width: 100%; }
  .tx-table colgroup, .tx-table thead { display: none; }
  .tx-table tr {
    border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 10px; padding: 10px 12px; background: var(--bg-card);
  }
  .tx-table tr:last-child { margin-bottom: 0; }
  .tx-table td {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; padding: 3px 0; border: none; text-align: right;
  }
  .tx-table td::before {
    content: attr(data-label); flex: none;
    font-size: var(--fs-xs); color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .05em; text-align: left;
  }
  .tx-td-desc { display: block; }
  .tx-td-desc::before { display: none; }
  .tx-td-desc .tx-desc-main { font-weight: 600; }
  .tx-td-cat { align-items: center; }
  .tx-cat-wrap { flex: 1 1 auto; justify-content: flex-end; }
  .tx-cat { max-width: 70%; }
}

@media (max-width: 760px) {
  .tx-header { flex-direction: column; align-items: stretch; }
  .tx-actions { flex-wrap: wrap; }
  /* mobile: 3 summary cards -> 2 per row */
  .tx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tx-row-main { flex-direction: column; align-items: flex-start; gap: 2px; }
  .tx-review-row { padding: 10px 0; }
  .tx-btn-sm { padding: 10px 16px; font-size: var(--fs-sm); }
}

@media (max-width: 380px) {
  /* very small screens: one summary card per row */
  .tx-stats { grid-template-columns: minmax(0, 1fr); }
}

/* ═══════════════════════════════════════════
   MANUAL ENTRY MODAL (transactions tab)
   ═══════════════════════════════════════════ */
.tx-modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
}
.tx-modal-card {
  width: min(460px, 100%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-active);
  border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  padding: var(--sp-5);
  max-height: 92vh;
  overflow-y: auto;
}
.tx-modal-card h3 {
  margin: 0 0 var(--sp-4);
  font-size: var(--fs-md);
  font-weight: 650;
}
.tx-form { display: flex; flex-direction: column; gap: var(--sp-3); }
.tx-form-row {
  display: flex; flex-direction: column; gap: 4px;
  font-size: var(--fs-xs); color: var(--text-secondary);
}
.tx-form-row select, .tx-form-row input {
  font: inherit; font-size: var(--fs-sm);
  color: #fff;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 7px 9px;
  outline: none;
}
.tx-form-row select:focus, .tx-form-row input:focus { border-color: var(--border-active); }
.tx-form-row select option { background: #000; color: #fff; }
.tx-newcat {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2);
}
.tx-newcat input {
  font: inherit; font-size: var(--fs-sm);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 7px 9px;
  outline: none;
}
.tx-newcat input::placeholder { color: var(--text-muted); }
.tx-newcat input:focus { border-color: var(--border-active); }
.tx-form-actions {
  display: flex; justify-content: flex-end; gap: var(--sp-2);
  margin-top: var(--sp-2);
}

/* ── statement upload (GoPay / BCA / BNI) ─────────────────────────── */
.tx-up-hint {
  font-size: var(--fs-xs); color: var(--text-muted);
  min-height: 1.2em;
}
.tx-up-drop {
  border: 1px dashed var(--border-active);
  border-radius: var(--radius-xs);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.tx-up-drop:hover { background: var(--bg-hover); border-color: var(--accent); }
.tx-up-drop-label {
  font-size: var(--fs-sm); color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* full-screen progress lock while the upload processes */
.tx-upload-lock {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  cursor: wait;
}
.tx-upload-card {
  width: min(420px, 100%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-active);
  border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  padding: var(--sp-5);
  text-align: center;
}
.tx-upload-title { font-size: var(--fs-md); font-weight: 650; margin-bottom: 14px; }
.tx-upload-track {
  height: 8px; border-radius: 999px;
  background: var(--bg-input, rgba(255,255,255,.08));
  overflow: hidden;
}
.tx-upload-bar {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  transition: width .3s ease;
}
.tx-upload-sub {
  margin-top: 12px;
  font-size: var(--fs-xs); color: var(--text-muted);
}

/* ── all-transactions pager ─────────────────────────────────────────── */
.tx-pager {
  display: flex; align-items: center; gap: var(--sp-2);
  margin-top: var(--sp-3); padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.tx-pager-info {
  font-size: var(--fs-xs); color: var(--text-muted);
}
.tx-pager-size {
  font: inherit; font-size: var(--fs-sm);
  color: #fff;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 5px 8px; outline: none;
}
.tx-pager-size:focus { border-color: var(--border-active); }
.tx-pager-size option { background: #000; color: #fff; }

/* ── finance overview (transactions) ───────────────────────────────── */
.tx-stat-sub { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.tx-num { text-align: right; font-variant-numeric: tabular-nums; }
.tx-muted { color: var(--text-muted); }
.ov-move {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: var(--fs-sm); color: var(--text-muted);
  padding: 2px 2px 0;
}
.ov-move b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.ov-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ov-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-muted); cursor: pointer; }
.ov-toggle input { accent-color: var(--accent); }
.ov-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ov-chip {
  font: inherit; font-size: var(--fs-xs);
  color: var(--text); background: transparent;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 10px; cursor: pointer;
}
.ov-chip:hover { background: var(--bg-hover); }
.ov-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.ov-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.ov-bars { display: block; width: 100%; height: auto; }
.ov-bars g[data-drill]:hover rect { filter: brightness(1.25); }
.ov-donut-wrap { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.ov-legend { flex: 1 1 180px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ov-legend-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: var(--radius-xs);
  cursor: pointer; font-size: var(--fs-sm);
}
.ov-legend-row:hover { background: var(--bg-hover); }
.ov-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.ov-legend-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-legend-val { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ov-mom-row { cursor: pointer; }
.ov-mom-row:hover td { background: var(--bg-hover); }
.ov-allfilters { display: inline-flex; align-items: center; gap: 8px; }
@media (max-width: 900px) {
  .ov-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ═══════════════════════════════════════════
   TRADING BRAIN TAB (📈)
   ═══════════════════════════════════════════ */
.trading-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3);
}
.trading-title { margin: 0 0 var(--sp-1); font-size: var(--fs-lg); }
.trading-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-muted); font-size: var(--fs-xs); }
.trading-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--sp-3); }
.trading-chip {
  font-size: var(--fs-xs); padding: 3px 9px; border-radius: 999px;
  background: var(--bg-hover); border: 1px solid var(--border); color: var(--text-secondary);
}
.trading-chip.is-dim { color: var(--text-muted); }
.trading-prose-line { margin: 0 0 6px; line-height: 1.55; color: var(--text-secondary); }
.trading-prose-line.is-bullet { padding-left: 14px; position: relative; }
.trading-prose-line.is-bullet::before { content: '•'; position: absolute; left: 2px; color: var(--text-muted); }
.table-scroll { overflow-x: auto; }
.trading-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.trading-table th {
  text-align: left; color: var(--text-muted); font-weight: 600; font-size: var(--fs-xs);
  letter-spacing: 0.04em; text-transform: uppercase; padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.trading-table td { padding: 5px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.trading-table tbody tr:hover td { background: var(--bg-hover); }
.trading-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.trading-table .nowrap { white-space: nowrap; }
.trading-sub { color: var(--text-muted); font-weight: 400; text-transform: none; }
.trading-metric { font-weight: 600; }
.trading-winner {
  font-size: var(--fs-xs); font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-hover); border: 1px solid var(--border-active); color: var(--text-primary);
}
.trading-pos { color: var(--st-good); font-weight: 600; }
.trading-neg { color: var(--st-serious); font-weight: 600; }
