/* QR Code Drop - admin panel and customer portal. Builds on base.css and follows docs/DESIGN.md (pass 3): Apps 365
   Point-family tokens, coral focus ring, 3:1 control borders, alerts with an icon and a word, tables that scroll
   inside their own labelled frame. Dense, calm, readable; works from 320px phones up, light and dark. */

:root {
  --side: #1b1d20;
  --side-ink: #c9d0d6;
  --side-hover: #2a2e33;
  --page: #f4f6f7;
  --card: #ffffff;
  --field: #ffffff;
  --head: #f4f7f7;
  --hover: #f7fafa;
  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --r: 14px;
  --r-sm: 10px;
  --line-strong: #7b858f;
  --teal-800: #175a5b;
  --info-line: #c9e6e6;
  --good-line: #a9d6bb;
  --warn-line: #f1d8ad;
  --warn-ink: #7a4800;
  --bad: #b3261e;
  --bad-50: #fdecea;
  --bad-line: #f1b3ad;
  --bad-ink: #7f1d17;
  --focus: #ee4123;
  --meter: #e3e8ea;
}

body.ui { background: var(--page); color: var(--ink); font-size: 15px; line-height: 1.5; }
.ui a { color: var(--teal-700); text-underline-offset: .18em; }
.ui a:hover { color: var(--teal-800); }
.ui :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ui h1 { font-size: 1.45rem; margin: 0; }
.ui h2 { font-size: 1.08rem; margin: 0 0 12px; }
.ui h3 { font-size: .98rem; margin: 0 0 8px; }
.ui p { margin: 0 0 10px; }
.ui .muted { color: var(--ink-3); }
.ui .small { font-size: .88rem; }
.ui .mono { font-family: var(--mono); font-size: .86em; overflow-wrap: anywhere; word-break: break-word; }
.ui .nowrap { white-space: nowrap; }
.ui .right { text-align: right; }
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 14px; height: 14px; }
html { scroll-padding-top: 16px; }

/* Shell: side navigation + main column. Below 900px the navigation becomes a scrolling strip. */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.side .brandline { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; text-decoration: none; padding: 4px 10px 18px; }
.side .brandline:hover { color: #fff; }
.side .brandline img { width: 28px; height: 28px; border-radius: 7px; }
.side .brandline small { display: block; font-weight: 500; color: var(--side-ink); font-size: .78rem; }
.side nav ul { list-style: none; margin: 0; padding: 0; }
.side nav a { display: flex; align-items: center; gap: 10px; color: var(--side-ink); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .93rem; min-height: 36px; }
.side nav a:hover { background: var(--side-hover); color: #fff; }
.side nav a[aria-current="page"] { background: var(--teal-700); color: #fff; }
.side nav .icon { width: 18px; height: 18px; }
.side :focus-visible { outline-color: #ff8a72; }
.side .who { border-top: 1px solid #33383e; margin-top: 18px; padding: 14px 10px 0; font-size: .84rem; }
.side .who .email { color: #fff; overflow-wrap: anywhere; display: block; margin-bottom: 8px; }
.side .who button, .side .help-links a { background: none; border: 1px solid #5a626b; color: var(--side-ink); border-radius: 8px; padding: 6px 10px; font: inherit; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; min-height: 32px; }
.side .who button:hover { color: #fff; border-color: #8a939c; }
.side .help-links { margin-top: auto; padding: 16px 10px 0; display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .84rem; }
.side .help-links a { border: 0; padding: 4px 0; color: var(--side-ink); text-decoration: underline; text-underline-offset: .2em; }
.side .help-links a:hover { color: #fff; }
.main { min-width: 0; padding: 22px 28px 48px; }
.topbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.topbar > div:first-child { min-width: 0; }
.topbar .crumbs, nav.crumbs { font-size: .86rem; color: var(--ink-3); margin-bottom: 4px; }
nav.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 2px 6px; margin: 0; padding: 0; }
nav.crumbs li { display: inline-flex; align-items: center; gap: 6px; }
nav.crumbs li + li::before { content: "/"; color: var(--ink-3); }
.topbar .crumbs a, nav.crumbs a { color: var(--ink-3); }
.topbar .crumbs a:hover, nav.crumbs a:hover { color: var(--teal-800); }
.topbar .sub { margin: 4px 0 0; color: var(--ink-3); font-size: .88rem; }
.topbar .actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; padding: 10px 12px; }
  .side .brandline { padding: 4px 4px 10px; }
  .side nav ul { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
  .side nav a { white-space: nowrap; padding: 7px 10px; }
  .side .who { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding-top: 10px; }
  .side .who .email { margin: 0; min-width: 0; }
  .side .help-links { padding-top: 8px; }
  .main { padding: 16px 16px 40px; }
}

/* Cards, grids, stat tiles. Grid items never grow past their track (wide tables scroll inside their frame). */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; min-width: 0; }
.card > h2:first-child, .card > header:first-child { margin-top: 0; }
.card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card header h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 420px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; min-width: 0; }
.kpi .label { font-size: .82rem; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 1.6rem; font-weight: 700; font-family: var(--font-display); line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .82rem; color: var(--ink-3); }
.kpi.warn { border-color: var(--warn-line); background: var(--warn-50); }
.kpi.warn .label, .kpi.warn .sub { color: var(--warn-ink); }
.kpi.bad { border-color: var(--bad-line); background: var(--bad-50); }
.kpi.bad .label, .kpi.bad .sub { color: var(--bad-ink); }
.kpi.bad a, .kpi.warn a { color: inherit; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: .8rem; font-weight: 600; padding: 0 6px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.trend .icon { width: 12px; height: 12px; }
.trend.up { background: var(--good-50); color: var(--good); }
.trend.down { background: var(--bad-50); color: var(--bad-ink); }
.trend.flat { background: var(--head); color: var(--ink-2); }

/* Alerts list (admin dashboard). */
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alerts li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card); }
.alerts li .icon { width: 18px; height: 18px; }
.alerts li.bad { border-color: var(--bad-line); background: var(--bad-50); color: var(--bad-ink); }
.alerts li.warn { border-color: var(--warn-line); background: var(--warn-50); color: var(--warn-ink); }
.alerts li.info { border-color: var(--info-line); background: var(--teal-50); color: var(--teal-800); }
.alerts li.good { border-color: var(--good-line); background: var(--good-50); color: var(--good); }
.alerts li a { color: inherit; font-weight: 600; }
.alerts li strong { display: block; }
@media (max-width: 560px) { .alerts li { grid-template-columns: auto minmax(0, 1fr); } .alerts li > a { grid-column: 2; } }

/* Tables: inside a focusable frame that scrolls sideways on its own. */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); max-width: 100%; }
.table-wrap:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t caption { text-align: left; font-weight: 600; padding: 10px 12px 0; color: var(--ink-2); }
table.t th, table.t td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); background: var(--head); font-weight: 600; white-space: nowrap; }
table.t th[data-sort] { cursor: pointer; user-select: none; }
table.t th[data-sort]::after { content: ""; margin-left: 4px; }
table.t th[aria-sort="ascending"]::after { content: "\2191"; }
table.t th[aria-sort="descending"]::after { content: "\2193"; }
table.t th a.sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
table.t th a.sort:hover { color: var(--teal-800); text-decoration: underline; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: var(--hover); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.card .table-wrap { border: 0; border-radius: 0; margin: 0 -18px; max-width: none; }
.card .table-wrap table.t th:first-child, .card .table-wrap table.t td:first-child { padding-left: 18px; }
.card .table-wrap table.t th:last-child, .card .table-wrap table.t td:last-child { padding-right: 18px; }
.empty { padding: 26px; text-align: center; color: var(--ink-3); }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--head); border: 1px solid var(--line); display: block; }
.thumb-icon { width: 44px; height: 44px; border-radius: 8px; background: var(--head); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--ink-3); }
.file-cell { display: flex; gap: 10px; align-items: center; min-width: 0; }
.file-cell .name { overflow-wrap: anywhere; }

