:root {
  --bg: #f4f6f9; --card: #ffffff; --ink: #14213d; --muted: #5b6b7f; --line: #e2e7ee; --soft: #eef2f7;
  --brand: #0b3a6e; --brand-2: #0f5299; --accent: #1f6fd1;
  --bad: #b42318; --mid: #a15c00; --good: #157f3b;
  --bad-bg: #fde8e6; --mid-bg: #fff2d9; --good-bg: #e3f5e9;
  --neg: #d4593f; --neu: #b8c2cf; --pos: #2f9e78;
  --sample: #6b4fbb; --sample-bg: #efeafd;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,33,61,.06), 0 1px 1px rgba(20,33,61,.04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e141c; --card: #161f2a; --ink: #e6edf5; --muted: #95a3b5; --line: #263242; --soft: #1c2735;
    --brand: #0b2e57; --brand-2: #164c8a; --accent: #6aa8f5;
    --bad: #ff8a7a; --mid: #f3b65b; --good: #57d18a; --bad-bg: #3a1d1a; --mid-bg: #3a2d14; --good-bg: #16331f;
    --neg: #e0765e; --neu: #4f5d70; --pos: #46b98f; --sample: #b9a5f5; --sample-bg: #2b2346; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; } h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 16px 0 8px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .nowrap { white-space: nowrap; } .r { text-align: right; }
.bad { color: var(--bad); } .mid { color: var(--mid); } .good { color: var(--good); }

/* top bar */
.topbar { background: var(--brand); color: #fff; display: flex; align-items: center; gap: 18px; padding: 0 16px; min-height: 56px; position: sticky; top: 0; z-index: 10; }
.brand { color: #fff; display: flex; gap: 8px; align-items: center; font-size: 16px; white-space: nowrap; } .brand:hover { text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.14); }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a { color: rgba(255,255,255,.82); padding: 8px 10px; border-radius: 7px; white-space: nowrap; }
.nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; } .nav a.on { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.pill { background: #ff6b57; color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; font-weight: 700; }
.who { display: flex; gap: 8px; align-items: center; font-size: 13px; white-space: nowrap; } .who a { color: rgba(255,255,255,.85); }
.uname { opacity: .9; }
.menu { display: none; background: none; border: 0; color: #fff; font-size: 22px; width: 44px; height: 44px; border-radius: 8px; cursor: pointer; }
.menu:hover, .menu[aria-expanded="true"] { background: rgba(255,255,255,.12); }
@media (max-width: 980px) {
  .topbar { flex-wrap: wrap; padding: 6px 12px 6px 16px; gap: 10px; } .menu { display: block; margin-left: auto; }
  .nav { order: 3; flex-basis: 100%; display: none; flex-direction: column; padding-bottom: 6px; } .nav.open { display: flex; }
  .nav a { padding: 11px 10px; font-size: 15px; }
  .who { order: 4; flex-basis: 100%; display: none; padding: 10px 10px 12px; border-top: 1px solid rgba(255,255,255,.15); font-size: 15px; }
  .nav.open ~ .who { display: flex; } .uname { display: inline; }
}
.role { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 5px; background: rgba(255,255,255,.2); color: inherit; }
.card .role, .roles-legend .role, dd .role { background: var(--soft); }
.role-admin { color: #ffd27a; } .card .role-admin, dd .role-admin, .roles-legend .role-admin { color: var(--mid); }
.role-analyst { color: #9fd0ff; } .card .role-analyst, .roles-legend .role-analyst { color: var(--accent); }

.wrap { max-width: 1320px; margin: 0 auto; padding: 20px 16px 40px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 24px; }
.flash { max-width: 1320px; margin: 14px auto 0; padding: 10px 14px; background: var(--good-bg); color: var(--ink); border-radius: 8px; width: calc(100% - 32px); }
.notice { background: var(--sample-bg); border: 1px solid color-mix(in srgb, var(--sample) 30%, transparent); padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.notice.slim { background: none; border: 0; border-left: 3px solid var(--sample); border-radius: 0; padding: 2px 0 2px 10px; font-size: 13px; color: var(--muted); }
.notice.slim b { color: var(--ink); }
.error { background: var(--bad-bg); color: var(--bad); padding: 10px 14px; border-radius: 8px; margin: 8px 0 12px; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.pagehead p { margin: 0; }
.actions, .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.actions form { margin: 0; }

/* forms */
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; max-width: 100%; }
textarea { width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); }
.stack { display: flex; flex-direction: column; gap: 12px; } .stack input:not([type=checkbox]):not([type=file]) { width: 100%; }
fieldset { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
legend { font-size: 12.5px; color: var(--muted); padding: 0 4px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--card); color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; } .btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: var(--line); color: var(--ink); font-weight: 500; }
.btn:disabled { opacity: .6; cursor: wait; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; }
.filters .quick { display: flex; gap: 8px; margin-left: auto; align-self: center; font-size: 13px; }
details summary { cursor: pointer; color: var(--accent); }
.otp { font-size: 24px; letter-spacing: .3em; text-align: center; font-family: ui-monospace, monospace; }

/* layout */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; margin-bottom: 16px; }
.grid > * { grid-column: span 12; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
@media (min-width: 900px) { .wide { grid-column: span 8; } .narrow { grid-column: span 4; } .half { grid-column: span 6; } .third { grid-column: span 4; } }
.cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; } .cardhead h2 { margin-bottom: 10px; }
.scroll { overflow-x: auto; }
.narrowcard { max-width: 760px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi span:first-child { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi b { display: block; font-size: 25px; line-height: 1.25; margin: 2px 0; font-variant-numeric: tabular-nums; } .kpi b small { font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.delta { font-size: 12px; font-weight: 600; color: var(--muted); } .delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.big { font-size: 28px; font-weight: 700; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl tr:last-child td { border-bottom: 0; }
.mentions-tbl td:nth-child(3) { min-width: 320px; }
.scorecard td:first-child { min-width: 220px; }
.conf td, .conf th { text-align: center; } .conf td.diag { background: var(--good-bg); font-weight: 700; }

/* chips & badges */
.chip { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--soft); font-size: 12.5px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.bad { background: var(--bad-bg); color: var(--bad); } .chip.mid { background: var(--mid-bg); color: var(--mid); } .chip.good { background: var(--good-bg); color: var(--good); }
.badge { display: inline-block; padding: 0 6px; border-radius: 5px; background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 600; vertical-align: 1px; }
.badge.sample { background: var(--sample-bg); color: var(--sample); }
.prio { font-weight: 700; font-size: 12px; padding: 1px 6px; border-radius: 5px; background: var(--soft); }
.prio.P1 { background: var(--bad-bg); color: var(--bad); } .prio.P2 { background: var(--mid-bg); color: var(--mid); }
.status { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--soft); }
.status.s-new { color: var(--accent); } .status.s-in_progress, .status.s-assigned { color: var(--mid); } .status.s-resolved, .status.s-closed { color: var(--good); }

.bar { display: inline-block; width: 90px; height: 7px; background: var(--soft); border-radius: 9px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.bar i { display: block; height: 100%; background: var(--neg); }
.chartbox { position: relative; height: 300px; }
.card.fill { display: flex; flex-direction: column; } .card.fill .chartbox { flex: 1; min-height: 300px; }
.legend { font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; }
.sw.neg { background: var(--neg); } .sw.neu { background: var(--neu); } .sw.pos { background: var(--pos); } .sw.line { background: var(--ink); height: 2px; width: 14px; }

/* lists */
.mentions { list-style: none; margin: 0; padding: 0; }
.mentions li { padding: 10px 0; border-bottom: 1px solid var(--line); } .mentions li:last-child { border-bottom: 0; }
.mentions a { color: var(--ink); }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 4px; }
.alerts-mini, .alert-list { list-style: none; margin: 0; padding: 0; }
.alerts-mini li { padding: 8px 0 8px 10px; border-left: 3px solid var(--line); margin-bottom: 6px; display: flex; flex-direction: column; }
.alerts-mini li.critical { border-color: var(--bad); } .alerts-mini li.warning { border-color: var(--mid); } .alerts-mini li.ack { opacity: .6; }
.alert-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); } .alert-list li.ack { opacity: .65; }
.sev { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 5px; background: var(--soft); white-space: nowrap; }
.sev.critical { background: var(--bad-bg); color: var(--bad); } .sev.warning { background: var(--mid-bg); color: var(--mid); }
.alert-detail { border-left: 4px solid var(--accent); } .alert-detail.critical { border-left-color: var(--bad); } .alert-detail.warning { border-left-color: var(--mid); }
.reasons { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.aspects { list-style: none; padding: 0; margin: 0; } .aspects li { margin-bottom: 6px; }
.timeline { list-style: none; padding: 0 0 0 14px; border-left: 2px solid var(--line); } .timeline li { margin: 0 0 14px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.rules { display: flex; flex-direction: column; gap: 10px; }
.rule { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.rule-name { flex-basis: 100%; display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; } .rule .grow { flex: 1 1 220px; } .rule .grow input { width: 100%; }
.roles-legend { display: grid; gap: 6px; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 99px; color: var(--muted); } .tabs a.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); border: 1px solid var(--line); }
.tabs .sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }
.tabs form.inline { display: flex; gap: 6px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; } .kv dt { color: var(--muted); font-size: 12.5px; } .kv dd { margin: 0; }
.small4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
blockquote.post { margin: 10px 0; padding: 12px 14px; background: var(--soft); border-radius: 8px; border-left: 3px solid var(--accent); font-size: 15px; }
.verdict { font-weight: 700; padding: 8px 12px; border-radius: 8px; margin-bottom: 6px; } .verdict.yes { background: var(--good-bg); color: var(--good); } .verdict.no { background: var(--bad-bg); color: var(--bad); }
.probs { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.probs span { position: relative; padding: 1px 6px; border-radius: 4px; background: linear-gradient(90deg, var(--c) var(--w), transparent var(--w)); }
.probs .neg { --c: color-mix(in srgb, var(--neg) 35%, transparent); } .probs .neu { --c: color-mix(in srgb, var(--neu) 45%, transparent); } .probs .pos { --c: color-mix(in srgb, var(--pos) 35%, transparent); }
.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ex { font: inherit; font-size: 12px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); border-radius: 99px; padding: 3px 10px; cursor: pointer; }
.preview { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; margin-bottom: 10px; }
.imgresult { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; } .imgresult img { max-width: 260px; border-radius: 8px; }
.thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.thumb { position: relative; display: block; } .thumb img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 7px; display: block; }
.thumb .chip { position: absolute; left: 6px; bottom: 6px; }
.token { display: block; padding: 8px; background: var(--card); border-radius: 6px; margin: 6px 0; word-break: break-all; font-size: 14px; }
.secret { word-break: break-all; }
.qr { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: 10px; width: max-content; margin: 8px auto; }

/* CX index & scorecard */
.index-card { display: flex; flex-direction: column; gap: 4px; }
.index-card p { margin: 6px 0; }
.opp { display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--line); padding-top: 12px; margin: 4px 0 10px; }
.opp .eyebrow { margin-bottom: 2px; } .opp a b { font-size: 15px; }
.index-big { font-size: 52px; font-weight: 700; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.index-big small { font-size: 18px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.formula { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.wbar, .gap { display: inline-block; width: 70px; height: 7px; background: var(--soft); border-radius: 9px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.wbar i { display: block; height: 100%; background: var(--accent); }
.gap i { display: block; height: 100%; } .gap.short i { background: var(--neg); } .gap.met i { background: var(--pos); width: 100% !important; }
.scorecard tr.inactive { opacity: .55; }
.hero { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 16px; margin-bottom: 16px; }
.hero .card { margin: 0; }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; } }
.drivers { display: grid; gap: 8px; }
.driver { display: grid; grid-template-columns: minmax(120px, 1.3fr) 2fr 52px 58px; gap: 10px; align-items: center; font-size: 13px; }
.driver .track { position: relative; height: 12px; background: var(--soft); border-radius: 6px; }
.driver .track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.driver .track b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; }
.driver .w { color: var(--muted); text-align: right; font-size: 12px; }

/* auth */
.auth { min-height: 80vh; display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 8px 30px rgba(20,33,61,.08); }
.auth-brand { font-size: 18px; display: flex; align-items: center; gap: 8px; } .auth-brand .logo { background: var(--brand); color: #fff; }

/* report */
.report .rhead { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.report .rhead h2 { font-size: 22px; margin: 2px 0; }
.eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.findings { margin: 0; padding-left: 18px; } .findings li { margin-bottom: 6px; }
.band-bad { border-top: 3px solid var(--bad); } .band-mid { border-top: 3px solid var(--mid); } .band-good { border-top: 3px solid var(--good); }
@media print {
  .topbar, .noprint, .foot, .flash { display: none !important; }
  body { background: #fff; } .card, .kpi { box-shadow: none; break-inside: avoid; } .wrap { padding: 0; }
  .grid { display: block; } .grid > .card { margin-bottom: 12px; }
}

/* Ask ATL CX */
.chat { display: flex; flex-direction: column; gap: 12px; }
.thread { display: flex; flex-direction: column; gap: 12px; min-height: 320px; max-height: 62vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 860px; padding: 12px 14px; border-radius: 12px; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--soft); border-bottom-left-radius: 4px; }
.msg.bot p { margin: 0 0 8px; } .msg.bot p:last-child { margin-bottom: 0; } .msg.bot ul, .msg.bot ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.bot h4 { margin: 8px 0 4px; font-size: 14px; } .msg.bot table { background: var(--card); border-radius: 8px; margin: 6px 0; }
.msg.pending .dots::after { content: '…'; animation: blink 1s infinite; } @keyframes blink { 50% { opacity: .2; } }
.cite { font-size: 12px; font-weight: 600; background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.trace { margin-top: 8px; font-size: 12px; color: var(--muted); } .trace ul { margin: 4px 0 0; padding-left: 18px; }
.fb { display: flex; gap: 4px; margin-top: 6px; } .fb button { border: 1px solid var(--line); background: var(--card); border-radius: 6px; cursor: pointer; padding: 1px 6px; opacity: .6; }
.fb button.on { opacity: 1; border-color: var(--accent); }
.askbar { display: flex; gap: 8px; align-items: flex-end; } .askbar textarea { flex: 1; }
.empty { padding: 20px 0; } .empty .examples { justify-content: flex-start; }

/* Help & training */
.roles3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-bottom: 16px; }
.roles3 .card { margin: 0; }
.rolecard.me { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.rolecard h2 { margin-bottom: 4px; } .rolecard p { margin: 0 0 8px; }
.ticks { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.steps { margin: 8px 0 10px; padding-left: 20px; display: grid; gap: 6px; }
.guides details { border-top: 1px solid var(--line); padding: 10px 0; } .guides details:first-child { border-top: 0; }
.guides summary { font-weight: 600; color: var(--ink); padding: 4px 0; }
#start, #guides, #scores, #training, #support { scroll-margin-top: 72px; }
@media (max-width: 900px) { .roles3 { grid-template-columns: minmax(0,1fr); } }
@media print { .guides details { break-inside: avoid; } }

/* ---------------------------------------------------------------- phones & small tablets */
@media screen and (max-width: 640px) {
  .wrap { padding: 16px 14px 32px; }
  h1 { font-size: 22px; }
  /* 16px stops iOS zooming into the page when a field is tapped */
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 42px; justify-content: center; }
  .pagehead { align-items: stretch; } .pagehead .actions { width: 100%; } .pagehead .actions .btn { flex: 1; }
  .filters { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
  .filters label:not(.check) input, .filters select { width: 100%; }
  .filters .check { grid-column: 1 / -1; font-size: 15px; }
  .filters > .btn { grid-column: 1 / -1; }
  .filters .quick { grid-column: 1 / -1; margin: 0; justify-content: space-around; }
  .filters .quick a { padding: 8px 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .kpis .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi b { font-size: 22px; }
  .index-big { font-size: 46px; }
  .driver { grid-template-columns: minmax(0,1fr) 52px 40px; row-gap: 4px; }
  .driver .dn { grid-column: 1 / -1; padding: 6px 0 2px; }
  .filters .quick a, .cardhead a.small { display: inline-block; padding: 8px 4px; }
  .chartbox, .card.fill .chartbox { height: 240px; min-height: 240px; }
  .card { padding: 14px; }
  .kv { grid-template-columns: minmax(0,1fr); gap: 2px; } .kv dd { margin-bottom: 8px; overflow-wrap: anywhere; }
  .imgresult img { max-width: 100%; }
  .askbar { flex-direction: column; align-items: stretch; }
  .tabs form.inline { margin-left: 0; width: 100%; }
  .alert-list li { flex-wrap: wrap; }
}

/* Wide tables marked .stack become one card per row on phones and portrait tablets */
@media screen and (max-width: 860px) {
  /* Tables marked .stack become one card per row; app.js copies each column header into data-l */
  .scroll:has(> .tbl.stack), .card.scroll:has(> .tbl.stack) { overflow-x: visible; }
  .tbl.stack, .tbl.stack tbody { display: block; width: 100%; }
  .tbl.stack tr.th-row { display: none; }
  .tbl.stack tr { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .tbl.stack tr:last-child { border-bottom: 0; }
  .tbl.stack td { display: flow-root; border: 0; padding: 1px 0; text-align: right; min-width: 0 !important; white-space: normal; }
  .tbl.stack td::before { content: attr(data-l); float: left; margin-right: 12px; color: var(--muted); font-size: 12.5px; font-weight: 500; text-align: left; }
  .tbl.stack td.full, .tbl.stack td.lead { display: block; order: -1; text-align: left; font-size: 14px; padding-bottom: 3px; }
  .tbl.stack td.full::before, .tbl.stack td.lead::before, .tbl.stack td:not([data-l])::before { content: none; }
  .tbl.stack td:not([data-l]) { text-align: left; }
  .tbl.stack td[colspan] { display: block; text-align: left; }
  .tbl.stack td:empty { display: none; }
  .tbl.stack td .bar { width: 70px; }
}
