/* PitBullTax QA (from the InTechCenter starter): tokens and BentoFlex components.
   Rules: one accent (the brand slot below), AA contrast in both themes, no text under 13px, 44px targets,
   :focus-visible always drawn, Reduce Motion turns movement into fades. Dark is its own theme, not an inversion.
   It follows the system setting: no toggle, nothing stored. tests/test_tokens.py checks the contrast pairs. */

/* ── brand slot: each client sets these four (and their dark twins), then runs the tests ── */
:root {
  --accent-fill: #1766b5;   /* PitBullTax blue (the reports' pbtblue); --on-accent text sits on it */
  --on-accent: #ffffff;
  --accent-ink: #1766b5;    /* the accent used as text on --paper and --surface */
  --accent-soft: #e6eef8;   /* tinted secondary actions; --ink and --accent-ink sit on it */
}

:root {
  --paper: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --ink: #111114;
  --ink-soft: #4a4a55;
  --ink-faint: #5c5c68;
  --line: rgba(17, 17, 20, 0.12);
  --line-strong: #8a8a96;   /* input borders: 3:1 against the surface */
  --good: #1d7a3a; --warn: #8a5300; --bad: #b42318; --on-bad: #ffffff;
  --scrim: rgba(10, 10, 14, 0.45);
  --r-tray: 14px; --r-card: 20px; --r-pill: 999px; --r-ctl: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif;
  --font-data: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --d-press: .12s; --d-fade: .2s; --d-ui: .26s; --d-enter: .8s; --stagger: .07s;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-fill: #1766b5; --on-accent: #ffffff; --accent-ink: #6ea8e8; --accent-soft: #14253a;
    --paper: #0f0f11; --surface: #17171b; --surface-2: #1d1d22; --ink: #f4f4f5; --ink-soft: #b4b4bd; --ink-faint: #8e8e98;
    --line: rgba(244, 244, 245, 0.12); --line-strong: #6e6e78; --good: #6fcf8f; --warn: #f0b458; --bad: #ff8a7a; --on-bad: #17171b;
    --scrim: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent-fill: #1766b5; --on-accent: #ffffff; --accent-ink: #6ea8e8; --accent-soft: #14253a;
  --paper: #0f0f11; --surface: #17171b; --surface-2: #1d1d22; --ink: #f4f4f5; --ink-soft: #b4b4bd; --ink-faint: #8e8e98;
  --line: rgba(244, 244, 245, 0.12); --line-strong: #6e6e78; --good: #6fcf8f; --warn: #f0b458; --bad: #ff8a7a; --on-bad: #17171b;
  --scrim: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }  /* headings that receive focus programmatically (expanded card, dialogs) */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.tnum { font-variant-numeric: tabular-nums; }
.small { font-size: 13px; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { margin-left: auto; }

/* demo banner (DEMO=1) */
.demo-banner { background: var(--warn); color: var(--surface); text-align: center; font-size: 13px; font-weight: 600; padding: 6px 16px; }

/* buttons: exactly one filled action per view; the rest are tinted or quiet. 44px targets, press state */
.btn { min-height: 44px; padding: 0 16px; border-radius: var(--r-ctl); border: 1px solid transparent; background: var(--accent-soft); color: var(--ink);
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  transition: transform var(--d-press) var(--ease); }
.btn:active { transform: scale(.97); }
.btn.fill { background: var(--accent-fill); color: var(--on-accent); }
.btn.quiet { background: transparent; border-color: var(--line-strong); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.danger.fill { background: var(--bad); color: var(--on-bad); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  cursor: pointer; display: inline-grid; place-items: center; position: relative; transition: transform var(--d-press) var(--ease); text-decoration: none; }
.icon-btn:active { transform: scale(.94); }
.icon-btn[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-fill); border: 2px solid var(--surface); }
.link-btn { background: none; border: 0; padding: 0 4px; min-height: 44px; color: var(--accent-ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* forms */
label.f { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
label.f .h { font-weight: 400; color: var(--ink-soft); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=tel], select, textarea {
  min-height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--line-strong); background: var(--surface); padding: 0 12px; width: 100%; }
textarea { padding: 10px 12px; min-height: 96px; resize: vertical; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent-fill); margin: 11px; }
.err { color: var(--bad); font-size: 14px; min-height: 0; }
.err:empty { display: none; }
.note { font-size: 14px; color: var(--ink-soft); }
.callout { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface-2); display: grid; gap: 8px; }
.code-block { font-family: var(--font-data); font-size: 15px; letter-spacing: .04em; word-break: break-all; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-family: var(--font-data); font-size: 15px; margin: 0; padding: 0; list-style: none; }

/* switches (role="switch"): keyboard-operable, state in text and shape, never color alone */
.switch { position: relative; width: 52px; min-width: 52px; height: 44px; border: 0; background: none; padding: 0; cursor: pointer; display: inline-grid; place-items: center; }
.switch::before { content: ""; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-strong);
  transition: background var(--d-fade) var(--ease); }
