/* Advance AI portal (app.advanceai.ai). Tokens follow ~/advanceai-site-v2/BRAND.md (v2.1).
   Fonts are self-hosted (OFL, see fonts/OFL.txt); no third-party requests. Components use tokens only. */
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("fonts/outfit-latin.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/manrope-latin.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --paper: #F5F8FD; --surface: #FFFFFF; --surface-2: #EEF3FA; --surface-3: #E4ECF7;
  --ink: #0F2A55; --ink-2: #344A73; --ink-3: #566A8E;
  --line: #DCE5F2; --line-2: #C3D2E8;
  --signal: #1764D0; --signal-hover: #1253B0; --signal-ink: #FFFFFF; --signal-soft: #E5EFFD;
  --human: #4F43C9; --human-soft: #EEEDFE; --human-line: #CBC7F7;
  --focus: #1B6FE0;
  --c-in: #1B6FE0; --c-out: #C96A28; --c-target: #0F2A55; --c-grid: #E7EDF6; --c-hatch: #C6D6EE;
  --ok: #12704A; --ok-soft: #E2F3EA; --warn: #8A5300; --warn-soft: #FFF1D6; --warn-line: #F1D49B;
  --bad: #B42318; --bad-soft: #FDE8E6; --bad-line: #F5C2BD; --muted-soft: #EDF1F7;
  --shadow-1: 0 1px 2px rgba(15, 42, 85, .06);
  --shadow-2: 0 1px 2px rgba(15, 42, 85, .05), 0 12px 32px -18px rgba(15, 42, 85, .28);
  --f-display: "Outfit", ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
  --f-body: "Manrope", ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
  --r-s: 8px; --r-m: 12px; --r-l: 16px; --wrap: 1120px; --gutter: 24px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #08121F; --surface: #0E1B2E; --surface-2: #13233A; --surface-3: #1A2D48;
    --ink: #EAF1FC; --ink-2: #BCC9DF; --ink-3: #8FA0BE;
    --line: #1C2F4B; --line-2: #2A4166;
    --signal: #5A9CF6; --signal-hover: #79B0F8; --signal-ink: #06152E; --signal-soft: #132C52;
    --human: #A59FFF; --human-soft: #1F1D47; --human-line: #3A3680;
    --focus: #7AB2FA;
    --c-in: #4A93F5; --c-out: #C9712F; --c-target: #EAF1FC; --c-grid: #172A44; --c-hatch: #2A4166;
    --ok: #5FD39A; --ok-soft: #0D2D22; --warn: #F2B657; --warn-soft: #33250A; --warn-line: #5A4214;
    --bad: #FF8F86; --bad-soft: #3A1512; --bad-line: #6A2620; --muted-soft: #15253C;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #08121F; --surface: #0E1B2E; --surface-2: #13233A; --surface-3: #1A2D48;
  --ink: #EAF1FC; --ink-2: #BCC9DF; --ink-3: #8FA0BE;
  --line: #1C2F4B; --line-2: #2A4166;
  --signal: #5A9CF6; --signal-hover: #79B0F8; --signal-ink: #06152E; --signal-soft: #132C52;
  --human: #A59FFF; --human-soft: #1F1D47; --human-line: #3A3680;
  --focus: #7AB2FA;
  --c-in: #4A93F5; --c-out: #C9712F; --c-target: #EAF1FC; --c-grid: #172A44; --c-hatch: #2A4166;
  --ok: #5FD39A; --ok-soft: #0D2D22; --warn: #F2B657; --warn-soft: #33250A; --warn-line: #5A4214;
  --bad: #FF8F86; --bad-soft: #3A1512; --bad-line: #6A2620; --muted-soft: #15253C;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .6);
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink-2); font: 400 1rem/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3, h4 { font-family: var(--f-display); color: var(--ink); margin: 0; line-height: 1.2; font-weight: 600; }
h1 { font-size: clamp(1.75rem, 3.2vw, 2.25rem); letter-spacing: -0.02em; font-weight: 650; }
h2 { font-size: 1.3rem; letter-spacing: -0.01em; }
h3 { font-size: 1.08rem; }
h4 { font-size: 1rem; }
h1:focus { outline: none; }
p { margin: 0; }
a { color: var(--signal); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--signal-hover); text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
button { font: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); color: var(--ink); padding: 10px 14px;
  border-radius: var(--r-s); z-index: 20; box-shadow: var(--shadow-2); }