/* Empty states: icon tile, one line, one action. */
.empty-state { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 28px 16px; color: var(--ink-2); }
.empty-state .tile { width: 48px; height: 48px; border-radius: 12px; background: var(--teal-50); color: var(--teal-700); display: flex; align-items: center; justify-content: center; }
.empty-state .tile .icon { width: 24px; height: 24px; }
.empty-state p { margin: 0; max-width: 34rem; }
.empty-state .title { font-weight: 600; color: var(--ink); }

/* Filters bar. */
.filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; margin-bottom: 12px; }
.filters .field { margin: 0; }
.filters label { font-size: .86rem; font-weight: 600; display: block; margin-bottom: 4px; }
.filters input, .filters select { min-width: 140px; }
.filters .btn-row { padding-bottom: 1px; }
@media (max-width: 560px) { .filters .field { flex: 1 1 100%; } .filters input, .filters select { min-width: 0; } }
.search { position: relative; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 16px; height: 16px; }
.search input { padding-left: 32px; }
.list-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 0 0 10px; }

/* Badges and chips (status always has a word). */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge-good { background: var(--good-50); color: var(--good); border-color: var(--good-line); }
.badge-warn { background: var(--warn-50); color: var(--warn-ink); border-color: var(--warn-line); }
.badge-bad { background: var(--bad-50); color: var(--bad-ink); border-color: var(--bad-line); }
.badge-neutral { background: var(--head); color: var(--ink-2); border-color: var(--line-2); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; background: var(--head); font-size: .82rem; }

