/* Sericana console. Look and feel after three references Iosif picked:
   - the shell and element shapes of an IVR call-centre dashboard (a dark icon rail whose active item
     sits in a white circle, pastel stat cards with white "Check" pills, rows as white rounded strips);
   - the soft, frosted feel of a customer-journey CRM (grey-blue backdrop, big rounded panels, round
     icon buttons, black pills for what's active, bold titles);
   - the agent colours of a SaaS dashboard (indigo, blue, teal) for everything per-agent.
   One toggle (auto / light / dark, html[data-theme]) re-skins all of it. */
@font-face { font-family: "Outfit"; font-weight: 100 900; font-display: swap; src: url("fonts/outfit-latin.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 100 900; font-display: swap; src: url("fonts/hanken-grotesk-latin.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 300 700; font-display: swap; src: url("fonts/space-grotesk-latin.woff2") format("woff2"); }

:root {
  --backdrop: #CBD9E6;
  --bg: #F5F5F5;
  --panel: rgba(255, 255, 255, 0.35);
  --aside: rgba(38, 54, 96, 0.07);
  --ground: linear-gradient(180deg, #DDE2EA 0%, #D4DBE7 55%, #CAD4E8 100%);
  --pill-grey: #DEDEDE; --pill-grey-ink: #4A4A4F; --solid-bar: #D6D6D6; --rim: #E6E6E6;
  --panel-edge: rgba(255, 255, 255, 0.35);
  --sheet: #FFFFFF;
  --sheet-2: #F1F1F2;
  --ink: #1C1C1E;
  --ink-2: #414147;
  --muted: #5F6068;
  --hairline: #E5E5E8;
  --logo-bg: #CBD9E6;
  --rail: #2D2D2F;
  --rail-ink: #9EA1A8;
  --accent-a: #4F5BD5;
  --accent-b: #1FBFAE;
  --crimson: #DE2D5E;
  --warn-bg: #FCEBD9;
  --warn-ink: #9A4A10;
  --danger: #D9485A;
  --ok: #2E9D6B;
  --on-ink: #FFFFFF;
  --agent-violet: #584CCC;
  --agent-blue: #4796FE;
  --agent-green: #16C8C7;
  --agent-amber: #E9A23B;
  --p-lilac: #E3D6E8;
  --p-blue: #CBD9E6;
  --p-blue-strong: #B9CCE8;
  --p-yellow: #F6D476;
  --p-peach: #F3D3BF;
  --p-mint: #CFEAE2;
  --p-ink: #1C1D21;
  --shadow: 0 1px 2px rgba(28, 33, 45, 0.05), 0 10px 30px rgba(28, 33, 45, 0.07);
  --shadow-soft: 0 1px 2px rgba(28, 33, 45, 0.05), 0 4px 14px rgba(28, 33, 45, 0.06);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --f-display: "Outfit", system-ui, sans-serif;
  --f-body: "Outfit", system-ui, sans-serif;
  --f-label: "Outfit", system-ui, sans-serif;
  --f-mono: "Space Grotesk", ui-monospace, monospace;
  --r-frame: 40px;
  --r-panel: 40px;
  --r-card: 18px;
  --rail-w: 117px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --backdrop: #1A1C21; --bg: #16171B; --aside: #1C1E23; --ground: linear-gradient(180deg, #17181C 0%, #1A1D23 100%); --pill-grey: #33363D; --pill-grey-ink: #E6E7EA; --solid-bar: #3A3D44; --rim: #2E3138; --panel: rgba(255, 255, 255, 0.04); --panel-edge: rgba(255, 255, 255, 0.07);
    --sheet: #1F2126; --sheet-2: #272A30; --ink: #F2F3F5; --ink-2: #CACDD3; --muted: #8E929B; --hairline: #2E3138;
    --rail: #0A0B0D; --rail-ink: #7F838B; --logo-bg: #2B3644; --accent-a: #8B93F7; --accent-b: #4FD8C8; --crimson: #F0507C;
    --warn-bg: #3B2A1A; --warn-ink: #F6C391; --danger: #FF7B8A; --ok: #5FD39E; --on-ink: #16171B;
    --agent-violet: #8E83FF; --agent-blue: #6AA8FF; --agent-green: #4FD8C8; --agent-amber: #F2BC63;
    --p-lilac: #3A3248; --p-blue: #2B3644; --p-blue-strong: #2B3644; --p-yellow: #4A3D1C; --p-peach: #47342A; --p-mint: #22403A; --p-ink: #F2F3F5;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35); --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --backdrop: #1A1C21; --bg: #16171B; --aside: #1C1E23; --ground: linear-gradient(180deg, #17181C 0%, #1A1D23 100%); --pill-grey: #33363D; --pill-grey-ink: #E6E7EA; --solid-bar: #3A3D44; --rim: #2E3138; --panel: rgba(255, 255, 255, 0.04); --panel-edge: rgba(255, 255, 255, 0.07);
  --sheet: #1F2126; --sheet-2: #272A30; --ink: #F2F3F5; --ink-2: #CACDD3; --muted: #8E929B; --hairline: #2E3138;
  --rail: #0A0B0D; --rail-ink: #7F838B; --logo-bg: #2B3644; --accent-a: #8B93F7; --accent-b: #4FD8C8; --crimson: #F0507C;
  --warn-bg: #3B2A1A; --warn-ink: #F6C391; --danger: #FF7B8A; --ok: #5FD39E; --on-ink: #16171B;
  --agent-violet: #8E83FF; --agent-blue: #6AA8FF; --agent-green: #4FD8C8; --agent-amber: #F2BC63;
  --p-lilac: #3A3248; --p-blue: #2B3644; --p-blue-strong: #2B3644; --p-yellow: #4A3D1C; --p-peach: #47342A; --p-mint: #22403A; --p-ink: #F2F3F5;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35); --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  /* flow-root keeps .app's top margin inside the body; otherwise every page scrolls by 14px with nothing to show. */
  display: flow-root;
  min-height: 100vh;
  background: var(--backdrop);
  color: var(--ink);
  font: 400 15.5px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
}

h1 { font: 600 clamp(28px, 3vw, 34px)/1.1 var(--f-display); letter-spacing: -0.01em; margin: 0 0 6px; }
.lede { font-size: 17px; color: var(--ink-2); margin: 0 0 24px; }
.label { font: 500 13.5px/1.4 var(--f-label); color: var(--muted); margin: 0 0 8px; }
.muted { color: var(--muted); margin: 0; }
.mono { font-family: var(--f-mono); font-size: 13px; }
.big { font: 600 44px/1 var(--f-display); margin: 4px 0 8px; letter-spacing: -0.02em; }
.bad { color: var(--danger) !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ico { display: block; flex: none; }
:focus-visible { outline: 2px solid var(--accent-a); outline-offset: 3px; }

.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 19px/1 var(--f-display); }
.wordmark img { display: block; width: 30px; height: 30px; padding: 5px; border-radius: 50%; background: var(--rail); }

/* Panels: the frosted CRM surface. Cards inside them are solid. */
.sheet { background: var(--panel); border: 1px solid var(--panel-edge); border-radius: var(--r-panel); box-shadow: none; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }

.center { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: min(440px, 100%); padding: 34px; background: var(--sheet); }
.login .wordmark { margin-bottom: 36px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--ink); color: var(--on-ink); text-decoration: none;
  font: 600 14.5px/1 var(--f-body); padding: 13px 20px; border-radius: 999px; border: 0; cursor: pointer;
  transition: transform 0.2s var(--ease), opacity 0.2s;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.97); }
.btn-quiet { background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hairline); }
.btn-quiet:hover { opacity: 1; box-shadow: inset 0 0 0 1px var(--ink); }
.circle-btn { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 0; background: var(--sheet); color: var(--ink); cursor: pointer; text-decoration: none; transition: transform 0.2s var(--ease); }
/* CRM panel tools: big round outline buttons with thin-line icons */
.ring-btn { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent); cursor: pointer; text-decoration: none; }
.ring-btn:hover { background: var(--sheet); }
.circle-btn:hover { transform: translateY(-1px); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hairline); font: 600 13px/1 var(--f-body); text-decoration: none; white-space: nowrap; }
.pill:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.pill[aria-current="true"], .pill-dark { background: var(--ink); color: var(--on-ink); box-shadow: none; }

.notice { padding: 12px 16px; border-radius: 14px; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--hairline); margin: 0 0 16px; font-size: 15px; }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); box-shadow: none; }