.skip:focus { left: 8px; }
.num, .fig-val, .stat-val, td.n { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: .9375rem; }
.fine { font-size: .875rem; color: var(--ink-3); line-height: 1.5; }
.neg { color: var(--bad); }

/* ---------------------------------------------------------------- top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: var(--wrap); margin: 0 auto; padding: 10px var(--gutter); display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font: 600 1.08rem var(--f-display); white-space: nowrap; border-radius: 8px; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand b { color: var(--signal); font-weight: 700; }
/* agent switcher: a segmented control */
.agents { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.agents a { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 9px;
  color: var(--ink-2); font-weight: 600; font-size: .9375rem; white-space: nowrap; }
.agents a:hover { text-decoration: none; color: var(--ink); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.agents a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.agents .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--warn-soft); color: var(--warn);
  font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; margin-right: 4px; }
.who-email { font-size: .875rem; color: var(--ink-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-role { font-size: .75rem; color: var(--ink-3); }
/* section tabs: underline */
.subnav { border-top: 1px solid var(--line); }
.subnav-in { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -8px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; display: inline-flex; align-items: center; min-height: 46px; padding: 0 10px; color: var(--ink-3);
  font-weight: 600; font-size: .9375rem; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--signal); }
.tabs a:focus-visible { outline-offset: -4px; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  font: 600 .9375rem var(--f-body); border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--signal); color: var(--signal-ink); box-shadow: var(--shadow-1); }
.btn-primary:hover { background: var(--signal-hover); color: var(--signal-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-1); }
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn-quiet { background: transparent; color: var(--ink-2); border-color: var(--line-2); min-height: 40px; padding: 0 14px; }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn { background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.linkish { background: none; border: 0; padding: 0; color: var(--signal); font-weight: 600; cursor: pointer; min-height: 44px; }
.linkish:hover { text-decoration: underline; color: var(--signal-hover); }
.more-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 600; font-size: .9375rem; }
.more-link svg { flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chip { min-height: 40px; padding: 0 14px; font: 600 .875rem var(--f-body); border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-2); cursor: pointer; }
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------------------------------------------------------------- layout */
main { flex: 1; width: 100%; }
#view { max-width: var(--wrap); margin: 0 auto; padding: 32px var(--gutter) 72px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 28px; }
.page-head-main { min-width: 0; flex: 1 1 420px; }
.page-head .sub { margin-top: 8px; max-width: 68ch; color: var(--ink-2); }
.page-head-side { display: flex; align-items: center; gap: 8px; }
.crumbs ol { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: .9375rem; }
.crumbs li { display: inline-flex; align-items: center; gap: 2px; color: var(--ink-3); }
.crumbs li + li::before { content: "/"; color: var(--line-2); padding: 0 6px; }
.crumbs a { color: var(--ink-3); font-weight: 500; display: inline-flex; align-items: center; min-height: 32px; }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current="page"] { color: var(--ink-2); font-weight: 600; }
.crumbs .back-arrow { display: none; }
.section { margin-top: 40px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 14px; }
.section-head p { color: var(--ink-3); font-size: .9375rem; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); align-items: start; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 22px 24px; box-shadow: var(--shadow-1); min-width: 0; }
.card > h3 { margin-bottom: 12px; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-sub { font-size: .9375rem; color: var(--ink-3); margin-top: 2px; }
.card-foot { margin-top: 8px; padding-top: 4px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-pad { padding: 20px 24px 0; }

/* ---------------------------------------------------------------- figures (headline numbers) */
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-1); overflow: hidden; }
.fig { padding: 20px 22px; border-left: 1px solid var(--line); margin-left: -1px; min-width: 0; }
.fig-label { font-size: .9375rem; font-weight: 600; color: var(--ink-2); }
.fig-val { font: 600 1.75rem/1.15 var(--f-display); color: var(--ink); margin-top: 6px; letter-spacing: -0.01em; }
.fig-val.neg { color: var(--bad); }
.fig-note { font-size: .875rem; color: var(--ink-3); margin-top: 6px; line-height: 1.45; }
.fig-note .chip-inline { margin-right: 6px; }

