/* Gatehouse design system (ADR 0024): one stylesheet for the console, My apps and the sign-in screens. Dark first, light available, one accent.
   No inline styles anywhere (the content security policy allows none): states are classes and widths are SVG attributes. */

:root {
  color-scheme: dark;
  --bg: #060a12; --bg2: #0a101c; --surface: #0d1524; --surface-2: #131c2e; --panel: rgba(255,255,255,.04); --panel2: rgba(255,255,255,.07); --solid: #0e1626;
  --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.14); --line-strong: rgba(255,255,255,.16);
  --fg: #e9eefb; --ink: #e9eefb; --muted: #8b98b2; --faint: #5b6881;
  --accent: #5eead4; --accent-hover: #8af3e1; --accent-ink: #04201c; --accent2: #8b9bff; --accent-soft: rgba(94,234,212,.13);
  --good: #4ade80; --good-soft: rgba(74,222,128,.14); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.14); --bad: #fb7185; --bad-soft: rgba(251,113,133,.15); --info: #8b9bff; --info-soft: rgba(139,155,255,.15);
  --card: var(--surface); --side: var(--bg2); --side-ink: var(--muted);
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 40px rgba(0,0,0,.4); --glow: 0 0 0 1px var(--line), 0 10px 40px rgba(0,0,0,.35);
  --stage: radial-gradient(1200px 600px at 70% 40%, #101c3a 0%, #0a1226 45%, #070b16 100%);
  --radius: 18px; --radius-sm: 11px; --rail: 72px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="light"] { color-scheme: light; --bg: #f3f5fa; --bg2: #eaeef6; --surface: #ffffff; --surface-2: #f0f3fa; --panel: rgba(255,255,255,.75); --panel2: #fff; --solid: #fff;
  --line: rgba(12,22,48,.09); --line2: rgba(12,22,48,.16); --line-strong: rgba(12,22,48,.18); --fg: #0b1426; --ink: #0b1426; --muted: #5a6783; --faint: #8b97b0;
  --accent: #0d9488; --accent-hover: #0b7a70; --accent-ink: #fff; --accent2: #4f5fe6; --accent-soft: rgba(13,148,136,.11);
  --good: #16a34a; --good-soft: rgba(22,163,74,.12); --warn: #b45309; --warn-soft: rgba(180,83,9,.12); --bad: #e11d48; --bad-soft: rgba(225,29,72,.1); --info: #4f5fe6; --info-soft: rgba(79,95,230,.1);
  --shadow: 0 1px 2px rgba(20,35,80,.05), 0 2px 8px rgba(20,35,80,.06); --shadow-lg: 0 10px 30px rgba(20,35,80,.12); --glow: 0 0 0 1px var(--line), 0 10px 30px rgba(20,35,80,.08);
  --stage: radial-gradient(1200px 600px at 70% 40%, #ffffff 0%, #e9eefb 55%, #dde5f5 100%); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { color-scheme: light; --bg: #f3f5fa; --bg2: #eaeef6; --surface: #ffffff; --surface-2: #f0f3fa; --panel: rgba(255,255,255,.75); --panel2: #fff; --solid: #fff;
  --line: rgba(12,22,48,.09); --line2: rgba(12,22,48,.16); --line-strong: rgba(12,22,48,.18); --fg: #0b1426; --ink: #0b1426; --muted: #5a6783; --faint: #8b97b0;
  --accent: #0d9488; --accent-hover: #0b7a70; --accent-ink: #fff; --accent2: #4f5fe6; --accent-soft: rgba(13,148,136,.11);
  --good: #16a34a; --good-soft: rgba(22,163,74,.12); --warn: #b45309; --warn-soft: rgba(180,83,9,.12); --bad: #e11d48; --bad-soft: rgba(225,29,72,.1); --info: #4f5fe6; --info-soft: rgba(79,95,230,.1);
  --shadow: 0 1px 2px rgba(20,35,80,.05), 0 2px 8px rgba(20,35,80,.06); --shadow-lg: 0 10px 30px rgba(20,35,80,.12); --glow: 0 0 0 1px var(--line), 0 10px 30px rgba(20,35,80,.08);
  --stage: radial-gradient(1200px 600px at 70% 40%, #ffffff 0%, #e9eefb 55%, #dde5f5 100%); } }
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.6 var(--font); background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; text-wrap: balance; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 6px; }
.mono, code { font-family: var(--mono); font-size: .86em; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.secret { display: block; padding: 12px 14px; word-break: break-all; font-size: 1rem; background: var(--surface-2); border-radius: var(--radius-sm); }
pre { background: var(--surface-2); padding: 12px 14px; border-radius: var(--radius-sm); overflow: auto; margin: 0; font-size: .86rem; }

/* ---------- Buttons and form controls ---------- */
button, a.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: .9rem; padding: 9px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; transition: background .12s, box-shadow .12s; }
button:hover, a.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }
button.secondary, a.btn.secondary { background: var(--surface); color: var(--fg); border-color: var(--line-strong); }
button.secondary:hover, a.btn.secondary:hover { background: var(--surface-2); color: var(--fg); }
button.danger { background: var(--bad); color: #fff; }
button.danger:hover { background: color-mix(in srgb, var(--bad) 85%, black); }
button.link { background: none; color: var(--accent); padding: 4px 8px; border: 0; font-weight: 600; }
button.link:hover { background: var(--accent-soft); color: var(--accent-hover); }

input, select, textarea { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 9px 12px; min-height: 40px; max-width: 100%; }
textarea { min-height: 88px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=checkbox], input[type=radio] { all: revert; width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); vertical-align: middle; cursor: pointer; }
input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
label { display: block; margin: 14px 0; font-weight: 600; }

/* ---------- Pills, chips ---------- */
.pill { display: inline-flex; align-items: center; font-size: .72rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.p-good { background: var(--good-soft); color: var(--good); } .p-warn { background: var(--warn-soft); color: var(--warn); }
.p-bad { background: var(--bad-soft); color: var(--bad); } .p-info { background: var(--info-soft); color: var(--info); } .p-mute { background: var(--surface-2); color: var(--muted); }
time[title] { cursor: help; text-decoration: underline dotted color-mix(in srgb, var(--muted) 50%, transparent); text-underline-offset: 3px; }
.chip { display: inline-block; font-size: .8rem; background: var(--surface-2); padding: 4px 12px; border-radius: 999px; color: var(--muted); margin: 0 6px 6px 0; }

/* ---------- Cards, panels, stats ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 22px; }
.panel h2, .panel h3 { margin-top: 0; }
.tiles-stat, .grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; display: grid; gap: 4px; }
.stat span { color: var(--muted); font-size: .82rem; font-weight: 600; }
.stat b { font-size: 2rem; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: .8rem; }
.stat.bad { border-color: var(--bad); background: linear-gradient(var(--bad-soft), var(--bad-soft)) padding-box; }
.stat.good b { color: var(--good); }

/* ---------- Tables ---------- */
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); font-weight: 700; white-space: nowrap; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: left; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 35%, transparent); }
tr:last-child td { border-bottom: 0; }
time { white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.mono, td.id, .nowrap { white-space: nowrap; }
td.id { font-family: var(--mono); font-size: .84rem; }
td.wrap { min-width: 200px; }
td.actions, th.actions { text-align: right; width: 1%; white-space: nowrap; }
td.actions .rowact { text-align: left; }
td a { text-decoration: none; font-weight: 550; } td a:hover { text-decoration: underline; }
td .sub, .sub { display: block; font-size: .8rem; color: var(--muted); font-weight: 400; margin-top: 1px; }
tr.group th { background: var(--surface); text-transform: none; letter-spacing: 0; font-size: .88rem; color: var(--fg); border-bottom: 1px solid var(--line); padding-top: 16px; }
tr.group:hover th { background: var(--surface); }
tr.empty-row td, tr.empty-row:hover td { text-align: center; color: var(--muted); padding: 34px 16px; background: transparent; }

/* ---------- Row actions: a small button that opens its form in place ---------- */
details.rowact { display: inline-block; vertical-align: top; }
details.rowact > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 9px; font-size: .84rem; font-weight: 600; background: var(--surface); color: var(--fg); }
details.rowact > summary::-webkit-details-marker { display: none; }
details.rowact > summary:hover { background: var(--surface-2); }
details.rowact[open] > summary { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
details.rowact.danger > summary { color: var(--bad); }
details.rowact.danger[open] > summary { background: var(--bad-soft); border-color: var(--bad); }
details.rowact .pop { margin-top: 8px; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 8px; min-width: 270px; white-space: normal; text-align: left; }
details.rowact .pop input, details.rowact .pop select { width: 100%; }
details.rowact .pop form { display: grid; gap: 8px; margin: 0; }

/* ---------- Filter bar ---------- */
.filterbar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.filterbar .fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; }
.filterbar label { display: grid; gap: 5px; margin: 0; font-size: .76rem; font-weight: 650; color: var(--muted); max-width: none; }
.filterbar input, .filterbar select { width: 100%; font-weight: 400; color: var(--fg); min-height: 40px; }
.filterbar .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filterbar .row .grow { flex: 1; }
.filterbar details > summary { font-size: .86rem; color: var(--accent); }
.presets { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; background: var(--surface); }
.presets .preset { padding: 5px 13px; font-size: .8rem; font-weight: 600; text-decoration: none; color: var(--muted); }
.presets .preset:hover { background: var(--surface-2); color: var(--fg); }
.presets .preset[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.fchips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .84rem; }
.fchip { display: inline-flex; gap: 6px; align-items: center; background: var(--accent-soft); color: var(--accent); padding: 4px 6px 4px 12px; border-radius: 999px; text-decoration: none; font-weight: 500; }
.fchip b { font-weight: 700; } .fchip span { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, transparent); line-height: 1; }
.fchip:hover { background: color-mix(in srgb, var(--accent-soft) 70%, var(--accent)); color: var(--accent-hover); }
.resultcount { color: var(--muted); font-size: .86rem; margin: 0; }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 38px 20px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty b { display: block; color: var(--fg); font-size: 1.02rem; margin-bottom: 4px; }

