/* AllowID site console — the layer on top of the brand.
   ==========================================================================
   Loaded after /static/brand/brand.css, which carries the palette, Inter and
   every primitive shared with the other surfaces. This file is only what is
   true about THIS console.

   Light, standard density (--type-base 15px). It runs on the customer's LAN,
   on a controller beside a door, and it has to work with the internet down —
   so nothing here loads from anywhere but this origin.
   ========================================================================== */

:root { --type-base: 15px; }

header.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
header.top .bar {
  display: flex; align-items: center; gap: 1.25rem;
  padding: .7rem 1.5rem; max-width: 1280px; margin: 0 auto;
}
header.top nav { display: flex; gap: 1rem; flex-wrap: wrap; flex: 1; }
header.top nav a {
  color: var(--ink); text-decoration: none; font-size: .94em;
  padding-bottom: 3px; border-bottom: 2px solid transparent;
}
header.top nav a:hover { text-decoration: none; border-bottom-color: var(--line-strong); }
header.top nav a.on { border-bottom-color: var(--accent); font-weight: 600; }
header.top .who {
  color: var(--ink-muted); font-size: .84em; text-align: right;
  white-space: nowrap; line-height: 1.5;
}
main { padding: 1.5rem; max-width: 1280px; margin: 0 auto; }

h1 { font-size: 1.47em; margin: 0 0 .3rem; font-weight: 650; letter-spacing: -.012em; }
h2 { font-size: 1.07em; margin: 1.8rem 0 .7rem; font-weight: 650; }
h3 {
  font-size: .8em; margin: 1.2rem 0 .4rem; font-weight: 650;
  color: var(--ink-muted); text-transform: uppercase; letter-spacing: .07em;
}
p.lede { color: var(--ink-muted); margin: 0 0 1.4rem; max-width: 74ch; }
.note { font-size: .87em; color: var(--ink-muted); max-width: 74ch; }

.panel { padding: 1.1rem 1.25rem; margin-bottom: 1.1rem; }
.panel.tight { padding: .7rem .9rem; }
.grid { display: grid; gap: .8rem; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-card); padding: .85rem 1rem;
}
.stat .n { font: 650 1.73em/1.1 var(--font-mono); font-variant-numeric: tabular-nums; }
.stat .k { color: var(--ink-muted); font-size: .84em; margin-top: .25rem; }
.stat.bad .n { color: var(--bad); }
.stat.ok  .n { color: var(--ok); }

