/*
 * Styles for the telemetry admin and the key page (rendered by the Lambda). The Lambda's CSP has
 * no inline styles, so every visual rule lives here. Tokens are the Qualor server's (ui/src/styles.css):
 * light on :root, dark under prefers-color-scheme. Current nav/tab items carry [aria-current].
 */
@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('fonts/schibsted-grotesk-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --font: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, monospace;
  --ink: #0a1b33;
  --ink-2: #10284a;
  --ink-line: #22406b;
  --ink-text: #e6eefa;
  --ink-muted: #b4c6e0;
  --cobalt: #1f5fbf;
  --cobalt-bright: #4d8ef0;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f0f4fa;
  --border: #d7e0ec;
  --border-strong: #b9c7da;
  --control-border: #7d8da1;
  --text: #0a1b33;
  --text-2: #33455f;
  --text-muted: #4a5b73;
  --accent: #1f5fbf;
  --accent-hover: #2a6fd6;
  --accent-text: #ffffff;
  --accent-soft: #e8effa;
  --primary: #1f5fbf;
  --primary-hover: #2a6fd6;
  --focus: #1f5fbf;
  --ok: #157a51;
  --ok-soft: #e0f3ea;
  --bad: #b3261e;
  --bad-soft: #fbe7e5;
  --warn: #8a5a00;
  --warn-soft: #fcf0d6;
  --neutral-soft: #e8edf4;
  --hairline: #e6ecf3;
  --shadow: 0 1px 2px rgb(10 27 51 / 0.05), 0 8px 24px -12px rgb(10 27 51 / 0.14);
  --shadow-panel: 0 1px 2px rgb(10 27 51 / 0.04);
  --chart-accent: #1f5fbf;
  --chart-track: #e8effa;
  --chart-grid: #e9eef5;
  --chart-new: #9fbbe6;
  /* The check icon for places a script fills (detect line, "Copied"): a mask painted in currentColor. */
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --icon-chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07142a;
    --surface: #0d2140;
    --surface-2: #10284a;
    --border: #1e3a61;
    --border-strong: #2d5184;
    --control-border: #56749e;
    --text: #e6eefa;
    --text-2: #c4d2e6;
    --text-muted: #9fb2cc;
    --accent: #8db6f7;
    --accent-hover: #a9c8fa;
    --accent-text: #07142a;
    --accent-soft: #14305a;
    --primary: #2a6fd6;
    --primary-hover: #1f5fbf;
    --focus: #8db6f7;
    --ok: #5fd39c;
    --ok-soft: #0f3a2c;
    --bad: #ff8a80;
    --bad-soft: #43191b;
    --warn: #f0c35a;
    --warn-soft: #3a2c0c;
    --neutral-soft: #173257;
    --hairline: #183256;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.5);
    --shadow-panel: 0 1px 2px rgb(0 0 0 / 0.25);
    --chart-accent: #6ea4f5;
    --chart-track: #14305a;
    --chart-grid: #183256;
    --chart-new: #2d5184;
  }
}