/* ---------- Forms ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filters label { margin: 0; font-size: .76rem; color: var(--muted); }
.filters input, .filters select { min-height: 38px; padding: 7px 12px; }
.inline-form { display: inline-flex; gap: 8px; margin: 4px 8px 4px 0; align-items: center; }
.screen label { display: grid; gap: 6px; font-weight: 600; max-width: 620px; }
.screen label small { font-weight: 400; color: var(--muted); line-height: 1.45; }
.screen label.inline { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.screen label.inline input { margin-top: 3px; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; } .kv dd { margin: 0; word-break: break-word; }
details > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 18px 14px; margin: 14px 0; }
legend { font-weight: 700; padding: 0 8px; }

/* ---------- Messages ---------- */
.notice, .alert, .banner, .banner-bad { margin: 0; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; }
.notice { background: var(--good-soft); color: var(--good); }
.alert { background: var(--bad-soft); color: var(--bad); }
.alert ul { margin: 0; padding-left: 18px; }
.banner { background: var(--info-soft); color: var(--info); }
.banner-warning, .banner-maintenance { background: var(--warn-soft); color: var(--warn); }
.banner-bad { background: var(--bad-soft); color: var(--bad); margin: 0 28px; }

/* ---------- Public shell: sign-in screens and the employee home page ---------- */
body.public { min-height: 100vh; background:
  radial-gradient(900px 420px at 15% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
  radial-gradient(700px 380px at 100% 0%, color-mix(in srgb, var(--info) 10%, transparent), transparent 60%), var(--bg); }
.shell { max-width: 980px; margin: 0 auto; padding: 28px 20px 56px; }
.brandbar { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.logo { display: inline-grid; place-items: center; line-height: 0; filter: drop-shadow(0 0 10px rgba(94, 234, 212, .4)); }
.logo-mark { display: block; }
.brandname { font-weight: 750; font-size: 1.15rem; letter-spacing: -.01em; }
.narrow { max-width: 420px; margin: 7vh auto 0; }
.shell:has(.narrow) .brandbar { justify-content: center; }
.narrow h1 { margin: 0 0 6px; font-size: 1.6rem; }
.narrow .lead { color: var(--muted); margin: 0 0 20px; }
.narrow label { margin: 14px 0; }
.narrow input[type=email], .narrow input[type=password], .narrow input[type=text] { width: 100%; }
.narrow button { width: 100%; margin-top: 8px; padding: 11px 16px; }
.tiles { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tiles li { margin: 0; }
.tiles a { display: grid; grid-template-columns: 44px 1fr; gap: 4px 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  text-decoration: none; color: var(--fg); box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s, border-color .12s; }
.tiles a:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); color: var(--fg); }
.tiles .tile-icon { grid-row: 1 / span 2; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; }
.tiles strong { font-size: 1rem; } .tiles small { color: var(--muted); }
.hello h1 { margin: 0 0 4px; font-size: 1.8rem; } .hello p { margin: 0; color: var(--muted); }
.shell .inline-form input { min-width: 240px; }

/* ---------- Console ---------- */
.screen { padding: 14px 32px 56px; display: grid; gap: 18px; align-content: start; max-width: 1280px; width: 100%; }
.screen h1 { margin: 0; font-size: 1.7rem; letter-spacing: -.02em; }
.screen h2 { margin: 16px 0 0; font-size: 1.1rem; }
.screen > p { margin: 0; }
.hero { display: grid; gap: 4px; padding: 6px 0 2px; }
.hero h1 { font-size: 1.9rem; } .hero p { color: var(--muted); margin: 0; font-size: 1.02rem; }

/* Overview: things that need a person */
.attention { display: grid; gap: 10px; }
.attention .item { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.attention .item .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--warn-soft); color: var(--warn); }
.attention .item.bad .dot { background: var(--bad-soft); color: var(--bad); }
.attention .clear { display: flex; gap: 12px; align-items: center; padding: 16px 18px; border-radius: var(--radius); background: var(--good-soft); color: var(--good); font-weight: 600; }
.appcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.appcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: grid; gap: 6px; text-decoration: none; color: var(--fg); }
.appcard:hover { border-color: var(--accent); color: var(--fg); box-shadow: var(--shadow-lg); }
.appcard .name { font-weight: 700; } .appcard .id { font-family: var(--mono); font-size: .78rem; color: var(--muted); word-break: break-all; }
.appcard .nums { display: flex; gap: 18px; margin-top: 4px; }
.appcard .nums b { display: block; font-size: 1.3rem; font-variant-numeric: tabular-nums; } .appcard .nums small { color: var(--muted); font-size: .74rem; }