.switch::after { content: ""; position: absolute; left: 7px; top: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink-faint);
  transition: transform var(--d-ui) var(--ease), background var(--d-fade) var(--ease); }
.switch[aria-checked="true"]::before { background: var(--accent-fill); border-color: var(--accent-fill); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: var(--on-accent); }
.switch[disabled] { opacity: .55; cursor: not-allowed; }

/* status pills: color plus text */
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; color: var(--ink); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.good { color: var(--good); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.off { color: var(--ink-faint); }
.pill.plain::before { display: none; }

/* top bar: brand slot · title · gear · log out */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1320px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; min-height: 44px; }
.brand .mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-fill); color: var(--on-accent); display: inline-grid; place-items: center; font-size: 14px; }
.top .who { margin-left: auto; font-size: 13px; color: var(--ink-soft); text-align: right; line-height: 1.25; }
.top .who b { color: var(--ink); display: block; font-size: 14px; }
@media (max-width: 560px) { .top .who { display: none; } .top .spacer-sm { margin-left: auto; } }

/* BentoFlex: one tray, equal cards. A card expands in place; the others become a fixed strip of pills. */
.wrap { max-width: 1320px; margin: 0 auto; padding: 16px 16px 48px; }
.page-title { font-size: 28px; margin: 8px 0 14px; }
.tray { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-tray); padding: 12px; }
.grid { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 12px; }
@media (min-width: 1101px) { .grid.n5 { --cols: 5; } }  /* five cards sit in one row instead of leaving an orphan */
@media (max-width: 1100px) { .grid { --cols: 3; } }
@media (max-width: 820px) { .grid { --cols: 2; } }
@media (max-width: 560px) { .grid { --cols: 1; } }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 18px; display: grid; gap: 8px;
  align-content: start; min-height: 196px; min-width: 0; transition: transform var(--d-press) var(--ease), border-color var(--d-press) var(--ease); }