/* ---------------------------------------------------------------- status chips: icon + text + color */
.badge { display: inline-flex; align-items: center; gap: 6px; font: 600 .8125rem/1.25 var(--f-body); padding: 4px 10px 4px 8px; border-radius: 999px;
  white-space: nowrap; border: 1px solid transparent; }
.badge svg { width: 14px; height: 14px; flex: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.muted { background: var(--muted-soft); color: var(--ink-2); }
.badge.review { background: var(--human-soft); color: var(--human); }
.badge.info { background: var(--signal-soft); color: var(--signal); }
.badge.wrap { white-space: normal; }

/* notices */
.notice { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--r-m); padding: 14px 16px; margin: 0 0 16px; color: var(--ink);
  border: 1px solid var(--line); background: var(--surface); }
.notice svg { flex: none; margin-top: 3px; }
.notice.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.notice.warn svg { color: var(--warn); }
.notice.review { background: var(--human-soft); border-color: var(--human-line); }
.notice.review svg { color: var(--human); }
.notice.info { background: var(--surface-2); border-color: var(--line); }
.notice.info svg { color: var(--signal); }
.notice b { font-weight: 700; }

/* ---------------------------------------------------------------- home */
.today { margin-bottom: 28px; }
.today-date { color: var(--ink-3); font-weight: 600; font-size: .9375rem; margin-bottom: 6px; }
.today h1 { font-size: clamp(2rem, 4.4vw, 2.85rem); letter-spacing: -0.025em; line-height: 1.1; max-width: 22ch; }
.today .sub { margin-top: 12px; font-size: 1.0625rem; max-width: 62ch; }
.attn { list-style: none; margin: 0; padding: 0; }
.attn li + li { border-top: 1px solid var(--line); }
.attn-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 4px 16px; align-items: start; padding: 18px 24px; color: inherit; }
a.attn-row:hover { text-decoration: none; background: var(--surface-2); }
a.attn-row:hover .attn-title { text-decoration: underline; text-decoration-color: var(--line-2); }
a.attn-row:focus-visible { outline-offset: -3px; border-radius: 0; }
.sev { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.sev.bad { background: var(--bad-soft); color: var(--bad); }
.sev.warn { background: var(--warn-soft); color: var(--warn); }
.sev.review { background: var(--human-soft); color: var(--human); }
.sev.info { background: var(--signal-soft); color: var(--signal); }
.attn-title, .attn-why, .attn-kind, .when-title, .when-meta, .cal-m, .cal-d { display: block; }
.attn-title { color: var(--ink); font-weight: 700; font-size: 1.03rem; line-height: 1.4; }
.attn-why { color: var(--ink-2); margin-top: 4px; font-size: .9375rem; line-height: 1.55; max-width: 72ch; }
.attn-kind { font-size: .8125rem; color: var(--ink-3); font-weight: 600; margin-top: 6px; }
.attn-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 120px; }
.attn-impact { font: 600 1.06rem/1.25 var(--f-display); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.attn-impact-note { font-size: .8125rem; color: var(--ink-3); white-space: nowrap; }
.attn-go { display: inline-flex; align-items: center; gap: 2px; color: var(--signal); font-weight: 600; font-size: .9375rem; margin-top: 2px; }
.attn-more { border-top: 1px solid var(--line); padding: 4px 24px; }
.all-clear { display: flex; gap: 14px; align-items: center; padding: 22px 24px; }
.all-clear .sev { background: var(--ok-soft); color: var(--ok); }
.when { list-style: none; margin: 0; padding: 0; }
.when li + li { border-top: 1px solid var(--line); }
.when-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 24px; color: inherit; }
a.when-row:hover { background: var(--surface-2); text-decoration: none; }
a.when-row:focus-visible { outline-offset: -3px; border-radius: 0; }
.cal { width: 56px; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; text-align: center; background: var(--surface); }
.cal-m { font-size: .75rem; font-weight: 700; color: var(--signal); background: var(--signal-soft); padding: 2px 0; }
.cal-d { font: 600 1.25rem/1.5 var(--f-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.when-title { color: var(--ink); font-weight: 600; line-height: 1.4; }
.when-meta { font-size: .875rem; color: var(--ink-3); margin-top: 2px; }
.agent-card { display: flex; flex-direction: column; gap: 10px; color: inherit; }
a.agent-card:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow-2); }
.agent-card h3 { font-size: 1.2rem; }
.agent-status { color: var(--ink); font-weight: 600; }
.agent-go { margin-top: auto; display: inline-flex; align-items: center; gap: 2px; color: var(--signal); font-weight: 600; }
.log { margin-top: 40px; }
.log > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font: 600 1.05rem var(--f-display); color: var(--ink); list-style: none; }
.log > summary::-webkit-details-marker { display: none; }
.log > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(-45deg); transition: transform .15s ease; margin-right: 4px; }
.log[open] > summary::before { transform: rotate(45deg); }