/* Client form: show only what applies to the chosen kind (CSS only) */
.client-form fieldset { margin: 16px 0; }
.client-form fieldset.kindpick { border: 0; padding: 0; }
.client-form fieldset.kindpick legend { padding: 0; font-size: 1.05rem; }
.client-form .kindpick { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.client-form .kindpick legend, .client-form .kindpick > p { grid-column: 1 / -1; }
.client-form .kindopt { display: grid; gap: 4px; border: 1.5px solid var(--line-strong); border-radius: var(--radius); padding: 14px 16px; margin: 0; cursor: pointer; max-width: none; font-weight: 400; background: var(--surface); }
.client-form .kindopt b { font-weight: 700; }
.client-form .kindopt:hover { border-color: var(--accent); }
.client-form .kindopt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.client-form .kindopt input { justify-self: start; }
.client-form .kindicon { color: var(--accent); }
.client-form .only-merchant, .client-form .only-service { display: none; }
.client-form:has(input[name="client[kind]"][value="merchant_app"]:checked) .only-merchant, .client-form[data-kind="merchant_app"] .only-merchant { display: block; }
.client-form:has(input[name="client[kind]"][value="service"]:checked) .only-service, .client-form[data-kind="service"] .only-service { display: block; }
.client-form:has(input[name="client[kind]"][value="service"]:checked) .not-service, .client-form[data-kind="service"] .not-service { display: none; }
.client-form details { margin: 16px 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Theme switch ---------- */
.theme { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; background: var(--surface); }
.theme form { display: contents; }
.theme button { border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 5px 12px; min-height: 0; font-size: .78rem; font-weight: 600; box-shadow: none; }
.theme button:hover { background: var(--surface-2); color: var(--fg); }
.theme button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* ---------- Modern pass: navigation, top bar, headers, cards ---------- */
.ico { width: 18px; height: 18px; flex: none; }
.pagehead { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.pagehead h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pagehead p { margin: 4px 0 0; }
.pagehead .actions { display: flex; gap: 8px; }
.crumbs { font-size: .82rem; color: var(--muted); display: flex; gap: 8px; }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: -4px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.bigsearch { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); max-width: 760px; margin: 14px 0 0; }
.bigsearch .ico { color: var(--muted); width: 22px; height: 22px; }
.bigsearch input { flex: 1; border: 0; background: transparent; min-height: 46px; font-size: 1.02rem; padding: 0; box-shadow: none; }
.bigsearch input:focus { box-shadow: none; }
.bigsearch:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.chips-row .chip { text-decoration: none; margin: 0; } .chips-row .chip:hover { background: var(--accent-soft); color: var(--accent); }
.starters { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.starter { display: grid; gap: 4px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--fg); box-shadow: var(--shadow); transition: transform .12s, border-color .12s, box-shadow .12s; }
.starter:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-lg); color: var(--fg); }
.starter span { color: var(--muted); font-size: .88rem; }
.appcards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.appcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: grid; gap: 14px; transition: box-shadow .15s, border-color .15s; }
.appcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
.appcard header { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.appcard h3 { margin: 0; font-size: 1.05rem; } .appcard h3 a { text-decoration: none; color: var(--fg); }
.appcard footer { display: flex; gap: 8px; flex-wrap: wrap; }
.appcard footer .btn { padding: 6px 14px; font-size: .86rem; }
.appcard .note { margin: 0; font-size: .84rem; padding: 6px 10px; border-radius: 8px; } .appcard .note.warn { background: var(--warn-soft); color: var(--warn); }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.mini div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.mini dt { font-size: .7rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.mini dd { margin: 2px 0 0; font-weight: 700; font-size: .95rem; }
.result { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.result .actions { display: flex; gap: 8px; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 18px; align-items: start; }
.formgrid > div { align-self: end; padding-bottom: 14px; }
.formgrid label { max-width: none; }
.savebar { display: flex; gap: 18px; align-items: end; flex-wrap: wrap; position: sticky; bottom: 12px; box-shadow: var(--shadow-lg); }
.savebar label { flex: 1; min-width: 260px; margin: 0; }
.diagnosis.bad { border-color: var(--bad); } .diagnosis.good { border-color: var(--good); }
.checks { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.checks li { display: flex; gap: 12px; align-items: flex-start; }
.checks .mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 800; flex: none; margin-top: 1px; }
.checks .ok .mark { background: var(--good-soft); color: var(--good); } .checks .fail .mark { background: var(--bad-soft); color: var(--bad); } .checks .unknown .mark { background: var(--warn-soft); color: var(--warn); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 8px; display: grid; gap: 0; border-left: 2px solid var(--line); margin-left: 8px; }
.timeline li { display: block; padding: 10px 0 10px 18px; position: relative; }
.timeline .dot { position: absolute; left: -15px; top: 17px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); border: 2px solid var(--bg); }
.timeline .t-good .dot { background: var(--good); } .timeline .t-bad .dot { background: var(--bad); }
.timeline .when { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.btn, button { transition: background .12s, transform .06s, box-shadow .12s; }
.btn:active, button:active { transform: translateY(1px); }
.tbl table { border-collapse: separate; border-spacing: 0; }
.tbl tbody tr { transition: background .1s; } .tbl tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.appcard .tile-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; }
.appcard header { align-items: center; } .appcard header .mono { font-size: .78rem; }
.mini { grid-template-columns: repeat(3, minmax(0, 1fr)); } .mini dd { font-size: .88rem; line-height: 1.3; } .mini dt { font-size: .64rem; }
td .muted { font-size: .84rem; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; max-width: 760px; }
.form .formrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; align-items: start; }
.formactions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 4px; }
.stack { display: grid; gap: 10px; }
.sectionhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sectionhead h2 { margin: 0; }
.cardlist { display: grid; gap: 12px; }
.howto { background: var(--info-soft); color: var(--fg); border: 1px solid color-mix(in srgb, var(--info) 22%, transparent); border-radius: var(--radius); padding: 16px 20px; }
.howto h3 { margin: 0 0 6px; } .howto ol { margin: 8px 0 0; padding-left: 20px; } .howto li { margin: 3px 0; }
input[type=datetime-local], input[type=date] { min-width: 0; }
.pager { display: flex; gap: 10px; margin: 0; } .filterbar label .sub { font-weight: 400; margin: 0; line-height: 1.3; }
.permgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 18px; }
.permgrid label.inline { margin: 0; align-items: flex-start; }
.permgrid .sub { margin-top: 0; }
details.panel > summary { font-weight: 700; padding: 2px 0; }
details.panel[open] > summary { margin-bottom: 10px; }
.client-form { display: grid; gap: 22px; max-width: 800px; }
.client-form .formsec { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 18px; }
.client-form .formsec > h3 { margin: 0; font-size: 1rem; }
.client-form label { margin: 0; }
.client-form .kindpick { border: 0; padding: 0; margin: 0; }
.client-form .kindpick legend { font-size: 1.05rem; padding: 0; margin-bottom: 6px; }