/* ---------- base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
summary:focus-visible, .search:focus-within, .select:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.error, .field-error { color: var(--bad); font-size: 13px; font-weight: 600; }
.error { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: var(--bad-soft); }
.stack-gap > * + * { margin-top: 16px; }
.stack-gap > input[type='hidden'] + * { margin-top: 0; }

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 22px; box-shadow: var(--shadow-panel); }
.card.panel { padding: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 18px 22px 0; }
.panel-head h2 { font-size: 15px; font-weight: 650; }
.panel-sub { color: var(--text-muted); font-size: 13px; font-weight: 450; }
.panel-body { padding: 14px 22px 20px; }
.panel-foot { padding: 12px 22px; border-top: 1px solid var(--hairline); font-size: 13px; font-weight: 600; }
.panel-foot a { text-decoration: none; }
.panel-foot.muted, .panel-foot .muted { font-weight: 450; }
.panel-head > .tabs { width: 100%; }
/* A list or table right under a panel heading (the mockup's 10px gap). */
.panel-gap { margin-top: 10px; }
.panel-gap > p { padding: 10px 22px 14px; }
.panel-rule { padding-top: 14px; border-top: 1px solid var(--hairline); }
h2#stack, main > h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 26px 0 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 34px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: 600 13.5px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color 0.15s, border-color 0.15s, color 0.15s; }
.btn:hover { background: var(--surface-2); border-color: var(--accent); }
.btn[aria-disabled='true'] { opacity: 0.5; cursor: default; pointer-events: none; }
.btn[data-busy='1'] > svg.i { display: none; }
.btn[data-busy='1']::before { content: ''; flex: none; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--icon-check) center / 16px no-repeat; mask: var(--icon-check) center / 16px no-repeat; }
.btn-primary, .btn-solid { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgb(10 27 51 / 0.2); }
.btn-primary:hover, .btn-solid:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-lg { min-height: 44px; font-size: 15px; padding: 0 20px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-danger.btn-solid { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn-danger.btn-solid:hover { background: #9c1f18; border-color: #9c1f18; color: #fff; }
.btn-quiet { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-quiet:hover { background: var(--surface-2); }
.btn-quiet.danger { color: var(--bad); }
.btn-quiet.danger:hover { background: var(--bad-soft); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 650; line-height: 1.5; letter-spacing: 0.01em; background: var(--neutral-soft); color: var(--text); white-space: nowrap; }
.badge svg.i { width: 13px; height: 13px; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-muted { background: var(--neutral-soft); color: var(--text-muted); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 8px; font-size: 13.5px; line-height: 1.45; }
.alert svg.i { margin-top: 2px; }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-info { background: var(--accent-soft); color: var(--accent); }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
thead th { font-size: 12.5px; color: var(--text-muted); font-weight: 550; white-space: nowrap; padding-top: 12px; padding-bottom: 10px; border-bottom-color: var(--border); }
thead th a { color: inherit; text-decoration: none; }
thead th a:hover { color: var(--text); }
tbody th { font-weight: 600; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.group th, tr.group td { padding: 9px 16px; background: var(--surface-2); font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }

.tabs { display: flex; flex-wrap: wrap; gap: 22px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 0 11px; text-decoration: none; color: var(--text-muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current='page'], .tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 650; }
.tab-count { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--neutral-soft); color: var(--text-muted); font-size: 11.5px; font-weight: 650; }
.tabs a[aria-current='page'] .tab-count, .tabs a.active .tab-count { background: var(--accent-soft); color: var(--accent); }

.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 650; }
.field-label .muted { font-weight: 450; }
.field .seg { justify-self: start; }
.field-hint { font-size: 12.5px; color: var(--text-muted); }
input.inp, textarea.inp { width: 100%; min-height: 36px; padding: 8px 11px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--surface); color: var(--text); font: 14px/1.4 var(--font); }
textarea.inp { font: 12px/1.55 var(--mono); resize: none; height: 104px; word-break: break-all; }
.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 550; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips > .muted { font-size: 13px; }

/* Segmented control: a group of labels around radio inputs (days picker) or links (period picker). */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg label, .seg a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 13px; border-right: 1px solid var(--border); font-weight: 600; font-size: 13px; color: var(--text-muted); cursor: pointer; text-decoration: none; position: relative; }
.seg label:last-child, .seg a:last-child { border-right: 0; }
.seg label:hover, .seg a:hover { background: var(--surface-2); }
.seg input[type='radio'] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg a[aria-current], .seg a.on { background: var(--accent-soft); color: var(--accent); }
.seg label:has(input:checked) { background: var(--accent-soft); color: var(--accent); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 17px; letter-spacing: -0.01em; color: #fff; text-decoration: none; }
.brand svg { flex: none; }

/* ---------- key page and sign-in (auth layout) ---------- */
.kp { display: grid; grid-template-columns: minmax(19rem, 5fr) 7fr; min-height: 100vh; background: var(--bg); }
.kp-art { position: relative; display: flex; flex-direction: column; gap: 32px; padding: 32px; overflow: hidden; background: var(--ink); color: var(--ink-text); }
.kp-art .brand { font-size: 19px; position: relative; z-index: 1; }
.kp-art .tagline { position: relative; z-index: 1; max-width: 24rem; margin: 32px 0 0; font-size: 30px; font-weight: 750; line-height: 1.15; letter-spacing: -0.025em; color: #fff; }
.kp-art .tagline span { color: var(--ink-muted); }
.kp-ill { flex: 1 1 auto; min-height: 10rem; margin: 0 -40px -40px; background: linear-gradient(180deg, var(--ink), rgb(10 27 51 / 0) 30%), var(--art) center bottom / cover no-repeat; }
.kp-ill.wide { background: linear-gradient(180deg, var(--ink), rgb(10 27 51 / 0) 25%, rgb(10 27 51 / 0) 75%, var(--ink)), var(--art) center / 150% auto no-repeat; }
.art-signin { --art: url('art/signin.webp'); }
.art-lost { --art: url('art/lost.webp'); }
.art-empty { --art: url('art/empty.webp'); }
.art-clean { --art: url('art/clean.webp'); }
.kp-main { display: grid; place-items: center; padding: 32px 24px; }
.kp-card { width: min(31rem, 100%); padding: 32px; box-shadow: var(--shadow); }
.kp-card.wide { width: min(35rem, 100%); }
.kp-card h1 { margin: 14px 0 10px; font-size: 25px; font-weight: 720; letter-spacing: -0.02em; line-height: 1.2; }
form.kp-card > h1:first-child { margin-top: 0; }
.kp-card .gone-ask { margin-top: 10px; }
.kp-card .lead + .btn, .kp-card h1 + .btn { margin-top: 22px; }
.kp-card .lead + .alert { margin: 20px 0 22px; }
.kp-card .lead { color: var(--text-2); font-size: 15px; line-height: 1.55; }
/* Sign-in card: the mockup's narrower card and its field rhythm. */
form.kp-card { width: min(25rem, 100%); }
form.kp-card .field { margin-top: 14px; }
form.kp-card h1 + .field, form.kp-card .error + .field { margin-top: 18px; }
form.kp-card .btn { margin-top: 22px; min-height: 38px; }
.kp-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 18px 0 22px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.kp-meta span { display: inline-flex; align-items: center; gap: 7px; }
.kp-meta svg.i { width: 14px; height: 14px; color: var(--text-muted); }
.kp-meta b { font-weight: 650; color: var(--text); }
.fine { margin-top: 14px; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); text-align: center; }
.kp-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 16px 0 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--border); }
.kp-sum div { padding: 10px 13px; background: var(--surface); }
.kp-sum dt { font-size: 12px; color: var(--text-muted); font-weight: 550; }
.kp-sum dd { margin: 2px 0 0; font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.keybox { position: relative; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font: 12.5px/1.6 var(--mono); color: var(--text); word-break: break-all; user-select: all; }
.keybox::before { content: ''; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.key-actions { display: flex; gap: 8px; margin: 12px 0 18px; }
.key-actions .btn-primary { flex: 1; }
.howto { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--hairline); }
.howto h3 { font-size: 13.5px; font-weight: 650; margin-bottom: 8px; }
.howto ul { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 13.5px; }
.howto li { margin: 5px 0; }
.howto-links { margin-top: 10px; font-size: 13.5px; }
.howto code { font: 12px var(--mono); padding: 1px 5px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.icon-disc { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.icon-disc svg.i { width: 20px; height: 20px; }
.icon-disc.muted { background: var(--neutral-soft); color: var(--text-muted); }
.reveal { animation: reveal 0.35s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgb(255 255 255 / 0.35); border-top-color: #fff; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .reveal, .spin { animation: none; } }

/* ---------- admin ---------- */
.adm-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 22px; min-height: 60px; padding: 0 32px; background: var(--ink); color: var(--ink-text); border-bottom: 1px solid rgb(255 255 255 / 0.08); }
.adm-header .tag { margin-left: 2px; padding: 2px 8px; border: 1px solid var(--ink-line); border-radius: 999px; color: var(--ink-muted); font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.adm-nav { display: flex; gap: 4px; }
.adm-nav a { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 8px; color: var(--ink-muted); font-weight: 550; text-decoration: none; white-space: nowrap; }
.adm-nav a:hover { color: #fff; background: rgb(255 255 255 / 0.06); }
.adm-nav a[aria-current='page'] { color: #fff; background: rgb(255 255 255 / 0.1); }
.adm-header a:focus-visible, .adm-header button:focus-visible { outline-color: var(--cobalt-bright); }
.nav-count { margin-left: 7px; padding: 0 7px; border-radius: 999px; background: var(--cobalt); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; }
.adm-user { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--ink-muted); }
.adm-user form { margin: 0; }
.adm-user .btn { background: transparent; border-color: rgb(255 255 255 / 0.18); color: var(--ink-text); min-height: 30px; }
.adm-user .btn:hover { background: rgb(255 255 255 / 0.06); }
.adm-main { padding: 26px 32px 40px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; font-weight: 750; letter-spacing: -0.025em; line-height: 1.15; }
.page-head .sub { margin-top: 4px; color: var(--text-muted); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { display: grid; gap: 4px; padding: 18px 22px; border-right: 1px solid var(--hairline); }
.kpi:last-child { border-right: 0; }
.kpi-label { color: var(--text-muted); font-size: 13px; font-weight: 550; }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 12.5px; color: var(--text-muted); }
.kpi-note b { color: var(--ok); font-weight: 650; }
.g { display: grid; gap: 16px; margin-top: 16px; }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* The Stack section has four cards: two by two, readable at 1440 px. */
.g-3:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g > .card { min-width: 0; }
.chart svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; background: var(--chart-accent); }
.legend i.bar { height: 10px; width: 10px; border-radius: 2px; background: var(--chart-new); }
.bl-row { display: grid; grid-template-columns: minmax(84px, 1fr) minmax(0, 1.6fr) 40px; gap: 12px; align-items: center; padding: 5px 0; font-size: 13.5px; }
.bl-row .lbl { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bl-row .bl-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; color: var(--text-muted); }
.bl-track { height: 8px; border-radius: 4px; background: var(--chart-track); overflow: hidden; }
.bl-fill { height: 100%; border-radius: 4px; background: var(--chart-accent); }
/* The SVG bar from views/html.mjs bar(): the widths are SVG attributes (CSP forbids style=). */
svg.bar { display: block; width: 100%; height: 8px; }
svg.bar .bar-track { fill: var(--chart-track); }
svg.bar .bar-fill { fill: var(--chart-accent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 8px; vertical-align: 1px; }
.dot.stale { background: #dc8428; }
.dot.gone { background: var(--border-strong); }
.idc { font: 12.5px var(--mono); }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 22px; border-top: 1px solid var(--hairline); font-size: 13.5px; }
.list-row:first-child { border-top: 0; }
.list-row .r { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12.5px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.search { display: flex; align-items: center; gap: 8px; width: 250px; max-width: 100%; min-height: 34px; padding: 0 10px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--surface); color: var(--text-muted); font-size: 13.5px; }
.search input { flex: 1; min-width: 0; min-height: 30px; border: 0; background: transparent; color: var(--text); outline: 0; }
.select { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font-size: 13.5px; font-weight: 550; cursor: pointer; }
/* The native arrow is replaced by the mockup's chevron; the select still covers it, so a click on it opens the list. */
.select select { min-height: 30px; margin-right: -20px; padding: 0 20px 0 0; border: 0; background: transparent; color: var(--text); font-weight: 550; cursor: pointer; outline: 0; appearance: none; -webkit-appearance: none; }
.select::after { content: ''; flex: none; width: 14px; height: 14px; background: var(--text-muted); pointer-events: none; -webkit-mask: var(--icon-chevron-down) center / 14px no-repeat; mask: var(--icon-chevron-down) center / 14px no-repeat; }
.select select option { background: var(--surface); color: var(--text); }
.select svg.i { width: 14px; height: 14px; color: var(--text-muted); }
.toolbar .count { margin-left: auto; color: var(--text-muted); font-size: 13px; }
.inst { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.inst > :only-child { grid-column: 1 / -1; }
/* The id link's overlay covers its row; where a browser ignores a positioned row, it stays inside the table. */
.inst .table-scroll { position: relative; }
.inst table tbody tr { position: relative; }
.inst table tbody tr:hover td { background: var(--surface-2); }
.inst tbody a.idc { color: var(--text); text-decoration: none; white-space: nowrap; }
.inst tbody a.idc::after { content: ''; position: absolute; inset: 0; }
.inst tbody td:first-child { white-space: nowrap; }
.inst table tbody tr.sel td { background: var(--accent-soft); }
.inst table tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.pager-nav { display: inline-flex; gap: 6px; }
.pager .btn { min-height: 30px; }
.drawer { position: sticky; top: 76px; }
.drawer .panel-head { align-items: flex-start; flex-wrap: nowrap; }
.drawer .panel-head h2.idc { font-size: 13.5px; overflow-wrap: anywhere; }
.drawer .panel-head .panel-sub { margin-top: 3px; }
.drawer .panel-head .btn-quiet { color: var(--text-muted); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 13.5px; margin: 0; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; font-weight: 550; text-align: right; }
.sec { padding: 14px 22px; border-top: 1px solid var(--hairline); }
.sec h3 { font-size: 12px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.minis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.mini b { display: block; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.mini span { font-size: 12px; color: var(--text-muted); }
summary { cursor: pointer; }
details.raw summary { color: var(--accent); font-weight: 600; font-size: 13px; }
details.raw pre { margin: 8px 0 0; max-height: 160px; overflow: auto; padding: 10px; border-radius: 8px; background: var(--surface-2); font: 11.5px/1.5 var(--mono); }
/* Features table: the "Details" disclosures inside cells. */
details.more { margin-top: 6px; }
details.more summary { color: var(--accent); font-weight: 600; font-size: 13px; }
details.more h3 { margin: 12px 0 4px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
td .sub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--text-muted); font-weight: 450; }
.dz { padding: 14px 22px 18px; border-top: 1px solid var(--hairline); }
.dz p { font-size: 12.5px; color: var(--text-muted); margin: 6px 0 10px; }
.dz-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dz .btn { min-height: 30px; }
.share { display: flex; align-items: center; gap: 10px; }
.share svg.bar { width: 110px; flex: none; }
.share .bl-track { width: 110px; flex: none; }
.share span { font-variant-numeric: tabular-nums; font-weight: 600; width: 36px; text-align: right; }
.act { color: var(--text-2); font-size: 13px; }
.act b { font-weight: 650; color: var(--text); }
.links { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
/* admin.js writes the text; the check icon is drawn here, hanging left of the text. */
.detect { position: relative; padding: 9px 11px 9px 35px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-size: 13px; line-height: 1.4; }
.detect::before { content: ''; position: absolute; left: 11px; top: 10px; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--icon-check) center / 16px no-repeat; mask: var(--icon-check) center / 16px no-repeat; }
.detect:empty { display: none; }
.detect b { font-weight: 650; }
.linkfield { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); }
.linkfield .btn { min-height: 30px; }
.linkfield code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12.5px var(--mono); }
.msg { padding: 12px 14px; border-radius: 8px; border: 1px dashed var(--border-strong); color: var(--text-2); font-size: 13px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.who b { display: block; font-weight: 650; }
.who span { font-size: 12.5px; color: var(--text-muted); }
.when { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.when small { display: block; font-size: 12px; color: var(--text-muted); }
td form { margin: 0; }
.links td.act { text-align: right; }
.links form .btn-block { min-height: 38px; }
.card.created { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.created .panel-head h2 { display: flex; align-items: center; gap: 8px; }
.table-scroll td.muted { white-space: nowrap; }

/* ---------- customer portal and admin customers (customer-portal mockup, mk.css) ---------- */
/* The customer's company, a pill in the portal header next to the brand. */
.org { display: inline-flex; align-items: center; margin-left: 4px; padding: 3px 10px; border: 1px solid var(--ink-line); border-radius: 999px; color: var(--ink-text); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.g-21b { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }
.stack16 > * + * { margin-top: 16px; }
.seg.small a { min-height: 28px; }
.page-head .head-actions { display: flex; gap: 8px; align-items: center; }
.page-head + .alert { margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 650; }
.card-title + p.muted { margin: 4px 0 10px; font-size: 13px; }
.card-title + ul { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; }
.panel-rule > h2 { font-size: 15px; font-weight: 650; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-weight: 600; }
.kv dd.plain { font-weight: 450; }
.roles { display: flex; flex-wrap: wrap; gap: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; font-weight: 550; }
.checks small { color: var(--text-muted); font-weight: 450; }
.checks input, .after input { margin: 0; accent-color: var(--accent); }
/* A checkbox under a field's control, such as Trial under the plan. */
.after { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.who .you { font-weight: 450; }
form.inline { display: inline-flex; }
.act-row { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 10px 22px; border-top: 1px solid var(--hairline); font-size: 13.5px; }
.act-row:first-child { border-top: 0; }
.act-row time { color: var(--text-muted); font-size: 12.5px; }
.alert + form { margin-top: 12px; }
form.kp-card .cf-turnstile { margin-top: 18px; }
/* The join card: a form inside the card (portal.js), with the mockup's 18 px rhythm. */
.kp-card form .field, .kp-card form .btn { margin-top: 18px; }
.kp-card form .btn { min-height: 38px; }
.kp-card form .error { margin: 14px 0 0; }
/* An e-mail as the mockup draws it: header, body, footer. */
.mail { max-width: 620px; margin: 0 auto 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.mail-h { display: grid; gap: 2px; padding: 12px 18px; border-bottom: 1px solid var(--hairline); font-size: 12.5px; color: var(--text-muted); }
.mail-h b { color: var(--text); font-weight: 650; }
.mail-b { padding: 20px 22px; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.mail-b p + p { margin-top: 12px; }
.mail-b .btn { margin-top: 14px; }
.mail-f { padding: 12px 22px; border-top: 1px solid var(--hairline); font-size: 12px; color: var(--text-muted); }

/* ---------- phone ---------- */
@media (max-width: 720px) {
  /* key page and sign-in: the ink panel becomes a band above the card */
  .kp { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
  .kp-art { gap: 10px; padding: 18px 18px 22px; min-height: 150px; }
  .kp-art .brand { font-size: 16px; }
  .kp-art .tagline { margin: 6px 0 0; font-size: 21px; max-width: 13.5rem; }
  .kp-ill, .kp-ill.wide { position: absolute; inset: 0 -30px 0 42%; margin: 0; min-height: 0; opacity: 0.6; background: linear-gradient(90deg, var(--ink), rgb(10 27 51 / 0) 45%), var(--art) center / cover no-repeat; }
  .kp-main { place-items: start center; padding: 16px 14px 24px; }
  .kp-card { padding: 22px 20px; }
  .kp-card h1 { font-size: 22px; }
  .kp-sum { grid-template-columns: 1fr 1fr; }
  .kp-sum div:first-child { grid-column: 1 / -1; }
  .key-actions { flex-wrap: wrap; }

  /* admin */
  .adm-header { flex-wrap: wrap; gap: 8px 14px; padding: 10px 16px; position: static; }
  .adm-nav { order: 3; width: 100%; flex-wrap: wrap; }
  .adm-user { gap: 10px; }
  .adm-main { padding: 18px 16px 32px; }
  .inst, .links, .g-21, .g-21b, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .g-3:has(> :nth-child(4)) { grid-template-columns: minmax(0, 1fr); }
  .drawer { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--hairline); }
  .search { width: 100%; }
  .toolbar .count { margin-left: 0; width: 100%; }
  .panel-head, .panel-body, .sec, .dz, .list-row, .panel-gap > p, .act-row, .panel-foot { padding-left: 16px; padding-right: 16px; }
  /* portal: the company pill keeps to its line and the address gives way before the header overflows */
  .org { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .adm-user { min-width: 0; }
  .adm-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .act-row { grid-template-columns: 1fr; gap: 2px; }
}
