/* ==========================================================================
   status monitor — styled after a nuclear station control board.
   Seafoam painted steel, tan bakelite sub-panels, engraved laminate
   nameplates, domed indicator lamps, chrome bezels, phosphor strip charts.
   ========================================================================== */

:root {
  /* Painted steel — the console body. */
  --steel:        #7ea9a2;
  --steel-lit:    #9cc2bb;
  --steel-dim:    #628d87;
  --steel-deep:   #4a6f6a;
  --room:         #2b3f3d;

  /* Tan bakelite sub-panel, as on the older board. */
  --bakelite:     #b4a07b;
  --bakelite-dim: #96835f;
  --bakelite-lit: #cbb894;

  /* Engraved laminate nameplates. */
  --plate:        #eeece1;
  --plate-edge:   #b9b7ac;
  --plate-ink:    #14100c;
  --plate-dark:   #1c1c1a;

  /* Indicator lamps. */
  --lamp-green:   #34e05c;
  --lamp-red:     #ff3a30;
  --lamp-amber:   #ffb020;
  --lamp-white:   #f4f0dd;
  --lamp-off:     #3a423f;

  /* Recessed phosphor screen. */
  --crt-bg:       #07130d;
  --crt-grid:     #123a26;
  --crt-trace:    #56ff96;
  --crt-fail:     #ff3a30;

  --chrome-hi:    #f6f6f2;
  --chrome-lo:    #74746e;

  --font-label: "Helvetica Neue", "Arial Narrow", "Liberation Sans Narrow", Arial, sans-serif;
  --font-digit: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --gap: 18px;
  --radius: 4px;
}

/* Painted metal: a fine speckle over the base colour so large flat areas
   read as sprayed steel rather than as a CSS background. */
:root {
  --grain: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'>\
<filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/>\
<feColorMatrix type='saturate' values='0'/></filter>\
<rect width='140' height='140' filter='url(%23n)' opacity='0.24'/></svg>");
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-label);
  color: var(--plate-ink);
  background:
    var(--grain),
    radial-gradient(120% 90% at 50% -10%, var(--steel-lit), var(--steel) 45%, var(--steel-dim) 100%);
  background-blend-mode: soft-light, normal;
}

[x-cloak] { display: none !important; }

/* --------------------------------------------------------------------------
   Shared console furniture
   -------------------------------------------------------------------------- */

/* Bevelled panel edge: light from above, shadow below, thin dark seam. */
.beveled {
  border-radius: var(--radius);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .45),
    inset 0 -1px 0 rgba(0, 0, 0, .3),
    inset 1px 0 0 rgba(255, 255, 255, .12),
    inset -1px 0 0 rgba(0, 0, 0, .18),
    0 2px 5px rgba(0, 0, 0, .3);
}