.filterbar label { align-content: start; }
.filterbar .fields { align-items: start; }
fieldset { min-width: 0; }
fieldset label.inline { display: inline-flex; margin: 4px 22px 4px 0; align-items: center; }
fieldset legend { font-size: .92rem; }
th, td { padding: 11px 14px; }
.tbl table { min-width: 0; }

.screen .form label, .screen .client-form label, .screen .filters label { margin: 0; }
.screen fieldset label.inline { display: inline-flex; margin: 4px 22px 4px 0; align-items: center; }
.screen .panel > h3 + p.muted { margin-top: -4px; }
.screen .form .formrow label { max-width: none; }
.form fieldset { margin: 0; }

.twocol { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pill.tag { margin-left: 6px; font-size: .66rem; padding: 1px 7px; }
a.ipaddr { text-decoration: none; font-weight: 600; white-space: nowrap; }
a.ipaddr:hover { text-decoration: underline; }
.placepanel .rowline { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.placepanel .rowline:last-child { border-bottom: 0; }

/* Access by feature: what a person can see, then what they may do there. */
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin: 14px 0; }
.feature { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 14px; background: var(--surface); }
.feature.on { border-color: var(--accent); }
.feature .pick { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0; }
.feature .pick.base b { font-size: 1.02rem; }
.feature .nested { margin: 8px 0 0 26px; padding-left: 12px; border-left: 2px solid var(--line); }
.feature .nested-hint { margin: 0 0 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.feature:has(input.base:not(:checked):not(:disabled)) .nested { opacity: .55; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.tabs a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; }
.tabs a[aria-current] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tabs .count { font-size: .75rem; opacity: .85; margin-left: 2px; }

/* The "i" help button: opens a short explanation in place. Works without script. */
.tip { display: inline-block; vertical-align: middle; margin-left: 6px; font-weight: 400; }
.tip .tipbtn { width: 20px; height: 20px; padding: 0; text-align: center; border-radius: 50%; border: 1px solid var(--line); background: transparent; font: italic 700 .8rem/18px Georgia, serif; color: var(--muted); cursor: pointer; }
.tip .tipbtn:hover, .tip .tipbtn:focus-visible, .tip .tipbtn:has(+ .tipbody:popover-open) { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
/* In the top layer: never clipped by a table or card. Centred on small screens or old browsers, beside the button where the browser can anchor it. */
.tip .tipbody { width: min(380px, 86vw); margin: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--fg); box-shadow: 0 8px 28px rgba(0,0,0,.18); text-align: left; font-size: .9rem; line-height: 1.45; }
@supports (position-area: bottom) {
  .tip .tipbody { inset: auto; margin: 6px 0 0; position-area: bottom span-right; position-try-fallbacks: flip-inline, flip-block, bottom span-left; }
}
.tip .tipbody b.t { display: block; margin-bottom: 4px; font-size: .95rem; }
.tip .tipbody p { margin: 6px 0; }
.tip .tipbody .k { font-weight: 600; }

/* Tools you cannot open yet: shown with the others, with a way to ask. */
.tiles li.locked .tilebox { display: grid; grid-template-columns: 44px 1fr; gap: 4px 14px; align-items: center; padding: 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: transparent; }
.tiles li.locked .tile-icon { background: var(--surface-2); color: var(--muted); }
.tiles li.locked .lock { margin-left: 6px; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.tiles li.locked .requestform, .tiles li.locked .pendingnote { grid-column: 1 / -1; margin: 10px 0 0; display: grid; gap: 8px; }
.tiles li.locked .pendingnote { color: var(--muted); font-size: .9rem; }

/* "Your internal apps" at the top of the console navigation: the tools this person can open, and a link to all of them. */

.callout { margin: 10px 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--surface-2); font-size: .92rem; line-height: 1.5; }

/* My apps: the employee's home, with its own top bar. */
body.workspace { background: var(--bg); min-height: 100vh; }
.wsbar { display: flex; align-items: center; gap: 24px; padding: 0 28px; height: 60px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.wsbrand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.05rem; color: var(--fg); text-decoration: none; }
.wsnav { display: flex; gap: 4px; }
.wsnav a { padding: 8px 14px; border-radius: 9px; color: var(--side-ink); text-decoration: none; font-weight: 600; font-size: .93rem; }
.wsnav a:hover { background: var(--surface-2); color: var(--fg); }
.wsnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.wsright { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.usermenu { position: relative; }
.usermenu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); }
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 750; font-size: .85rem; }
.usermenu .uname { font-weight: 600; font-size: .9rem; }
.usermenu .menu { position: absolute; right: 0; top: 44px; min-width: 240px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); display: grid; gap: 2px; z-index: 30; }
.usermenu .menu a, .usermenu .menu .linklike { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; color: var(--fg); text-decoration: none; background: none; border: 0; font: inherit; font-size: .92rem; cursor: pointer; }
.usermenu .menu a:hover, .usermenu .menu .linklike:hover { background: var(--surface-2); }
.usermenu .who { margin: 0 0 6px; padding: 6px 10px 10px; border-bottom: 1px solid var(--line); display: grid; }
.usermenu .who span { color: var(--muted); font-size: .82rem; }
.wsmain { max-width: 1040px; margin: 0 auto; padding: 32px 28px 64px; }
.wshero h1 { margin: 0 0 6px; font-size: 1.8rem; letter-spacing: -.01em; }
.wshero .lead { margin: 0; color: var(--muted); font-size: 1.02rem; max-width: 60ch; }
.wsstart { margin: 24px 0 8px; padding: 18px 22px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--surface); }
.wsstart h2 { margin: 0 0 8px; font-size: 1rem; }
.wsstart ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.5; }
.wsnudge { margin: 20px 0 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--accent-soft); }
.wssection { margin: 34px 0 12px; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.wssection .count { font-size: .75rem; padding: 1px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-weight: 700; }
.wssub { margin: -6px 0 14px; }
.mycards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.mycard { display: grid; grid-template-columns: 48px 1fr auto; gap: 4px 14px; align-items: center; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: box-shadow .15s ease, border-color .15s ease; }
.mycard:hover { box-shadow: var(--shadow-lg); border-color: var(--accent); }
.mycard .tile-icon { grid-row: 1 / span 2; width: 48px; height: 48px; border-radius: 13px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; }
.mycard .body { display: grid; gap: 2px; min-width: 0; }
.mycard .body small { color: var(--muted); }
.mycard .last { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.mycard .btn.open { align-self: center; white-space: nowrap; }
.mycards.locked .mycard { border-style: dashed; border-color: var(--line-strong); background: transparent; }
.mycards.locked .mycard:hover { box-shadow: none; border-color: var(--line-strong); }
.mycards.locked .tile-icon { background: var(--surface-2); color: var(--muted); }
.mycards.locked .lock { margin-left: 6px; font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.mycards.locked .requestform, .mycards.locked .pendingnote { grid-column: 1 / -1; margin: 12px 0 0; display: grid; gap: 8px; }
.mycards.locked .pendingnote { color: var(--muted); font-size: .9rem; }
.wsempty { padding: 26px; border: 1px dashed var(--line-strong); border-radius: var(--radius); text-align: center; }
.wsempty p { margin: 4px 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) { .wsbar { padding: 0 14px; gap: 10px; } .wsmain { padding: 20px 14px 48px; } .usermenu .uname { display: none; } .mycard { grid-template-columns: 44px 1fr; } .mycard .btn.open { grid-column: 1 / -1; justify-self: start; margin-top: 8px; } }

/* A table row that is a link: the whole row opens it. The link in the first cell is stretched over the row; other links stay clickable above it. */
.tbl tbody tr.rowlink { position: relative; cursor: pointer; }
.tbl tbody tr.rowlink a.rowhit::after { content: ""; position: absolute; inset: 0; }
.tbl tbody tr.rowlink td a:not(.rowhit) { position: relative; z-index: 1; }


/* =====================================================================================================================================================
   The new look (ADR 0024). Everything above keeps its names and takes the new tokens; this layer refines the shapes and adds the console shell.
   ===================================================================================================================================================== */
body { background: var(--bg); }
h1, h2, h3 { letter-spacing: -.015em; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* buttons: primary is the plain button, calmer ones are .secondary and .ghost */
button, a.btn { border-radius: var(--radius-sm); font-weight: 600; box-shadow: 0 1px 0 rgba(255,255,255,.12) inset; }
button.secondary, a.btn.secondary { background: var(--panel); border-color: var(--line2); box-shadow: none; }
button.secondary:hover, a.btn.secondary:hover { background: var(--panel2); }
button.ghost, a.btn.ghost { background: none; border-color: transparent; color: var(--muted); box-shadow: none; }
button.ghost:hover, a.btn.ghost:hover { background: var(--panel); color: var(--fg); }
button.danger { box-shadow: none; }
.btn .ico, button .ico { width: 16px; height: 16px; }
input, select, textarea { background: var(--panel); border-color: var(--line2); border-radius: var(--radius-sm); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select { color-scheme: inherit; }
code { background: var(--panel2); }
pre, .secret { background: var(--panel); border: 1px solid var(--line); }

/* surfaces */
.panel, .stat, .card, .tbl, .filterbar, .appcard, .feature, .callout { background: var(--panel); border-color: var(--line); box-shadow: none; }
.tbl, .panel, .card, .filterbar { border-radius: var(--radius); }
.tbl { background: var(--surface); }
th { background: var(--panel); color: var(--muted); }
th, td { border-bottom-color: var(--line); }
tbody tr:hover td { background: var(--panel); }
tr.group th { background: transparent; }
.pill { font-size: .7rem; letter-spacing: .02em; }
.empty { border-color: var(--line2); background: var(--panel); border-radius: var(--radius); }
.stat.bad { border-color: color-mix(in srgb, var(--bad) 50%, transparent); background: var(--bad-soft); }
.fchip { background: var(--accent-soft); }
.presets { background: var(--panel); border-color: var(--line2); }
.notice, .alert, .banner, .banner-warning, .banner-bad { border-radius: var(--radius-sm); }
.howto { background: var(--info-soft); }
.screen { padding: 22px 0 90px; max-width: 1360px; gap: 20px; }
.screen h1 { font-size: 1.65rem; }
.screen h2 { font-size: 1.08rem; }
.pagehead { padding-bottom: 2px; }
.tabs a { border-color: var(--line2); }
.tabs a:hover { background: var(--panel); }
.tabs a[aria-current] { background: var(--accent); color: var(--accent-ink); }
.crumbs a:hover { color: var(--accent); }
.sub { color: var(--muted); }

/* shell */
body.console { margin: 0; min-height: 100vh; }
.console .ico { width: 20px; height: 20px; flex: none; }
.console form.inline { display: inline; margin: 0; }
.soft { color: var(--muted); } .small { font-size: .85rem; }
.push { margin-left: auto; }

/* shell */
.rail { position: fixed; inset: 0 auto 0 0; width: var(--rail); z-index: 40; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 12px; gap: 2px; transition: width .22s cubic-bezier(.2,.8,.2,1); overflow-x: hidden; overflow-y: auto; scrollbar-width: none; }
.rail:hover, .rail:focus-within { width: 232px; box-shadow: 20px 0 60px rgba(0,0,0,.25); }
.brand { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 6px; margin-bottom: 10px; font-weight: 650; letter-spacing: .2px; white-space: nowrap; flex: none; }
.brand .logo { flex: none; }
.rail .nav, .sheet .nav { display: flex; align-items: center; gap: 14px; height: 42px; padding: 0 12px; border-radius: 12px; color: var(--muted); white-space: nowrap; position: relative; flex: none; }
.rail .nav:hover, .sheet .nav:hover { background: var(--panel2); color: var(--fg); }
.rail .nav[aria-current], .sheet .nav[aria-current] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.rail .nav[aria-current]::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); }
.rail .grp, .sheet .grp { margin: 14px 12px 4px; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.rail .grp { height: 0; overflow: hidden; margin: 6px 12px 0; opacity: 0; transition: opacity .15s; }
.rail:hover .grp, .rail:focus-within .grp { height: auto; margin: 14px 12px 4px; opacity: 1; }
.rail:not(:hover):not(:focus-within) .nav > span, .rail:not(:hover):not(:focus-within) .brand .word { opacity: 0; }
.rail .nav > span, .rail .brand .word { transition: opacity .15s; }

.topbar { position: sticky; top: 0; z-index: 30; margin-left: var(--rail); display: flex; align-items: center; gap: 12px; padding: 14px 28px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: color-mix(in srgb, var(--bg) 72%, transparent); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 1rem; margin: 0; font-weight: 600; }
.topbar .topbrand { display: none; }
.topbar .grow { flex: 1; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); white-space: nowrap; }
.pulse-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: pulse 2s infinite; }
.live-pill[data-state="connecting"] .dot, .live-pill[data-state="retrying"] .pulse-dot { background: var(--warn); animation: none; }
.live-pill[data-state="off"] .pulse-dot { background: var(--faint); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.cmdk { display: flex; align-items: center; gap: 10px; min-width: 300px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--muted); font-size: .9rem; }
.cmdk:hover { border-color: var(--line2); color: var(--fg); }
.cmdk kbd { margin-left: auto; font: 600 .72rem var(--mono); border: 1px solid var(--line2); border-radius: 6px; padding: 1px 6px; color: var(--faint); }
.env { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 4px 10px; border: 1px solid var(--line); border-radius: 99px; }
.env.production { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; color: var(--muted); padding: 0; }
.iconbtn:hover { color: var(--fg); border-color: var(--line2); }
.me { position: relative; }
.me > summary { list-style: none; cursor: pointer; }
.me > summary::-webkit-details-marker { display: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--accent2), var(--accent)); display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #04101c; }
.me .menu { position: absolute; right: 0; top: 46px; width: 240px; padding: 14px; display: grid; gap: 2px; background: var(--solid); border: 1px solid var(--line2); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.4); z-index: 60; }
.me .menu small { color: var(--muted); margin-bottom: 8px; }
.me .menu a, .me .menu .linklike { padding: 8px 10px; border-radius: 10px; color: var(--fg); text-align: left; background: none; border: 0; width: 100%; font-size: .92rem; }
.me .menu a:hover, .me .menu .linklike:hover { background: var(--panel2); }
.console main { margin-left: var(--rail); padding: 24px 28px 90px; max-width: 1560px; }
.banner { margin: 0 0 16px; padding: 10px 16px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.banner.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }


