/*
 * One stylesheet for every page. Colours are tokens, so light and dark are the
 * same rules; sizes are chosen for a thumb first (44px to tap, 16px text on a
 * phone so a field does not zoom when touched) and tightened for a computer.
 */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #eef1f5; --text: #18202b; --muted: #5a6676;
  --border: #dbe1e9; --accent: #2457c5; --accent-soft: #e6edfb; --on-accent: #ffffff;
  --good: #1a7f45; --good-soft: #e1f3e8; --warn: #9a5b00; --warn-soft: #fbefd9; --bad: #b93229; --bad-soft: #fbe5e3;
  --scrim: rgba(15, 22, 33, .45);
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06); --shadow-lg: 0 8px 28px rgba(16,24,40,.16);
  --side-w: 232px; --tap: 40px;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116; --surface: #171b22; --surface-2: #1f252e; --text: #e8ecf1; --muted: #9ba7b6;
    --border: #2a323d; --accent: #7aa2ff; --accent-soft: #1c2a47; --on-accent: #0b1220;
    --good: #5fcf8e; --good-soft: #14301f; --warn: #f0b457; --warn-soft: #33270f; --bad: #ff8a80; --bad-soft: #3a1a18;
    --scrim: rgba(0, 0, 0, .6); --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 8px 28px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
h1, h2, h3, h4 { line-height: 1.25; }
h2 { font-size: 18px; margin: 0 0 8px; }
h4 { margin: 14px 0 6px; font-size: 14px; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Fields and buttons ---- */
select, input, textarea, button { font: inherit; color: inherit; }
select, textarea, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; min-height: var(--tap); max-width: 100%;
}
textarea { width: 100%; min-height: 180px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); }
button { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 8px; padding: 7px 14px; min-height: var(--tap); cursor: pointer; font-weight: 500; }
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
button.danger { background: transparent; color: var(--bad); border: 1px solid var(--border); }
button:disabled { opacity: .6; cursor: wait; }
button.small, .button-link.small { min-height: 32px; padding: 4px 10px; }
.button-link { display: inline-flex; align-items: center; text-decoration: none; background: transparent; color: var(--accent); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; min-height: var(--tap); }

