:root {
  --bg: #090c11; --panel: #111823; --panel-2: #161f2c; --line: #1f2a39; --line-2: #2a3749;
  --text: #e7edf5; --muted: #8a97a8; --dim: #5f6c7e; --gold: #ffc857; --accent: #5cc8ff;
  --good: #3ddc97; --critical: #ff4d6d; --high: #ff8a3d; --medium: #f5c542;
  --radius: 12px; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
h1 { font-size: 22px; margin: 0 0 6px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
p { margin: 0 0 10px; }
.dim { color: var(--dim); } .small, small { font-size: 12px; }
.critical { color: var(--critical); } .high { color: var(--high); } .medium { color: var(--medium); } .good { color: var(--good); }
em.high, em.medium { font-style: normal; }

.top { display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand img { width: 26px; height: 26px; }
.top nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.top nav a { color: var(--muted); padding: 7px 12px; border-radius: 8px; white-space: nowrap; }
.top nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.top nav a.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--gold); }
.me { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.me form { margin: 0; }

main { max-width: 1280px; margin: 0 auto; padding: 24px; }
main.narrow { max-width: 420px; padding-top: 12vh; }
.login h1 img { width: 36px; height: 36px; }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: rgba(61,220,151,.08); border-color: rgba(61,220,151,.35); }
.flash.bad { background: rgba(255,77,109,.08); border-color: rgba(255,77,109,.4); }
.flash.token code.copy { display: block; margin: 6px 0 10px; padding: 8px 10px; user-select: all; word-break: break-all; font-size: 13px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 18px 0; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; min-height: 104px; }
.tile b { font-size: 26px; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tile small { color: var(--dim); margin-top: auto; padding-top: 6px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; overflow-x: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; margin-bottom: 0; }
.grid2 > .card { margin-bottom: 16px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
table.compact td { padding: 6px 10px; }
th.n, td.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.dim td { opacity: .55; }
td.empty { color: var(--dim); text-align: center; padding: 22px; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-2); }
.pill.reporting, .pill.u-current, .pill.u-installed { color: var(--good); border-color: rgba(61,220,151,.35); }
.pill.silent, .pill.u-failed, .pill.u-rolled_back { color: var(--high); border-color: rgba(255,138,61,.4); }
.pill.revoked { color: var(--critical); border-color: rgba(255,77,109,.4); }
.pill.u-staged, .pill.u-installing { color: var(--accent); border-color: rgba(92,200,255,.4); }
.grade { display: inline-block; min-width: 22px; text-align: center; font-weight: 700; }
.grade.dim { color: var(--dim); }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
dl.kv dt { color: var(--dim); } dl.kv dd { margin: 0; }

form.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 14px; }
form.stack { display: flex; flex-direction: column; gap: 12px; }
form.inline { display: inline; margin: 0; }
label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12.5px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; }
input, select { background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font: inherit; min-width: 0; }
input[type=number] { width: 120px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--gold); }
input:focus, select:focus { outline: 2px solid rgba(92,200,255,.45); outline-offset: 0; border-color: var(--accent); }
button { background: var(--gold); color: #1a1405; border: 0; border-radius: 8px; padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer; }
button:hover { filter: brightness(1.08); }
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); }
button.danger { background: transparent; color: var(--critical); border: 1px solid rgba(255,77,109,.45); }
button.danger:hover { background: rgba(255,77,109,.1); }
button.small { padding: 3px 10px; font-size: 12px; font-weight: 500; }
button.link { background: none; color: var(--accent); padding: 0; font-weight: 400; }
button:disabled, select:disabled, input:disabled { opacity: .55; cursor: not-allowed; }