.console .banner { margin: 0 0 16px; }
.console .rail a, .console .sheet a { text-decoration: none; }
.console .topbar a, .console .me .menu a { text-decoration: none; }
.console .topbar button.iconbtn, .console .cmdk { box-shadow: none; }
.console .topbar .iconbtn { background: var(--panel); color: var(--muted); border: 1px solid var(--line); min-height: 40px; }
.console .cmdk { background: var(--panel); color: var(--muted); border: 1px solid var(--line); font-weight: 400; justify-content: flex-start; }
.console .cmdk:hover { background: var(--panel); color: var(--fg); }
.console .me .menu .linklike { background: none; color: var(--fg); border: 0; box-shadow: none; font-weight: 500; justify-content: flex-start; padding: 8px 10px; }
.console .me .menu .linklike:hover { background: var(--panel2); }
.console .seg button, .console .feedchip, .console .segtabs button, .console .tabbar button, .console .place, .console .tipbtn { box-shadow: none; }
.console .seg button { background: none; font-weight: 500; } .console .seg button:hover { background: none; color: var(--fg); }
.console .seg button[aria-pressed="true"], .console .seg button[aria-pressed="true"]:hover { background: var(--panel2); color: var(--fg); }
.console .feedchip { background: none; font-weight: 400; } .console .feedchip:hover { background: var(--panel); }
.console .feedchip[aria-pressed="true"] { background: var(--panel2); }
.console .segtabs button { background: none; font-weight: 500; } .console .segtabs button:hover { background: none; }
.console .segtabs button[aria-selected="true"] { background: var(--panel2); color: var(--fg); }
.console .place, .console .place:hover { background: none; font-weight: 400; justify-content: stretch; color: var(--fg); } .console .place:hover { background: var(--panel2); }
.console .tabbar button { background: none; font-weight: 400; }
.console .toast button { background: none; color: var(--accent); box-shadow: none; padding: 0; }
.console .tip .tipbtn { background: transparent; color: var(--muted); }
.console .tip .tipbtn:hover { background: var(--accent); color: var(--accent-ink); }
/* command palette, toast (every console page) */
.palette { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding-top: 14vh; background: rgba(3,6,14,.55); backdrop-filter: blur(6px); }
.palette .box { width: min(640px, 92vw); border-radius: 20px; background: var(--solid); border: 1px solid var(--line2); box-shadow: 0 30px 100px rgba(0,0,0,.5); overflow: hidden; animation: in .2s; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--fg); font: inherit; font-size: 1.05rem; padding: 18px 20px; outline: none; }
.palette .results { max-height: 50vh; overflow: auto; padding: 8px; } .palette h4 { margin: 10px 12px 4px; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.palette .pi { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; color: var(--fg); } .palette .pi[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.palette .pi small { color: var(--muted); margin-left: auto; } .palette .foot { padding: 10px 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: .78rem; display: flex; gap: 16px; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--solid); border: 1px solid var(--line2); border-radius: 14px; padding: 10px 16px; display: flex; gap: 14px; align-items: center; z-index: 90; box-shadow: 0 14px 50px rgba(0,0,0,.4); }
.toast button { border: 0; background: none; color: var(--accent); font-weight: 600; }


/* the "i" help button: a native popover, never clipped by a table or card */
.tip .tipbody { background: var(--solid); border-color: var(--line2); }

/* phone: the rail becomes a bottom tab bar and a sheet */
.tabbar, .sheet { display: none; }
@media (max-width: 1100px) { .cmdk { min-width: 0; } .cmdk span, .cmdk kbd { display: none; } }
@media (max-width: 760px) {
  :root { --rail: 0px; }
  .rail { display: none; }
  .topbar { padding: 10px 16px; } .topbar .topbrand { display: inline-grid; } .live-pill { display: none; } .env { display: none; } .topbar h1 { font-size: .95rem; }
  .console main { padding: 14px 16px 110px; } .screen { padding: 14px 0 100px; gap: 16px; }
  .tabbar { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 50; background: color-mix(in srgb, var(--solid) 82%, transparent); backdrop-filter: blur(20px); border: 1px solid var(--line2); border-radius: 22px; padding: 6px; justify-content: space-around; }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; font-size: .68rem; color: var(--muted); padding: 6px 12px; border-radius: 16px; background: none; border: 0; text-decoration: none; min-height: 0; }
  .tabbar a[aria-current] { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
  .sheet { display: none; position: fixed; inset: 0; z-index: 70; }
  .sheet:target { display: block; }
  .sheet .scrim { position: absolute; inset: 0; background: rgba(3,6,14,.6); backdrop-filter: blur(6px); }
  .sheet .panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow: auto; padding: 16px 16px 28px; background: var(--solid); border: 0; border-top: 1px solid var(--line2); border-radius: 24px 24px 0 0; display: grid; gap: 2px; }
  .toast { bottom: 104px; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dt { margin-top: 10px; }
  .filterbar .fields { grid-template-columns: 1fr 1fr; }
  .pagehead .actions { width: 100%; }
  .tbl { border-radius: 14px; }
  th, td { padding: 10px 12px; }
  .wsbar { padding: 0 14px; gap: 10px; }
}
/* a table that stacks into cards on a phone (needs data-label on each cell) */
@media (max-width: 760px) {
  .tbl.stack table, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .tbl.stack thead { display: none; }
  .tbl.stack { border: 0; background: none; box-shadow: none; overflow: visible; }
  .tbl.stack tr { position: relative; margin-bottom: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
  .tbl.stack td { border: 0; padding: 4px 0 4px 88px; position: relative; min-height: 26px; }
  .tbl.stack td::before { content: attr(data-label); position: absolute; left: 0; top: 7px; color: var(--faint); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
  .tbl.stack td:not([data-label]) { display: none; }
  .tbl.stack td .pill { vertical-align: middle; }
  .tbl.stack td.id .sub { display: block; }
  .tbl.stack tr.empty-row { border-style: dashed; }
  .tbl.stack tr.empty-row td { display: block; padding: 12px 0; text-align: center; } .tbl.stack tr.empty-row td::before { content: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* small utilities (replace the inline styles the content security policy never allowed) */
.u-m0 { margin: 0; } .u-mb0 { margin-bottom: 0; } .u-mt0 { margin-top: 0; } .u-mt8 { margin-top: 8px; } .u-mt10 { margin-top: 10px; } .u-mt12 { margin-top: 12px; } .u-mt14 { margin-top: 14px; } .u-mt20 { margin-top: 20px; }
.u-center { text-align: center; } .u-lg { font-size: 1.2rem; } .u-break { word-break: break-all; } .u-w100 { width: 100%; } .u-basis100 { flex-basis: 100%; } .u-inline { display: inline; }

.presets { max-width: 100%; overflow-x: auto; } .presets .preset { white-space: nowrap; }
.tbl.rows tbody tr:not(.group):not(.empty-row) { cursor: pointer; }
.filtertoggle { display: none; }
@media (max-width: 760px) { .filtertoggle { display: inline-flex; align-self: start; } .filterbar[hidden] { display: none !important; } }
.wsbar { background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

/* links and buttons are never underlined; colour and shape say what they are */
a, a:hover, a:focus, td a:hover, a.ipaddr:hover, .tbl a:hover { text-decoration: none !important; }
time[title] { text-decoration: none; }

/* forms: every control fills its column, so nothing runs into the next one */
.form .formrow { align-items: end; }
.form select, .form input:not([type=checkbox]):not([type=radio]), .form textarea { width: 100%; min-width: 0; }
.form .formrow label { align-content: end; }

/* copy buttons: small, quiet, next to a value */
button.copy { display: inline-grid; place-items: center; width: 22px; height: 22px; min-height: 0; padding: 0; margin-left: 6px; vertical-align: middle; border: 0; border-radius: 7px; background: none; color: var(--faint); box-shadow: none; font-weight: 400; position: relative; z-index: 1; }
button.copy .ico { width: 14px; height: 14px; }
button.copy:hover { background: var(--panel2); color: var(--fg); }
button.copy.done { color: var(--good); }
.tbl tr:hover button.copy, button.copy:focus-visible { color: var(--muted); }

/* the audit table fits the screen: fixed column shares, long values wrap instead of widening the page */
.tbl.auditable table { table-layout: fixed; width: 100%; }
.tbl.auditable col.c-when { width: 9%; } .tbl.auditable col.c-event { width: 24%; } .tbl.auditable col.c-who { width: 20%; }
.tbl.auditable col.c-app { width: 14%; } .tbl.auditable col.c-where { width: 22%; } .tbl.auditable col.c-result { width: 11%; }
.tbl.auditable th, .tbl.auditable td { padding: 11px 12px; overflow-wrap: anywhere; word-break: normal; }
.tbl.auditable td.id { white-space: normal; } .tbl.auditable .pill { white-space: normal; overflow-wrap: anywhere; text-align: left; }
.tbl.auditable time { white-space: nowrap; } .tbl.auditable td:last-child .pill { white-space: nowrap; }
.tbl.auditable .only-narrow { display: none; }
@media (max-width: 1180px) {
  .tbl.auditable col.c-app, .tbl.auditable th.c-app, .tbl.auditable td.c-app { display: none; }
  .tbl.auditable col.c-when { width: 11%; } .tbl.auditable col.c-event { width: 27%; } .tbl.auditable col.c-who { width: 24%; } .tbl.auditable col.c-where { width: 26%; } .tbl.auditable col.c-result { width: 12%; }
  .tbl.auditable .only-narrow { display: block; }
}
@media (max-width: 760px) { .tbl.auditable col { width: auto !important; } .tbl.auditable .only-narrow { display: none; } .tbl.auditable td.c-app { display: block; } .tbl.auditable td.c-app:not([data-label]) { display: none; } }
