/* Quantum Leap (Q-L) design system.  Light and dark themes share one set of tokens;
   the theme is chosen by data-theme on <html> (set by app.js from the toggle or the
   system preference).  No framework, no build step.  The accent is the website's teal
   (#2a7776, v1.9.4); dark mode uses a brighter teal with dark text on it, so buttons and
   links keep at least 4.5:1 contrast.  --brand is the logo colour in both themes. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/vendor/inter/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/vendor/inter/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/vendor/inter/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/vendor/inter/inter-latin-700-normal.woff2") format("woff2"); }

/* ----- tokens ------------------------------------------------------------------- */
:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e4e7eb;
  --border-strong: #cdd3db;
  --text: #14171d;
  --text-2: #464d5a;
  --muted: #6b7280;
  --brand: #2a7776;
  --accent: #2a7776;
  --accent-hover: #225f5e;
  --accent-soft: #e8f3f2;
  --on-accent: #ffffff;
  --good: #0ca30c;
  --good-text: #0b6b0b;
  --good-soft: #e3f6e3;
  --warn: #fab219;
  --warn-text: #8a5a00;
  --warn-soft: #fdf3dc;
  --danger: #d03b3b;
  --danger-text: #b42323;
  --danger-soft: #fbe5e5;
  --info-text: #1d5958;
  --info-soft: #e8f3f2;
  --focus: rgba(42, 119, 118, .35);
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --radius: 12px;
  --radius-sm: 8px;
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; --c6: #4a3aa7;
  --grid: #e9ecf0;
  --neutral-mark: #9aa3b2;
  --hero-a: #e8f3f2; --hero-b: #f4f5f7;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1216;
  --surface: #171b22;
  --surface-2: #1d222b;
  --border: #262c36;
  --border-strong: #3a4250;
  --text: #e8eaef;
  --text-2: #b7bdc9;
  --muted: #8b93a3;
  --brand: #2a7776;
  --accent: #4fb0aa;
  --accent-hover: #6cc2bc;
  --accent-soft: #15302f;
  --on-accent: #0b1f1f;
  --good: #0ca30c;
  --good-text: #6fd66f;
  --good-soft: #0f2a12;
  --warn: #fab219;
  --warn-text: #f5c451;
  --warn-soft: #3a2b08;
  --danger: #e66767;
  --danger-text: #f08c8c;
  --danger-soft: #3a1515;
  --info-text: #8fd3cd;
  --info-soft: #15302f;
  --focus: rgba(79, 176, 170, .45);
  --shadow: none;
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #9085e9;
  --grid: #262c36;
  --neutral-mark: #6b7482;
  --hero-a: #15302f; --hero-b: #0f1216;
}

/* ----- base --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column;
}
@media (max-width: 640px) { body { font-size: 16px; } }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; margin: 0; color: var(--text); }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.code-lg { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.35rem; letter-spacing: .06em; font-weight: 600; }
.break { word-break: break-all; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; flex: none; }
.i.lg { width: 24px; height: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ----- layout ------------------------------------------------------------------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 640px) { .container { padding: 0 16px; } }
main { flex: 1 0 auto; padding: 24px 0 48px; }
main.narrow .container { max-width: 760px; }
main.form .container { max-width: 620px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.page-head .titles { min-width: 0; }
.page-head h1 { margin-bottom: 4px; }
.page-head .sub { color: var(--muted); font-size: .92rem; }
.page-head .actions { margin: 0; }
.crumb { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-head h2 { font-size: 1.05rem; }
.section-head .more { font-size: .85rem; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
@media (max-width: 900px) { .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.main-side { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }

/* ----- top bar ------------------------------------------------------------------ */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.topbar-inner { display: flex; align-items: center; gap: 8px 20px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; flex: none; }
.brand .org-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
@media (max-width: 480px) { .brand .org-name { max-width: 150px; } }
.brand .brand-sub { color: var(--muted); font-weight: 500; font-size: .82rem; margin-left: 2px; }
.nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.nav a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: .92rem; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .i { width: 20px; height: 20px; }
#theme-toggle .sun { display: none; }
:root[data-theme="dark"] #theme-toggle .sun { display: block; }
:root[data-theme="dark"] #theme-toggle .moon { display: none; }
.nav-toggle { display: none; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 999px; border: 1px solid var(--border); }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; letter-spacing: .02em; }
.menu .who { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; font-weight: 500; color: var(--text-2); }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; }
.menu-panel .head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-panel .head b { display: block; font-size: .92rem; }
.menu-panel .head span { color: var(--muted); font-size: .82rem; word-break: break-all; }
.menu-panel a, .menu-panel button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); text-decoration: none; }
@media (max-width: 1360px) { .nav a .i { display: none; } }
@media (max-width: 1100px) { .menu .who { display: none; } }
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav a .i { display: inline-block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; padding: 8px 12px 12px; box-shadow: var(--shadow-lg); }
  .topbar.open .nav { display: flex; }
  .nav a { padding: 11px 12px; font-size: 1rem; }
  .menu .who { display: none; }
  .brand .brand-sub { display: none; }
}
@media (max-width: 400px) { .brand .brand-name { display: none; } .brand:not(.org) .brand-sub { display: inline; color: var(--text); font-weight: 700; font-size: 1.02rem; margin: 0; } }