td.bar { width: 60%; }
td.bar span { display: block; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), #8b7cff); margin-top: 6px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 6px; }
.chart .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.chart .col span { display: block; width: 100%; max-width: 36px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--gold), #c9861c); min-height: 2px; }
.chart .col small { color: var(--dim); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* bar lengths in steps of 5: the CSP allows no inline styles */
td.bar span.w0 { width: 1%; } .chart .col span.h0 { height: 0%; }
td.bar span.w5 { width: 5%; } .chart .col span.h5 { height: 5%; }
td.bar span.w10 { width: 10%; } .chart .col span.h10 { height: 10%; }
td.bar span.w15 { width: 15%; } .chart .col span.h15 { height: 15%; }
td.bar span.w20 { width: 20%; } .chart .col span.h20 { height: 20%; }
td.bar span.w25 { width: 25%; } .chart .col span.h25 { height: 25%; }
td.bar span.w30 { width: 30%; } .chart .col span.h30 { height: 30%; }
td.bar span.w35 { width: 35%; } .chart .col span.h35 { height: 35%; }
td.bar span.w40 { width: 40%; } .chart .col span.h40 { height: 40%; }
td.bar span.w45 { width: 45%; } .chart .col span.h45 { height: 45%; }
td.bar span.w50 { width: 50%; } .chart .col span.h50 { height: 50%; }
td.bar span.w55 { width: 55%; } .chart .col span.h55 { height: 55%; }
td.bar span.w60 { width: 60%; } .chart .col span.h60 { height: 60%; }
td.bar span.w65 { width: 65%; } .chart .col span.h65 { height: 65%; }
td.bar span.w70 { width: 70%; } .chart .col span.h70 { height: 70%; }
td.bar span.w75 { width: 75%; } .chart .col span.h75 { height: 75%; }
td.bar span.w80 { width: 80%; } .chart .col span.h80 { height: 80%; }
td.bar span.w85 { width: 85%; } .chart .col span.h85 { height: 85%; }
td.bar span.w90 { width: 90%; } .chart .col span.h90 { height: 90%; }
td.bar span.w95 { width: 95%; } .chart .col span.h95 { height: 95%; }
td.bar span.w100 { width: 100%; } .chart .col span.h100 { height: 100%; }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px; }
  .me span { display: none; }
  main { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* Single sign-on (plan 0042) */
.login .or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 12px; margin: 18px 0; }
.login .or::before, .login .or::after { content: ""; flex: 1; border-top: 1px solid var(--line-2); }
table.rules td { padding: 4px 6px; border: 0; }
table.rules input, table.rules select { width: 100%; }
.access-row form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.access-row select { padding: 4px 8px; font-size: 13px; }
.exc { display: inline-flex; gap: 6px; align-items: center; margin: 2px 8px 2px 0; }