.link { background: none; border: 0; padding: 6px 0; color: var(--ink); font: 600 14px/1 var(--f-body); cursor: pointer; text-decoration: underline; text-decoration-color: var(--hairline); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.link:hover { text-decoration-color: var(--ink); }
a.link { display: inline-flex; align-items: center; gap: 4px; }
.more { margin-top: 12px; }

/* ---------- app frame: dark icon rail + soft content area ---------- */
/* Measured from the IVR reference: a 117 px charcoal rail (#2D2D2F) inside a 40 px-radius frame; a
   56 px light-blue logo disc; 52 px items 74 px apart; solid white glyphs, the active one dark inside a
   white circle; the light content card overlaps the rail with its own rounded left corners. */
.app {
  display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr);
  margin: 14px; min-height: calc(100vh - 28px); border-radius: var(--r-frame); overflow: clip;
  background: var(--rail);
  box-shadow: 0 30px 80px rgba(28, 33, 45, 0.14);
}
.rail {
  position: sticky; top: 14px; height: calc(100vh - 28px); z-index: 20;
  display: flex; flex-direction: column; align-items: center; gap: 40px; padding: 28px 0 28px;
}
.rail-logo { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--logo-bg); color: #2D2D2F; margin-bottom: 35px; }
:root[data-theme="dark"] .rail-logo { color: #CBD9E6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rail-logo { color: #CBD9E6; } }
.rail-logo img { width: 30px; height: 30px; display: block; }
.rail-links, .rail-foot { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.rail-foot { margin-top: auto; gap: 14px; }
.rail-foot form { margin: 0; }
.rail-link {
  position: relative; width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 50%; border: 0; background: none; color: #FFFFFF; cursor: pointer; text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}
.rail-link .ico { width: 26px; height: 26px; }
.rail-link:hover { background: rgba(255, 255, 255, 0.1); }
.rail-link[aria-current="page"] { background: #FFFFFF; color: #2D2D2F; }
.rail-link[aria-current="page"] .ico { width: 28px; height: 28px; }
.rail-link[data-tip]::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translate(-4px, -50%);
  padding: 7px 11px; border-radius: 10px; background: var(--rail); color: #FFFFFF; font: 600 12.5px/1 var(--f-body); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
.rail-link[data-tip]:hover::after, .rail-link[data-tip]:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
.app-main { position: relative; z-index: 1; min-width: 0; display: flex; flex-direction: column; background: var(--ground); border-radius: 40px 0 0 40px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px clamp(16px, 3vw, 34px) 0; }
.crumb { margin: 0; display: flex; align-items: center; gap: 6px; font: 500 14px/1 var(--f-body); color: var(--muted); }
.crumb b { color: var(--ink); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-search { display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 22px 0 18px; min-width: 240px; border-radius: 999px; background: var(--sheet); color: var(--muted); text-decoration: none; font: 400 14.5px/1 var(--f-body); }
.top-title { margin: 0; font: 400 32px/1.15 var(--f-display); letter-spacing: -0.01em; }
.top-search:hover { color: var(--ink); }
.avatar { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--p-yellow), var(--p-peach)); color: var(--p-ink); font: 700 15px/1 var(--f-display); box-shadow: 0 0 0 3px var(--sheet); }

.page { width: 100%; max-width: 1120px; margin: 0 auto; padding: clamp(18px, 3vw, 28px) clamp(16px, 3vw, 34px) 56px; }
.page-wide { max-width: 1400px; }
.ov-sub { margin: 0 0 18px; font-size: 15px; }
.hero { margin-bottom: 24px; }
.hero-tight { margin-bottom: 20px; }
.hero .label { margin: 0 0 4px; }
.hero .muted { font-size: 15px; }

/* ---------- KPI tiles: the pastel stat cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 14px; border-radius: 18px; background: var(--sheet); color: inherit; text-decoration: none; box-shadow: none; transition: transform 0.25s var(--ease); min-height: 0; }
a.kpi:hover { transform: translateY(-2px); }
.kpi .label { color: var(--ink-2); margin: 0; padding-right: 84px; font: 400 15px/1.3 var(--f-body); }
.kpi strong { font: 500 30px/1.1 var(--f-display); letter-spacing: -0.01em; margin: 2px 0 0; }
.kpi-foot { display: flex; align-items: center; gap: 10px; font-size: 13px; min-height: 24px; margin-top: auto; }
.kpi-foot .meter { flex: 1; max-width: 150px; }
.kpi-pill { position: absolute; right: 14px; top: 14px; padding: 10px 16px; border-radius: 999px; background: #FFFFFF; color: #1C1C1E; font: 400 15px/1 var(--f-body); }
.kpi-lilac, .kpi-blue, .kpi-yellow, .kpi-peach, .kpi-mint { color: var(--p-ink); box-shadow: none; }
.kpi-lilac { background: var(--p-lilac); } .kpi-blue { background: var(--p-blue); } .kpi-yellow { background: var(--p-yellow); } .kpi-peach { background: var(--p-peach); } .kpi-mint { background: var(--p-mint); }
.kpi-lilac .label, .kpi-blue .label, .kpi-yellow .label, .kpi-peach .label, .kpi-mint .label { color: var(--p-ink); }
.kpi-lilac .muted, .kpi-blue .muted, .kpi-yellow .muted, .kpi-peach .muted, .kpi-mint .muted { color: color-mix(in srgb, var(--p-ink) 72%, transparent); }
.kpi-lilac .meter-track, .kpi-blue .meter-track, .kpi-yellow .meter-track, .kpi-peach .meter-track { fill: rgba(255, 255, 255, 0.6); }
.kpi-lilac .meter-fill, .kpi-blue .meter-fill, .kpi-yellow .meter-fill, .kpi-peach .meter-fill { fill: var(--p-ink); }
.kpi-lilac .spark-line, .kpi-blue .spark-line, .kpi-yellow .spark-line, .kpi-peach .spark-line { stroke: var(--p-ink) !important; }
.kpi-lilac .spark-area, .kpi-blue .spark-area, .kpi-yellow .spark-area, .kpi-peach .spark-area { fill: var(--p-ink) !important; opacity: 0.08; }
.kpi-lilac .spark-dot, .kpi-blue .spark-dot, .kpi-yellow .spark-dot, .kpi-peach .spark-dot { fill: var(--p-ink) !important; }

.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; margin-bottom: 18px; align-items: start; }
.split > .sheet { margin-bottom: 0; }
/* IVR layout: a main column (cards, chart, table) beside a tall grey aside */
.ov-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: stretch; }
.ov-main { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.ov-main > * { margin: 0 !important; }
.ov-aside { display: flex; flex-direction: column; padding: 24px 20px; border-radius: 30px; background: var(--aside); }
.app-main.has-aside { display: grid; grid-template-columns: minmax(0, 1fr) 360px; align-items: stretch; }
.app-col { min-width: 0; display: flex; flex-direction: column; }
.app-aside { margin: 14px 14px 14px 0; padding: 28px 22px 22px; border-radius: 28px; }
.aside-profile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.aside-profile h2 { margin: 10px 0 0; font: 500 20px/1.2 var(--f-display); }
.aside-profile p { margin: 0; font-size: 13.5px; }
.avatar-lg { position: relative; width: 92px; height: 92px; font-size: 34px; font-weight: 600; }
.avatar-lg .online { position: absolute; right: 4px; bottom: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--agent-green); box-shadow: 0 0 0 3px var(--sheet); }
.aside-actions { display: flex; gap: 10px; margin-top: 14px; }
.act { display: grid; place-items: center; width: 70px; height: 36px; border-radius: 999px; color: var(--p-ink); text-decoration: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7); }
.act .ico { width: 18px; height: 18px; }
.act:hover { filter: brightness(0.96); }
.act-yellow { background: var(--p-yellow); } .act-lilac { background: var(--p-lilac); } .act-blue { background: var(--p-blue); }
.act-blue, .kpi-blue { background: var(--p-blue-strong); }
.needs-panel { padding: 0; }
.needs-panel > .panel-head { padding: 0 2px; margin-bottom: 10px; }
.needs-panel .needs .item { border-radius: 12px; min-height: 50px; padding: 6px 12px; box-shadow: none; }
.ov-aside > section { padding: 0; }
.ov-aside > section + section { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--hairline); }
.ov-aside .panel-head { margin-bottom: 14px; }
.needs-head { display: grid; grid-template-columns: 130px minmax(0, 1.3fr) minmax(0, 1fr) 140px 36px; gap: 14px; padding: 0 12px 6px; color: var(--ink-2); font: 400 15px/1.3 var(--f-body); }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; margin-bottom: 18px; align-items: stretch; }
.ov-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ov-side > .sheet { margin: 0; }
.ov-side > .sheet:last-child { flex: 1; }
.ov-grid > .sheet { margin-bottom: 0; }

/* panel header: title left, round buttons / pills right (CRM) */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-title { display: flex; align-items: center; gap: 10px; margin: 0; font: 600 19px/1.2 var(--f-display); letter-spacing: -0.01em; }
.panel-title .ico-box { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--hairline); color: var(--ink-2); }
.panel-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- lists: rows as white rounded strips (IVR table) ---------- */
.items { padding: 20px 20px 18px; margin-bottom: 16px; }
.items > .label:first-child, .chart-sheet > .label:first-child, .board-head .label, .dock > .label:first-child { font: 600 18px/1.2 var(--f-display); color: var(--ink); letter-spacing: -0.01em; margin-bottom: 14px; }
.new-line { padding: 4px 0 8px; font-size: 14px; }
.item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; padding: 13px 14px; border-radius: 16px; background: var(--sheet); align-items: start; box-shadow: 0 1px 2px rgba(28, 33, 45, 0.04); }
.item:has(.badge-src) { grid-template-columns: 86px minmax(0, 1fr) auto; }
.item-title { color: var(--ink); font: 500 15.5px/1.35 var(--f-body); text-decoration: none; overflow-wrap: anywhere; }
.needs { gap: 4px; }
.needs .item { padding: 8px 12px; border-radius: 10px; align-items: center; box-shadow: none; grid-template-columns: 130px minmax(0, 1.3fr) minmax(0, 1fr) 140px 36px; gap: 14px; min-height: 52px; }
.needs .cell { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.needs .cell-why { color: var(--muted); font-size: 14.5px; }
.needs .cell-from { color: var(--ink-2); font-size: 14px; }
.needs .pin-btn { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 18%, transparent); }
.needs .pinned { justify-content: center; }
.needs .pin-txt { display: none; }
.ov-spend .kpi-pill { text-decoration: none; }
.needs .badge { justify-self: start; font-size: 15px; }
.needs .badge .ico { width: 18px; height: 18px; }
.needs .item > div { display: flex; align-items: baseline; gap: 16px; min-width: 0; }
.needs .item-title { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 400; }
.needs .item-why, .needs .item-meta { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.needs .item-why { color: var(--muted); font-size: 14px; }
.needs .item-meta { display: none; }
.item-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.item-why { margin: 4px 0 0; color: var(--ink-2); font-size: 14.5px; }
.item-meta { margin: 5px 0 0; color: var(--muted); font: 400 12.5px/1.4 var(--f-body); overflow-wrap: anywhere; }
.item-step { margin: 6px 0 0; font-size: 14.5px; color: var(--ink); }
.step-label { font: 700 11.5px/1 var(--f-body); color: var(--accent-a); margin-right: 6px; }
.badge { align-self: start; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-align: center; font: 400 14px/1 var(--f-body); padding: 8px 14px 8px 10px; border-radius: 999px; background: var(--sheet-2); color: var(--ink-2); white-space: nowrap; }
.badge .ico { width: 15px; height: 15px; }
.badge-top { background: var(--p-yellow); color: var(--p-ink); }
.badge-look { background: var(--p-blue); color: var(--p-ink); }
.badge-src { background: var(--p-lilac); color: var(--p-ink); }
.badge-radar { background: var(--p-blue); } .badge-followup { background: var(--p-lilac); } .badge-board { background: var(--p-yellow); } .badge-system { background: var(--p-peach); } .badge-automation { background: var(--p-mint); }
.divider { list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 2px 2px; color: var(--muted); font: 600 12.5px/1 var(--f-body); }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px dashed var(--hairline); }
.low { margin-top: 12px; padding-top: 4px; }
.low summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 6px 2px; }
.pending, .empty { padding: 8px 2px; font-size: 14px; }
.followups-section { padding-top: 20px; }
.pin-form { margin: 0; }
.pin-btn { display: inline-flex; align-items: center; gap: 4px; background: var(--sheet-2); border: 0; color: var(--ink-2); border-radius: 999px; padding: 7px 11px; font: 600 12px/1 var(--f-body); cursor: pointer; white-space: nowrap; }
.pin-btn:hover { background: var(--ink); color: var(--on-ink); }
.pinned { display: inline-flex; align-items: center; gap: 4px; font: 600 12px/1 var(--f-body); color: var(--ok); white-space: nowrap; padding: 7px 0; }

.brief { padding: 22px 26px; margin-bottom: 16px; background: var(--p-yellow); color: var(--p-ink); border: 0; backdrop-filter: none; }
.brief .label { color: color-mix(in srgb, var(--p-ink) 70%, transparent); }
.brief-text { font: 500 20px/1.45 var(--f-display); margin: 0; }
.actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.actions form { margin: 0; }