/* Slotted panel screws, one per corner, each turned a different way. */
.screwed { position: relative; }
.screwed::before,
.screwed::after,
.screws::before,
.screws::after {
  content: "";
  position: absolute;
  width: 11px; height: 11px;
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255,255,255,.7), rgba(0,0,0,.35)),
    radial-gradient(circle at 35% 30%, #cfd3d0, #6f7a76 65%, #4c5653);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 1px 1px rgba(255,255,255,.25);
}
.screwed::before { top: 7px; left: 7px; }
.screwed::after  { top: 7px; right: 7px; }
.screws { position: absolute; inset: 0; pointer-events: none; }
.screws::before { bottom: 7px; left: 7px; }
.screws::after  { bottom: 7px; right: 7px; }
/* The slot itself, drawn as a hairline through the head. */
.screwed::before, .screws::after { background-image:
    linear-gradient(74deg, transparent 44%, rgba(0,0,0,.55) 44%, rgba(0,0,0,.55) 56%, transparent 56%),
    radial-gradient(circle at 35% 30%, #cfd3d0, #6f7a76 65%, #4c5653); }
.screwed::after, .screws::before { background-image:
    linear-gradient(18deg, transparent 44%, rgba(0,0,0,.55) 44%, rgba(0,0,0,.55) 56%, transparent 56%),
    radial-gradient(circle at 35% 30%, #cfd3d0, #6f7a76 65%, #4c5653); }

/* Engraved laminate nameplate — white core, black legend, chamfered edge. */
.plate {
  display: inline-block;
  padding: 3px 9px 4px;
  background: linear-gradient(180deg, #fbfaf3, var(--plate) 55%, #dedcd0);
  color: var(--plate-ink);
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  line-height: 1.15;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 -1px 0 var(--plate-edge),
    0 1px 2px rgba(0, 0, 0, .45);
}
.plate.dark {
  background: linear-gradient(180deg, #3a3a37, var(--plate-dark) 60%, #0f0f0e);
  color: #f2efe2;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 2px rgba(0,0,0,.5);
}
.plate.small { font-size: 9.5px; padding: 2px 6px 3px; letter-spacing: .1em; }

/* Recessed digital window — the little readouts under each label. */
.readout {
  background: linear-gradient(180deg, #0b1512, #10201b);
  color: var(--lamp-amber);
  font-family: var(--font-digit);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  padding: 5px 8px;
  border-radius: 2px;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, .8),
    inset 0 -1px 0 rgba(255, 255, 255, .07),
    0 1px 0 rgba(255, 255, 255, .3);
  text-shadow: 0 0 6px rgba(255, 176, 32, .45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.readout.green { color: var(--lamp-green); text-shadow: 0 0 6px rgba(52, 224, 92, .4); }
.readout.red   { color: #ff6a60;           text-shadow: 0 0 6px rgba(255, 58, 48, .45); }
.readout.dim   { color: #7f938a;           text-shadow: none; }

/* Domed indicator lamp. Dark and glassy when out; lit from within when on. */
.lamp {
  width: 17px; height: 17px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.5), transparent 42%),
    radial-gradient(circle at 50% 55%, var(--lamp-off), #202624 75%);
  box-shadow:
    inset 0 0 3px rgba(0,0,0,.8),
    0 0 0 3px #23292a,
    0 0 0 4px rgba(255,255,255,.22),
    0 1px 2px rgba(0,0,0,.5);
  flex: none;
}
.lamp.on {
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.85), transparent 45%),
    radial-gradient(circle at 50% 55%, var(--c), color-mix(in srgb, var(--c) 55%, #000) 78%);
  box-shadow:
    inset 0 0 4px rgba(255,255,255,.5),
    0 0 0 3px #23292a,
    0 0 0 4px rgba(255,255,255,.22),
    0 0 14px 2px color-mix(in srgb, var(--c) 60%, transparent),
    0 1px 2px rgba(0,0,0,.5);
}
.lamp.green { --c: var(--lamp-green); }
.lamp.red   { --c: var(--lamp-red); }
.lamp.amber { --c: var(--lamp-amber); }
.lamp.white { --c: var(--lamp-white); }
.lamp.big   { width: 22px; height: 22px; }

/* An alarm lamp flashes until it is acknowledged — every board has one. */
@keyframes flash { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .28; } }
.lamp.flash { animation: flash 1.1s steps(1, end) infinite; }
@media (prefers-reduced-motion: reduce) { .lamp.flash { animation: none; } }

/* Chunky illuminated pushbutton. */
.button {
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #101413;
  padding: 9px 14px;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  background: linear-gradient(180deg, #e6e3d6, #c9c5b5 52%, #a5a294);
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 -2px 0 rgba(0,0,0,.25),
    0 2px 0 #6c6f6a,
    0 3px 6px rgba(0,0,0,.4);
  transition: transform .05s linear, box-shadow .05s linear;
}
.button:hover { background: linear-gradient(180deg, #f1eee1, #d3cfbf 52%, #adaa9c); }
.button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.45), 0 1px 0 #6c6f6a;
}
.button:disabled { opacity: .5; cursor: not-allowed; }
.button.hot {
  background: linear-gradient(180deg, #ff6b5f, #d8281c 52%, #a51b12);
  color: #fff3ef;
  text-shadow: 0 1px 1px rgba(0,0,0,.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -2px 0 rgba(0,0,0,.3),
              0 2px 0 #5f120c, 0 3px 8px rgba(0,0,0,.45);
}
.button.hot:hover { background: linear-gradient(180deg, #ff7f74, #e63023 52%, #b21f15); }
.button.go {
  background: linear-gradient(180deg, #6ff08c, #23b545 52%, #157e2f);
  color: #06210e;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -2px 0 rgba(0,0,0,.28),
              0 2px 0 #0d5a22, 0 3px 8px rgba(0,0,0,.4);
}
.button.small { padding: 6px 10px; font-size: 10px; letter-spacing: .1em; }

/* --------------------------------------------------------------------------
   Console header rail
   -------------------------------------------------------------------------- */

.console-head {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  padding: 12px 22px;
  background:
    var(--grain),
    linear-gradient(180deg, #3d5754, #2b3f3d 60%, #223231);
  background-blend-mode: overlay, normal;
  border-bottom: 3px solid #16211f;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}

.unit-mark {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.unit-mark .designation {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #dfe7e3;
  text-shadow: 0 2px 0 rgba(0,0,0,.6);
}
/* The stencilled bay number bolted to the end of the desk. */
.bay-number {
  display: flex;
  gap: 3px;
}
.bay-number span {
  background: linear-gradient(180deg, #fdfcf5, #e3e1d4);
  color: #101010;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 6px 5px;
  border-radius: 2px;
  box-shadow: inset 0 -1px 0 #b7b5aa, 0 1px 2px rgba(0,0,0,.6);
}

.head-spacer { flex: 1 1 auto; }

.head-cluster {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 7px 14px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(0,0,0,.22));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.head-cluster .tally {
  display: flex;
  align-items: center;
  gap: 7px;
}
.head-cluster .tally-count {
  font-family: var(--font-digit);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: #d7e2dd;
  min-width: 1.4em;
}
.head-cluster .tally-label {
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #8fa39d;
}

.master-clock {
  font-family: var(--font-digit);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--lamp-green);
  text-shadow: 0 0 8px rgba(52,224,92,.4);
  background: #08120e;
  padding: 6px 12px;
  border-radius: 3px;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.85), 0 1px 0 rgba(255,255,255,.14);
}

.head-link {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #9fb4ae;
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.head-link:hover { color: #e4efea; border-bottom-color: var(--lamp-amber); }

/* --------------------------------------------------------------------------
   Master annunciator: the big banner across the top of every control room
   -------------------------------------------------------------------------- */

.annunciator {
  margin: var(--gap) var(--gap) 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #26302f, #171f1e);
  box-shadow: inset 0 0 0 2px #0d1413, 0 3px 10px rgba(0,0,0,.4);
}
/* Each window is a backlit legend tile: dark until its condition is true. */
.annunciator .window {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  line-height: 1.3;
  color: #55625e;
  background: linear-gradient(180deg, #2f3a38, #1d2624);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), inset 0 2px 5px rgba(0,0,0,.5);
}
.annunciator .window.lit {
  color: #0e1210;
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 88%, #fff), var(--c));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 0 18px color-mix(in srgb, var(--c) 45%, transparent);
}
.annunciator .window.green { --c: #4ee06a; }
.annunciator .window.red   { --c: #ff4438; }
.annunciator .window.amber { --c: #ffb524; }
.annunciator .window.white { --c: #ece7d2; }
.annunciator .window.lit.flash { animation: flash 1.1s steps(1, end) infinite; }
@media (prefers-reduced-motion: reduce) { .annunciator .window.lit.flash { animation: none; } }

/* --------------------------------------------------------------------------
   The board: one module per monitored site
   -------------------------------------------------------------------------- */

.board {
  display: grid;
  /* min(360px, 100%) rather than a bare 360px: on a 375px phone a hard
     360px minimum plus the page padding overflows, and the whole board
     scrolls sideways. Modules carry min-width:0 for the same reason. */
  grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
  gap: var(--gap);
  padding: var(--gap);
  align-items: start;
}

.module {
  position: relative;
  min-width: 0;
  padding: 16px 16px 14px;
  border-radius: var(--radius);
  background:
    var(--grain),
    linear-gradient(180deg, var(--bakelite-lit), var(--bakelite) 22%, var(--bakelite-dim));
  background-blend-mode: overlay, normal;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    inset 0 -2px 0 rgba(0,0,0,.28),
    inset 0 0 0 1px rgba(0,0,0,.22),
    0 4px 12px rgba(0,0,0,.35);
}
/* A module with an active alarm gets a red surround, like a taped-off panel.
   It breathes, slowly, so a faulted circuit is findable from across the room
   without the whole board turning into a fairground. */
.module.alarm {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    inset 0 -2px 0 rgba(0,0,0,.28),
    inset 0 0 0 3px rgba(226, 46, 32, .95),
    0 0 26px rgba(226, 46, 32, .45),
    0 4px 12px rgba(0,0,0,.35);
  animation: alarm-breathe 2.4s ease-in-out infinite;
}
@keyframes alarm-breathe {
  50% { box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    inset 0 -2px 0 rgba(0,0,0,.28),
    inset 0 0 0 3px rgba(226, 46, 32, .95),
    0 0 8px rgba(226, 46, 32, .18),
    0 4px 12px rgba(0,0,0,.35); }
}
@media (prefers-reduced-motion: reduce) { .module.alarm { animation: none; } }
.module.paused { filter: saturate(.55); }

.module-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding-left: 14px;   /* clear of the corner screws */
  padding-right: 14px;
}
.module-head .titles { min-width: 0; flex: 1; }
.module-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  letter-spacing: .15em;
}
.module-url {
  display: block;
  margin-top: 6px;
  font-family: var(--font-digit);
  font-size: 11px;
  color: #3f3623;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.module-url:hover { color: #14100c; text-decoration: underline; }

/* Vertical lamp stack on the right of the nameplate, with etched legends. */
.lamp-stack {
  display: grid;
  grid-template-columns: auto auto;
  /* The lamps' chrome bezel is drawn with box-shadow, which sits outside the
     17px layout box by 4px on every side. A row gap under 8px therefore has
     neighbouring bezels touching even though the boxes do not. */
  gap: 12px 7px;
  align-items: center;
  padding: 9px 9px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(0,0,0,.16), rgba(255,255,255,.1));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.2);
}
.lamp-stack .legend {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #3d3524;
}

/* Chart speed selector — a strip of small detent buttons above the screen. */
.span-select {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.span-buttons {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .28);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 255, 255, .25);
}
.span-btn {
  font-family: var(--font-digit);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  padding: 4px 6px;
  min-width: 30px;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  color: #b9c6c0;
  background: linear-gradient(180deg, #3d4744, #232b29);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 1px rgba(0, 0, 0, .45);
}
.span-btn:hover { color: #f0f5f2; background: linear-gradient(180deg, #4a5551, #2b3432); }
/* The selected detent is lit, like every other selected control on the board. */
.span-btn.on {
  color: #201607;
  background: linear-gradient(180deg, #ffd583, #f0a81c);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .6),
    inset 0 -1px 0 rgba(0, 0, 0, .28),
    0 0 9px rgba(255, 176, 32, .5);
}
.span-btn:focus-visible { outline: 2px solid var(--lamp-amber); outline-offset: 1px; }

/* The strip-chart recorder window. */
.chart {
  position: relative;
  margin: 8px 0 12px;
  padding: 6px;
  border-radius: 3px;
  /* Chrome bezel around a deeply recessed screen. */
  background: linear-gradient(180deg, var(--chrome-hi), #b9b9b2 40%, var(--chrome-lo));
  box-shadow: 0 1px 3px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.8);
}
.chart-screen {
  position: relative;
  display: block;
  width: 100%;
  height: 108px;
  border-radius: 2px;
  background: var(--crt-bg);
  box-shadow: inset 0 3px 10px rgba(0,0,0,.9), inset 0 0 30px rgba(0,0,0,.6);
  overflow: hidden;
}
.chart-screen svg { display: block; width: 100%; height: 100%; }
.chart-scale {
  position: absolute;
  top: 4px; left: 7px;
  font-family: var(--font-digit);
  font-size: 9px;
  color: #3f7a5c;
  pointer-events: none;
}
.chart-span {
  position: absolute;
  bottom: 3px; right: 7px;
  font-family: var(--font-digit);
  font-size: 9px;
  color: #3f7a5c;
  pointer-events: none;
}
.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #2f6b4d;
}

/* The block of engraved plates + readouts under the chart. */
.gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 8px 10px;
}
.gauge { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.gauge > .plate { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.gauge .readout { width: 100%; }

.module-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  padding-top: 12px;
  /* Clear of the bottom corner screws, which are positioned 7px in and are
     11px across — so they reach 18px into a panel whose own padding is only
     16px. Same allowance .module-head makes for the top pair. The border-top
     still spans the full inner width; only the buttons indent. */
  padding-left: 14px;
  padding-right: 14px;
  padding-bottom: 2px;
  border-top: 1px solid rgba(0,0,0,.22);
  box-shadow: 0 -1px 0 rgba(255,255,255,.28);
  flex-wrap: wrap;
}
.module-foot .spacer { flex: 1; }

/* --------------------------------------------------------------------------
   Empty board + the add control
   -------------------------------------------------------------------------- */

.add-module {
  display: grid;
  place-content: center;
  gap: 14px;
  justify-items: center;
  min-height: 260px;
  padding: 24px;
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(45deg,
      rgba(255, 200, 40, .16) 0 14px, rgba(0, 0, 0, .12) 14px 28px),
    linear-gradient(180deg, var(--steel-lit), var(--steel-dim));
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.4);
}
.add-module .hint {
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #223734;
  text-align: center;
  max-width: 24ch;
  line-height: 1.6;
}

/* The big round key switch that opens the registration panel. */
.key-switch {
  width: 76px; height: 76px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 34px;
  font-weight: 300;
  line-height: 1;
  color: #eef3f0;
  background:
    radial-gradient(circle at 38% 28%, #6d7a76, #38423f 60%, #1d2422);
  box-shadow:
    0 0 0 5px #cdd2ce,
    0 0 0 7px #7e8783,
    inset 0 2px 3px rgba(255,255,255,.3),
    inset 0 -3px 6px rgba(0,0,0,.6),
    0 5px 12px rgba(0,0,0,.45);
  transition: transform .08s linear;
}
.key-switch:hover { color: var(--lamp-amber); }
.key-switch:active { transform: translateY(2px); }

/* --------------------------------------------------------------------------
   Overlay: the maintenance panel that swings out over the board
   -------------------------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 16, 15, .72);
  backdrop-filter: blur(2px);
  overflow-y: auto;
}
.dialog {
  position: relative;
  width: min(560px, 100%);
  padding: 22px 24px 20px;
  border-radius: var(--radius);
  background:
    var(--grain),
    linear-gradient(180deg, var(--steel-lit), var(--steel) 30%, var(--steel-dim));
  background-blend-mode: overlay, normal;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    inset 0 0 0 1px rgba(0,0,0,.25),
    0 20px 50px rgba(0,0,0,.6);
}
.dialog-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(0,0,0,.25);
  box-shadow: 0 1px 0 rgba(255,255,255,.3);
}
.dialog-head .plate { font-size: 12px; }

.field-grid { display: grid; gap: 13px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

label.field { display: grid; gap: 5px; }
label.field > .plate { justify-self: start; }

/* Recessed input, like a paper tag slotted into the panel. */
.input {
  width: 100%;
  font-family: var(--font-digit);
  font-size: 13px;
  color: #101a17;
  padding: 8px 10px;
  border: 0;
  border-radius: 2px;
  background: linear-gradient(180deg, #dcdccf, #efeee3 25%);
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,.35),
    inset 0 -1px 0 rgba(255,255,255,.7),
    0 1px 0 rgba(255,255,255,.35);
}
.input:focus {
  outline: 0;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,.35),
    0 0 0 2px var(--lamp-amber),
    0 0 12px rgba(255,176,32,.5);
}
select.input { font-family: var(--font-label); letter-spacing: .08em; text-transform: uppercase; font-size: 11px; font-weight: 700; }

.field-note {
  font-family: var(--font-digit);
  font-size: 10px;
  color: #253a37;
  line-height: 1.5;
}

/* Toggle rendered as a two-position panel switch. */
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .bat {
  position: relative;
  width: 38px; height: 20px;
  border-radius: 10px;
  background: linear-gradient(180deg, #2b3331, #454e4b);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.3);
  flex: none;
}
.toggle .bat::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f3f3ee, #a8aca8 70%, #7c817d);
  box-shadow: 0 1px 2px rgba(0,0,0,.6);
  transition: transform .12s ease-out;
}
.toggle input:checked + .bat { background: linear-gradient(180deg, #14682b, #1f9c40); }
.toggle input:checked + .bat::after { transform: translateX(18px); }
.toggle input:focus-visible + .bat { box-shadow: inset 0 2px 4px rgba(0,0,0,.7), 0 0 0 2px var(--lamp-amber); }
.toggle .legend {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #16211f;
}

.advanced {
  margin-top: 4px;
  padding: 14px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .12);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
  display: grid;
  gap: 13px;
}
.advanced-toggle {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: #1c2c2a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dialog-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(0,0,0,.25);
  box-shadow: 0 -1px 0 rgba(255,255,255,.3);
}
.dialog-foot .spacer { flex: 1; }

/* Fault legend — the red-bordered strip an error appears in. */
.fault {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 2px;
  font-family: var(--font-digit);
  font-size: 11.5px;
  line-height: 1.4;
  color: #ffe3e0;
  background: linear-gradient(180deg, #7d1c14, #571009);
  box-shadow: inset 0 0 0 1px rgba(255,120,110,.5), 0 1px 3px rgba(0,0,0,.5);
}

/* --------------------------------------------------------------------------
   Login + settings
   -------------------------------------------------------------------------- */

.centered {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.console-panel {
  position: relative;
  width: min(430px, 100%);
  padding: 26px 26px 22px;
  border-radius: var(--radius);
  background:
    var(--grain),
    linear-gradient(180deg, var(--steel-lit), var(--steel) 28%, var(--steel-dim));
  background-blend-mode: overlay, normal;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    inset 0 0 0 1px rgba(0,0,0,.25),
    0 12px 34px rgba(0,0,0,.5);
}
.console-panel .stack { display: grid; gap: 14px; }
.console-panel .stack > .plate { justify-self: start; }
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 9.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #24403c;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(180deg, rgba(0,0,0,.3), rgba(255,255,255,.35));
}

.settings-page { max-width: 860px; margin: 0 auto; padding: var(--gap); display: grid; gap: var(--gap); }
.section {
  position: relative;
  padding: 20px;
  border-radius: var(--radius);
  background:
    var(--grain),
    linear-gradient(180deg, var(--bakelite-lit), var(--bakelite) 22%, var(--bakelite-dim));
  background-blend-mode: overlay, normal;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    inset 0 0 0 1px rgba(0,0,0,.22),
    0 4px 12px rgba(0,0,0,.3);
}
.section > .plate { margin-bottom: 16px; }
.section .body { display: grid; gap: 13px; padding: 0 12px; }
.spec-list { display: grid; gap: 7px; }
.spec {
  display: grid;
  grid-template-columns: minmax(150px, auto) 1fr;
  gap: 12px;
  align-items: center;
}
.spec .plate { justify-self: start; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row .spacer { flex: 1; }

.cred-list { display: grid; gap: 8px; }
.cred {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 3px;
  background: rgba(0,0,0,.14);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
}
.cred .who { font-family: var(--font-digit); font-size: 12px; color: #241d10; }
.cred .when { font-family: var(--font-digit); font-size: 10px; color: #4d4432; }

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: grid;
  gap: 8px;
  justify-items: center;
}
.toast {
  padding: 10px 18px;
  border-radius: 3px;
  font-family: var(--font-digit);
  font-size: 12px;
  color: #d9f5e4;
  background: linear-gradient(180deg, #24302c, #131b19);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 6px 18px rgba(0,0,0,.5);
}
.toast.bad { color: #ffdedb; background: linear-gradient(180deg, #7d1c14, #4d0e08); }

/* --------------------------------------------------------------------------
   Narrow screens: the desk folds to one column
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  :root { --gap: 12px; }
  .field-grid.two { grid-template-columns: minmax(0, 1fr); }
  .console-head { gap: 10px 14px; padding: 10px 14px; }
  .unit-mark .designation { font-size: 18px; }
  .spec { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .module, .dialog, .section { padding-left: 13px; padding-right: 13px; }
}