/* ---------------------------------------------------------------- tables (cards on phones) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); box-shadow: var(--shadow-1); }
.card .table-wrap, .card.flush .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
caption { text-align: left; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8125rem; font-weight: 700; color: var(--ink-3); background: var(--surface-2); white-space: nowrap; }
td { color: var(--ink-2); }
td.n, th.n { text-align: right; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tr.total td { font-weight: 700; color: var(--ink); background: var(--surface-2); }
td .title, td a.title { color: var(--ink); font-weight: 600; }
td a.title { color: var(--signal); }
td .fine { margin-top: 2px; }
td.nodata { color: var(--ink-3); background: repeating-linear-gradient(135deg, transparent 0 5px, var(--c-grid) 5px 6px); }
th.sticky, td.sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; }
th.sticky, tr.total td.sticky { background: var(--surface-2); }
.wide-hint { display: none; }
.note-cell { max-width: 36ch; white-space: normal; }
@media (min-width: 721px) { .rt td.lead { min-width: 180px; } .rt td.lead + td { min-width: 150px; } }
@media (max-width: 720px) {
  .rt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rt, .rt tbody, .rt tr, .rt td { display: block; width: 100%; }
  .rt tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .rt tbody tr:last-child { border-bottom: 0; }
  .rt td { border: 0; padding: 5px 0; display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: 12px; text-align: left; white-space: normal; }
  .rt td::before { content: attr(data-label); color: var(--ink-3); font-size: .875rem; font-weight: 600; }
  .rt td.n { text-align: left; }
  .rt td.lead { display: block; padding-bottom: 8px; font-size: 1.03rem; }
  .rt td.lead::before { content: none; }
  .rt td.empty-cell { display: none; }
  .rt tr.total td { background: transparent; }
  .rt tr.total { background: var(--surface-2); }
  .wide-hint { display: block; margin: 0 0 8px; }
}

/* ---------------------------------------------------------------- charts */
.chart { position: relative; width: 100%; min-height: 40px; }
.chart svg { display: block; overflow: visible; }
.chart .grid-line { stroke: var(--c-grid); stroke-width: 1; }
.chart .zero { stroke: var(--line-2); stroke-width: 1; }
.chart .axis { fill: var(--ink-3); font: 500 12px var(--f-body); }
.chart .s-in { fill: var(--c-in); }
.chart .s-out { fill: var(--c-out); }
.chart .s-target { stroke: var(--c-target); stroke-width: 2.5; stroke-linecap: round; }
.chart .s-line { fill: none; stroke: var(--c-in); stroke-width: 2; }
.chart .s-dot { fill: var(--c-in); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .col.is-hover .bar { opacity: .82; }
.chart .nodata-band { fill: url(#hatch); }
.chart .band-hover { fill: var(--surface-2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .875rem; color: var(--ink-2); margin: 0 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.legend .sw-in { background: var(--c-in); }
.legend .sw-out { background: var(--c-out); }
.legend .sw-target { height: 3px; width: 14px; border-radius: 2px; background: var(--c-target); }
.legend .sw-nodata { background: repeating-linear-gradient(135deg, var(--surface) 0 2px, var(--c-hatch) 2px 3.5px); border: 1px solid var(--c-hatch); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--paper); font-size: .875rem; line-height: 1.45;
  padding: 8px 11px; border-radius: 9px; box-shadow: var(--shadow-2); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 3; }
.tip b { font-weight: 700; }
.chart-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 16px; margin-top: 8px; }

/* ---------------------------------------------------------------- list rows */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }
.rows > li.group { padding: 18px 0 6px; border-bottom: 0; }
.rows > li.group h3 { font-size: .9375rem; color: var(--ink-3); font-family: var(--f-body); font-weight: 700; }
.rows .main { min-width: 0; flex: 1; }
.rows .title { color: var(--ink); font-weight: 600; line-height: 1.45; }
.rows .meta { font-size: .875rem; color: var(--ink-3); margin-top: 3px; line-height: 1.45; }
.rows a.title { color: var(--signal); }
.date-col { flex: none; width: 92px; font-weight: 600; font-size: .9375rem; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.35; }
.date-col small { display: block; color: var(--ink-3); font-weight: 500; font-size: .8125rem; }
.badges { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.qtext { color: var(--ink); line-height: 1.55; overflow-wrap: anywhere; }
.rows .title, .rows .meta { overflow-wrap: anywhere; }

/* key/value */
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; margin: 0; font-size: .9375rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.kv-gap { height: 14px; }
.kv .total-row { border-top: 1px solid var(--line); padding-top: 10px; }
.kv-terms { grid-template-columns: minmax(130px, 42%) minmax(0, 1fr); }
.kv-terms dd { text-align: left; font-weight: 500; overflow-wrap: anywhere; }

/* disclosure */
details.more { margin-top: 14px; border-top: 1px solid var(--line); }
details.more > summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(-45deg); transition: transform .15s ease; margin: 0 6px 0 2px; }
details.more[open] > summary::before { transform: rotate(45deg); }
details.more > summary .fine { font-weight: 500; margin-left: auto; }

/* lease */
.lease-card.is-draft { border-color: var(--human-line); }
.lease-card h4 { margin: 22px 0 10px; }
.checks { list-style: none; margin: 0; padding: 0; font-size: .9375rem; }
.checks li { padding: 8px 0 8px 30px; position: relative; border-bottom: 1px solid var(--line); line-height: 1.5; }
.checks li:last-child { border-bottom: 0; }
.checks .box { position: absolute; left: 0; top: 10px; width: 18px; height: 18px; border: 1.5px solid var(--line-2); border-radius: 5px; display: grid; place-items: center; color: var(--ok); }
.checks li.done { color: var(--ink-3); }
.checks .field { display: block; font-size: .8125rem; color: var(--ink-3); }
.review-group { font-size: .9375rem; color: var(--ink-3); margin: 16px 0 4px; font-family: var(--f-body); font-weight: 700; }

/* documents */
.doc-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.doc-slot { font-size: .875rem; color: var(--ink-3); max-width: 28ch; text-align: right; }
.doc-slot.err { color: var(--bad); }
@media (max-width: 720px) { .doc-actions { align-items: stretch; } .doc-actions .btn { width: 100%; } .doc-slot { text-align: left; max-width: none; } }

/* ---------------------------------------------------------------- states */
.state { text-align: center; padding: 48px 24px; }
.state h2 { margin-bottom: 8px; }
.state p { color: var(--ink-2); max-width: 52ch; margin: 0 auto; }
.state .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.state .sev { margin: 0 auto 14px; width: 44px; height: 44px; border-radius: 14px; }
.skel { display: grid; gap: 16px; }
.skel i { display: block; height: 18px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.skel i.h { height: 40px; width: min(420px, 70%); }
.skel i.b { height: 140px; border-radius: var(--r-l); }
.skel i.s { width: 50%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* idle warning */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; width: min(520px, calc(100% - 32px));
  background: var(--ink); color: var(--paper); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-2);
  display: flex; align-items: center; gap: 16px; }
.toast p { flex: 1; line-height: 1.45; }
.toast .btn { background: var(--paper); color: var(--ink); flex: none; }

/* ---------------------------------------------------------------- sign-in gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
  background: radial-gradient(55% 45% at 15% 0%, color-mix(in srgb, #22B8F0 14%, transparent), transparent 70%),
              radial-gradient(45% 45% at 100% 100%, color-mix(in srgb, var(--signal) 10%, transparent), transparent 70%), var(--paper); }
.gate-card { max-width: 460px; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 36px 32px 28px; box-shadow: var(--shadow-2); }
.gate-brand { display: flex; align-items: center; gap: 10px; font: 600 1.1rem var(--f-display); color: var(--ink); margin-bottom: 28px; }
.gate-brand b { color: var(--signal); }
.gate-card h1 { font-size: clamp(1.7rem, 5vw, 2rem); margin-bottom: 10px; }
.gate-card .lede { color: var(--ink-2); margin-bottom: 24px; }
.gate-status { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 20px; color: var(--ink); font-size: .9375rem; }
.gate-status svg { flex: none; margin-top: 3px; color: var(--signal); }
.gate-steps { list-style: none; margin: 24px 0 0; padding: 20px 0 0; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.gate-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; font-size: .9375rem; color: var(--ink-2); }
.gate-steps .n { width: 26px; height: 26px; border-radius: 50%; background: var(--signal-soft); color: var(--signal); font-weight: 700; font-size: .8125rem; display: grid; place-items: center; }
.gate-steps b { color: var(--ink); font-weight: 600; display: block; }
.gate-fine { margin-top: 22px; font-size: .875rem; color: var(--ink-3); line-height: 1.5; }

.foot { max-width: var(--wrap); width: 100%; margin: 0 auto; padding: 20px var(--gutter) 32px; display: flex; flex-wrap: wrap; gap: 8px 24px;
  justify-content: space-between; font-size: .875rem; color: var(--ink-3); border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .who { display: none; }
}
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .topbar-in { flex-wrap: wrap; gap: 10px; padding-top: 10px; padding-bottom: 10px; min-height: 0; }
  .agents { order: 3; flex-basis: 100%; display: flex; }
  .agents a { flex: 1; justify-content: center; min-height: 40px; padding: 0 8px; }
  .brand-name { font-size: 1.02rem; }
  #view { padding-top: 22px; }
  .page-head { margin-bottom: 22px; }
  .crumbs li { display: none; }
  .crumbs li.parent { display: inline-flex; }
  .crumbs li.parent::before { content: none; }
  .crumbs .back-arrow { display: inline-block; margin-right: 2px; }
  .card { padding: 18px; border-radius: 14px; }
  .attn-row { grid-template-columns: 32px minmax(0, 1fr); padding: 16px 18px; }
  .attn-side { grid-column: 2; align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; gap: 4px 10px; min-width: 0; align-items: baseline; }
  .attn-go { display: none; }
  .attn-more { padding: 4px 18px; }
  .when-row { grid-template-columns: 56px minmax(0, 1fr); padding: 14px 18px; }
  .when-row .badge { grid-column: 2; justify-self: start; }
  .cal { width: 52px; }
  .fig { border-left: 0; border-top: 1px solid var(--line); margin-left: 0; margin-top: -1px; padding: 16px 18px; }
  .rows > li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px 12px; }
  .rows > li:not(:has(.date-col)) { grid-template-columns: minmax(0, 1fr); }
  .rows > li > .date-col { width: auto; }
  .rows > li:has(.date-col) > :not(.date-col):not(.main) { grid-column: 2; }
  .rows > li > :not(.date-col):not(.main) { justify-self: start; }
  .rows > li.group { display: block; }
  .badges { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .card-top { flex-wrap: wrap; }
  .rt .badge { white-space: normal; }
  .grid.two { grid-template-columns: 1fr; }
  .kv-terms { grid-template-columns: 1fr; gap: 2px; }
  .kv-terms dd { margin-bottom: 10px; }
  .gate-card { padding: 28px 22px 22px; }
  .toast { flex-direction: column; align-items: stretch; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .badge, .chip, .agents a, .btn { border: 1px solid CanvasText; }
  .tabs a[aria-current="page"]::after { background: Highlight; }
}
@media print {
  .topbar, .foot, .chips, .toast, .chart-foot, .skip { display: none !important; }
  .card, .figs, .table-wrap { box-shadow: none; }
  body { background: #fff; }
}