.grid.enter .card { animation: rise var(--d-enter) var(--ease) backwards; animation-delay: calc(var(--i, 0) * var(--stagger)); }
.card:hover { border-color: color-mix(in srgb, var(--accent-fill) 45%, var(--line)); }
.card:active { transform: scale(.985); }
.card h2 { font-size: 15px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0; }
.card .hit { all: unset; cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0; }
.card .hit::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-card); }
.card .hit:focus-visible::after { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.card .fig { font-weight: 700; font-size: 40px; line-height: 1.05; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.card .fig.word { font-size: 24px; letter-spacing: -0.02em; }
.card .sub { font-size: 14px; color: var(--ink-soft); }
.card .viz { margin-top: auto; }
.card .viz svg { display: block; width: 100%; height: 44px; }
.card .viz svg.band { height: 12px; }
.mini svg.band { height: 8px; }
.rows-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.rows-mini li { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-top: 4px; }
.rows-mini li > span:last-child:not(:first-child) { color: var(--ink-soft); text-align: right; }
.rows-mini a { display: inline-flex; align-items: center; min-height: 44px; }
.spark { fill: none; stroke: var(--accent-ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: var(--accent-soft); stroke: none; }
.band rect { rx: 3; }

.strip { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
@media (max-width: 820px) { .strip { grid-template-columns: repeat(var(--n, 5), minmax(120px, 1fr)); overflow-x: auto; padding-bottom: 4px; } }
.mini { border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 44px; padding: 4px 12px;
  display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; min-width: 0; transition: transform var(--d-press) var(--ease); }
.mini:active { transform: scale(.97); }
.mini span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini svg { width: 36px; height: 16px; flex: none; margin-left: auto; }
.mini[aria-current="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.mini[aria-current="true"] .spark { stroke: var(--paper); }
.mini[aria-current="true"] .spark-area { fill: none; }

.xp { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px; display: grid; gap: 16px; min-width: 0;
  grid-template-columns: minmax(0, 1fr); }
.xp.enter { animation: grow var(--d-ui) var(--ease) backwards; }
.xp-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; }
.xp-head h2 { font-size: 24px; }
.xp-head .fig { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.xp .chart svg { width: 100%; height: 160px; display: block; }
.chart text { fill: var(--ink-faint); font-size: 13px; }
.chart .axis { stroke: var(--line); }
.inner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.inner-grid > .box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.box h3 { font-size: 16px; }
.section-gap { display: grid; gap: 20px; }

table.rows { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rows th { text-align: left; font-size: 13px; font-weight: 600; color: var(--ink-soft); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.rows td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.rows td.num, table.rows th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.rows tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.rowlink { all: unset; cursor: pointer; color: var(--accent-ink); font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.rowlink:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 6px; }
.pager { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--ink-soft); }
.empty { color: var(--ink-soft); font-size: 14px; padding: 12px 0; }

/* entity overlays: above the grid; closing returns to the untouched expanded state */
.ov { position: fixed; inset: 0; z-index: 40; background: var(--scrim); display: grid; place-items: start center; padding: 24px 16px; overflow-y: auto;
  animation: fade var(--d-fade) var(--ease) both; }
.sheet { width: min(760px, 100%); background: var(--surface); border-radius: var(--r-card); border: 1px solid var(--line); padding: 20px; display: grid; gap: 16px;
  animation: grow var(--d-ui) var(--ease) backwards; }
.sheet-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sheet-head h2 { font-size: 22px; }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.formgrid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .formgrid { grid-template-columns: minmax(0, 1fr); } }

/* the permission matrix */
.matrix { display: grid; gap: 14px; }
.matrix fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 4px 12px 8px; margin: 0; }
.matrix legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.perm { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding: 2px 0; }
.perm:first-of-type { border-top: 0; }
.perm .lbl { font-size: 14px; }
.perm .src { font-size: 13px; color: var(--ink-faint); display: block; }
.perm .src.over { color: var(--accent-ink); font-weight: 600; }

/* connection cards */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.conn { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 8px; align-content: start; }
.conn dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 14px; }
.conn dt { color: var(--ink-soft); }
.conn dd { margin: 0; }

/* sign-in and invite pages */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth main { width: min(420px, 100%); display: grid; gap: 18px; }
.auth .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 24px; display: grid; gap: 16px; }
.auth .brandline { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.auth form { display: grid; gap: 14px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-faint); font-size: 13px; }
.or::before, .or::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.wholine { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.wholine .em { font-weight: 600; overflow-wrap: anywhere; }
.auth .link-btn { justify-self: center; }
.gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; padding: 0 18px; border-radius: var(--r-ctl);
  background: #ffffff; color: #1f1f1f; border: 1px solid #747775; font-weight: 600; text-decoration: none; }
.gbtn:hover { background: #f2f2f2; }
.gbtn:active { transform: scale(.97); }
.foot { font-size: 13px; color: var(--ink-soft); text-align: center; }
.foot a { color: var(--ink-soft); display: inline-flex; min-height: 44px; align-items: center; padding: 0 6px; }

/* the public privacy page */
.doc { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; display: grid; gap: 18px; }
.doc h1 { font-size: 32px; } .doc h2 { font-size: 20px; margin-top: 8px; }

/* motion: one easing, short distances */
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
@keyframes grow { from { transform: scale(.985); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
/* Reduce Motion: movement becomes a fade, never a cut */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
  @keyframes rise { from { opacity: 0; } }
  @keyframes grow { from { opacity: 0; } }
  .card:active, .btn:active, .mini:active, .icon-btn:active { transform: none; }
}
/* ── PitBullTax QA ─────────────────────────────────────────────────────── */
/* The logo's red stays inside the logo: red is the "bad" state everywhere else. Dark mode gets a light plate. */
.brand .logo { height: 28px; width: auto; display: block; }
.brand .app-name { font-weight: 700; letter-spacing: -0.01em; padding-left: 10px; border-left: 1px solid var(--line-strong); color: var(--ink-soft); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand .logo { background: #f4f4f5; padding: 3px 6px; border-radius: 8px; box-sizing: content-box; } }
:root[data-theme="dark"] .brand .logo { background: #f4f4f5; padding: 3px 6px; border-radius: 8px; box-sizing: content-box; }
.grid.n10 { --cols: 5; }
@media (max-width: 1100px) { .grid.n10 { --cols: 3; } }
@media (max-width: 820px) { .grid.n10 { --cols: 2; } }
@media (max-width: 560px) { .grid.n10 { --cols: 1; } }
.strip { grid-template-columns: repeat(var(--n, 5), minmax(96px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
.strip .mini { padding: 4px 10px; gap: 6px; }
.strip .mini svg { width: 26px; }
.mono { font-family: var(--font-data); font-size: 13px; font-variant-numeric: tabular-nums; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
svg.bar { display: block; width: 100%; height: 4px; }
.viz.wide svg.band { width: 100%; height: 14px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.legend span, .lane h3 { display: inline-flex; align-items: center; gap: 6px; }
i[data-c] { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--line-strong); flex: none; }
i[data-c="reported"] { background: var(--warn); } i[data-c="confirmed"] { background: var(--accent-ink); } i[data-c="sent"] { background: var(--ink-faint); }
i[data-c="staging"] { background: var(--accent-fill); } i[data-c="verified"], i[data-c="live"] { background: var(--good); } i[data-c="declined"] { background: var(--bad); }
.pill.st-reported { color: var(--warn); } .pill.st-confirmed, .pill.st-staging { color: var(--accent-ink); } .pill.st-verified, .pill.st-live { color: var(--good); }
.pill.st-sent, .pill.st-closed { color: var(--ink-soft); } .pill.st-declined { color: var(--bad); }
.warn-t { color: var(--warn); font-weight: 600; }
.f.inline { display: inline-grid; min-width: 220px; }
.rows-h { font-size: 16px; margin-top: 4px; }
h3.big { font-size: 22px; }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.files li { display: flex; justify-content: space-between; gap: 12px; align-items: center; border-top: 1px solid var(--line); flex-wrap: wrap; }
.files li:first-child { border-top: 0; }
.files a { min-height: 44px; display: inline-flex; align-items: center; overflow-wrap: anywhere; }
video { width: 100%; border-radius: 12px; background: #000; display: block; }
dl.mail { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 14px; }
dl.mail dt { color: var(--ink-soft); } dl.mail dd { margin: 0; overflow-wrap: anywhere; }
pre.mailbody { white-space: pre-wrap; font: 14px/1.5 var(--font); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0; max-height: 260px; overflow: auto; }

/* the board: eight lanes inside the expanded card (it never leaves the grid) */
.lanes { display: grid; grid-template-columns: repeat(8, minmax(136px, 1fr)); gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 10px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.lane h3 { font-size: 14px; justify-content: space-between; display: flex; }
.lane h3 > span:nth-child(2) { margin-right: auto; }
.lane ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 520px; overflow-y: auto; }
.ticket { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; gap: 2px; padding: 8px 10px; min-height: 44px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); font-size: 14px; transition: transform var(--d-press) var(--ease), border-color var(--d-press) var(--ease); }
.ticket:hover { border-color: color-mix(in srgb, var(--accent-fill) 45%, var(--line)); }
.ticket:active { transform: scale(.97); }
.ticket:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.ticket .t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* the chat (the agent's card, expanded) */
.chat { display: grid; gap: 14px; max-width: 920px; width: 100%; margin: 0 auto; }
.hello { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; display: grid; gap: 10px; animation: rise var(--d-enter) var(--ease) backwards; }
.hello h3 { font-size: 24px; }
.assure, .csteps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.assure li, .csteps li { display: flex; gap: 8px; align-items: center; }
.assure svg, .csteps svg { color: var(--good); flex: none; }
.csteps { font-size: 13px; color: var(--ink-soft); }
.thread { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.msg { border-radius: 16px; padding: 10px 14px; display: grid; gap: 6px; max-width: 760px; border: 1px solid var(--line); animation: rise var(--d-ui) var(--ease) backwards; }
.msg.me { background: var(--accent-soft); justify-self: end; border-color: transparent; }
.msg.ai { background: var(--surface-2); justify-self: start; }
.msg-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.msg-h .by { font-weight: 700; }
.msg-b { display: grid; gap: 8px; overflow-wrap: anywhere; }
.withheld { color: var(--warn); }
.refchip { all: unset; cursor: pointer; font-family: var(--font-data); font-size: 13px; font-weight: 600; color: var(--accent-ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 1px 8px; }
.refchip:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.acard { border: 2px solid var(--accent-fill); border-radius: 14px; padding: 10px 12px; display: grid; gap: 8px; background: var(--surface); }
.acard-h { font-weight: 700; }
.thinking { display: flex; gap: 8px; align-items: center; color: var(--ink-soft); font-size: 14px; }
.dots { width: 28px; height: 8px; background: radial-gradient(circle, var(--ink-faint) 3px, transparent 3.5px) 0 0 / 10px 8px repeat-x; animation: dots 1.2s steps(3) infinite; }
@keyframes dots { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.ask { display: grid; gap: 8px; position: sticky; bottom: 0; background: var(--surface); padding: 8px 0 4px; border-top: 1px solid var(--line); }
.ask-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.ask textarea { min-height: 52px; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.cap { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--r-pill); min-height: 44px; padding: 0 14px; cursor: pointer; font-weight: 600; font-size: 14px; }
.cap:active { transform: scale(.97); }
label.check { display: inline-flex; align-items: center; gap: 0; font-size: 14px; }
label.check input { margin: 11px 8px 11px 0; }

/* the item sheet */
.sheet.wide { width: min(1080px, 100%); }
.item-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.item-cols > .stack { align-content: start; }
@media (max-width: 820px) { .item-cols { grid-template-columns: minmax(0, 1fr); } }
.item-cols .box, .sheet .box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.sheet summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; gap: 8px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.media figure { margin: 0; display: grid; gap: 6px; }
.media img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); display: block; background: var(--surface); }
.media figcaption { font-size: 13px; color: var(--ink-soft); }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; counter-reset: s; }
.stepper li { font-size: 13px; color: var(--ink-faint); border-top: 4px solid var(--line); padding-top: 6px; min-width: 0; }
.stepper li span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper li.done { border-top-color: var(--good); color: var(--ink-soft); }
.stepper li.now { border-top-color: var(--accent-fill); color: var(--ink); font-weight: 700; }
@media (max-width: 560px) { .stepper { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.actionbar { position: sticky; bottom: -20px; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 0 4px; display: grid; gap: 10px; }
.small-thread .msg { max-width: 100%; }

@media print { .top, .ov { display: none; } .grid.enter .card, .xp.enter { animation: none; } }