/* ----- footer ------------------------------------------------------------------- */
.foot { border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; padding: 18px 0 28px; }
.foot .container { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--accent); }
.foot .spacer { flex: 1; }

/* ----- cards -------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
:not(.grid) > .card + .card { margin-top: 16px; }
.card.tight { padding: 14px 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-body { padding: 16px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { font-size: 1rem; font-weight: 600; }
.card-head .hint { margin: 0; }
.card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: .85rem; color: var(--muted); }
.select-bar { display: flex; gap: 12px 16px; align-items: center; flex-wrap: wrap; margin: 0 0 10px; }
.table td.sel, .table th.sel { width: 28px; padding-right: 0; }
.table td.sel input { width: 16px; height: 16px; accent-color: var(--accent); vertical-align: middle; }
.preview-box { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; justify-content: center; }
.preview-box svg { max-width: 100%; height: auto; }
.card ol.small li { margin-bottom: 6px; }
.card.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.card.danger-zone .card-head h3 { color: var(--danger-text); }
.card.danger-zone p { color: var(--muted); font-size: .92rem; margin-bottom: 12px; }
@media (max-width: 640px) { .card { padding: 16px; } }

/* ----- KPI tiles ---------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--text); box-shadow: var(--shadow); min-width: 0; }
a.kpi:hover { text-decoration: none; border-color: var(--border-strong); }
.kpi .label { display: block; font-size: .8rem; color: var(--muted); font-weight: 500; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .value { display: block; font-size: 1.7rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .delta { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: .78rem; color: var(--muted); }
.kpi .delta.up { color: var(--good-text); }
.kpi .delta.down { color: var(--danger-text); }
.kpi .delta .i { width: 14px; height: 14px; }
.kpi.hero .value { font-size: 2.4rem; }
.kpi.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .kpi .value { font-size: 1.45rem; } .kpis > :last-child:nth-child(odd) { grid-column: span 2; } }

/* ----- charts ------------------------------------------------------------------- */
.chart { position: relative; width: 100%; min-height: 120px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: inherit; font-size: 11px; fill: var(--muted); }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--border-strong); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover ~ .marker, .chart .hit.on ~ .marker { opacity: 1; }
.chart .bar-label { fill: var(--text-2); font-size: 12px; }
.chart .row-label { fill: var(--text); font-size: 12.5px; }
.chart .row-label.link { cursor: pointer; }
.chart .row-label.link:hover { fill: var(--accent); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--text-2); margin: 8px 0 0; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; }
.donut-wrap .chart { width: 124px; flex: none; }
.donut-list { list-style: none; margin: 0; padding: 0; font-size: .85rem; flex: 1 1 170px; min-width: 0; }
.donut-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.donut-list i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-list .lbl { flex: 1; min-width: 0; color: var(--text-2); line-height: 1.3; }
.donut-list .val { font-variant-numeric: tabular-nums; font-weight: 600; }
.donut-list .pct { color: var(--muted); font-variant-numeric: tabular-nums; width: 42px; text-align: right; }
.chart-empty { color: var(--muted); font-size: .88rem; padding: 24px 0; text-align: center; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 9px; border-radius: 7px; font-size: .8rem; line-height: 1.35; max-width: 260px; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .08s; white-space: pre-line; }
.tip.on { opacity: 1; }
details.table-view { margin-top: 8px; font-size: .85rem; }
details.table-view summary { cursor: pointer; color: var(--muted); }
details.table-view table { margin-top: 8px; }
.range-tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.range-tabs a { padding: 5px 12px; border-radius: 999px; font-size: .84rem; font-weight: 500; color: var(--text-2); }
.range-tabs a:hover { text-decoration: none; color: var(--text); }
.range-tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ----- forms -------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: 6px; color: var(--text); }
label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; }
label.check input { margin: 3px 0 0; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=tel], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: max(16px, .95rem); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 42px;
}
@media (min-width: 641px) { input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=tel], input[type=search], select, textarea { font-size: .95rem; } }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input[type=file] { width: 100%; font: inherit; padding: 8px 0; color: var(--text-2); }
input[type=file]::file-selector-button { font: inherit; font-weight: 500; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); margin-right: 10px; cursor: pointer; }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.hint { font-size: .8rem; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row > input, .input-row > select { flex: 1 1 160px; width: auto; min-width: 0; }
/* show / hide password: the eye button is added by app.js */
.pw-wrap { position: relative; display: block; }
.input-row > .pw-wrap { flex: 1 1 160px; min-width: 0; }
.pw-wrap > .pw-input { padding-right: 48px; }
.pw-toggle { position: absolute; top: 1px; right: 1px; bottom: 1px; width: 44px; padding: 0; border: 0; border-radius: 0 calc(var(--radius-sm) - 1px) calc(var(--radius-sm) - 1px) 0; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) { .pw-toggle:hover { color: var(--text); background: var(--surface-2); } } /* no sticky hover after a tap */
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.pw-toggle[aria-pressed="true"] { color: var(--accent); }
.pw-toggle .i { width: 20px; height: 20px; }
input::-ms-reveal, input::-ms-clear { display: none; } /* Edge's own eye would make two */
.input-row .suffix { color: var(--muted); white-space: nowrap; font-size: .92rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
fieldset { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
legend { font-weight: 600; font-size: .95rem; padding: 0; margin: 4px 0 12px; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* ----- buttons ------------------------------------------------------------------ */
.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: .92rem; padding: 10px 16px; min-height: 42px; border-radius: var(--radius-sm); border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn.ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--surface); color: var(--danger-text); border-color: var(--border-strong); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: .84rem; }
.btn.lg { padding: 13px 22px; min-height: 50px; font-size: 1rem; }
.btn.wide { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn .i { width: 18px; height: 18px; }
.link-btn, button.link { background: none; border: 0; color: var(--accent); padding: 0; font: inherit; font-weight: 500; cursor: pointer; }
.link-btn:hover, button.link:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger-text); }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; align-items: center; }
.actions form { display: inline; }
.actions.end { justify-content: flex-end; }
@media (max-width: 480px) { .actions .btn:not(.sm) { flex: 1 1 auto; } }