/* log lines (activity, recent, dock) */
.log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.log-list li { display: grid; grid-template-columns: 86px 96px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 14px; border-radius: 14px; background: var(--sheet); font-size: 14px; }
.log-list .t { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.log-list .what { overflow-wrap: anywhere; }
.who { font: 600 12px/1 var(--f-body); padding: 7px 10px; border-radius: 999px; text-align: center; white-space: nowrap; color: var(--p-ink); }
.who-blue { background: var(--p-blue); } .who-green { background: var(--p-mint); } .who-violet { background: var(--p-lilac); }
.st-err { color: var(--danger); font-weight: 700; }
.st-run { color: var(--accent-a); font-weight: 700; }

/* ---------- telemetry cards (the v2 folder header) ---------- */
.tele-row { display: flex; gap: 16px; overflow-x: auto; padding: 20px; margin-bottom: 18px; scroll-snap-type: x proximity; }
.tele { flex: none; width: 236px; display: flex; flex-direction: column; border-radius: 22px; background: var(--sheet); overflow: hidden; scroll-snap-align: start; box-shadow: var(--shadow-soft); }
.tele-head { position: relative; height: 104px; flex: none; background: var(--p-blue); color: var(--p-ink); }
.tele.hue-green .tele-head { background: var(--p-mint); }
.tele-folder { display: none; }
.tele-folder { position: absolute; inset: 0; width: 100%; height: 100%; }
.tele-logo { position: absolute; left: 12px; top: 8px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: #16171B; }
.tele-state { position: absolute; right: 10px; top: 9px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.92); color: #16171B; font: 700 11px/1.3 var(--f-body); }
.tele-state i { width: 7px; height: 7px; border-radius: 50%; background: #9AA1AD; }
.tele[data-state="running"] .tele-state i { background: #2E9D6B; animation: pulse-dot 1.2s ease-in-out infinite; }
.tele[data-state="idle"] .tele-state i { background: #1FBFAE; }
.tele[data-state="error"] .tele-state i { background: #D9485A; }
.tele[data-state="setup"] .tele-state i { background: #E9A23B; }
@keyframes pulse-dot { 50% { opacity: 0.35; } }
.tele-wave { position: absolute; left: 12px; right: 12px; bottom: 26px; height: 20px; overflow: hidden; }
.tele-wave svg { width: 200%; height: 20px; display: block; }
.tele-wave path { stroke: color-mix(in srgb, var(--p-ink) 55%, transparent); }
.tele[data-state="running"] .tele-wave svg { animation: wave 1.6s linear infinite; }
@keyframes wave { to { transform: translateX(-25%); } }
.tele-session { position: absolute; left: 12px; right: 12px; bottom: 6px; margin: 0; color: var(--p-ink); font: 600 11.5px/1.3 var(--f-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tele-name { display: block; margin: 12px 12px 0; text-align: center; color: var(--ink); text-decoration: none; font: 600 16px/1.2 var(--f-display); }
a.tele-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.tele-meta { margin: 3px 12px 0; text-align: center; color: var(--muted); font: 400 12px/1.35 var(--f-body); }
.tele-spark { display: flex; justify-content: center; padding: 8px 12px 2px; }
.tele-stats { margin-top: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; text-align: center; }
.tele-stats div { padding: 8px 2px; border-radius: 12px; background: var(--sheet-2); }
.tele-stats strong { display: block; font: 600 17px/1 var(--f-display); }
.tele-stats span { display: block; margin-top: 3px; color: var(--muted); font: 500 10.5px/1 var(--f-body); }
.tele-planned { border: 2px dashed var(--hairline); box-shadow: none; background: transparent; }
.tele-head-planned { background: transparent; height: 72px; }
.tele-head-planned .tele-logo { background: var(--sheet-2); color: var(--muted); }
.tele-head-planned .tele-session { color: var(--muted); left: 54px; bottom: auto; top: 18px; }
.tele-planned .tele-meta { margin-bottom: 14px; }

/* ---------- charts ---------- */
.spark { display: block; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent-a); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: var(--accent-a); opacity: 0.12; stroke: none; }
.spark-dot { fill: var(--accent-a); }
.spark-blue .spark-line { stroke: var(--agent-blue); } .spark-blue .spark-area, .spark-blue .spark-dot { fill: var(--agent-blue); }
.spark-green .spark-line { stroke: var(--agent-green); } .spark-green .spark-area, .spark-green .spark-dot { fill: var(--agent-green); }
.spark-violet .spark-line { stroke: var(--agent-violet); } .spark-violet .spark-area, .spark-violet .spark-dot { fill: var(--agent-violet); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font: 500 11px var(--f-body); }
.axis line { stroke: var(--hairline); stroke-width: 1; }
.bar-hit { fill: transparent; }
.chart g:hover > .bar-hit { fill: var(--sheet-2); }
.seg-score { fill: var(--agent-blue); } .seg-brief { fill: color-mix(in srgb, var(--agent-blue) 55%, var(--sheet)); } .seg-followups { fill: var(--agent-green); } .seg-chat { fill: var(--agent-violet); } .seg-other { fill: var(--muted); }
.refline line { stroke: var(--crimson); stroke-width: 1.2; stroke-dasharray: 5 4; }
.refline text { fill: var(--crimson); }
.chart-sheet { padding: 20px 22px; margin-bottom: 16px; }
.bar-legend, .hm-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 12px 0 0; font-size: 13px; }
.bar-legend i, .hm-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
.bar-legend i.seg-score { background: var(--agent-blue); } .bar-legend i.seg-brief { background: color-mix(in srgb, var(--agent-blue) 55%, var(--sheet)); } .bar-legend i.seg-followups { background: var(--agent-green); } .bar-legend i.seg-chat { background: var(--agent-violet); }
.hm { stroke: none; }
.hm-0 { fill: var(--sheet); }
.hm-1 { fill: var(--agent-violet); fill-opacity: 0.16; } .hm-2 { fill: var(--agent-violet); fill-opacity: 0.32; } .hm-3 { fill: var(--agent-violet); fill-opacity: 0.52; } .hm-4 { fill: var(--agent-violet); fill-opacity: 0.74; } .hm-5 { fill: var(--agent-violet); fill-opacity: 0.95; }
.hm-err { fill: var(--danger); }
.hm-legend i.hm-1 { background: color-mix(in srgb, var(--agent-violet) 16%, transparent); } .hm-legend i.hm-2 { background: color-mix(in srgb, var(--agent-violet) 32%, transparent); }
.hm-legend i.hm-3 { background: color-mix(in srgb, var(--agent-violet) 52%, transparent); } .hm-legend i.hm-4 { background: color-mix(in srgb, var(--agent-violet) 74%, transparent); }
.hm-legend i.hm-5 { background: var(--agent-violet); } .hm-legend i.hm-err { background: var(--danger); }
.ylbl { fill: var(--ink-2) !important; }
.meter { display: block; width: 100%; height: 8px; }
.meter-track { fill: var(--sheet-2); } .meter-fill { fill: var(--ink); }
.meter-warn .meter-fill { fill: var(--agent-amber); } .meter-full .meter-fill { fill: var(--crimson); }

/* agent workload (stacked rounded segments joined by ribbons) */
.workload { padding: 20px 22px 18px; background: #FFFFFF; border: 0; box-shadow: inset 0 0 0 1px #E3E5E9; border-radius: 14px; backdrop-filter: none; -webkit-backdrop-filter: none; }
:root[data-theme="dark"] .workload { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--hairline); }
.workload, .workload .chart text { font-family: "Hanken Grotesk", system-ui, sans-serif; }
.workload .panel-title { font: 500 16px/1.2 "Hanken Grotesk", system-ui, sans-serif; }
.workload .ico-box { width: 28px; height: 28px; border-radius: 6px; background: #F3F4F6; box-shadow: none; }
.workload .wl-total { margin: 0 0 8px; }
.workload .pill { border-radius: 10px; height: 38px; min-width: 92px; justify-content: center; padding: 0 12px; font: 500 14px/1 var(--f-body); background: transparent; color: #374151; box-shadow: inset 0 0 0 1px #E5E7EB; }
.workload .pill[aria-current="true"] { background: transparent; color: #111827; box-shadow: inset 0 0 0 1.5px #111827; }
:root[data-theme="dark"] .workload .pill { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--hairline); }
:root[data-theme="dark"] .workload .pill[aria-current="true"] { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink-2); }
.wl-delta { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.wl-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 6px; }
.wl-total strong { font: 500 32px/1 var(--f-display); letter-spacing: -0.01em; }
.wl-total span { color: var(--muted); font-size: 14px; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; border-radius: 4px; font: 500 13px/1 var(--f-body); }
.delta-up { background: #E7F8F6; color: #0FA89F; box-shadow: inset 0 0 0 1px #CFF1EC; }
.delta-down { background: color-mix(in srgb, var(--crimson) 14%, transparent); color: var(--crimson); }
.delta-flat { background: var(--sheet-2); color: var(--muted); }
.wl-chart { margin-top: 8px; }
.wl-seg-sericana { fill: var(--agent-violet); } .wl-seg-radar { fill: var(--agent-blue); } .wl-seg-followups { fill: var(--agent-green); }
.wl-rib-sericana { fill: var(--agent-violet); } .wl-rib-radar { fill: var(--agent-blue); } .wl-rib-followups { fill: var(--agent-green); }
.wl-ribs { opacity: 0.15; }
.wl-rib { stroke-width: 6; stroke-linejoin: round; }
.wl-rib-sericana { stroke: var(--agent-violet); } .wl-rib-radar { stroke: var(--agent-blue); } .wl-rib-followups { stroke: var(--agent-green); }
.wl-seg { stroke: rgba(20, 20, 60, 0.1); stroke-width: 1; }
.wl-val { fill: var(--ink) !important; font: 400 16px "Hanken Grotesk", system-ui, sans-serif !important; }
.wl-day { fill: var(--ink-2) !important; font: 400 14px "Hanken Grotesk", system-ui, sans-serif !important; }
.wl-day-now { fill: var(--ink) !important; font-weight: 400 !important; }
.wl-ghost { fill: var(--sheet-2); }
.wl-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 28px; margin: 12px 0 0; font-size: 13px; color: var(--ink-2); }
.wl-legend span { display: inline-flex; align-items: center; gap: 7px; }
.wl-legend i { width: 10px; height: 10px; border-radius: 2px; }
.wl-legend .lg-sericana { background: var(--agent-violet); } .wl-legend .lg-radar { background: var(--agent-blue); } .wl-legend .lg-followups { background: var(--agent-green); }
.agent-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.agent-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--sheet); text-decoration: none; color: inherit; }
.agent-row:hover { box-shadow: inset 0 0 0 1px var(--hairline); }
.agent-dot { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: #FFFFFF; }
.agent-dot-sericana { background: var(--agent-violet); } .agent-dot-radar { background: var(--agent-blue); } .agent-dot-followups { background: var(--agent-green); }
.agent-row b { display: block; font: 600 15px/1.2 var(--f-display); }
.agent-row small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.agent-row .n { font: 600 20px/1 var(--f-display); text-align: right; }
.agent-row .n small { text-align: right; }

.tbl { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 14px; }
.tbl th { text-align: left; font: 600 12.5px/1.4 var(--f-body); color: var(--muted); padding: 2px 12px 2px; }
.tbl td { padding: 11px 12px; background: var(--sheet); }
.tbl td:first-child { border-radius: 12px 0 0 12px; }
.tbl td:last-child { border-radius: 0 12px 12px 0; }
.tbl td:not(:first-child), .tbl th:not(:first-child) { text-align: right; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.fchip { padding: 9px 15px; border-radius: 999px; background: var(--sheet); color: var(--ink-2); text-decoration: none; font: 600 13px/1 var(--f-body); box-shadow: inset 0 0 0 1px var(--hairline); }
.fchip:hover { box-shadow: inset 0 0 0 1px var(--ink); color: var(--ink); }
.fchip[aria-current="true"] { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.kpis-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ---------- board (kanban) ---------- */
.board-sheet { padding: 20px; margin-bottom: 16px; }
.notched { position: relative; margin-bottom: 16px; }
.notch-row { display: flex; align-items: flex-end; gap: 0; }
.notch-tab { position: relative; display: flex; align-items: center; gap: 12px; padding: 26px 34px 10px; background: var(--panel); border: 0; border-radius: var(--r-panel) var(--r-panel) 0 0; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.notch-tab .label { margin: 0; font: 600 19px/1.2 var(--f-display); color: var(--ink); }
.notch-tab::after { content: ""; position: absolute; right: -40px; bottom: 0; width: 40px; height: 40px; background: radial-gradient(circle at 100% 0, transparent 39.5px, var(--panel) 40px); }
.notch-tools { flex: 1; display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 0 0 14px 56px; min-width: 0; }
.notched > .sheet { border-top-left-radius: 0; border-top-right-radius: 0; margin: 0; border: 0; }
.notch-tab-r.notch-tools { flex: 0 0 auto; margin-left: auto; padding: 12px 22px 8px; gap: 8px; }
.notch-tab-r::after { display: none; }
.notch-tab-r::before { content: ""; position: absolute; left: -40px; bottom: 0; width: 40px; height: 40px; background: radial-gradient(circle at 0 0, transparent 39.5px, var(--panel) 40px); }
.notch-tab:first-child { flex: 0 0 34%; }
.notch-dip { display: flex; align-items: center; align-self: center; margin: 0 auto; padding: 6px 6px 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7); }
.notch-dip + .notch-tab-r.notch-tools { margin-left: 0; }
.notch-dip a { width: 52px; height: 52px; margin-left: -8px; box-shadow: 0 0 0 3px var(--sheet); }
.notch-dip a:first-child { margin-left: 0; }
.add-pop { position: relative; }
.add-pop > summary { list-style: none; }
.add-pop > summary::-webkit-details-marker { display: none; }
.add-pop[open] > summary { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.add-pop .add-card { position: absolute; right: 0; top: calc(100% + 10px); z-index: 15; width: min(560px, 80vw); padding: 14px; border-radius: 24px; background: var(--sheet); box-shadow: var(--shadow); justify-content: flex-start; }
.sel { position: relative; display: inline-flex; }
.sel::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-70%) rotate(45deg); pointer-events: none; color: var(--ink-2); }
.sel select { appearance: none; -webkit-appearance: none; padding-right: 34px !important; }
.board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.board-head .label { margin: 0; }
.add-card { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 520px; justify-content: flex-end; }
.add-card input, .add-card select { height: 42px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--hairline); color: var(--ink); font: 500 14px/1 var(--f-body); }
.add-card input[name="title"] { flex: 1 1 220px; max-width: 380px; min-width: 0; }
.add-card .btn { padding: 12px 18px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: color-mix(in srgb, #F2F4F7 88%, transparent); border-radius: 30px; padding: 14px; min-height: 220px; display: flex; flex-direction: column; transition: box-shadow 0.15s; box-shadow: none; }
.lane.over { box-shadow: inset 0 0 0 2px var(--ink); }
.lane-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 6px 12px; font: 500 15px/1 var(--f-display); }
.lane-count { font: 700 12px/1 var(--f-body); color: var(--on-ink); background: var(--ink); padding: 5px 9px; border-radius: 999px; }
.lane-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 40px; }
.lane-empty { text-align: center; font-size: 13px; padding: 16px 0; border: 2px dashed var(--hairline); border-radius: 14px; margin: 0; }
.kcard { background: var(--sheet); border-radius: 22px; padding: 14px 16px; cursor: grab; box-shadow: none; }
.kcard.dragging { opacity: 0.45; }
.kcard-title { color: var(--ink); text-decoration: none; font: 500 14px/1.4 var(--f-body); overflow-wrap: anywhere; }
a.kcard-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.kcard-notes { margin: 5px 0 0; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.kcard-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 9px; }
.kcard-actions { margin-left: auto; display: flex; gap: 2px; }
.kcard-actions form { margin: 0; }
.kbtn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 20%, transparent); cursor: pointer; font-size: 14px; line-height: 1; }
/* card buttons stay out of the way until you point at a card (always shown on touch screens) */
@media (hover: hover) { .kcard .kcard-actions { opacity: 0; transition: opacity 0.15s; } .kcard:hover .kcard-actions, .kcard:focus-within .kcard-actions { opacity: 1; } }
.kbtn:hover { background: var(--ink); color: var(--on-ink); }
.kbtn-del:hover { background: var(--crimson); color: #FFFFFF; }
.chip { font: 600 11.5px/1 var(--f-body); padding: 5px 9px; border-radius: 999px; background: var(--sheet-2); color: var(--ink-2); white-space: nowrap; }
.chip-prio-high { color: var(--crimson); } .chip-prio-low { color: var(--muted); }
.chip-bad { background: var(--warn-bg); color: var(--warn-ink); }
.chip-warn { background: var(--p-yellow); color: var(--p-ink); }
.chip-src { background: var(--p-lilac); color: var(--p-ink); }
.board-hint { font-size: 13px; margin-top: 12px; }
.board-hint .ico, .notice .ico { display: inline-block; vertical-align: -2px; }
.dock { padding: 18px 20px; }
.dock-list li { font-size: 13px; }

/* board: split by project / client / company (pill tabs, then sub-tabs) */
.space-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 0; margin-bottom: 14px; background: none; width: fit-content; max-width: 100%; }
.stab { display: inline-flex; align-items: center; gap: 8px; padding: 18px 24px; border-radius: 999px; color: var(--ink); text-decoration: none; font: 500 15px/1 var(--f-body); white-space: nowrap; }
.stab:hover { background: var(--sheet); color: var(--ink); }
.stab[aria-current="true"] { background: var(--ink); color: var(--on-ink); }
.stab-n { color: var(--muted); font: 500 13px/1 var(--f-body); }
.stab[aria-current="true"] .stab-n { color: color-mix(in srgb, var(--on-ink) 65%, transparent); }
:root[data-theme="dark"] .stab[aria-current="true"] .stab-n { background: rgba(0, 0, 0, 0.12); }
.space-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.schip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; background: var(--sheet); color: var(--ink-2); text-decoration: none; font: 600 13px/1 var(--f-body); box-shadow: var(--shadow-soft); }
.schip span { color: var(--muted); font-weight: 700; font-size: 11.5px; }
.schip:hover { color: var(--ink); }
.schip[aria-current="true"] { background: var(--ink); color: var(--on-ink); }
.schip[aria-current="true"] span { color: color-mix(in srgb, var(--on-ink) 70%, transparent); }
.space-new { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.space-new input { height: 36px; width: 180px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--hairline); color: var(--ink); font: 500 13.5px/1 var(--f-body); }
.space-new .pill { border: 0; cursor: pointer; }
.space-del { margin: 0 0 0 auto; }
.chip-space { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--p-ink); }
.chip-space .ico { width: 12px; height: 12px; }
.chip-project { background: var(--p-blue); } .chip-client { background: var(--p-lilac); } .chip-company { background: var(--p-yellow); }
.kmenu { position: relative; }
.kmenu summary { list-style: none; display: grid; place-items: center; }
.kmenu summary::-webkit-details-marker { display: none; }
.kmenu[open] summary { background: var(--ink); color: var(--on-ink); }
.kmenu-form { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 10; display: flex; gap: 6px; padding: 8px; border-radius: 16px; background: var(--sheet); box-shadow: var(--shadow); }
.kmenu-form select { height: 36px; max-width: 190px; padding: 0 10px; border-radius: 999px; border: 0; background: var(--sheet-2); color: var(--ink); font: 500 13px/1 var(--f-body); }
.kmenu-form .btn { padding: 9px 14px; font-size: 13px; }
.add-card .chip-space { height: 42px; padding: 0 14px; font-size: 13px; }

/* ---------- memory graph ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; font-size: 13.5px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lg-source { background: var(--agent-amber); } .lg-topic { background: var(--agent-violet); } .lg-item { background: var(--agent-blue); } .lg-followup { background: var(--agent-green); } .lg-context { background: var(--crimson); }
.graph-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.graph-sheet { padding: 10px; overflow: hidden; }
.graph { width: 100%; height: auto; display: block; }
.graph-bg { fill: transparent; }
.ge { stroke: color-mix(in srgb, var(--ink) 14%, transparent); stroke-width: 1; transition: opacity 0.25s, stroke 0.25s; }
.gn { cursor: pointer; transition: opacity 0.25s; }
.gn circle { stroke: var(--sheet); stroke-width: 1.5; }
.gn text { fill: var(--ink-2); font: 600 11px var(--f-body); pointer-events: none; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; }
.gn-source circle { fill: var(--agent-amber); } .gn-topic circle { fill: var(--agent-violet); } .gn-item circle { fill: var(--agent-blue); } .gn-followup circle { fill: var(--agent-green); } .gn-context circle { fill: var(--crimson); }
.gn-topic text { font-weight: 700; fill: var(--ink); }
.gn:hover circle, .gn:focus-visible circle { stroke: var(--ink); }
.gn:focus-visible { outline: none; }
.graph.focus .gn:not(.lit) { opacity: 0.15; }
.graph.focus .ge:not(.lit) { opacity: 0.12; }
.ge.lit { stroke: var(--ink); stroke-width: 1.6; }
.gn.future, .ge.future { opacity: 0 !important; pointer-events: none; }
.graph-aside { padding: 20px; align-self: start; position: sticky; top: 20px; }
.detail-title { font: 600 17px/1.35 var(--f-display); margin: 0 0 6px; overflow-wrap: anywhere; }
.topics-label { margin-top: 20px; }
.topic-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.topic-list li { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 12px; background: var(--sheet); font-size: 14px; }
.scrub { display: flex; align-items: center; gap: 12px; padding: 10px 6px 4px; flex-wrap: wrap; }
.scrub input[type="range"] { flex: 1; min-width: 160px; accent-color: var(--ink); }
.scrub .btn { padding: 10px 16px; font-size: 13.5px; }

/* ---------- settings forms ---------- */
.form-card { padding: 24px; margin-bottom: 16px; }
.form-card textarea, .form-card input, .form-card select { width: 100%; margin: 12px 0; padding: 12px 16px; border-radius: 16px; border: 0; box-shadow: inset 0 0 0 1px var(--hairline); background: var(--sheet); color: var(--ink); font: 400 15px/1.5 var(--f-body); }
.add-source { display: grid; gap: 4px; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--hairline); }
.add-source label { font: 600 13px/1.4 var(--f-body); color: var(--muted); }
.add-source .btn { justify-self: start; }
.source-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.source { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; border-radius: 14px; background: var(--sheet); }
.source-off { opacity: 0.6; }
.source-name { margin: 0; font-weight: 600; }
.source-actions { display: flex; gap: 14px; align-items: flex-start; }
.source-actions form { margin: 0; }
.err { color: var(--warn-ink); }
.log { padding: 24px; }
.log ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.log li { display: flex; gap: 16px; padding: 10px 14px; border-radius: 12px; background: var(--sheet); font-size: 15px; flex-wrap: wrap; }

/* ---------- costs & savings (the Sales Analytics reference) ---------- */
.cost-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.cost-filters, .cost-period { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cost-period .muted { font: 600 13px/1 var(--f-body); margin-right: 4px; }
.pill-agent { padding: 5px 13px 5px 5px; }
.mini-dot { width: 24px; height: 24px; flex: none; display: inline-grid; place-items: center; border-radius: 50%; color: #FFFFFF; }
.mini-dot .ico { width: 12px; height: 12px; }
.app-main:has(.costs) { background: #FBFBFB; }
:root[data-theme="dark"] .app-main:has(.costs) { background: var(--bg); }
.cost-titlerow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.cost-title { font: 500 30px/1.05 var(--f-display); color: #BDBDBD; margin: 0; letter-spacing: -0.02em; }
.cost-filters-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.ring-btn.sm { width: 36px; height: 36px; }
.ring-row { display: flex; gap: 8px; }
.cost-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: end; margin-bottom: 18px; }
.cost-headline .label { font: 600 17px/1.2 var(--f-display); color: var(--ink); margin-bottom: 6px; }
.cost-big { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; font: 700 34px/1 var(--f-display); letter-spacing: -0.02em; }
.cost-big .cents { color: color-mix(in srgb, var(--ink) 32%, transparent); }
.cb { display: inline-flex; align-items: center; gap: 3px; padding: 5px 8px; border-radius: 7px; background: var(--crimson); color: #FFFFFF; font: 500 13px/1 var(--f-body); letter-spacing: 0; }
.cb-soft { background: var(--crimson); color: #FFFFFF; }
.cb-flat { background: var(--sheet-2); color: var(--muted); }
.cost-headline .muted { font-size: 13.5px; }
.cost-cards { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ccard { display: flex; flex-direction: column; gap: 8px; min-width: 150px; padding: 10px 12px; border-radius: 12px; background: var(--sheet); color: var(--ink); text-decoration: none; box-shadow: inset 0 0 0 1px var(--rim); }
.ccard:first-child { box-shadow: inset 0 0 0 1px var(--rim), 0 -7px 0 -3px var(--rim); }
.ccard-label { display: inline-flex; align-items: center; gap: 6px; font: 600 12.5px/1 var(--f-body); color: var(--muted); }
.ccard-sm .ccard-label { color: var(--ink); font: 500 13.5px/1 var(--f-body); }
.ccard strong { font: 700 22px/1 var(--f-display); letter-spacing: -0.01em; }
.ccard-foot { display: flex; align-items: center; gap: 7px; font: 600 12.5px/1.2 var(--f-body); }
.ccard-foot .mini-dot { width: 20px; height: 20px; }
.ccard-go { margin-left: auto; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: var(--sheet-2); }
.ccard-dark { background: #16171B; color: #FFFFFF; box-shadow: 0 -7px 0 -3px #2A2B30; }
.ccard-dark .ccard-label, .ccard-dark .ccard-foot { color: rgba(255, 255, 255, 0.7); }
:root[data-theme="dark"] .ccard-dark { background: #F2F3F5; color: #16171B; }
:root[data-theme="dark"] .ccard-dark .ccard-label, :root[data-theme="dark"] .ccard-dark .ccard-foot { color: rgba(22, 23, 27, 0.65); }
.ccard-sm { min-width: 110px; align-items: center; text-align: center; }
.ccard-accent { box-shadow: inset 0 0 0 1px var(--crimson); }
.num-pill { display: inline-block; padding: 4px 9px; border-radius: 999px; background: var(--pill-grey); color: var(--pill-grey-ink); font-size: 12px !important; font-weight: 600 !important; }
.num-pill-accent { background: var(--crimson); color: #FFFFFF; }
.mini-delta { font: 700 12px/1 var(--f-body); color: var(--muted); }
.mini-delta-flat { opacity: 0.6; }

.share-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.share-track { flex: 1; display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: #EDEDED; min-width: 0; }
:root[data-theme="dark"] .share-track { background: var(--sheet-2); }
.share { min-width: 150px; display: flex; align-items: center; gap: 9px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--sheet); color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; }
.share b { font: 700 14px/1 var(--f-display); }
.share span { margin-left: auto; color: var(--muted); font: 600 12.5px/1 var(--f-body); }
.share:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.share-btn { flex: none; padding: 12px 22px; }
.share-empty { margin: 0 0 18px; }
.fx-1 { flex: 1; } .fx-2 { flex: 2; } .fx-3 { flex: 3; } .fx-4 { flex: 4; } .fx-5 { flex: 5; } .fx-6 { flex: 6; } .fx-7 { flex: 7; } .fx-8 { flex: 8; } .fx-9 { flex: 9; } .fx-10 { flex: 10; }
.fx-11 { flex: 11; } .fx-12 { flex: 12; } .fx-13 { flex: 13; } .fx-14 { flex: 14; } .fx-15 { flex: 15; } .fx-16 { flex: 16; } .fx-17 { flex: 17; } .fx-18 { flex: 18; } .fx-19 { flex: 19; } .fx-20 { flex: 20; }

.cost-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cost-left, .cost-right { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cost-row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.cpanel { padding: 18px; margin: 0; }
.costs .cpanel .panel-title { font: 500 14px/1.2 var(--f-body); }
.costs .cpanel .panel-head > .muted { height: 30px; padding: 0 12px; border-radius: 8px; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rim); color: var(--ink); display: inline-flex; align-items: center; font-size: 13px; }
.costs .cpanel { background: #F0F0F0; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; border-radius: 24px; }
:root[data-theme="dark"] .costs .cpanel { background: var(--sheet-2); }
.cpanel .panel-head { margin-bottom: 12px; }
.cpanel .panel-title { font-size: 16.5px; }
.clist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.clist li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 12px; background: var(--sheet); }
.clist-ico { width: 24px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: none; color: var(--ink-2); }
.clist-ico.on { background: none; }
.clist-ico.agent-dot-sericana { color: var(--agent-violet); } .clist-ico.agent-dot-radar { color: var(--agent-blue); } .clist-ico.agent-dot-followups { color: var(--agent-green); }
.clist-name b { display: block; font: 600 14px/1.2 var(--f-body); }
.clist-name small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clist-val { font: 700 14.5px/1 var(--f-display); }
.pct { min-width: 44px; text-align: center; padding: 5px 8px; border-radius: 8px; background: var(--sheet-2); font: 700 12px/1 var(--f-body); color: var(--ink-2); }
.pct-ok { background: color-mix(in srgb, var(--agent-green) 15%, transparent); color: color-mix(in srgb, var(--agent-green) 70%, var(--ink)); }

.ib-chart { max-height: 220px; }
.ib-bar { fill: var(--sheet); filter: drop-shadow(0 1px 2px rgba(28, 33, 45, 0.06)); }
.ib-hatch { fill: url(#ibHatch); }
.ib-badge { fill: var(--sheet-2); }
.ib-ico { color: var(--ink); }
.ib-val { fill: var(--ink) !important; font: 700 12px var(--f-display) !important; }
.ib-lbl { fill: var(--muted) !important; font: 500 11px var(--f-body) !important; }
.hatch-bg { fill: var(--sheet); }
.hatch-line { stroke: color-mix(in srgb, var(--ink) 16%, transparent); stroke-width: 2; }

.value-panel { display: block; padding: 0; overflow: hidden; }
.value-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; }
.value-title { display: flex; align-items: center; gap: 10px; }
.value-title small { display: block; color: var(--muted); font: 400 12.5px/1.2 var(--f-body); }
.value-body { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; padding-right: 14px; }
.pick-agent { position: relative; }
.pick-agent > summary { list-style: none; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font: 700 13px/1.2 var(--f-body); color: var(--ink); }
.pick-agent > summary::-webkit-details-marker { display: none; }
.pick-agent > div { position: absolute; left: 0; top: calc(100% + 6px); z-index: 10; display: flex; flex-direction: column; min-width: 170px; padding: 6px; border-radius: 14px; background: var(--sheet); box-shadow: var(--shadow); }
.pick-agent > div a { padding: 8px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
.pick-agent > div a:hover { background: var(--sheet-2); }
.value-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 18px 46px; border-radius: 0 24px 0 0; background: var(--crimson); color: #FFFFFF; margin-top: 8px; }
.value-vert { position: absolute; left: 12px; bottom: 18px; writing-mode: vertical-rl; transform: rotate(180deg); font: 500 12px/1 var(--f-body); color: rgba(255, 255, 255, 0.75); }
.value-head { position: absolute; left: 18px; top: 18px; }
.value-panel { position: relative; }
.value-kicker { display: flex; align-items: center; gap: 7px; margin: 0; font: 600 12.5px/1 var(--f-body); color: rgba(255, 255, 255, 0.82); }
.value-name { margin: 0 0 8px; font: 700 18px/1.2 var(--f-display); }
.value-card dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.value-card dt { font: 600 12px/1 var(--f-body); color: rgba(255, 255, 255, 0.75); }
.value-card dd { margin: 3px 0 0; font: 600 16px/1.2 var(--f-display); }
.value-side { margin: auto 0 0; padding-top: 10px; font: 600 12px/1.3 var(--f-body); color: rgba(255, 255, 255, 0.8); }
.value-chart { padding: 0 4px 12px; min-width: 0; align-self: end; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--sheet); box-shadow: inset 0 0 0 1px #E3E3E3; }
.seg a { padding: 8px 12px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font: 500 13px/1 var(--f-body); }
.seg a[aria-current="true"] { background: #111111; color: #FFFFFF; }
.hb-bar { fill: var(--solid-bar); }
.hb-bar-top { fill: url(#hbHatch); }
.hb-tag { fill: var(--crimson); }
.hb-tagtxt { fill: #FFFFFF !important; font: 700 10.5px var(--f-display) !important; }
.hb-grid { stroke: var(--hairline); stroke-dasharray: 3 4; }
.hb-axis { fill: var(--muted) !important; font: 500 10.5px var(--f-body) !important; }

.chart-scroll, .table-scroll { min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.atable { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 14px; }
.atable th { text-align: left; padding: 0 8px; font: 600 12px/1.4 var(--f-body); color: var(--muted); }
.atable th:not(:first-child), .atable td:not(:first-child) { text-align: right; }
.atable td { padding: 10px 8px; background: var(--sheet); white-space: nowrap; }
.atable td:first-child { border-radius: 14px 0 0 14px; }
.atable td:last-child { border-radius: 0 14px 14px 0; }
.atable td a { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
.atable tr.open td { background: color-mix(in srgb, var(--crimson) 6%, var(--sheet)); }
.atable tr.open td:first-child { border-radius: 14px 0 0 0; }
.atable tr.open td:last-child { border-radius: 0 14px 0 0; }
.atable tr.detail td { padding: 0 12px 14px; border-radius: 0 0 14px 14px; background: linear-gradient(135deg, var(--sheet), color-mix(in srgb, var(--crimson) 12%, var(--sheet))); text-align: left; white-space: normal; }
.dark-pill { display: inline-block; min-width: 30px; text-align: center; padding: 5px 9px; border-radius: 999px; background: #252525; color: #FFFFFF; font: 600 12px/1 var(--f-body); }
:root[data-theme="dark"] .dark-pill { background: #F2F3F5; color: #16171B; }
.dark-pill-muted { background: var(--sheet-2); color: var(--muted); }
.detail-box { padding: 6px 4px 4px; border-radius: 0; background: none; }
.atable tr.open td { background: color-mix(in srgb, var(--crimson) 9%, var(--sheet)); }
.atable tr.detail td { background: linear-gradient(160deg, color-mix(in srgb, var(--crimson) 9%, var(--sheet)) 0%, color-mix(in srgb, var(--agent-violet) 11%, var(--sheet)) 100%); }
.detail-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 14px; }
.dchip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--sheet); color: var(--ink); font: 500 13px/1 var(--f-body); }
.mini-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; margin-bottom: 14px; }
.mini-grid .mini-card.big { grid-row: 1 / span 3; justify-content: space-between; min-height: 150px; }
.mini-grid .mini-card.big b { font-size: 28px !important; }
.mini-grid .mini-card:not(.big) { padding: 8px 12px; }
.mini-grid .mini-card:not(.big) b { font-size: 16px !important; }
.detail-k { margin: 2px 0 8px; font: 700 12.5px/1 var(--f-body); color: var(--ink); }
.mini-cards { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.mini-card { flex: 1 1 140px; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rim); background-image: repeating-linear-gradient(45deg, transparent 0 5px, color-mix(in srgb, var(--ink) 9%, transparent) 5px 7px); background-size: 28% 100%; background-position: right; background-repeat: no-repeat; }
.mini-card b { font: 700 22px/1 var(--f-display) !important; }
.mini-card b .cents { color: color-mix(in srgb, var(--ink) 32%, transparent); font-weight: 600; }
.mini-card span { font: 600 12px/1 var(--f-body); color: var(--muted); }
.mini-card b { font: 700 18px/1 var(--f-display); }
.mini-card small { font: 600 11.5px/1 var(--f-body); color: var(--muted); }
.la-chart { max-height: 130px; }
.la-line { fill: none; stroke: var(--crimson); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.la-prev { fill: none; stroke: #F29BB4; stroke-width: 1.2; stroke-dasharray: 3 3; }
.la-dot { fill: var(--sheet); stroke: var(--crimson); stroke-width: 2.5; }
.la-mark { fill: var(--crimson); stroke: var(--sheet); stroke-width: 2.5; }
.hb-dot { stroke: var(--sheet); stroke-width: 2; }
.hb-dot-sericana { fill: var(--agent-violet); } .hb-dot-radar { fill: var(--agent-blue); } .hb-dot-followups { fill: var(--agent-green); }
.la-stop-a { stop-color: var(--crimson); stop-opacity: 0.08; }
.la-stop-b { stop-color: var(--crimson); stop-opacity: 0; }
.la-lbl { fill: var(--muted) !important; font: 500 10.5px var(--f-body) !important; }
.la-track-a { stop-color: var(--crimson); } .la-track-b { stop-color: #F2B53C; } .la-track-c { stop-color: #2E9D6B; }

.assume-note { font-size: 13.5px; margin: -4px 0 12px; }
.assume { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.assume label { display: flex; flex-direction: column; gap: 5px; font: 600 12px/1.3 var(--f-body); color: var(--muted); }
.assume input { height: 42px; padding: 0 18px; border-radius: 999px; border: 0; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--hairline); color: var(--ink); font: 600 15px/1 var(--f-display); }
.assume label:first-of-type { grid-column: 1 / -1; }
.assume .btn { grid-column: 1 / -1; justify-self: start; }

@media (max-width: 1200px) {
  .cost-hero { grid-template-columns: 1fr; }
  .cost-cards { justify-content: flex-start; }
}
@media (max-width: 1100px) {
  .cost-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .notch-row { flex-direction: column; align-items: stretch; }
  .notch-tab { border-radius: var(--r-panel) var(--r-panel) 0 0; padding: 20px 20px 8px; }
  .notch-tab-r.notch-tools { order: 0; margin: 0; flex: none; border-radius: 0; justify-content: flex-start; padding: 4px 20px 10px; }
  .notch-tab-r::before, .notch-dip { display: none; }
  .notch-tab:first-child { flex: none; }
  .mini-grid { grid-template-columns: 1fr 1fr; }
  .mini-grid .mini-card.big { grid-row: auto; grid-column: 1 / -1; min-height: 0; }
  .stab { padding: 12px 16px; font-size: 14px; }
  .share-track { flex: 1 1 100%; flex-wrap: wrap; border-radius: 22px; }
  .share-btn { flex: 1 1 100%; }
  .notch-tab::after { display: none; }
  .add-pop .add-card { right: auto; left: 0; }
  .cost-row2 { grid-template-columns: 1fr; }
  .value-panel { grid-template-columns: 1fr; }
  .share-row { flex-wrap: wrap; }
  .share { flex: 1 1 140px; }
  .ccard { flex: 1 1 140px; }
  .assume { grid-template-columns: 1fr; }
}

/* ---------- chat with the agents ---------- */
.hue-blue { --hue: var(--agent-blue); } .hue-green { --hue: var(--agent-green); } .hue-violet { --hue: var(--agent-violet); } .hue-amber { --hue: var(--agent-amber); }
/* The header and the shell around it take 112px, so this fills the window without making a short conversation scroll. */
.chat { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 112px); flex: 1; }
.chat-side {
  position: sticky; top: 14px; height: calc(100vh - 112px); align-self: start;
  display: flex; flex-direction: column; gap: 12px; padding: 16px 14px 16px;
  margin: 0 0 0 clamp(12px, 2vw, 22px);
}
.chat-new { justify-content: center; width: 100%; padding: 13px 16px; }
.chat-search { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 999px; background: var(--sheet); color: var(--muted); box-shadow: var(--shadow-soft); }
.chat-search:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }
.chat-search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: 500 14px/1 var(--f-body); padding: 12px 0; outline: none; }
.chat-search input::placeholder { color: var(--muted); }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.chat-group { font: 600 12.5px/1 var(--f-body); color: var(--muted); margin: 16px 8px 8px; }
.chat-thread { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 14px; color: var(--ink-2); text-decoration: none; margin-bottom: 4px; }
.chat-thread span { font: 600 14px/1.3 var(--f-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread small { font-size: 12px; color: var(--muted); }
.chat-thread:hover { background: var(--sheet); color: var(--ink); }
.chat-thread[aria-current="page"] { background: var(--ink); color: var(--on-ink); }
.chat-thread[aria-current="page"] small { color: color-mix(in srgb, var(--on-ink) 70%, transparent); }
.chat-none { font-size: 14px; padding: 8px; }
.chat-usage { border-radius: 18px; padding: 14px 16px; background: var(--p-peach); color: var(--p-ink); }
.chat-usage .label { margin: 0 0 4px; color: color-mix(in srgb, var(--p-ink) 70%, transparent); }
.chat-usage .muted { color: color-mix(in srgb, var(--p-ink) 65%, transparent); }
.chat-usage-line { margin: 0 0 8px; font-size: 14px; }
.chat-usage-line strong { font: 600 20px/1 var(--f-display); }
.chat-usage .meter-track { fill: rgba(255, 255, 255, 0.6); } .chat-usage .meter-fill { fill: var(--p-ink); }

.chat-main { min-width: 0; width: 100%; max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; padding: 18px clamp(16px, 3vw, 34px) 0; }
.chat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 18px; margin-bottom: 12px; border-radius: 20px; background: var(--sheet); box-shadow: var(--shadow-soft); }
.chat-title { font: 600 20px/1.25 var(--f-display); margin: 0 0 4px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.chat-sub { font-size: 13px; }
.chat-actions { display: flex; align-items: center; gap: 14px; flex: none; }
.chat-actions form { margin: 0; }
.chat-actions .link { padding: 4px 0; }
.chat-actions .chat-new-inline { display: none; }
.chat-main.is-empty { padding-top: clamp(28px, 7vh, 80px); }
.chat-main.is-empty .chat-head, .chat-main.is-empty .chat-log { display: none; }
.chat-main:not(.is-empty) .chat-hello, .chat-main:not(.is-empty) .chat-starters { display: none; }
.chat-hello { text-align: center; margin-bottom: 24px; }
.chat-hello h1 { font-size: clamp(32px, 4.4vw, 46px); }
.chat-hello .lede { margin: 0 auto; max-width: 560px; color: var(--muted); font-size: 17px; }

.chat-log { list-style: none; margin: 0; padding: 8px 0 26px; flex: 1; display: flex; flex-direction: column; gap: 30px; }
.turn { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 70px; }
.msg-user { align-self: flex-end; max-width: min(640px, 88%); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-to { margin: 0; display: flex; align-items: center; gap: 6px; font: 600 12px/1 var(--f-body); color: var(--muted); }
.msg-to i { width: 7px; height: 7px; border-radius: 50%; }
.bubble { background: var(--ink); color: var(--on-ink); border-radius: 20px 20px 6px 20px; padding: 12px 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; line-height: 1.5; }
.msg-bot { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px 18px; border-radius: 6px 22px 22px 22px; background: var(--sheet); box-shadow: var(--shadow-soft); }
.bot-head { margin: 0; display: flex; align-items: center; gap: 9px; font: 600 14.5px/1 var(--f-display); }
.bot-avatar { width: 24px; height: 24px; border-radius: 50%; flex: none; background: var(--hue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hue) 18%, transparent); }
.tool-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tool-chips[hidden] { display: none; }
.tool-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--hue) 12%, var(--sheet)); font: 600 12.5px/1.2 var(--f-body); color: var(--ink-2); }
.tool-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--hue); flex: none; }
.tool-chip small { color: var(--muted); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.tool-chip.running::before { animation: pulse-dot 1s ease-in-out infinite; }
.reasoning { border-left: 2px solid color-mix(in srgb, var(--hue) 50%, transparent); padding-left: 12px; }
.reasoning[hidden] { display: none; }
.reasoning summary { cursor: pointer; font-size: 13.5px; color: var(--muted); width: fit-content; }
.reasoning-body { font-size: 14px; color: var(--muted); margin-top: 8px; max-height: 320px; overflow-y: auto; }
.reasoning-body.live { white-space: pre-wrap; }
.reasoning-body p { margin: 0 0 8px; }

.answer { font-size: 16px; line-height: 1.62; overflow-wrap: anywhere; }
.answer-live { white-space: pre-wrap; }
.answer-live:empty { display: none; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h3 { font: 600 19px/1.3 var(--f-display); margin: 20px 0 8px; }
.md h4 { font: 700 16px/1.35 var(--f-body); margin: 16px 0 6px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md ul { list-style-type: disc; } .md ul ul { list-style-type: circle; } .md ol { list-style-type: decimal; }
.md li { margin: 4px 0; }
.md li > ul, .md li > ol { margin: 4px 0; }
.md li::marker { color: var(--muted); }
.md a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent-a); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.md a:hover { text-decoration-color: var(--ink); }
.md code { font: 13.5px/1.4 var(--f-mono); background: var(--sheet-2); border-radius: 6px; padding: 1px 5px; }
.md pre { background: var(--sheet-2); border-radius: 14px; padding: 12px 14px; overflow-x: auto; margin: 0 0 12px; }
.md pre code { background: none; padding: 0; font-size: 13px; white-space: pre; }
.md blockquote { margin: 0 0 12px; padding: 2px 0 2px 14px; border-left: 3px solid var(--hairline); color: var(--ink-2); }
.md hr { border: 0; border-top: 1px solid var(--hairline); margin: 16px 0; }
.md-table { overflow-x: auto; margin: 0 0 12px; border-radius: 14px; background: var(--sheet-2); padding: 4px; }
.md table { border-collapse: separate; border-spacing: 0 4px; width: 100%; font-size: 14.5px; }
.md th, .md td { text-align: left; padding: 8px 12px; vertical-align: top; }
.md td { background: var(--sheet); }
.md td:first-child { border-radius: 10px 0 0 10px; } .md td:last-child { border-radius: 0 10px 10px 0; }
.md th { font: 600 12px/1.3 var(--f-body); color: var(--muted); }
.sources { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; font-size: 13px; }
.sources span { font: 700 12px/1.6 var(--f-body); color: var(--muted); }
.sources a { color: var(--ink-2); text-underline-offset: 3px; }
.turn-note { margin: 0; font-size: 14px; color: var(--muted); }
.turn-running { display: flex; align-items: center; gap: 12px; }
.turn-running form { margin: 0; }
.answer .md-tail:empty { display: none; }
.turn-bad { color: var(--warn-ink); background: var(--warn-bg); padding: 9px 13px; border-radius: 12px; }
.turn-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; font: 500 12px/1.4 var(--f-body); color: var(--muted); }
.copy { display: inline-flex; align-items: center; gap: 4px; padding: 0; font: 600 12.5px/1 var(--f-body); color: var(--muted); text-decoration: none; }
.copy:hover { color: var(--ink); }
.copy[hidden] { display: none; }
.typing { display: flex; gap: 5px; margin: 6px 0; }
.typing[hidden] { display: none; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--hue); opacity: 0.3; animation: typing 1.2s ease-in-out infinite; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-dock { position: sticky; bottom: 0; z-index: 5; padding: 14px 0 14px; background: linear-gradient(to bottom, transparent, var(--bg) 26%); }
.chat-main.is-empty .chat-dock { position: static; padding: 0; background: none; }
.composer { background: var(--sheet); border-radius: 24px; box-shadow: var(--shadow); padding: 14px 12px 10px 18px; transition: box-shadow 0.2s; }
.composer:focus-within { box-shadow: var(--shadow), inset 0 0 0 2px var(--ink); }
.composer textarea { display: block; width: 100%; resize: none; border: 0; outline: none; background: none; color: var(--ink); font: 400 16px/1.5 var(--f-body); min-height: 50px; max-height: 260px; padding: 2px 4px 10px 0; }
.composer textarea::placeholder { color: var(--muted); }
.composer textarea:disabled { opacity: 0.5; }
.composer-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.agent-pick { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.agent-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px; background: var(--sheet-2); font: 600 13px/1 var(--f-body); color: var(--ink-2); cursor: pointer; user-select: none; }
.agent-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.agent-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--hue); }
.agent-chip:hover { color: var(--ink); }
.agent-chip:has(input:checked) { background: var(--ink); color: var(--on-ink); }
.agent-chip:has(input:focus-visible) { outline: 2px solid var(--accent-a); outline-offset: 2px; }
.model-pick { position: relative; }
.model-pick summary { list-style: none; display: inline-flex; align-items: center; gap: 3px; padding: 8px 9px 8px 13px; border-radius: 999px; font: 600 13px/1 var(--f-body); color: var(--ink-2); cursor: pointer; user-select: none; }
.model-pick summary::-webkit-details-marker { display: none; }
.model-pick summary::before { content: ""; width: 8px; height: 8px; margin-right: 5px; border-radius: 2px; background: linear-gradient(135deg, var(--agent-violet), var(--agent-green)); }
.model-pick summary:hover, .model-pick[open] summary { background: var(--sheet-2); color: var(--ink); }
.model-menu { position: absolute; bottom: calc(100% + 10px); left: 0; z-index: 20; width: 300px; max-width: calc(100vw - 40px); background: var(--sheet); border-radius: 18px; box-shadow: var(--shadow); padding: 10px; }
.chat-main.is-empty .model-menu { bottom: auto; top: calc(100% + 10px); }
.model-menu .label { margin: 2px 8px 6px; }
.model-opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 12px; cursor: pointer; }
.model-opt:hover, .model-opt:has(input:checked) { background: var(--sheet-2); }
.model-opt input { accent-color: var(--ink); margin: 3px 0 0; flex: none; }
.model-off { opacity: 0.55; cursor: not-allowed; }
.model-off:hover { background: none; }
.model-txt { display: flex; flex-direction: column; gap: 3px; }
.model-txt b { font: 600 14.5px/1.2 var(--f-display); color: var(--ink); }
.model-txt small { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.model-txt .mono { font-size: 11.5px; }
.composer-meta { margin-left: auto; padding: 0 6px; font: 500 12px/1 var(--f-body); color: var(--muted); white-space: nowrap; }
.send { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--ink); color: var(--on-ink); cursor: pointer; transition: opacity 0.2s, transform 0.2s var(--ease); }
.send:hover { opacity: 0.85; }
.send:active { transform: scale(0.94); }
.send:disabled { opacity: 0.4; cursor: not-allowed; }
.send[hidden] { display: none; }
.chat-hint { font-size: 12px; text-align: center; margin: 8px 0 0; }
.chat-main.is-empty .chat-hint { display: none; }

.chat-starters { margin-top: 18px; padding-bottom: 56px; }
.quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 28px; }
.quick form { margin: 0; }
.quick-chip { display: inline-flex; align-items: center; gap: 8px; padding: 11px 17px; border-radius: 999px; border: 0; background: var(--sheet); color: var(--ink); font: 600 14px/1 var(--f-body); cursor: pointer; box-shadow: var(--shadow-soft); transition: transform 0.2s var(--ease); }
.quick-chip:hover { transform: translateY(-1px); }
.quick-chip:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.quick-chip .ico { color: var(--muted); }
.chat-cards { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-bottom: 28px; }
.chat-card { display: flex; flex-direction: column; gap: 7px; padding: 16px 18px; border-radius: var(--r-card); color: var(--p-ink); text-decoration: none; transition: transform 0.25s var(--ease); }
.chat-card:hover { transform: translateY(-2px); }
.chat-card.hue-blue { background: var(--p-blue); } .chat-card.hue-green { background: var(--p-mint); } .chat-card.hue-violet { background: var(--p-lilac); }
.chat-card .label { display: flex; align-items: center; gap: 7px; margin: 0; color: color-mix(in srgb, var(--p-ink) 72%, transparent); }
.chat-card .label i { width: 8px; height: 8px; border-radius: 50%; background: var(--hue); }
.chat-card p { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--p-ink); }
.chat-card strong { font: 600 36px/1 var(--f-display); letter-spacing: -0.02em; }
.chat-card small { margin-top: auto; font-size: 13px; color: color-mix(in srgb, var(--p-ink) 70%, transparent); }
.chat-recent > .label { margin-bottom: 10px; }
.chat-recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.chat-recent-card { display: flex; flex-direction: column; gap: 7px; padding: 14px 16px; border-radius: var(--r-card); background: var(--sheet); color: inherit; text-decoration: none; box-shadow: var(--shadow-soft); transition: transform 0.25s var(--ease); }
.chat-recent-card:hover { transform: translateY(-2px); }
.chat-recent-card .ico { color: var(--muted); }
.chat-recent-card b { font: 600 14.5px/1.35 var(--f-body); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat-recent-card small { margin-top: auto; font-size: 12.5px; color: var(--muted); }

@media (max-width: 1100px) {
  .chat { grid-template-columns: 244px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat-main { order: 1; }
  .chat-side { order: 2; position: static; height: auto; margin: 0; padding: 18px 16px 28px; border-top: 1px solid var(--hairline); }
  .chat-side .chat-new { display: none; }
  .chat-list { max-height: 55vh; }
  .chat-actions .chat-new-inline { display: inline-flex; align-items: center; gap: 4px; }
  .chat-cards { grid-template-columns: 1fr 1fr; }
  .chat-cards .chat-card:first-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .chat-main { padding: 14px 12px 0; }
  .chat-main.is-empty { padding-top: 24px; }
  .chat-hello .lede { font-size: 15.5px; }
  .composer { padding: 12px 10px 8px 14px; border-radius: 20px; }
  .composer-meta, .chat-hint { display: none; }
  .agent-chip { padding: 8px 11px; }
  .send { margin-left: auto; }
  .msg-user { max-width: 92%; }
  .msg-bot { padding: 14px; }
  .quick { justify-content: flex-start; }
  .chat-cards { grid-template-columns: 1fr; }
  .chat-card strong { font-size: 30px; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .graph-wrap { grid-template-columns: 1fr; }
  .graph-aside { position: static; }
  .ov-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, minmax(240px, 82vw)); scroll-snap-type: x mandatory; }
  .lane { scroll-snap-align: start; }
  .top-search { min-width: 0; }
  .top-search span { display: none; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; margin: 0; border-radius: 0; min-height: 100vh; background: var(--bg); box-shadow: none; }
  .rail { position: sticky; top: 0; height: auto; flex-direction: row; gap: 10px; padding: 10px 12px; overflow-x: auto; scrollbar-width: none; background: var(--rail); }
  .rail::-webkit-scrollbar { display: none; }
  .rail { align-items: center; }
  .rail-logo { width: 40px; height: 40px; flex: none; margin: 0; }
  .rail-logo img { width: 24px; height: 24px; }
  .rail-links, .rail-foot { flex-direction: row; margin: 0; gap: 6px; flex: none; }
  .rail-foot { margin-left: auto; }
  .rail-link { width: 40px; height: 40px; }
  .rail-link .ico, .rail-link[aria-current="page"] .ico { width: 20px; height: 20px; }
  .app-main { border-radius: 0; }
  .rail-link[data-tip]::after { display: none; }
  .chat-side { top: 0; }
  .crumb { display: none; }
  .topbar { padding-top: 14px; flex-wrap: wrap; }
  .top-title { flex: 1 1 100%; font-size: 26px; }
  .top-actions { width: 100%; }
  .top-search { flex: 1; }
  .top-search span { display: inline; }
}
@media (max-width: 560px) {
  .item, .item:has(.badge-src) { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .item > .badge { justify-self: start; }
  .item > .pin-form, .item > .pinned { justify-self: start; }
  .items { padding: 16px 14px 14px; }
  .brief-text { font-size: 18px; }
  .log-list li { grid-template-columns: 70px minmax(0, 1fr); }
  .log-list li .who { grid-column: 2; justify-self: start; }
  .log-list li .what { grid-column: 1 / -1; }
  .source { flex-direction: column; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; min-height: 104px; }
  .kpi strong { font-size: 28px; }
  .kpi .label { font-size: 12px; padding-right: 0; }
  .kpi-pill { display: none; }
  .workload { padding: 16px 14px; }
  .kpis > .kpi:nth-child(3):last-child { grid-column: 1 / -1; min-height: 88px; }
  .chart-scroll > svg { min-width: 520px; }
  .space-tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .space-tabs::-webkit-scrollbar { display: none; }
  .space-tabs > * { flex: none; }
  .rail { gap: 6px; padding: 8px 10px; }
  .rail-logo { width: 36px; height: 36px; }
  .rail-links, .rail-foot { gap: 2px; }
  .rail-link { width: 36px; height: 36px; }
  .atable th:nth-child(4), .atable tr:not(.detail) td:nth-child(4) { display: none; }
  .atable td { padding: 10px 6px; }
  .atable tr.detail td { padding: 0 8px 12px; }
  .chart-scroll { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
}

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

/* system dark (theme "auto"): the same component overrides as the dark toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rail-logo { color: #CBD9E6; }
  :root:not([data-theme="light"]) .workload { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--hairline); }
  :root:not([data-theme="light"]) .workload .pill { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--hairline); }
  :root:not([data-theme="light"]) .workload .pill[aria-current="true"] { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink-2); }
  :root:not([data-theme="light"]) .stab[aria-current="true"] .stab-n { background: rgba(0, 0, 0, 0.12); }
  :root:not([data-theme="light"]) .app-main:has(.costs) { background: var(--bg); }
  :root:not([data-theme="light"]) .ccard-dark { background: #F2F3F5; color: #16171B; }
  :root:not([data-theme="light"]) .ccard-dark .ccard-label, :root:not([data-theme="light"]) .ccard-dark .ccard-foot { color: rgba(22, 23, 27, 0.65); }
  :root:not([data-theme="light"]) .share-track { background: var(--sheet-2); }
  :root:not([data-theme="light"]) .costs .cpanel { background: var(--sheet-2); }
  :root:not([data-theme="light"]) .dark-pill { background: #F2F3F5; color: #16171B; }
  :root:not([data-theme="light"]) .workload .ico-box { background: var(--sheet-2); }
  :root:not([data-theme="light"]) .seg a[aria-current="true"] { background: var(--ink); color: var(--on-ink); }
  :root:not([data-theme="light"]) .seg { box-shadow: inset 0 0 0 1px var(--hairline); }
  :root:not([data-theme="light"]) .lane { background: color-mix(in srgb, var(--sheet-2) 55%, transparent); }
  :root:not([data-theme="light"]) .kcard { background: #2A2D33; box-shadow: inset 0 0 0 1px var(--hairline); }
  :root:not([data-theme="light"]) .delta-up { background: color-mix(in srgb, var(--agent-green) 14%, transparent); color: var(--agent-green); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--agent-green) 35%, transparent); }
  :root:not([data-theme="light"]) .hatch-bg { fill: color-mix(in srgb, var(--ink) 24%, var(--sheet)); }
  :root:not([data-theme="light"]) .hatch-line { stroke: color-mix(in srgb, var(--ink) 50%, transparent); }
}
:root[data-theme="dark"] .workload .ico-box { background: var(--sheet-2); }
:root[data-theme="dark"] .seg a[aria-current="true"] { background: var(--ink); color: var(--on-ink); }
:root[data-theme="dark"] .seg { box-shadow: inset 0 0 0 1px var(--hairline); }
:root[data-theme="dark"] .delta-up { background: color-mix(in srgb, var(--agent-green) 14%, transparent); color: var(--agent-green); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--agent-green) 35%, transparent); }
@media (max-width: 1200px) { .app-main.has-aside { display: flex; } .app-aside { margin: 0 clamp(16px, 3vw, 34px) 28px; } }
@media (max-width: 900px) { .needs-head { display: none; } .needs .item { grid-template-columns: 130px minmax(0, 1fr) 36px; } .needs .cell-why, .needs .cell-from { display: none; } }
@media (max-width: 560px) { .needs .item { grid-template-columns: minmax(0, 1fr) 36px; } .needs .item > .badge { display: none; } .value-body { grid-template-columns: 1fr; padding: 0; } .value-card { border-radius: 0; } .notch-dip { display: none; } }
:root[data-theme="dark"] .lane { background: color-mix(in srgb, var(--sheet-2) 55%, transparent); }
:root[data-theme="dark"] .kcard { background: #2A2D33; box-shadow: inset 0 0 0 1px var(--hairline); }
:root[data-theme="dark"] .hatch-bg { fill: color-mix(in srgb, var(--ink) 24%, var(--sheet)); }
:root[data-theme="dark"] .hatch-line { stroke: color-mix(in srgb, var(--ink) 50%, transparent); }

/* Morning digest. Uses theme tokens only, so both dark blocks already cover it. */
.digest-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.digest-side { display: grid; gap: 20px; min-width: 0; }
.digest-panel { padding: 24px; min-width: 0; }
.digest-bubble { max-width: 560px; padding: 16px 18px; border-radius: 18px 18px 18px 6px; background: var(--sheet); box-shadow: var(--shadow-soft); color: var(--ink); font: 400 14.5px/1.5 var(--f-body); white-space: pre-wrap; overflow-wrap: anywhere; }
.digest-bubble a { color: var(--agent-violet); text-decoration: underline; text-underline-offset: 2px; }
.digest-state { margin: 0 0 4px; font: 700 26px/1.2 var(--f-display); color: var(--ink); }
.digest-note { margin: 0 0 16px; font-size: 14px; }
.digest-panel form { margin: 0 0 10px; }
.digest-panel form .btn { width: 100%; }
.digest-panel .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.digest-panel form.digest-hour { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin: 16px 0 0; font-size: 14px; color: var(--muted); }
.digest-hour select { height: 40px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--hairline); color: var(--ink); font: 500 14px/1 var(--f-body); }
.digest-panel form.digest-hour .btn { width: auto; }
.digest-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; color: var(--ink); }
.digest-row + p { margin-top: 12px; }
.digest-side .notice { margin: 12px 0 0; }
@media (max-width: 900px) { .digest-grid { grid-template-columns: minmax(0, 1fr); } .digest-panel { padding: 18px; } }

/* Apps, devices and the phone's "More" menu. Uses theme tokens only, so both dark blocks already cover it. */
.app-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 20px; align-items: start; }
.app-card { padding: 24px; display: grid; gap: 14px; min-width: 0; }
.app-card-head { display: flex; align-items: center; gap: 14px; }
.app-card-head h2 { margin: 0; font: 600 20px/1.2 var(--f-display); }
.app-card-icon, .more-icon { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hairline); }
.app-card-note { font-size: 14px; }
.app-card .btn { justify-self: start; }
.app-card-hash { margin: 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.app-card-hash code { font: 500 12px/1.4 var(--f-mono); }
.app-note { margin-top: 18px; font-size: 14px; }
.app-note a { color: inherit; text-decoration: underline; }
.device-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-radius: var(--r-card); background: var(--sheet); }
.device-row p { margin: 4px 0 0; font-size: 13px; }
.device-row form { margin: 0; flex: none; }
.more-list { padding: 8px; display: grid; gap: 2px; margin-bottom: 16px; }
.more-list form { margin: 0; }
.more-link { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px; border: 0; border-radius: var(--r-card); background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.more-link:hover { background: var(--sheet); }
.more-link > span:nth-child(2) { flex: 1; min-width: 0; display: grid; gap: 2px; }
.more-link b { font-weight: 600; font-size: 15.5px; }
.more-link .muted { font-size: 13px; }

/* The rail scales with the window's height, so its last items are never cut off on a laptop screen. */
@media (min-width: 821px) {
  .rail { gap: clamp(8px, 3vh, 40px); padding: clamp(12px, 2.8vh, 28px) 0; }
  .rail-logo { width: clamp(40px, 6vh, 56px); height: clamp(40px, 6vh, 56px); margin-bottom: clamp(0px, 2vh, 35px); }
  .rail-links { gap: clamp(2px, 1.3vh, 22px); }
  .rail-foot { gap: clamp(2px, 1vh, 14px); }
  .rail-link { width: clamp(38px, 5.6vh, 52px); height: clamp(38px, 5.6vh, 52px); }
  .rail-link .ico { width: clamp(20px, 2.9vh, 26px); height: clamp(20px, 2.9vh, 26px); }
  .rail-link[aria-current="page"] .ico { width: clamp(20px, 3vh, 28px); height: clamp(20px, 3vh, 28px); }
}

/* The phone's bottom bar replaces the rail, as in a native app. */
.tabbar { display: none; }
@media (max-width: 820px) {
  .rail { display: none; }
  .app { display: block; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--rail);
  }
  .tab { display: grid; justify-items: center; gap: 3px; padding: 6px 2px; border-radius: 14px; color: var(--rail-ink); font: 600 11px/1 var(--f-body); text-decoration: none; }
  .tab[aria-current="page"] { color: #FFFFFF; background: rgba(255, 255, 255, 0.12); }
  .app-main { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); min-height: 100vh; }
  .app-main.has-tabs { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

  /* A slim header: the page's name and the bell. Chat is a tab away, so the search pill goes. */
  .topbar { flex-wrap: nowrap; padding-top: 14px; }
  .top-search, .avatar { display: none; }
  .top-actions { width: auto; }
  .crumb { display: flex; font-size: 24px; }
  .crumb > span, .crumb > svg { display: none; }
  .crumb b { font: 400 26px/1.15 var(--f-display); }
  .top-title { flex: 1 1 auto; min-width: 0; font-size: 26px; overflow-wrap: anywhere; }
  .circle-btn { flex: none; }

  /* Inside a conversation the header and tabs step aside, as in the Claude app. */
  .chat-main:not(.is-empty) { padding-top: 10px; }
  .app-main:not(.has-tabs) .topbar { display: none; }
  .composer textarea { min-height: 26px; }
  .composer-bar { flex-wrap: nowrap; }
  .agent-pick { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .agent-pick::-webkit-scrollbar { display: none; }
  .agent-chip { flex: none; }
  .model-pick { flex: none; }
  .send { flex: none; }
  .chat-dock { padding: 10px 0 12px; }
  /* The first answer streams in without a page load, so the tabs can still be there. */
  .has-tabs .chat-main:not(.is-empty) .chat-dock { bottom: calc(60px + env(safe-area-inset-bottom)); }
}

/* Automations. Uses theme tokens only, so both dark blocks already cover it. */
.auto-card { padding: 22px 24px; margin-bottom: 14px; }
.auto-off { opacity: 0.72; }
.auto-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.auto-card-head form { margin: 0; flex: none; }
.auto-card-head h2 { margin: 0 0 4px; font: 600 19px/1.25 var(--f-display); }
.auto-card-head h2 a { color: inherit; text-decoration: none; }
.auto-card-head h2 a:hover { text-decoration: underline; }
.auto-card-head .muted { font-size: 14px; }
.btn-compact { padding: 9px 16px; font-size: 13.5px; }
.auto-empty { margin-top: 12px; font-size: 14px; }
.auto-result { margin-top: 14px; padding: 14px 16px; border-radius: var(--r-card); background: var(--sheet); }
.auto-result-head { margin: 0 0 4px; font-size: 13.5px; }
.auto-result-text { margin: 0; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.auto-error .auto-result-head b, .auto-refused .auto-result-head b { color: var(--danger); }
.auto-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font: 600 13.5px/1.2 var(--f-body); color: var(--agent-violet); text-decoration: none; }
.auto-link:hover { text-decoration: underline; }
.auto-history { display: grid; gap: 10px; }
.auto-history .auto-result { margin-top: 0; }
.auto-actions { margin-bottom: 16px; gap: 10px; }
.auto-examples { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; margin-bottom: 16px; }
.auto-example { display: grid; gap: 4px; padding: 16px 18px; border-radius: var(--r-card); background: var(--sheet); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-soft); }
.auto-example:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.auto-example .muted { font-size: 13.5px; }
.auto-form label { display: block; margin-top: 12px; font: 600 13px/1.4 var(--f-body); color: var(--muted); }
.auto-form input, .auto-form textarea, .auto-form select { margin: 6px 0 4px; }
.auto-form textarea { resize: vertical; }
.auto-when { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 0 12px; }
.auto-more { margin-top: 10px; }
.auto-more summary { cursor: pointer; font: 600 13px/1.4 var(--f-body); color: var(--muted); }
.auto-form .auto-check { display: flex; align-items: center; gap: 10px; margin: 14px 0; font: 500 14px/1.4 var(--f-body); color: var(--ink); }
.auto-check input { width: 18px; height: 18px; flex: none; margin: 0; accent-color: var(--ink); box-shadow: none; }
.auto-form .btn { margin-top: 4px; }
.auto-note { margin-top: 14px; font-size: 13.5px; }
.auto-note a { color: inherit; text-decoration: underline; }
.f-day, .f-every, .f-at { display: none; }
.auto-form:has(option[value="weekly"]:checked) .f-day { display: block; }
.auto-form:has(option[value="hourly"]:checked) .f-every { display: block; }
.auto-form:has(option[value="hourly"]:checked) .f-time { display: none; }
.auto-form:has(option[value="once"]:checked) .f-at { display: block; }
.auto-form:has(option[value="once"]:checked) .f-time { display: none; }
a.tele-planned { color: inherit; text-decoration: none; }
a.tele-planned:hover { border-color: var(--ink); }

/* Four tiles on the Overview: all in a row where they fit, two by two on a phone. */
.kpi-mint { background: var(--p-mint); }
.kpis:has(> .kpi-mint) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
@media (max-width: 560px) { .kpis:has(> .kpi-mint) { grid-template-columns: 1fr 1fr; } }
/* Below this the tiles are too narrow for a label and a pill side by side, and the whole tile is a link anyway. */
@media (max-width: 1500px) { .kpis:has(> .kpi-mint) .kpi-pill { display: none; } .kpis:has(> .kpi-mint) .label { padding-right: 0; } }
/* On a phone the chart scrolls sideways: it starts at its right-hand end, so today is what shows first. */
@media (max-width: 560px) {
  .workload .chart-scroll { direction: rtl; -webkit-mask-image: none; mask-image: none; }
  .workload .chart-scroll > svg { direction: ltr; }
}

/* With the keyboard open on a touch screen the tabs step aside, or they would sit on the composer and its send button. */
@media (max-width: 820px) and (pointer: coarse) {
  body:has(textarea:focus, input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="hidden"]):focus) .tabbar { display: none; }
  body:has(textarea:focus, input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="hidden"]):focus) .has-tabs .chat-main:not(.is-empty) .chat-dock { bottom: 0; }
}