/* Tables scroll inside their own container; the page never scrolls sideways. */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { font-size: .94em; width: 100%; }
th { text-align: left; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
code, .mono { font-size: .87em; font-family: var(--font-mono); }

form.inline { display: inline; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.row label { display: block; font-size: .84em; color: var(--ink-muted); }
label.field { display: block; margin-bottom: .55rem; font-size: .87em; color: var(--ink-muted); }
label.field input, label.field select, label.field textarea { width: 100%; }

/* A recovery session looks different from every other session, on every page.
   Somebody who forgets which kind of session they are in will try to do
   something a recovery session must not do. */
.recovery-band {
  background: var(--warn-bg); border-bottom: 1px solid var(--warn-line);
  color: var(--ink); padding: .45rem 1.5rem; font-size: .87em;
}

/* Secrets shown exactly once. */
.secrets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .5rem; margin: 1rem 0; }
.secrets code {
  display: block; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: .6rem .7rem; font-size: 1em;
  letter-spacing: .04em; text-align: center; user-select: all;
}

/* The decision chain. Colour is never the only signal: each step carries a
   word as well as a mark. */
ol.chain { list-style: none; padding: 0; margin: .6rem 0; }
ol.chain li {
  padding: .55rem .7rem .55rem 2.2rem; position: relative;
  border-left: 2px solid var(--line); margin-left: .6rem;
}
ol.chain li::before {
  position: absolute; left: -.62rem; top: .55rem;
  width: 1.1rem; height: 1.1rem; border-radius: 50%;
  display: grid; place-items: center; font-size: .72em; font-weight: 700;
  background: var(--surface); border: 1px solid var(--line);
}
ol.chain li.yes::before { content: "✓"; background: var(--ok); color: var(--brand-white); border-color: var(--ok); }
ol.chain li.no::before  { content: "✗"; background: var(--bad); color: var(--brand-white); border-color: var(--bad); }
ol.chain li .verdict { font-size: .8em; color: var(--ink-muted); margin-left: .4rem; }

.enrol-panel { border: 1px solid var(--accent); border-radius: var(--r-md); padding: .9rem 1rem; background: var(--surface); }
.enrol-panel .stage { font-weight: 650; font-size: 1.05em; }

.auth { max-width: 560px; margin: 6vh auto; }
header.top.plain .bar { padding: .9rem 1.5rem; }
header.top.plain .brandmark img { width: 2em; height: 2em; }

@media (max-width: 760px) {
  header.top .bar { flex-direction: column; align-items: flex-start; gap: .6rem; }
  header.top .who { text-align: left; }
  main { padding: 1rem; }
}

/* ==========================================================================
   Console layout, 2026-09-30 redesign: a rail of sections on the left, one
   work area on the right. Forms read top to bottom; lists scan left to right.
   The rail collapses to a top bar with a section menu on a phone.
   ========================================================================== */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.rail {
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; height: 100vh; overflow: auto;
}
.rail .brandmark img { width: 34px; height: 34px; border-radius: 8px; }
.rail .brandmark { gap: 10px; text-decoration: none; }
.rail .wordmark { font-size: 17px; }
.rail .surface-name { display: block; font-size: 12px; margin: 0; }
.rail .site { font-size: 13px; color: var(--ink-muted); padding: 8px 10px; background: var(--surface-2); border-radius: var(--r-sm); }
.rail .site b { color: var(--ink); }
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail .navhead { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; margin: 12px 10px 4px; }
.rail nav a {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--r-sm); color: var(--ink-muted);
  font-weight: 500; text-decoration: none;
}
.rail .navgroup summary {
  display: flex; align-items: center; gap: 8px;
  list-style: none; cursor: pointer; user-select: none;
  padding: 7px 10px; margin-top: 6px; border-radius: var(--r-sm);
  font-size: 11px; letter-spacing: .07em; text-transform: uppercase; font-weight: 600; color: var(--ink-faint);
}
.rail .navgroup summary::-webkit-details-marker { display: none; }
.rail .navgroup summary > span:first-child { flex: 1; }
.rail .navgroup summary::after {
  content: ""; width: 6px; height: 6px; margin: 0 2px 0 0;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s;
}
.rail .navgroup[open] summary::after { transform: rotate(45deg); }
.rail .navgroup summary:hover { background: var(--surface-2); color: var(--ink); }
.rail .navgroup summary .count { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--warn); font-weight: 650; }
.rail .navgroup[open] { padding-bottom: 4px; }
.rail .navgroup a { padding-left: 18px; }
.rail nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.rail nav a.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.rail nav a .count { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-faint); }
.rail nav a .count.warn { color: var(--warn); font-weight: 650; }
.rail .who { margin-top: auto; font-size: 13px; color: var(--ink-muted); border-top: 1px solid var(--line); padding-top: 12px; }
.rail .who b { color: var(--ink); }
.mobilebar { display: none; }
.work { padding-block: 26px 60px; padding-inline: clamp(16px, 3.5vw, 40px); min-width: 0; }
.work > .gradient-rule { margin: 0 0 18px; }
.work h1 { font-size: 1.65em; margin: 0 0 6px; text-wrap: balance; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.pagehead .lede { margin: 0 0 16px; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid2 > *, .stack > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 18px; }
.form .wide { grid-column: 1 / -1; }
.form label, label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-muted); min-width: 0; }
.form label .hint, .hint { font-weight: 400; color: var(--ink-faint); font-size: 12.5px; }
.form input, .form select, .form textarea { width: 100%; }
textarea.code { font-family: var(--font-mono); font-size: 13px; min-height: 110px; }
button.secondary, .button.secondary {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
}
button.secondary:hover { border-color: var(--accent); color: var(--accent-text); background: var(--surface); }
button.sm { padding: .25rem .6rem; font-size: 13px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
a.tile { display: block; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.tile:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); text-decoration: none; }
.tile .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .k { font-size: 12.5px; color: var(--ink-muted); font-weight: 500; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td a.rowlink { color: inherit; font-weight: 600; text-decoration: none; }
td a.rowlink:hover { color: var(--accent-text); text-decoration: underline; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 13.5px; font-weight: 600; margin: 1px 0; }
.chip.accent { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); }
.chip form { display: inline; }
.chip button { background: none; border: 0; padding: 0; color: inherit; font-weight: 700; cursor: pointer; line-height: 1; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ink-faint); vertical-align: middle; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.flow .arrow { color: var(--ink-faint); font-weight: 700; }
.sentence { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px 16px; align-items: start; }
.sentence > .k { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 650; padding-top: 6px; }
.checkgrid { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.checkgrid label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--ink); cursor: pointer; }
.actionitem { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; background: var(--surface); }
.step { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-muted); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg label { padding: 6px 13px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-muted); background: var(--surface); }
.seg label + label { border-left: 1px solid var(--line-strong); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent-soft); color: var(--accent-text); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; color: var(--ink); }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 18px; }
.ledgrid { display: grid; grid-template-columns: minmax(150px, 1.2fr) 1fr 1fr 44px; gap: 8px 12px; align-items: center; }
.ledgrid .h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 650; }
.led { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface-2); justify-self: center; }
.led.breathe { animation: led-breathe 2.4s ease-in-out infinite; }
.led.blink { animation: led-blink .9s steps(1) infinite; }
@keyframes led-breathe { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes led-blink { 0% { opacity: 1; } 50% { opacity: .08; } }
@media (prefers-reduced-motion: reduce) { .led.breathe, .led.blink { animation: none; } }
.ovr { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, 1.4fr) 120px; gap: 8px 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ovr:last-of-type { border-bottom: 0; }
.ovr .lab { font-weight: 600; font-size: 14px; }
.ovr .lab small { display: block; font-weight: 400; color: var(--ink-faint); font-size: 12.5px; }
.ovr label.inherit { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-faint); font-weight: 500; }
.ovr .inherited { opacity: .55; }
.typepick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.typepick a, .typepick label { border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); padding: 12px 14px; color: var(--ink); text-decoration: none; cursor: pointer; }
.typepick b { display: block; font-weight: 650; }
.typepick span { font-size: 12.5px; color: var(--ink-muted); }
.typepick .on, .typepick label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.typepick input { position: absolute; opacity: 0; pointer-events: none; }
.kv { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.result { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.vars { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.vars code { font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }
.big { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.week { display: grid; grid-template-columns: 52px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 11px; min-width: 560px; }
.week .d { font-weight: 600; color: var(--ink-muted); align-self: center; }
.week .c { height: 16px; background: var(--surface-2); border-radius: 2px; }
.week .c.on { background: var(--accent); }
.week .hr { color: var(--ink-faint); }
.scroll { overflow-x: auto; }
@media (max-width: 980px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .typepick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .mobilebar { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 16px; position: sticky; top: 0; z-index: 10; }
  .grid2 { grid-template-columns: 1fr; }
  .sentence { grid-template-columns: 1fr; gap: 4px; }
  .ovr { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .ledgrid { grid-template-columns: minmax(100px, 1fr) 1fr 1fr 34px; }
}

/* The brand styles typed inputs; an <input> with no type attribute is a text
   field too, and the date/time ones are used all over this console. */
input:not([type]), input[type=datetime-local], input[type=time], input[type=date], input[type=url] {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: .42rem .6rem; min-width: 0; max-width: 100%;
}
input:not([type]):focus, input[type=datetime-local]:focus, input[type=time]:focus, input[type=date]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form input:not([type]), .form input[type=datetime-local] { width: 100%; }
.actionitem.pick { grid-template-columns: minmax(0, 1fr) auto; }
.actionitem.pick label { display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--ink); cursor: pointer; }
.actionitem.pick .order { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-faint); }
.actionitem.pick .order input { width: 58px; padding: 4px 6px; }
.work { max-width: 1180px; margin: 0; }
/* The custom-colour picker only when "custom" is the chosen colour. */
select + input[type=color] { display: none; }
select:has(option[value="custom"]:checked) + input[type=color] { display: inline-block; }

/* Labels and divs here are flex/grid; the hidden attribute must still win. */
[hidden] { display: none !important; }