/* ----- messages ----------------------------------------------------------------- */
.flash, .alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .92rem; border: 1px solid transparent; }
.flash .i, .alert .i { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.flash.ok, .alert.ok { background: var(--good-soft); color: var(--good-text); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.flash.error, .alert.error { background: var(--danger-soft); color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.alert.notice { background: var(--warn-soft); color: var(--warn-text); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.alert.info { background: var(--info-soft); color: var(--info-text); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.alert p { margin: 0; }
.alert form.inline button { color: inherit; text-decoration: underline; }
.error { color: var(--danger-text); }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .i { width: 36px; height: 36px; stroke-width: 1.5; margin-bottom: 10px; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 460px; margin: 0 auto 14px; }

/* ----- badges ------------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.setup { background: var(--warn-soft); color: var(--warn-text); }
.badge.active { background: var(--good-soft); color: var(--good-text); }
.badge.paused { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge.info { background: var(--info-soft); color: var(--info-text); }
.badge.danger, .badge.retired { background: var(--danger-soft); color: var(--danger-text); }
.badge.plain::before { display: none; }

/* ----- tables ------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table td.trunc, .table td .trunc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.code { white-space: nowrap; }
.code .mark { background: var(--warn-soft); color: var(--warn-text); box-shadow: inset 0 -2px 0 var(--warn); border-radius: 2px; font-weight: 700; padding: 0 1px; }
.table td.actions-cell { white-space: nowrap; text-align: right; }
.table .sub { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; }
.table.compact th, .table.compact td { padding: 8px 12px; }
@media (max-width: 640px) {
  table.table.stack, table.table.stack tbody, table.table.stack tr, table.table.stack td { display: block; width: 100%; }
  table.table.stack thead { display: none; }
  table.table.stack tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  table.table.stack tr:last-child { border-bottom: 0; }
  table.table.stack td { border: 0; padding: 3px 0; display: flex; gap: 10px; align-items: baseline; overflow-wrap: anywhere; min-width: 0; }
  table.table.stack td.num { text-align: left; }
  table.table.stack td.trunc { white-space: normal; max-width: none; }
  table.table.stack td.actions-cell { text-align: left; }
  table.table.stack td[data-label]::before { content: attr(data-label); flex: 0 0 96px; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
  table.table.stack td:empty { display: none; }
  table.table.stack tbody tr:hover td { background: transparent; }
}

/* ----- filters & pagination ------------------------------------------------------ */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { flex: 1 1 220px; width: auto; min-width: 0; }
.filters select { width: auto; flex: 0 1 auto; max-width: 100%; }
.filters .btn { min-height: 42px; }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 16px; font-size: .9rem; }
.count { color: var(--muted); font-weight: 500; font-size: .95rem; margin-left: 6px; }

/* ----- lists -------------------------------------------------------------------- */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: .92rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; min-width: 0; }
@media (max-width: 480px) { dl.kv { grid-template-columns: 1fr; gap: 2px 0; } dl.kv dd { margin-bottom: 8px; } }
.events { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.events li { display: grid; grid-template-columns: 10px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); position: relative; }
.events li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); margin-top: 5px; }
.events li:last-child { border-bottom: 0; }
.events .when { color: var(--muted); font-size: .8rem; display: block; }
.events .det { color: var(--text-2); display: block; word-break: break-word; }
.attention { list-style: none; margin: 0; padding: 0; }
.attention li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.attention li:last-child { border-bottom: 0; }
.attention .i { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.attention .warning .i { color: var(--warn-text); }
.attention .info .i { color: var(--accent); }
.attention .txt { flex: 1; min-width: 0; }
.attention .act { white-space: nowrap; font-size: .85rem; }
.linklist { list-style: none; margin: 0; padding: 0; }
.linklist li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.linklist li:last-child { border-bottom: 0; }
.linklist .n { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ----- scanner ------------------------------------------------------------------ */
.scanner { background: #0b0f19; border-radius: var(--radius); overflow: hidden; position: relative; aspect-ratio: 4 / 3; max-height: 60vh; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .reticle { position: absolute; inset: 15%; border: 2px solid rgba(255,255,255,.75); border-radius: 14px; pointer-events: none; box-shadow: 0 0 0 999px rgba(0,0,0,.25); }
.scanner .status { position: absolute; left: 0; right: 0; bottom: 0; padding: 9px 12px; background: rgba(0,0,0,.55); color: #fff; font-size: .85rem; }
.scan-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 8px; }
.scan-controls .btn { flex: 1 1 160px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 18px 0 12px; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* ----- content viewer ----------------------------------------------------------- */
.viewer img { max-width: 100%; height: auto; border-radius: var(--radius-sm); display: block; margin: 0 auto; }
.viewer video { width: 100%; max-height: 70vh; border-radius: var(--radius-sm); background: #000; }
.viewer iframe { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.viewer .text { white-space: pre-wrap; word-wrap: break-word; font-size: 1.05rem; line-height: 1.6; }
.manage-link { text-align: center; margin-top: 18px; font-size: .85rem; color: var(--muted); }

/* ----- rolling list ------------------------------------------------------------- */
.roll-list { list-style: none; margin: 0; padding: 0; }
.roll-list > li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.roll-list > li:first-child { padding-top: 0; }
.roll-list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.roll-list .pos { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border-strong); display: grid; place-items: center; font-weight: 600; font-size: .85rem; font-variant-numeric: tabular-nums; color: var(--text-2); align-self: start; }
.roll-list li.last .pos { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.roll-list .what { min-width: 0; }
.roll-list .what b { display: flex; gap: 8px; align-items: center; font-weight: 600; min-width: 0; }
.roll-list .what b .i { flex: none; color: var(--muted); }
.roll-list .what b span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roll-list .what .sub { display: block; color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.roll-list .what .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; color: var(--muted); font-size: .8rem; margin-top: 4px; }
.roll-list .ops { display: flex; gap: 6px; align-items: center; }
.roll-list .ops form { margin: 0; }
.roll-list .ops .btn.sm { min-width: 34px; padding: 6px 10px; }
@media (max-width: 640px) {
  .roll-list > li { grid-template-columns: 30px minmax(0, 1fr); }
  .roll-list .ops { grid-column: 2; flex-wrap: wrap; }
}
.roll-mini { margin: 0 0 12px; padding: 0; font-size: .9rem; list-style: decimal inside; }
.roll-mini li { padding: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roll-mini li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.roll-mini .i { width: 15px; height: 15px; vertical-align: -2px; margin-right: 6px; color: var(--muted); }

/* ----- destination chooser ------------------------------------------------------ */
.modes { display: grid; gap: 10px; margin: 4px 0 8px; }
.mode { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface); transition: border-color .12s; }
.mode.open { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.mode > label.check { margin: 0; font-weight: 600; }
.mode > label.check input { margin-top: 3px; }
.mode .fields { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.mode.open .fields { display: block; }
.mode .fields .field:last-child { margin-bottom: 0; }

/* ----- tag preview -------------------------------------------------------------- */
.tag-preview { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.tag-preview .qr { width: 132px; height: 132px; image-rendering: pixelated; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 6px; flex: none; }
.tag-preview dl { flex: 1; min-width: 220px; }
.codebox { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; }

/* ----- landing page ------------------------------------------------------------- */
.hero { background: linear-gradient(180deg, var(--hero-a) 0%, var(--hero-b) 100%); border-bottom: 1px solid var(--border); margin-top: -24px; padding: 56px 0 48px; }
.hero .container { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 32px; align-items: center; }
.hero h1 { font-size: 2.6rem; letter-spacing: -.03em; line-height: 1.1; margin-bottom: 16px; }
.hero .lead { font-size: 1.12rem; color: var(--text-2); max-width: 540px; margin-bottom: 24px; }
.hero .actions { margin-top: 0; }
.hero-art { display: flex; justify-content: center; }
.hero-art svg { width: min(100%, 340px); height: auto; }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.steps { counter-reset: step; }
.steps .card { position: relative; padding-top: 22px; }
.steps .num { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; margin-bottom: 12px; }
.steps h3 { margin-bottom: 6px; }
.steps p { color: var(--text-2); font-size: .95rem; }
.feature-list { list-style: none; padding: 0; margin: 0; }
.feature-list li { display: flex; gap: 12px; padding: 8px 0; font-size: .95rem; color: var(--text-2); }
.feature-list .i { color: var(--good); width: 20px; height: 20px; margin-top: 2px; }
.feature-list.warn .i { color: var(--warn-text); }
.cta-band { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.cta-band h2 { font-size: 1.25rem; margin-bottom: 4px; }
.cta-band p { color: var(--text-2); }
@media (max-width: 860px) {
  .hero { padding: 40px 0 36px; }
  .hero .container { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .hero-art { order: -1; }
  .hero-art svg { width: min(60%, 220px); }
}

/* ----- misc --------------------------------------------------------------------- */
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.split { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; color: var(--muted); font-size: .9rem; }
.split .badge { vertical-align: middle; }
.progress { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 20px; font-size: .9rem; }
.meta-grid b { display: block; font-size: .78rem; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
@media print { .topbar, .foot, .actions, .filters { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