/* Buttons: one primary per view; 40px high (32px small, still over the 24px target). */
.ui .btn { min-height: 40px; padding: 6px 14px; border-radius: var(--r-sm); font-size: .92rem; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); gap: 6px; transition: background-color .15s, border-color .15s, color .15s; }
.ui .btn:hover { border-color: var(--ink); color: var(--ink); }
.ui .btn-primary { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.ui .btn-primary:hover { background: var(--teal-800); border-color: var(--teal-800); color: #fff; filter: none; }
.ui .btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.ui .btn-danger:hover { background: var(--bad-ink); border-color: var(--bad-ink); color: #fff; }
.ui .btn-danger:focus-visible { outline-color: var(--ink); }
.ui .btn-danger-quiet { background: var(--card); border-color: var(--bad-line); color: var(--bad); }
.ui .btn-danger-quiet:hover { background: var(--bad-50); border-color: var(--bad); color: var(--bad-ink); }
.ui .btn-sm { min-height: 32px; padding: 3px 10px; font-size: .86rem; }
.ui .btn-lg { min-height: 48px; padding: 10px 20px; font-size: 1rem; }
.ui .btn-ghost { border-color: transparent; background: transparent; }
.ui .btn-ghost:hover { border-color: var(--line-2); }
.ui .btn[aria-disabled="true"], .ui .btn[disabled] { opacity: .55; cursor: not-allowed; }
.ui .btn[disabled] { pointer-events: none; }
.inline-form { display: inline; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Forms: label above, hint under the label, 3:1 control borders, 16px text (no zoom on phones). */
.field { margin-bottom: 14px; min-width: 0; }
.field > label, .field > .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.field .req { color: var(--bad); }
.field .opt { font-weight: 400; color: var(--ink-3); font-size: .86rem; }
.ui input[type=text], .ui input[type=email], .ui input[type=password], .ui input[type=url], .ui input[type=number], .ui input[type=date], .ui input[type=datetime-local], .ui input[type=search], .ui input[type=tel], .ui select, .ui textarea {
  width: 100%; font: inherit; font-size: 1rem; min-height: 40px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--field); color: var(--ink);
}
.ui input[type=color] { width: 56px; height: 40px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--field); }
.ui input[type=file] { font: inherit; font-size: .92rem; max-width: 100%; }
.ui textarea { resize: vertical; min-height: 70px; }
.ui input:focus-visible, .ui select:focus-visible, .ui textarea:focus-visible { outline: 3px solid var(--teal-700); outline-offset: 1px; border-color: var(--teal-700); }
.ui input[type=checkbox]:focus-visible, .ui input[type=radio]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ui [aria-invalid="true"] { border-color: var(--bad) !important; }
.ui ::placeholder { color: var(--ink-3); opacity: 1; }
.help { font-size: .86rem; color: var(--ink-3); margin: 4px 0 0; }
.err { font-size: .88rem; color: var(--bad); margin: 4px 0 0; display: flex; gap: 6px; align-items: center; }
.err .icon { flex: none; }
.field-check { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: start; }
.field-check input { margin-top: 3px; width: 20px; height: 20px; accent-color: var(--teal-700); }
.field-check label { font-weight: 600; margin: 0; }
.field-check .help, .field-check .err { grid-column: 2; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 700px) { .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); } }
fieldset { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px 4px; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; font-size: .95rem; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.form-actions.sticky { position: sticky; bottom: 0; background: var(--page); padding: 12px 0; border-top: 1px solid var(--line); z-index: 2; }
.secret-state { font-size: .86rem; margin: 2px 0 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.locked { background: var(--card); }
.locked .field > label { color: var(--ink-2); }
.upsell { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--teal-50); color: var(--teal-800); border: 1px solid var(--info-line); font-size: .9rem; margin-bottom: 12px; }
.upsell .icon { margin-top: 2px; }
.upsell a { color: var(--teal-800); font-weight: 600; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 74px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; bottom: 4px; min-width: 64px; border: 0; border-radius: 6px; background: var(--head); color: var(--ink); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; }
.pw-toggle:hover { background: var(--line); }

/* Error summary: gets focus after a failed save and links to each field. */
.error-summary { border: 2px solid var(--bad); background: var(--card); border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 16px; }
.error-summary h2 { color: var(--bad-ink); font-size: 1rem; margin: 0 0 6px; display: flex; gap: 8px; align-items: center; }
.error-summary ul { margin: 0; padding-left: 20px; }
.error-summary a { color: var(--bad-ink); font-weight: 600; }
.error-summary:focus { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Alerts: an icon and a word, never colour alone. */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 14px; font-size: .92rem; background: var(--teal-50); color: var(--ink); border: 1px solid var(--info-line); }
.notice > .icon { margin-top: 2px; color: var(--teal-700); }
.notice-ok { background: var(--good-50); color: var(--ink); border-color: var(--good-line); }
.notice-ok > .icon { color: var(--good); }
.notice-err { background: var(--bad-50); color: var(--bad-ink); border-color: var(--bad-line); }
.notice-err > .icon, .notice-err a { color: var(--bad-ink); }
.notice-warn { background: var(--warn-50); color: var(--warn-ink); border-color: var(--warn-line); }
.notice-warn > .icon, .notice-warn a { color: var(--warn-ink); }
.notice p:last-child { margin-bottom: 0; }
.notice > div, .notice > p { min-width: 0; }

/* Key/value lists. */
dl.kv { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: .92rem; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { dl.kv { grid-template-columns: minmax(0, 1fr); gap: 0; } dl.kv dd { margin-bottom: 8px; } }

/* Tabs. */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; font-size: .92rem; }
.tabs a:hover { color: var(--teal-800); }
.tabs a[aria-current="page"] { color: var(--teal-700); border-bottom-color: var(--teal-700); font-weight: 600; }

/* Pager. */
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.pager-info { font-size: .86rem; color: var(--ink-3); margin: 8px 0 0; }
.pager .pager-info { margin: 0 auto 0 0; }

/* Usage meters. */
.usage { margin-bottom: 12px; }
.usage .row { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; flex-wrap: wrap; }
.usage .note { font-size: .82rem; color: var(--bad-ink); margin: 2px 0 0; }

/* Code blocks. */
pre.code { font-family: var(--mono); font-size: .82rem; background: var(--head); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-all; margin: 0; }
.log-lines { font-family: var(--mono); font-size: .78rem; background: #15181c; color: #d7dde2; border-radius: 8px; padding: 12px; overflow: auto; max-height: 360px; margin: 0; white-space: pre-wrap; word-break: break-all; }
pre.code:focus-visible, .log-lines:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Auth pages (sign in, set up, sign up). */
body.ui-auth { background: var(--page); }
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 620px; }
@media (max-width: 420px) { .auth-card { padding: 20px 16px; } }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--charcoal); text-decoration: none; margin-bottom: 18px; }
.auth-brand img { width: 32px; height: 32px; border-radius: 8px; }
.auth h1 { font-size: 1.35rem; margin-bottom: 8px; }
.auth .btn { width: 100%; min-height: 44px; }
.auth .pw-toggle { width: auto; }
.auth .alt { display: grid; gap: 8px; margin: 14px 0; }
.auth .or { text-align: center; color: var(--ink-3); font-size: .86rem; margin: 14px 0; display: flex; align-items: center; gap: 10px; }
.auth .or::before, .auth .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.auth .foot { font-size: .9rem; color: var(--ink-3); margin-top: 16px; text-align: center; }
.auth .help-foot { font-size: .86rem; color: var(--ink-3); text-align: center; margin: 18px 0 0; }
.totp-grid { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; align-items: start; margin: 12px 0 16px; }
.totp-qr { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #fff; padding: 8px; }
.totp-qr svg { width: 100%; height: 100%; }
@media (max-width: 560px) { .totp-grid { grid-template-columns: minmax(0, 1fr); } .totp-qr { margin: 0 auto; } }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

/* Portal specifics. */
.plan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.plan-card { border: 1px solid var(--line-2); border-radius: 20px; padding: 16px; background: var(--card); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.plan-card.featured { border-color: var(--teal-700); box-shadow: 0 0 0 1px var(--teal-700) inset; }
.plan-card .price { font-size: 1.5rem; font-weight: 700; font-family: var(--font-display); }
.plan-card .price small { font-size: .86rem; font-weight: 500; color: var(--ink-3); }
.plan-card ul { margin: 4px 0 8px; padding-left: 18px; font-size: .9rem; color: var(--ink-2); }
.plan-card .btn { margin-top: auto; }
.plan-card .btn-row .btn { margin-top: 0; }
.plan-card .btn-row { margin-top: auto; }
.plan-card.current { background: var(--teal-50); }
.plan-card .effect { font-size: .84rem; color: var(--ink-2); border-top: 1px dashed var(--line-2); padding-top: 6px; margin: 2px 0 6px; }
.plan-card .effect.bad { color: var(--bad-ink); }
.interval-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 2px; gap: 2px; margin-bottom: 12px; }
.interval-switch label { padding: 4px 14px; border-radius: 999px; cursor: pointer; font-size: .9rem; font-weight: 600; min-height: 32px; display: inline-flex; align-items: center; }
.interval-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.interval-switch input:checked + label { background: var(--teal-700); color: #fff; }
.interval-switch input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.q-row { border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 12px 2px; margin-bottom: 10px; background: var(--head); }
.q-row .q-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.q-row .q-head strong { font-size: .9rem; color: var(--ink-2); }
.q-row .btn-ghost { min-width: 32px; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-preview { width: 220px; max-width: 100%; aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; padding: 10px; color: var(--ink-3); }
.qr-preview svg { width: 100%; height: 100%; }
.copy-line { display: flex; gap: 6px; align-items: center; width: 100%; }
.copy-line input { flex: 1; min-width: 0; font-family: var(--mono); font-size: .84rem !important; }
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.studio .preview { position: sticky; top: 16px; }
@media (max-width: 1000px) { .studio { grid-template-columns: minmax(0, 1fr); } .studio .preview { position: static; } }
.studio .qr-preview { width: 100%; max-width: 320px; margin: 0 auto; }
.issues { list-style: none; padding: 0; margin: 10px 0 0; font-size: .86rem; }
.issues li { padding: 4px 0; display: flex; gap: 6px; }
.verify-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; }
.steps li::before { counter-increment: s; content: counter(s); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--teal-50); color: var(--teal-800); font-weight: 700; font-size: .82rem; display: flex; align-items: center; justify-content: center; }
.steps li.done::before { content: "\2713"; background: var(--good-50); color: var(--good); }
.badge-line { display: flex; gap: 6px; flex-wrap: wrap; }

/* First-run onboarding: four steps from sign-up to a tested poster. */
.onboard { border: 1px solid var(--info-line); background: linear-gradient(180deg, var(--teal-50), var(--card) 120px); }
.onboard .lede { color: var(--ink-2); margin: -4px 0 14px; }
.onboard ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.onboard li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.onboard li .num { width: 32px; height: 32px; border-radius: 50%; background: var(--charcoal); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.onboard li.done .num { background: var(--good); }
.onboard li.done .num::after { content: ""; }
.onboard li[aria-current="step"] { border-color: var(--teal-700); box-shadow: 0 0 0 1px var(--teal-700) inset; }
.onboard li .what { font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.onboard li .why { color: var(--ink-3); font-size: .9rem; margin: 2px 0 0; }
.onboard li .go { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.onboard li.later { opacity: 1; }
.onboard li.later .what { color: var(--ink-2); }
.onboard .progress-line { display: flex; align-items: center; gap: 10px; font-size: .88rem; color: var(--ink-2); margin-bottom: 12px; }
.onboard .progress-line progress { flex: 1; }

/* Template choice cards (new drop point). */
.choice-cards > li { list-style: none; margin: 0; }
.choice-cards > li > .choice-card { height: 100%; }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0 0 16px; padding: 0; border: 0; }
.choice-card { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 14px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--card); color: var(--ink); text-decoration: none; min-height: 44px; }
.choice-card:hover { border-color: var(--teal-700); color: var(--ink); }
.choice-card .tile { grid-row: span 2; width: 40px; height: 40px; border-radius: 10px; background: var(--teal-50); color: var(--teal-700); display: flex; align-items: center; justify-content: center; }
.choice-card strong { font-size: .98rem; }
.choice-card span.d { font-size: .86rem; color: var(--ink-3); }
.choice-card[aria-current="true"], .choice-card:has(input:checked) { border-color: var(--teal-700); background: var(--teal-50); box-shadow: 0 0 0 1px var(--teal-700) inset; }

/* Builder with the phone preview beside it. */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.builder .preview-col { position: sticky; top: 16px; }
@media (max-width: 1180px) { .builder { grid-template-columns: minmax(0, 1fr); } .builder .preview-col { position: static; } }
.phone { width: 300px; max-width: 100%; margin: 0 auto; border-radius: 36px; background: #15181c; padding: 12px; box-shadow: var(--shadow); }
.phone-screen { border-radius: 26px; overflow: hidden; background: #f4f7f7; height: 560px; overflow-y: auto; font-size: 13px; line-height: 1.45; color: #15181c; }
.phone-screen .pv-bar { height: 22px; background: #e8eded; }
.phone-screen .pv-head { padding: 12px 14px 10px; background: #fff; border-bottom: 1px solid #e1e5e8; }
.phone-screen .pv-org { font-size: 11px; color: #5d6670; margin: 0 0 2px; }
.phone-screen .pv-title { font-size: 17px; font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.phone-screen .pv-body { padding: 12px 14px; display: grid; gap: 10px; }
.phone-screen .pv-intro { margin: 0; color: #3d454d; white-space: pre-line; overflow-wrap: anywhere; }
.phone-screen .pv-q { background: #fff; border: 1px solid #e1e5e8; border-radius: 10px; padding: 8px 10px; }
.phone-screen .pv-q label { display: block; font-weight: 600; font-size: 12px; margin-bottom: 4px; overflow-wrap: anywhere; }
.phone-screen .pv-q .box { height: 24px; border: 1px solid #7b858f; border-radius: 6px; background: #fff; }
.phone-screen .pv-q .box.tall { height: 44px; }
.phone-screen .pv-q .hint { font-size: 11px; color: #5d6670; margin: 3px 0 0; }
.phone-screen .pv-btn { display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; min-height: 38px; font-weight: 600; font-size: 13px; }
.phone-screen .pv-btn.primary { background: var(--pv-accent, #1f7374); color: #fff; }
.phone-screen .pv-btn.secondary { background: #fff; border: 1px solid #cfd5da; color: #15181c; }
.phone-screen .pv-files { font-size: 11px; color: #5d6670; margin: 0; text-align: center; }
.phone-screen .pv-consent { display: flex; gap: 6px; font-size: 11.5px; color: #3d454d; }
.phone-screen .pv-consent .tick { width: 14px; height: 14px; border: 1px solid #7b858f; border-radius: 3px; flex: none; margin-top: 1px; background: #fff; }
.phone-screen .pv-badge { font-size: 10.5px; color: #5d6670; text-align: center; margin: 4px 0 0; }
.preview-col .caption { text-align: center; font-size: .84rem; color: var(--ink-3); margin: 8px 0 0; }
details.preview-toggle { margin-bottom: 16px; }
details.preview-toggle > summary { font-weight: 600; padding: 8px 0; }

/* Ready page after the first drop point: poster and on-screen test code. */
.ready { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .ready { grid-template-columns: minmax(0, 1fr); } }
.ready .test-qr { width: 240px; max-width: 100%; aspect-ratio: 1 / 1; margin: 6px auto 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; align-items: center; justify-content: center; color: var(--ink-3); }
.ready .test-qr svg { width: 100%; height: 100%; }
.ready ol { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 6px; }

/* Plans editor: current vs new, live pricing card, review panel. */
.compare { width: 100%; border-collapse: collapse; font-size: .9rem; }
.compare th, .compare td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.compare th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); background: var(--head); }
.compare td.changed { background: var(--warn-50); font-weight: 600; color: var(--warn-ink); }
.compare td.changed::before { content: "Changed: "; position: absolute; left: -10000px; }
.card-preview { max-width: 300px; margin: 0 auto; }
.review { border: 2px solid var(--warn); }
.review h2 { display: flex; gap: 8px; align-items: center; }
.review ul.effects { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 4px; }

/* Step-up: a fresh authenticator code for the most sensitive admin actions. */
.stepup { border: 1px solid var(--warn-line); background: var(--warn-50); border-radius: var(--r-sm); padding: 12px 14px 2px; margin: 12px 0; }
.stepup p { color: var(--warn-ink); font-size: .9rem; display: flex; gap: 8px; align-items: flex-start; }
.stepup .field { max-width: 260px; }
.stepup.ok { border-color: var(--good-line); background: var(--good-50); padding-bottom: 10px; }
.stepup.ok p { color: var(--good); margin: 0; }
.danger-zone { border: 1px solid var(--bad-line); }
.danger-zone h2 { color: var(--bad-ink); }
.confirm-type .field { max-width: 360px; }

/* Native dialogs. */
dialog.dlg { border: 1px solid var(--line); border-radius: 20px; padding: 22px; max-width: min(560px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgba(16, 24, 32, .25); color: var(--ink); background: var(--card); }
dialog.dlg::backdrop { background: rgba(18, 21, 24, .55); }
dialog.dlg h2 { margin-top: 0; }
dialog.dlg ul { padding-left: 20px; }

/* Session warning (admin idle time-out, WCAG 2.2.1). */
.session-warning { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 520px; margin: 0 auto; z-index: 50; box-shadow: var(--shadow); }

@media print {
  .side, .topbar .actions, .no-print { display: none !important; }
  .shell { display: block; }
}
.totp-key { font-size: 1.05rem !important; letter-spacing: .04em; }
button.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--teal-700); text-decoration: underline; cursor: pointer; }
button.linkish:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.recovery-codes { list-style: none; padding: 12px 16px; margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5em, 1fr)); gap: 6px 16px; font-size: 1rem; border: 1px dashed var(--line-strong); border-radius: 10px; }
svg.chart { width: 100%; height: auto; display: block; }
progress.meter { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--meter); overflow: hidden; margin: 6px 0 2px; color: var(--teal-700); }
progress.meter::-webkit-progress-bar { background: var(--meter); border-radius: 99px; }
progress.meter::-webkit-progress-value { background: var(--teal-700); border-radius: 99px; }
progress.meter::-moz-progress-bar { background: var(--teal-700); border-radius: 99px; }
progress.meter.full::-webkit-progress-value { background: var(--bad); }
progress.meter.full::-moz-progress-bar { background: var(--bad); }
.field.mono textarea { font-family: var(--mono); font-size: .82rem; }
.copied { color: var(--good) !important; border-color: var(--good) !important; }
details > summary { cursor: pointer; }
.card details.card { margin: 8px 0; padding: 10px 14px; }
.chip .btn-ghost { min-height: 24px; min-width: 24px; padding: 0 4px; }
.side .brandline:has(img.lockup) { flex-direction: column; align-items: flex-start; gap: 6px; }
.side .brandline img.lockup { width: 168px; max-width: 100%; height: auto; border-radius: 0; }
.side .brandline .tag, .auth-brand .tag { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 6px; background: var(--teal-700); color: #fff; }
.auth-brand img.lockup { width: 190px; height: auto; border-radius: 0; }
@media (max-width: 900px) { .side .brandline:has(img.lockup) { flex-direction: row; align-items: center; } .side .brandline img.lockup { width: 140px; } }
.ui h2 .icon, .ui h3 .icon, .verify-bar .icon, .notice span .icon { display: inline-block; vertical-align: -3px; }

/* Teams (pass 1): workspace switcher in the side bar, the "working in" bar, team tables and the public address page. */
.side .switcher { border-top: 1px solid #33383e; margin-top: 18px; padding: 14px 10px 0; display: grid; gap: 6px; font-size: .84rem; }
.side .switcher label { color: var(--side-ink); }
.side .switcher select { width: 100%; background: #26292d; color: #fff; border: 1px solid #6b737b; border-radius: 8px; padding: 6px 8px; font: inherit; min-height: 36px; }
.side .switcher .btn { justify-self: start; background: none; color: var(--side-ink); border-color: #6b737b; }
.side .switcher .btn:hover { color: #fff; border-color: #8a939c; }
@media (max-width: 900px) { .side .switcher { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; margin-top: 8px; padding-top: 10px; } }
.team-bar { background: var(--teal-50); color: var(--teal-800); }
.role-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.role-form select { min-height: 32px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line-strong); font: inherit; background: var(--field); color: var(--ink); }
.address-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.address-line .prefix { font-family: var(--mono); color: var(--ink-3); overflow-wrap: anywhere; }
.address-line input { flex: 1 1 140px; width: auto !important; }
.drop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.drop-list li { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.drop-list li p { margin: 4px 0 0; color: var(--ink-3); font-size: .9rem; }
details.howto { margin: 6px 0 14px; }
details.howto ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }
details.howto ul { margin: 4px 0; padding-left: 18px; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }

/* Phones: wide tables become stacked rows (each cell keeps its column name). */
@media (max-width: 640px) {
  table.t.stack thead { position: absolute; left: -10000px; }
  table.t.stack, table.t.stack tbody, table.t.stack tr, table.t.stack td { display: block; width: 100%; }
  table.t.stack tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.t.stack tr:last-child { border-bottom: 0; }
  table.t.stack td { border: 0; padding: 3px 18px; display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 8px; text-align: left !important; }
  table.t.stack td::before { content: attr(data-label); font-size: .8rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; padding-top: 2px; }
  table.t.stack td[data-label=""]::before, table.t.stack td:not([data-label])::before { content: none; }
  table.t.stack td:not([data-label]), table.t.stack td[data-label=""] { grid-template-columns: minmax(0, 1fr); }
  .card .table-wrap table.t.stack td:first-child { padding-left: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .ui *, .ui *::before, .ui *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Dark mode for the portal and admin (DESIGN.md dark set). QR previews and the phone mock-up stay light. */
@media (prefers-color-scheme: dark) {
  body.ui {
    color-scheme: dark;
    --page: #121518; --card: #1b1f24; --field: #121518; --head: #20252b; --hover: #222830;
    --ink: #e9eef1; --ink-2: #aeb8c0; --ink-3: #8f99a3;
    --line: #343a42; --line-2: #4a525b; --line-strong: #6b7580; --meter: #343a42;
    --teal-50: #16302f; --teal-700: #53b2b3; --teal-800: #8fd0d0; --info-line: #2c5252;
    --good: #5cc58a; --good-50: #15291e; --good-line: #2d5a40;
    --warn: #f0b45a; --warn-50: #2e2414; --warn-line: #5c4520; --warn-ink: #f0b45a;
    --bad: #ff8a80; --bad-50: #331a18; --bad-line: #6b2f2a; --bad-ink: #ff8a80;
    --charcoal: #e9eef1; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
  .ui .btn-primary, .ui .btn-primary:hover, .side nav a[aria-current="page"], .interval-switch input:checked + label, .side .brandline .tag, .auth-brand .tag { color: #15181c; }
  .ui .btn-primary:hover { background: #8fd0d0; border-color: #8fd0d0; }
  .ui .btn-danger, .ui .btn-danger:hover { color: #15181c; }
  .ui .btn-danger:hover { background: #ffb3ab; border-color: #ffb3ab; }
  .side nav a[aria-current="page"] { background: #53b2b3; }
  .onboard li .num { background: #e9eef1; color: #15181c; }
  .onboard li.done .num { background: #5cc58a; color: #15181c; }
  .auth-brand { color: var(--ink); }
  .notice, .notice-ok { color: var(--ink); }
  .empty-state .tile, .choice-card .tile { color: #8fd0d0; }
  .phone { background: #000; }
  .log-lines { background: #0b0d0f; }
  .qr-preview, .totp-qr, .ready .test-qr { background: #fff; color: #5d6670; }
}

/* Builder: the less used settings fold away for a new drop point. */
details.more-options { margin: 0 0 16px; }
details.more-options > summary { list-style: none; width: 100%; justify-content: flex-start; margin-bottom: 16px; white-space: normal; text-align: left; }
details.more-options > summary::-webkit-details-marker { display: none; }
details.more-options > summary::before { content: "+"; font-weight: 700; width: 1em; }
details.more-options[open] > summary::before { content: "-"; }
details.danger-inline { display: inline-block; }
details.danger-inline > summary { list-style: none; }
details.danger-inline > summary::-webkit-details-marker { display: none; }
details.danger-inline[open] { display: block; width: 100%; margin-top: 8px; }
details.danger-inline .card { margin: 8px 0 0; }
.card.highlight { border-color: var(--teal-700); box-shadow: 0 0 0 1px var(--teal-700) inset; }
.ready h3 { display: flex; align-items: center; gap: 8px; }
.ready .qr-box { align-items: stretch; }
.ready .qr-box .qr-preview { align-self: center; }
.usage-title { margin-top: 14px; }
.filters .search .icon { top: auto; bottom: 12px; transform: none; }
svg.chart .bar { fill: var(--teal-700); }
svg.chart .val { fill: var(--ink-2); }
svg.chart .lbl { fill: var(--ink-3); }
.alerts li > div > span { display: block; }
dialog.dlg-wide { max-width: min(720px, calc(100vw - 32px)); padding: 0; } dialog.dlg-wide > .card { margin: 0; border: 0; }
/* Icons inside running text sit on the line (base.css makes svg a block). */
.ui p > .icon, .ui li > .icon, .ui summary > .icon, .ui dd > .icon, .ui label > .icon { display: inline-block; vertical-align: -3px; }
/* 2.4.11: the sticky save bar never hides the field that has focus. */
html:has(.form-actions.sticky) { scroll-padding-bottom: 88px; }

/* ---- Pass 5: the D92 look ("From the wall to the library", DESIGN.md) ------------------------------------------
   The portal takes the website's tokens: deep teal side bar and page headers (colour-blocked bands), signal yellow
   for the current page and the main call to action on deep, warm paper behind the cards, and the display face
   (Archivo, self-hosted, the same hashed file the website preloads) for headings and big numbers. The admin panel
   takes the same tokens but stays calm: deep side bar, system font, plain headers. Text always sits on a flat colour
   that passes (contrast in PASS-LOG pass 5). */
@font-face {
  font-family: "Archivo QCD";
  src: url("/assets/fonts/archivo-display.woff2?v=f52dd9154ffd") format("woff2");
  font-weight: 600 850;
  font-style: normal;
  font-display: swap;
}
:root {
  --deep: #0b2a2b; --deep-2: #103738; --deep-3: #164546; --deep-line: #24585a; --deep-edge: #4e8f90;
  --deep-ink: #e9eef1; --deep-ink-2: #b9cacb; --footer: #071a1b;
  --teal-900: #0f4f50; --teal-100: #cfebea; --teal-300: #8fd0d0; --coral-300: #ff8a72;
  --signal: #ffc83d; --signal-300: #ffd96e; --signal-50: #fff6db; --signal-line: #e8b52f;
  --paper: #f6f3ec; --paper-2: #e9e3d6;
  --font-head: "Archivo QCD", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* Portal: side bar on deep, the current page in signal yellow (ink text 11.5:1). */
body.portal { --page: var(--paper); --r: 16px; }
.portal .side { background: var(--deep); color: var(--deep-ink-2); }
.portal .side .brandline span { font-family: var(--font-head); font-weight: 800; letter-spacing: -.01em; }
.portal .side .brandline small { font-family: var(--font); color: var(--deep-ink-2); letter-spacing: 0; }
.portal .side nav a { color: var(--deep-ink-2); }
.portal .side nav a:hover { background: var(--deep-2); color: #fff; }
.portal .side nav a[aria-current="page"] { background: var(--signal); color: #15181c; font-weight: 650; }
.portal .side :focus-visible { outline-color: var(--coral-300); }
.portal .side .who, .portal .side .switcher { border-top-color: var(--deep-line); }
.portal .side .who button, .portal .side .switcher .btn, .portal .side .switcher select { border-color: var(--deep-edge); }
.portal .side .switcher select { background: var(--deep-2); }
.portal .side .who button:hover, .portal .side .switcher .btn:hover { border-color: var(--deep-ink); color: #fff; }
.portal .side .help-links a { color: var(--deep-ink-2); }
.portal .side .help-links a:hover { color: #fff; }

/* Display face for headings and big numbers (body text stays the system stack). */
.portal h1, .portal h2, .portal .kpi .value, .portal .plan-card .price, .portal .onboard li .num, .portal .stat-big { font-family: var(--font-head); }
.portal h1 { font-weight: 800; letter-spacing: -.015em; line-height: 1.06; font-size: clamp(1.45rem, 3vw, 1.9rem); }
.portal h2 { font-weight: 750; letter-spacing: -.005em; }
.portal .kpi .value { font-weight: 800; }

/* Colour-blocked page header: a deep band with white heading, deep-ink-2 text and a signal edge (decorative). */
.portal .topbar { background: var(--deep); background-image: linear-gradient(120deg, var(--deep) 55%, var(--deep-2)); color: var(--deep-ink);
  border-radius: 20px; padding: 22px 24px 22px 28px; align-items: center; box-shadow: inset 6px 0 0 var(--signal); margin-bottom: 20px; }
.portal .topbar h1 { color: #fff; }
.portal .topbar .sub, .portal .topbar p, .portal .topbar .muted, .portal .topbar nav.crumbs, .portal .topbar nav.crumbs li + li::before { color: var(--deep-ink-2); }
.portal .topbar a, .portal .topbar nav.crumbs a { color: var(--teal-300); }
.portal .topbar a:hover, .portal .topbar nav.crumbs a:hover { color: #fff; }
.portal .topbar :focus-visible { outline-color: var(--coral-300); }
.portal .topbar .btn { background: transparent; color: var(--deep-ink); border-color: var(--deep-edge); }
.portal .topbar .btn:hover { background: var(--deep-2); border-color: var(--deep-ink); color: #fff; }
.portal .topbar .btn-primary { background: var(--signal); border-color: var(--signal); color: #15181c; font-weight: 650; }
.portal .topbar .btn-primary:hover { background: var(--signal-300); border-color: var(--signal-300); color: #15181c; }
.portal .topbar .btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.portal .topbar .btn-danger-quiet { background: var(--card); color: var(--bad); border-color: var(--bad-line); }
.portal .topbar .btn-danger-quiet:hover { background: var(--bad-50); color: var(--bad-ink); }
@media (max-width: 900px) { .portal .topbar { padding: 18px 16px 18px 22px; border-radius: 16px; } }

/* Icon tiles in the website's colours (teal, ink with signal, coral, signal), cards a little rounder. */
.portal .card, .portal .kpi, .portal .table-wrap { border-radius: var(--r); }
.portal .empty-state .tile, .portal .choice-card .tile { background: var(--teal-700); color: #fff; }
.portal .choice-cards > li:nth-child(4n+2) .tile { background: #15181c; color: var(--signal); }
.portal .choice-cards > li:nth-child(4n+3) .tile { background: #ee4123; color: #fff; }
.portal .choice-cards > li:nth-child(4n+4) .tile { background: var(--signal); color: #15181c; }
.portal .onboard { border-color: var(--signal-line); background: linear-gradient(180deg, var(--signal-50), var(--card) 140px); }
.portal .onboard li .num { background: var(--charcoal); color: var(--signal); font-weight: 800; }
.portal .onboard li.done .num { background: var(--good); color: #fff; }
.portal .plan-card.featured { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset, 0 6px 0 0 var(--signal); }
.portal .team-bar { background: var(--teal-100); color: var(--teal-900); }

/* Portal sign-in pages: the card on a deep band. */
body.ui-auth.portal { background: var(--deep); background-image: radial-gradient(circle at 15% 10%, var(--deep-3), transparent 45%), radial-gradient(circle at 90% 95%, var(--teal-900), transparent 40%); }
.portal .auth-brand span { font-family: var(--font-head); font-weight: 800; }
.portal .auth h1 { font-family: var(--font-head); font-weight: 800; }

/* Admin: the same tokens, calmer (deep side bar, system font, plain page headers). */
body.adm .side { background: var(--footer); }
body.adm .side nav a:hover { background: var(--deep-2); }
body.adm .side .who { border-top-color: var(--deep-line); }
body.adm .side .who button { border-color: var(--deep-edge); }
body.adm .side .brandline .tag { background: var(--signal); color: #15181c; }
.maintenance-bar { border: 1px solid var(--warn-line); }

@media (prefers-color-scheme: dark) {
  body.portal { --page: #121518; }
  .portal .onboard { background: linear-gradient(180deg, #2b2612, var(--card) 140px); border-color: #5c4a1a; }
  .portal .onboard li .num { background: #e9eef1; color: #15181c; }
  .portal .onboard li.done .num { background: #5cc58a; color: #15181c; }
  .portal .empty-state .tile, .portal .choice-card .tile { background: #53b2b3; color: #15181c; }
  .portal .team-bar { background: #16302f; color: #8fd0d0; }
  .portal .plan-card.featured { border-color: var(--ink); }
  body.adm .side .brandline .tag { color: #15181c; }
}

/* Pass 5: languages, alerts, review, request links, bulk codes. */
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 14px; }
.lang-grid .field { margin-bottom: 6px; }
details.card.tx { margin: 10px 0 0; padding: 12px 16px; background: var(--paper, #f6f3ec); }
details.card.tx > summary { font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
details.card.tx[open] > summary { margin-bottom: 10px; }
fieldset.tx-q { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 2px; margin: 0 0 10px; background: var(--card); }
fieldset.tx-q legend { font-size: .9rem; font-weight: 600; padding: 0 4px; overflow-wrap: anywhere; }
.bulk .bulk-progress { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 8px 0 12px; }
.bulk .bulk-progress[hidden] { display: none; }
.bulk .bulk-progress label { font-weight: 600; font-size: .9rem; }
.bulk .bulk-progress progress.meter { margin: 0; }
@media (prefers-color-scheme: dark) { details.card.tx { background: var(--head); } }
.tabs .count { display: inline-block; min-width: 1.6em; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--head); color: var(--ink-2); font-size: .78rem; font-weight: 600; text-align: center; }
.side nav a .nav-count { margin-left: auto; min-width: 1.6em; padding: 0 6px; border-radius: 999px; background: var(--signal, #ffc83d); color: #15181c; font-size: .76rem; font-weight: 700; text-align: center; }
.side nav a[aria-current="page"] .nav-count { background: #15181c; color: var(--signal, #ffc83d); }
.ui .h3 { font-size: .98rem; margin: 0; }
dl.kv.kv-tight { gap: 2px 12px; font-size: .88rem; margin: 6px 0; }
.thumb.thumb-lg, .thumb-icon.thumb-lg { width: 96px; height: 96px; border-radius: 10px; }
.review-list, .request-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.review-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.review-item:not(:has(.pick)) { grid-template-columns: minmax(0, 1fr); }
.review-item .pick { padding-top: 36px; }
.review-item .pick input { width: 22px; height: 22px; }
.review-item .file-cell { align-items: flex-start; }
.review-item p { margin: 0 0 4px; }
.review-group fieldset.batch { border: 1px dashed var(--line-2); border-radius: 12px; margin: 12px 0 0; padding: 8px 12px 10px; }
.review-group fieldset.batch legend { font-size: .86rem; font-weight: 600; padding: 0 4px; }
.request { margin: 0; }
.request .request-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 4px; }
.request .copy-line { margin: 8px 0; }
@media (max-width: 560px) { .review-item .file-cell { flex-direction: column; } .thumb.thumb-lg, .thumb-icon.thumb-lg { width: 72px; height: 72px; } }
.review-item .thumb-icon { width: 96px; height: 96px; border-radius: 10px; flex: none; }
/* The side bar's count holds visually hidden words: keep them inside the scrolling strip on phones. */
.side nav ul, .side nav a { position: relative; }