/* Two-step sign-in */
.me a { color: var(--muted); }
.me a:hover { color: var(--text); }
.recovery-codes { display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 24px; margin: 12px 0; }
.recovery-codes code { font-size: 15px; padding: 4px 8px; }
.qr { background: #fff; border-radius: 10px; padding: 8px; display: inline-block; margin: 6px 0; }
.qr img { display: block; image-rendering: pixelated; }
code.secret { user-select: all; }

/* Sign-in page: the same design as Obelsk's (art on the left, a card on the right). */
.login-body { background: #070a0f; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-art { position: relative; overflow: hidden; display: grid; place-items: center; padding: 48px;
  background: radial-gradient(70% 55% at 50% 42%, rgba(255,200,87,.10), transparent 70%), linear-gradient(180deg, #0b1018, #070a0f);
  border-right: 1px solid var(--line); }
.login-stage { width: 100%; max-width: 520px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.scene { position: relative; width: 340px; height: 330px; margin-bottom: 18px; }
.scene .monolith { position: absolute; z-index: 1; left: 50%; bottom: 92px; transform: translateX(-50%); width: 150px; height: auto; filter: drop-shadow(0 0 36px rgba(255,200,87,.28)); }
.scene-glow { position: absolute; left: 50%; top: 38%; width: 300px; height: 300px; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(255,200,87,.22), rgba(255,200,87,.05) 45%, transparent 70%); }
.scene-ring { position: absolute; left: 50%; top: 31%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  border: 1px solid rgba(255,200,87,.45); animation: scan 4.5s ease-out infinite; }
.scene-ring.r2 { animation-delay: -2.25s; }
@keyframes scan { from { transform: scale(.55); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }
.scene-floor { position: absolute; left: -40%; right: -40%; top: 252px; height: 150px; transform: perspective(240px) rotateX(58deg); transform-origin: 50% 0%;
  background-image: linear-gradient(rgba(255,200,87,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(255,200,87,.16) 1px, transparent 1px);
  background-size: 34px 34px; background-position: center top;
  -webkit-mask-image: radial-gradient(60% 100% at 50% 0%, #000 30%, transparent 75%); mask-image: radial-gradient(60% 100% at 50% 0%, #000 30%, transparent 75%); }
.scene-floor::before { content: ""; position: absolute; left: 20%; right: 20%; top: -1px; height: 2px; background: linear-gradient(90deg, transparent, rgba(255,200,87,.7), transparent); }
@media (prefers-reduced-motion: reduce) { .scene-ring { animation: none; opacity: .35; } .scene-ring.r2 { display: none; } }
.login-art h2 { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.login-art p { color: var(--muted); max-width: 440px; margin-top: 12px; line-height: 1.6; }
.login-points { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.login-points li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #c9d4e1; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.02); }
.login-points .dot { width: 7px; height: 7px; border-radius: 50%; }
.login-points .dot.user { background: #60a5fa; box-shadow: 0 0 8px #60a5fa; }
.login-points .dot.agent { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.login-points .dot.ext { background: var(--critical); box-shadow: 0 0 8px var(--critical); }
.login-form { display: grid; place-items: center; padding: 40px 24px; background: radial-gradient(60% 50% at 50% 30%, rgba(96,165,250,.05), transparent 70%); }
.login-card { width: 100%; max-width: 400px; padding: 34px 32px 28px; border: 1px solid var(--line-2); border-radius: 18px;
  background: linear-gradient(180deg, rgba(23,31,44,.85), rgba(14,19,28,.85)); box-shadow: 0 24px 70px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04); }
.login-brand { display: flex; align-items: center; gap: 10px; padding: 0 0 26px; margin-bottom: 22px; border-bottom: 1px solid var(--line); color: var(--text); }
.login-brand img { width: 34px; height: 34px; }
.wordmark { font-weight: 750; letter-spacing: .28em; font-size: 15px; }
.wordmark small { display: block; font-weight: 500; letter-spacing: .08em; font-size: 10.5px; color: var(--muted); text-transform: lowercase; }
.login-card h1 { margin: 0 0 6px; font-size: 24px; }
.login-card .sub { color: var(--muted); margin-bottom: 22px; }
.login-card form { margin: 0; }
.login-card .field { margin-bottom: 14px; }
.login-card .field label { display: block; margin: 0 0 6px; }
.login-card .field input { width: 100%; padding: 10px 12px; background: var(--bg); }
.login-card .btn { display: block; width: 100%; padding: 12px; margin-top: 8px; font-size: 14.5px; border-radius: 10px; }
.login-card .btn:not(.primary) { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); }
.login-card .btn.primary { background: linear-gradient(180deg, var(--gold), #f0b232); color: #1a1205; }
.login-card .or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 12px; margin: 16px 0; }
.login-card .or::before, .login-card .or::after { content: ""; flex: 1; border-top: 1px solid var(--line-2); }
.login-card .flash.ok { color: var(--good); }
.login-card .flash.bad { color: var(--critical); }
.login-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; line-height: 1.5; }
.login-note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 760px) { .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; } .login-card { padding: 28px 22px 22px; } }

/* Pathfinder (plan 0017): its own host; transcripts are untrusted text. */
.pill.pf-running { color: var(--accent); border-color: rgba(92,200,255,.4); }
.pill.pf-done, .pill.pf-new, .pill.pf-promoted { color: var(--good); border-color: rgba(61,220,151,.35); }
.pill.pf-failed, .pill.pf-needs-person, .pill.pf-budget { color: var(--high); border-color: rgba(255,138,61,.4); }
.pill.pf-stopped, .pill.pf-dismissed { color: var(--dim); }
.pf-untrusted { font-size: 12px; color: var(--medium); margin: 0 0 10px; }
pre.pf-text { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12.5px; margin: 4px 0 0; max-height: 420px; overflow-y: auto; background: var(--panel-2); padding: 8px 10px; border-radius: 8px; }
ol.pf-events { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
ol.pf-events .ev-meta { font-size: 12px; color: var(--dim); }
ol.pf-events .ev-error pre.pf-text { border-left: 3px solid var(--critical); }
ol.pf-events .ev-custom-tool pre.pf-text, ol.pf-events .ev-custom-result pre.pf-text { border-left: 3px solid var(--gold); }
ol.pf-events .ev-message pre.pf-text { font-family: inherit; font-size: 13.5px; }
ol.pf-pipeline { display: flex; flex-wrap: wrap; gap: 8px 22px; padding-left: 18px; margin: 0; }
.pf-url { overflow-wrap: anywhere; }
.pf-filters a { margin-right: 10px; } .pf-filters a.on { font-weight: 650; }
form.pf-decide { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
form.pf-decide input[name=note] { min-width: 160px; }
h2.gap, form.gap { margin-top: 16px; }
.pill.pf-analysed, .pill.pf-v-matters { color: var(--gold); border-color: rgba(255,196,61,.45); }
.pill.pf-v-already-covered { color: var(--good); border-color: rgba(61,220,151,.35); }
.pill.pf-v-not-relevant { color: var(--dim); }
.pill.pf-v-needs-person { color: var(--high); border-color: rgba(255,138,61,.4); }
.pf-brief + .pf-brief { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.pf-brief h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; }
dl.pf-kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 0; }
dl.pf-kv dt { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding-top: 4px; }
dl.pf-kv dd { margin: 0; }
@media (max-width: 700px) { dl.pf-kv { grid-template-columns: 1fr; } }
.pill.pf-change-drafted { color: var(--accent); border-color: rgba(92,200,255,.4); }
.pf-edit + .pf-edit { margin-top: 10px; }
pre.pf-old { border-left: 3px solid var(--critical); opacity: .85; }
pre.pf-new { border-left: 3px solid var(--good); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-align: center; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); color: var(--text); }
.pill.pf-approved, .pill.pf-r-approve { color: var(--good); border-color: rgba(61,220,151,.35); }
.pill.pf-rejected, .pill.pf-r-reject { color: var(--critical); border-color: rgba(255,77,109,.4); }
.pf-check { margin-right: 10px; } .pf-check.ok { color: var(--good); } .pf-check.no { color: var(--critical); }
.pf-review + .pf-review { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.pf-brief h4 { font-size: 13px; margin: 14px 0 6px; font-weight: 600; }
form.pf-switch { margin: 0 0 12px; }
.pf-repro details summary { cursor: pointer; color: var(--dim); }

/* Pathfinder inside Omnilsk: Omnilsk's header and menu, Pathfinder's sections as tabs under it. */
.subnav { display: flex; align-items: center; gap: 4px; padding: 0 24px; height: 46px; background: #0d131c; border-bottom: 1px solid var(--line); position: sticky; top: 56px; z-index: 1; overflow-x: auto; }
.subnav-name { color: var(--gold); font-weight: 650; font-size: 13px; letter-spacing: .04em; margin-right: 10px; white-space: nowrap; }
.subnav a { color: var(--muted); padding: 6px 11px; border-radius: 8px; white-space: nowrap; font-size: 13.5px; }
.subnav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.subnav a.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--gold); }
.top nav .pf-sections { display: none; }

/* ---------- Responsive (plan 0048) ----------
   Phones (< 640px) and tablets in portrait (< 1024px): the header keeps the
   logo, the page title and a Menu button; the menu and the account open as a
   panel over the page (a CSS checkbox: these pages run no scripts). No page
   scrolls sideways: a wide table scrolls inside its own box. Controls are
   tap-sized; form text is 16px so phones don't zoom. Desktop is unchanged. */
.menu-toggle { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mbar-title, .mbar-menu, .menu-close, .scrim, .menu-brand { display: none; }
.topmenu { display: contents; }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
.grid2 > *, .tiles > *, fieldset { min-width: 0; }
@media (max-width: 1023px) {
  .top { flex-wrap: nowrap; height: 56px; padding: 0 10px 0 16px; gap: 12px; z-index: 40; }
  .brand { flex: none; }
  .mbar-title { display: block; flex: 1; min-width: 0; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mbar-menu {
    display: inline-flex; align-items: center; gap: 7px; min-height: 44px; margin: 0; padding: 0 14px; border-radius: 10px; cursor: pointer;
    border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font-size: 14px; font-weight: 600; flex: none; flex-direction: row;
  }
  .mbar-menu svg, .menu-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; }
  .menu-toggle:focus-visible ~ .top .mbar-menu { outline: 2px solid var(--gold); outline-offset: 2px; }
  .topmenu {
    display: flex; flex-direction: column; gap: 16px; position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(300px, 86vw);
    padding: 16px 14px 22px; background: var(--panel); border-left: 1px solid var(--line-2); box-shadow: 0 0 48px rgba(0,0,0,.6);
    overflow-y: auto; transform: translateX(105%); visibility: hidden; transition: transform .2s ease;
  }
  .menu-toggle:checked ~ .top .topmenu { transform: none; visibility: visible; }
  /* The panel opens with the logo and name, like Obelsk's. */
  .menu-brand { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 2px 52px 10px 4px; border-bottom: 1px solid var(--line); color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: .2px; }
  .menu-brand:hover { text-decoration: none; }
  .menu-brand img { width: 32px; height: 32px; flex: none; }
  .menu-brand small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: .04em; }
  /* The panel lives in the header, which is its own layer: lift the header above the backdrop while the menu is open. */
  .menu-toggle:checked ~ .top { z-index: 70; }
  .menu-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; z-index: 55; margin: 0; background: rgba(0,0,0,.55); }
  .menu-close { display: grid; place-items: center; position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 10px; color: var(--muted); cursor: pointer; }
  .top nav { flex-direction: column; flex: none; overflow: visible; gap: 2px; }
  .top nav a { padding: 12px; font-size: 15px; }
  .top nav a.on { box-shadow: inset 3px 0 0 var(--gold); }
  .subnav { display: none; }
  .top nav .pf-sections { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 14px; padding-left: 8px; border-left: 1px solid var(--line-2); }
  .top nav .pf-sections a { padding: 10px 12px; font-size: 14.5px; }
  .top nav .pf-sections a.on { box-shadow: inset 3px 0 0 var(--gold); background: var(--panel-2); color: var(--text); }
  .me { flex-direction: column; align-items: flex-start; gap: 14px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); white-space: normal; font-size: 14px; }
  .me span { display: inline; }
  .me a, .me button.link { min-height: 44px; display: inline-flex; align-items: center; }
  main { padding: 18px 16px 44px; }
  /* Tables scroll inside their own box, never the page. */
  main :is(div, section, form, details, article, fieldset):has(> table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  main pre { max-width: 100%; overflow-x: auto; }
  main code, .mono { overflow-wrap: anywhere; }
  /* Tap-sized controls; 16px text so phones don't zoom into fields. */
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea { font-size: 16px; min-height: 44px; }
  button, a.btn { min-height: 44px; }
  button.small, a.btn.small { min-height: 40px; padding: 6px 12px; font-size: 13px; }
  button.link { min-height: 0; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  main input, main select, main textarea { max-width: 100%; }
  main p:has(> a.btn:first-child) { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
}
@media (max-width: 639px) {
  main { padding: 16px 12px 40px; }
  h1 { font-size: 20px; flex-wrap: wrap; }
  .card { padding: 14px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { min-height: 92px; padding: 12px 14px; }
  .tile b { font-size: 22px; }
  .row { flex-wrap: wrap; }
}

/* The sidebar's hide and show buttons (desktop only). */
.side-toggle { display: none; margin: 0; }
.side-toggle button { display: grid; place-items: center; width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.side-toggle button:hover { color: var(--text); background: var(--panel); border-color: var(--line-2); }
.side-toggle button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.side-toggle svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media print { .side-toggle { display: none !important; } }

/* The menu's icons and the signed-in person (every width). */
.top nav a { display: flex; align-items: center; gap: 10px; }
.top nav a svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.top nav .pf-sections a { display: block; }
.me a.who { display: inline-flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line-2); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--gold); }

/* Desktop (1024px and wider): the menu is a sidebar on the left, like
   Obelsk's. Pathfinder's sections sit under Pathfinder in it. */
@media (min-width: 1024px) {
  body { padding-left: 232px; }
  .top {
    position: fixed; top: 0; left: 0; bottom: 0; width: 232px; height: auto; z-index: 20;
    flex-direction: column; align-items: stretch; gap: 0; padding: 20px 14px;
    background: linear-gradient(180deg, #0c1119, #0a0e14); border-bottom: 0; border-right: 1px solid var(--line); overflow-y: auto;
  }
  .top .brand { padding: 4px 8px 22px; font-size: 17px; }
  .top .brand img { width: 32px; height: 32px; }
  .top nav { flex-direction: column; flex: none; gap: 2px; overflow: visible; }
  .top nav a { padding: 9px 10px; font-weight: 500; }
  .top nav a:hover { background: var(--panel); }
  .top nav a.on { background: linear-gradient(90deg, rgba(255,200,87,.14), rgba(255,200,87,.02)); box-shadow: inset 2px 0 0 var(--gold); }
  .top nav .pf-sections { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 18px; padding-left: 8px; border-left: 1px solid var(--line-2); }
  .top nav .pf-sections a { padding: 7px 10px; font-size: 13.5px; }
  .top nav .pf-sections a.on { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--gold); }
  .subnav { display: none; }
  .me { flex-direction: column; align-items: stretch; gap: 10px; margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); white-space: normal; font-size: 12.5px; }
  .me a.who { border-radius: 8px; padding: 4px; margin: 0 -4px; }
  .me a.who:hover { background: var(--panel); text-decoration: none; }
  .me form { align-self: flex-start; }
  main { padding: 26px 32px 60px; }
  .side-toggle.side-hide { display: block; position: absolute; top: 22px; right: 10px; }
  body.side-hidden { padding-left: 0; }
  body.side-hidden .top { display: none; }
  body.side-hidden .side-toggle.side-show { display: block; position: fixed; top: 14px; left: 14px; z-index: 30; }
  body.side-hidden .side-show button { background: var(--panel); border-color: var(--line-2); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
  body.side-hidden main { padding-left: 64px; max-width: 1600px; }
}
@media print { .mbar-title, .mbar-menu, .scrim, .topmenu .menu-close { display: none !important; } }

/* List tables as cards on phones (plan 0048): one card per row; each cell
   shows its column's name (data-label, copied from the header when the
   templates load). The first cell is the card's title. */
@media (max-width: 639px) {
  table.cards, table.cards tbody { display: block; width: 100%; }
  table.cards thead { display: none; }
  table.cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  table.cards tr:last-child { border-bottom: 0; }
  table.cards td, table.compact.cards td { display: block; min-width: 0; padding: 0; border: 0; text-align: left; overflow-wrap: anywhere; }
  table.cards td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--dim); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
  table.cards td:first-child::before, table.cards td[data-label=""]::before, table.cards td:not([data-label])::before { display: none; }
  table.cards td:first-child, table.cards td.wide, table.cards td[colspan], table.cards td:has(form, button, textarea) { grid-column: 1 / -1; }
  table.cards td:empty, table.cards .ph-hide { display: none; }
  table.cards tr.dim td { opacity: .6; }
}

/* A sign-in-style page with the card alone (Pathfinder's signed-out page). */
.login-wrap.one { grid-template-columns: 1fr; }
.login-card > a.btn { display: block; text-align: center; text-decoration: none; }

/* Detection packs (plan 0050): tabs, the pipeline strip, next steps, glossary. */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 16px; border-bottom: 1px solid var(--line); }
.tabs a { color: var(--muted); padding: 7px 12px; border-radius: 8px 8px 0 0; font-size: 14px; }
.tabs a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); box-shadow: inset 0 -2px 0 var(--gold); }
.tabs a.tabs-aside { margin-left: auto; font-size: 13px; }
.pipe { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.pipe li { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); position: relative; min-width: 0; overflow-wrap: anywhere; }
.pipe li:not(:last-child)::after { content: "›"; position: absolute; right: -9px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.nextsteps ul { margin: 0; padding-left: 18px; }
.nextsteps li { margin: 4px 0; }
.nextsteps li.act::marker { color: var(--gold); }
.glossary dt { font-weight: 650; margin-top: 8px; }
.glossary dd { margin: 2px 0 0; color: var(--muted); }
ol.steps li { margin: 8px 0; }
@media (max-width: 760px) {
  .pipe { grid-template-columns: 1fr 1fr; }
  .pipe li::after { display: none; }
  .tabs a.tabs-aside { margin-left: 0; }
}

/* Settings (plan 0057): sections down the side, a row along the top on phones. */
.set-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; align-items: start; }
.set-nav { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.set-nav a { padding: 7px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.set-nav a:hover { color: var(--text); background: var(--panel-2); }
.set-nav a.on { color: var(--text); background: var(--panel-2); box-shadow: inset 2px 0 0 var(--gold); }
.set-nav .set-out { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.set-main { min-width: 0; }
.set-search { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.set-search input[type=search] { flex: 1 1 240px; min-width: 0; }
.set-title { margin: 0 0 4px; }
.set-rows td:first-child { max-width: 420px; }
.pill.changed { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.danger-zone { border-color: color-mix(in srgb, var(--critical) 45%, var(--line)); }
.danger-zone h2 { color: var(--critical); }
@media (max-width: 900px) {
  .set-layout { grid-template-columns: 1fr; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; padding: 6px; }
  .set-nav a { white-space: nowrap; }
  .set-nav a.on { box-shadow: inset 0 -2px 0 var(--gold); }
  .set-nav .set-out { margin: 0; border: 0; padding-top: 7px; }
}

/* Breathing room: a warning right under a form, and buttons in a row. */
form + .flash, .row + .flash { margin-top: 12px; }
.run-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.run-buttons form.inline { margin: 0; }
.card form.inline + p { margin-top: 10px; }

/* The version at the foot of the menu, as in Obelsk. */
.me .me-version { font-size: 12px; }
@media (min-width: 1024px) { .me .me-version { display: block; } }
.set-search.row { align-items: center; }
.set-search label.check { margin: 0; align-self: center; }
/* The avatar keeps its centred letter wherever the menu shows it. */
.me span.avatar { display: grid; place-items: center; line-height: 1; }

/* The Settings bar (plan 0058): the foot of a page, opening downwards. */
.setbar { margin-top: 24px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); }
.setbar > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 18px; font-weight: 600; border-radius: var(--radius); }
.setbar > summary::-webkit-details-marker { display: none; }
.setbar > summary:hover { background: var(--panel-2); }
.setbar > summary svg { width: 18px; height: 18px; color: var(--gold); flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.setbar-hint { color: var(--muted); font-weight: 400; font-size: 13px; }
.setbar-chev { margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.setbar[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.setbar[open] .setbar-chev { transform: rotate(-135deg); margin-top: 4px; }
.setbar-body { padding: 16px; }
.setbar-body > .card:last-child, .setbar-body > .grid2:last-child { margin-bottom: 0; }
/* A Change button lands on its card: show which one (below the sticky top bar). */
.card:target, section:target, form:target { outline: 2px solid var(--gold); outline-offset: 3px; scroll-margin-top: 80px; }

/* Settings tables with a control in a row: cells centred, the control and its button side by side. */
table.mid td { vertical-align: middle; }
table.mid select { width: 100%; max-width: 420px; }
table.mid td > .dim.small { margin-top: 4px; }
.inline-edit { display: flex; align-items: center; gap: 8px; margin: 0; flex-wrap: wrap; }
.inline-edit input[type=number] { width: 110px; }
.inline-edit + form.inline { margin-top: 6px; }
table.mid + p { margin-top: 14px; }

/* Plan 0058, as revised: collapsible tiles and stacked Settings sections. */
details.fold > summary { list-style: none; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
.tile-h { display: flex; align-items: center; gap: 12px; }
.tile-h h2 { margin: 0; }
details.fold[open] > .tile-h { margin-bottom: 12px; }
.tile-chev { margin-left: auto; flex: none; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details[open] > summary > .tile-chev { transform: rotate(-135deg); margin-top: 4px; }
.set-sec { margin-bottom: 14px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); }
.set-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); }
.set-sec > summary::-webkit-details-marker { display: none; }
.set-sec > summary:hover { background: var(--panel-2); }
.set-sec-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-sec-t b { font-size: 16px; }
.set-sec[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.set-sec-body { padding: 16px 16px 2px; }
/* Tiles side by side are the same height, titles level. */
.grid2 { align-items: stretch; margin-bottom: 16px; }
.grid2 > .card { height: 100%; margin-bottom: 0; }
.grid2 > .card > h2:first-child, .grid2 > .card > .tile-h:first-child { margin-top: 0; }

/* A tile's settings status: value, default, who changed it last. */
.tile-meta { list-style: none; margin: 0 0 12px; padding: 0; font-size: 13px; }
.tile-meta li { margin: 2px 0; overflow-wrap: anywhere; }
#switches { margin-top: 12px; }