/* ---- The frame of a page: side list on a computer, bottom bar on a phone ---- */
header.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
header.bar h1 { font-size: 17px; margin: 0 8px 0 0; letter-spacing: -.01em; }
header.bar .spacer { flex: 1; }
main { padding: 16px; max-width: 1280px; margin: 0 auto; }
body.app { padding-left: var(--side-w); }
body.app header.bar { padding: 12px 28px; }
body.app header.bar h1 { font-size: 20px; flex: 1; min-width: 0; }
body.app main { padding: 20px 28px 32px; margin: 0; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); display: flex; flex-direction: column; gap: 2px; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; z-index: 6; }
.side .brand { font-size: 20px; font-weight: 700; letter-spacing: -.02em; padding: 4px 12px 14px; }
/* The logo mark beside the name, wherever the name is the heading. */
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark { flex-shrink: 0; border-radius: 22%; }
.side .grp { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 14px 12px 4px; }
.side .push { flex: 1; }
.side .me { padding: 10px 12px 4px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 8px; }
.side button, .side a.item { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; font-weight: 400; text-decoration: none; }
.side button:hover, .side a.item:hover { background: var(--surface-2); }
.side button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side svg, .bottom svg, .menu .opt svg { width: 22px; height: 22px; flex-shrink: 0; }
.cnt { margin-left: auto; font-size: 12px; font-weight: 600; background: var(--bad-soft); color: var(--bad); border-radius: 999px; padding: 1px 8px; }
.cnt.plain { background: var(--surface-2); color: var(--muted); }
/* The sections of the screen being shown, under its name. */
.side .subs { display: flex; flex-direction: column; flex-shrink: 0; margin: 2px 0 6px 23px; border-left: 1px solid var(--border); }
.side .subs:empty { display: none; }
.side .subs a { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 3px 10px 3px 12px; margin-left: -1px; border-left: 2px solid transparent; border-radius: 0 8px 8px 0; color: var(--muted); font-size: 14px; line-height: 1.25; text-decoration: none; }
.side .subs a:hover { background: var(--surface-2); }
.side .subs a[aria-current="true"] { border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
.bottom { display: none; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 500; white-space: nowrap; }
.chip-btn svg { width: 16px; height: 16px; color: var(--muted); }
header.bar select.chip { border-radius: 999px; min-height: 36px; padding: 0 10px; max-width: 14rem; font-size: 14px; }

/* ---- Rows of choices ---- */
nav.tabs, .chips { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
nav.tabs::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
nav.tabs button, .chips button, .chips a { background: var(--surface); color: var(--muted); border: 1px solid var(--border); border-radius: 999px; white-space: nowrap; font-weight: 400; text-decoration: none; display: inline-flex; align-items: center; padding: 0 14px; min-height: 36px; }
nav.tabs button.active, .chips button.active, .chips button[aria-pressed="true"], .chips a[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
/* The same sections on a phone, which has no side list: a row under the page's title. */
.secs { display: none; }
.chips .cnt { margin-left: 6px; }

/* ---- Cards, figures, bars ---- */
.grid { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
.span-all { grid-column: 1 / -1; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.card h3 .h-action { float: right; font-weight: 400; font-size: 13px; margin-left: 10px; }
.card.flag { border-left: 4px solid var(--warn); }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.attn { display: flex; flex-direction: column; }
.attn button { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; color: var(--text); text-align: left; width: 100%; font-weight: 400; }
.attn button:first-child { border-top: 0; }
.attn .n { min-width: 44px; height: 32px; padding: 0 6px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--warn-soft); color: var(--warn); }
.attn .n.bad { background: var(--bad-soft); color: var(--bad); }
.attn .t { flex: 1; min-width: 0; }
.attn .t small { display: block; color: var(--muted); font-size: 13px; }
.chev { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.bars .b { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars .b .m { position: absolute; bottom: 0; left: 0; right: 0; background: var(--bad); border-radius: 3px 3px 0 0; opacity: .8; }
.hbar { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; gap: 8px; align-items: center; margin: 6px 0; }
.track { background: var(--surface-2); border-radius: 5px; height: 10px; overflow: hidden; }
.fill { background: var(--accent); height: 100%; }
.cmp { display: grid; grid-template-columns: minmax(120px, 35%) 1fr auto; gap: 8px; align-items: center; margin: 6px 0; }
.cmp .track { position: relative; background: var(--surface-2); height: 12px; border-radius: 6px; overflow: visible; }
.cmp .mine { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 6px; }
.cmp .team { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 12px; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click, tr[data-call] { cursor: pointer; }
tr.click:hover, tr[data-call]:hover { background: var(--surface-2); }
.scroll { overflow-x: auto; }

/* ---- Small pieces ---- */
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.hot, .pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warm, .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.cold { background: var(--accent-soft); color: var(--accent); }
.pill.good { background: var(--good-soft); color: var(--good); }
.score { font-weight: 650; font-variant-numeric: tabular-nums; }
.score.good { color: var(--good); } .score.warn { color: var(--warn); } .score.bad { color: var(--bad); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row .grow { flex: 1; min-width: 0; }
.empty { color: var(--muted); padding: 12px 0; }
code.url { display: block; background: var(--surface-2); padding: 6px 8px; border-radius: 6px; word-break: break-all; font-size: 12px; }
.hidden { display: none !important; }
ul.tight { margin: 2px 0 0; padding-left: 18px; }
.transcript { font-size: 14px; background: var(--surface-2); border-radius: 8px; padding: 10px; max-height: 420px; overflow-y: auto; white-space: pre-wrap; }
.transcript > div { margin-bottom: 6px; }
.improve { border-left: 3px solid var(--warn); padding: 4px 10px; margin: 8px 0; }
.improve .q { color: var(--muted); font-style: italic; }
.strength { border-left: 3px solid var(--good); padding: 4px 10px; margin: 8px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin-bottom: 14px; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.filters .note { flex: 1 1 100%; font-size: 12px; color: var(--muted); }

/* ---- A detail that opens over the page: a side panel on a computer, the whole screen on a phone ---- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 9; }
.drawer { position: fixed; inset: 0 0 0 auto; width: min(760px, 100%); background: var(--surface); border-left: 1px solid var(--border); overflow-y: auto; padding: 16px; z-index: 10; box-shadow: var(--shadow-lg); }
.drawer .close { float: right; }
.drawer.sheet { padding: 0; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
.sheet-top { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sheet-top h2 { font-size: 16px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-top .back { background: transparent; color: var(--accent); font-weight: 600; padding: 0 12px 0 4px; min-height: 44px; display: inline-flex; align-items: center; gap: 2px; }
.sheet-top .back svg { width: 22px; height: 22px; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.sheet-body > * { flex-shrink: 0; margin-top: 0; margin-bottom: 0; }
body.sheet-open { overflow: hidden; }
.menu { position: fixed; z-index: 12; right: 28px; top: 60px; width: 320px; max-height: 80vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px 16px; }
.menu h2 { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px 0; margin: 0; }
.menu .opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; color: var(--text); text-align: left; font-weight: 400; text-decoration: none; }
.menu .opt svg { color: var(--muted); }
.menu .opt[aria-checked="true"] { color: var(--accent); font-weight: 600; }
.menu .opt small { margin-left: auto; color: var(--muted); }
.menu .custom { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 12px 0 8px; border-top: 1px solid var(--border); }
.menu .custom label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); flex: 1 1 120px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: min(92vw, 480px); font-size: 14px; }
.toast.bad { background: var(--bad); color: #fff; }

/* ---- Inside a call ---- */
.hero { display: flex; gap: 14px; align-items: center; }
.ring { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); }
.ring span { width: 56px; height: 56px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero .who { min-width: 0; }
.hero .who strong { display: block; font-size: 17px; }
.hero .who span { display: block; color: var(--muted); font-size: 13px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.card audio { width: 100%; display: block; }
details.sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
details.sec > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px; font-weight: 600; cursor: pointer; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary .chev { margin-left: auto; transition: transform .15s ease; }
details.sec[open] > summary .chev { transform: rotate(90deg); }
details.sec > .in { padding: 0 16px 16px; }
details.sec > .in > h4:first-child { margin-top: 0; }
.crit { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.crit:first-child { border-top: 0; padding-top: 0; }
.crit .pips { display: flex; gap: 3px; }
.crit .pips i { width: 16px; height: 8px; border-radius: 2px; background: var(--surface-2); }
.crit .pips i.on { background: var(--accent); }
.crit small { grid-column: 1 / -1; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }

/* ---- Sign-in, home and logins screens ---- */
/* Stacked, not side by side: a browser extension (a password manager, say) adds elements of its own to the page,
   and in a row one of those pushes the box to the edge. In a column it sits above or below and the box stays put. */
body.centered { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.auth { width: min(420px, 100%); }
.auth .brand { font-size: 28px; margin: 0 0 4px; letter-spacing: -.02em; }
.auth form { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.auth label, form.stack label { font-size: 13px; color: var(--muted); margin-top: 8px; }
.auth button, form.stack button { margin-top: 14px; padding: 9px 12px; min-height: 44px; }
form.stack { display: flex; flex-direction: column; gap: 4px; max-width: 360px; margin-top: 8px; }
.alert { overflow-wrap: anywhere; padding: 8px 10px; border-radius: 8px; margin-top: 10px; font-size: 13px; background: var(--bad-soft); color: var(--bad); }
.alert.good { background: var(--good-soft); color: var(--good); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.centered-text { text-align: center; margin-top: 14px; }
.welcome h2 { margin: 0 0 4px; font-size: 18px; }
.tile { display: block; text-decoration: none; color: inherit; transition: border-color .12s ease; }
.tile:hover { border-color: var(--accent); }
.tile h3 { color: var(--accent); }
.actions { white-space: nowrap; }
.actions button { margin-right: 6px; }
details summary { cursor: pointer; color: var(--accent); font-size: 13px; }
details.sec > summary { color: var(--text); font-size: inherit; }
main > .card, main > .grid { margin-bottom: 12px; }
/* A screen is a column of blocks with even space between them. */
#view { display: flex; flex-direction: column; gap: 14px; }
#view > * { margin-top: 0; margin-bottom: 0; min-width: 0; }

/* ---- Counsellor workspace ---- */
.lead-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: flex-start;
  padding: 10px 2px; border-bottom: 1px solid var(--border); cursor: pointer; }
.lead-row:last-child { border-bottom: 0; }
.lead-row:hover { background: var(--surface-2); }
.lead-main { min-width: 0; }
.lead-name { font-weight: 600; }
.lead-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.task-line { width: 100%; text-align: right; font-size: 12px; color: var(--muted); }
.due { color: var(--muted); }
.due.over { color: var(--bad); font-weight: 600; }
.card.inner { box-shadow: none; margin-top: 12px; }
.card.inner h4 { margin: 0 0 8px; font-size: 13px; }
.task { padding: 7px 0; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: 0; }
.tl { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.tl:last-child { border-bottom: 0; }
/* A tick-box and its words stay together when a row of them wraps. */
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; vertical-align: top; }
.thread { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; padding: 4px 0; }
.msg { max-width: 80%; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.msg.out { align-self: flex-end; background: var(--accent-soft); }
.msg-body { white-space: pre-wrap; word-break: break-word; }
.msg-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.msg-error { color: var(--bad); font-size: 11px; margin-top: 2px; word-break: break-word; }
.brief-lead { padding: 8px 0; border-bottom: 1px solid var(--border); }
.brief-lead:last-child { border-bottom: none; }
.brief-text { white-space: pre-wrap; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; overflow-wrap: anywhere; }
.ai-block { padding: 8px 0; border-bottom: 1px solid var(--border); }
.ai-block:last-of-type { border-bottom: none; }

/* The exact text of a WhatsApp template, shown before it is sent. */
.tpl-preview { margin-top: 6px; padding: 8px 10px; border-left: 3px solid var(--warn); background: var(--warn-soft); color: inherit; border-radius: 4px; white-space: pre-wrap; }

/* ---- A phone ---- */
@media (max-width: 720px) {
  :root { --tap: 44px; }
  body { font-size: 16px; }
  select, textarea, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) { font-size: 16px; }
  header.bar { padding: 8px 16px; gap: 8px; }
  header.bar h1 { font-size: 18px; }
  body.app { padding-left: 0; padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
  body.app header.bar { padding: 8px 16px; }
  body.app header.bar h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; margin-right: 0; }
  header.bar h1 .wide { display: none; }
  body.app main { padding: 14px 16px 24px; }
  header.bar select.chip { flex: 0 1 7rem; min-width: 0; max-width: 7rem; }
  .chip-btn { flex-shrink: 0; }
  .secs { display: flex; flex: 1 1 100%; min-width: 0; margin: 0 -16px; padding: 0 16px; }
  .side { display: none; }
  .bottom { display: flex; position: fixed; inset: auto 0 0 0; z-index: 8; background: var(--surface); border-top: 1px solid var(--border); padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px)); }
  .bottom button, .bottom a { flex: 1; min-width: 0; min-height: 52px; padding: 0; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 500; border-radius: 10px; text-decoration: none; }
  .bottom button[aria-current="page"] { color: var(--accent); font-weight: 600; }
  .bottom button { position: relative; }
  .bottom .cnt { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; padding: 0 6px; font-size: 11px; line-height: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 14px; }
  .kpi .value { font-size: 24px; }
  .card h3 .h-action { float: none; display: inline-block; margin: 0 12px 0 0; }
  .card h3 { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
  .hbar { grid-template-columns: minmax(84px, 36%) 1fr auto; font-size: 14px; }
  .row > input:not([type="checkbox"]):not([type="radio"]), .row > select { flex: 1 1 140px; min-width: 0; }
  .filters label { flex: 1 1 140px; }
  .filters label > input, .filters label > select { width: 100%; }
  .tl { grid-template-columns: 84px 1fr; }
  textarea { min-height: 110px; }
  .lead-meta { justify-content: flex-start; width: 100%; }
  .task-line { text-align: left; }
  .msg { max-width: 88%; }

  /* A detail takes the whole screen. */
  .drawer { inset: 0; width: 100%; border-left: 0; }
  .menu { left: 0; right: 0; top: auto; bottom: 0; width: auto; border: 0; border-radius: 18px 18px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

  /* A table with headings reads as a list of cards: the row's name, its key figure, then each answer beside its question. */
  table.cards, table.cards tbody { display: block; }
  table.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.cards tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  table.cards tbody tr:last-child { border-bottom: 0; }
  table.cards td { display: flex; justify-content: space-between; gap: 12px; grid-column: 1 / -1; padding: 1px 0; border: 0; text-align: right; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
  table.cards td::before { content: attr(data-label); color: var(--muted); text-align: left; flex: 0 0 auto; max-width: 50%; }
  table.cards td.c-title { grid-column: 1; grid-row: 1; display: block; text-align: left; font-size: 16px; font-weight: 600; }
  table.cards td.c-badge { grid-column: 2; grid-row: 1; display: block; align-self: start; white-space: nowrap; font-weight: 600; }
  table.cards td.c-badge::before { content: attr(data-label) " "; font-weight: 400; font-size: 12px; max-width: none; }
  table.cards td.c-sub, table.cards td.c-wide { display: block; text-align: left; }
  table.cards td.c-sub { color: var(--muted); }
  table.cards td.c-title::before, table.cards td.c-sub::before, table.cards td.c-wide::before { content: none; }
  table.cards td select, table.cards td input { min-width: 0; flex: 0 1 auto; max-width: 62%; }
  table.cards td.c-hide, table.cards td.c-empty { display: none; }
  table.cards tr.wide-row { display: none; }
  .scroll:has(> table.cards), .card.scroll:has(table.cards) { overflow-x: visible; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
