/* ==========================================================================
   Console — the panel's whole visual system.

   World: rack-mounted control hardware under work light. Painted graphite steel,
   panels seated *into* the chassis with a hairline top-light edge and a title strip
   stamped across the top. Three state roles borrowed from real control rooms:
   signal green is nominal, sodium amber is attention and every primary control,
   crimson is owner-only and destructive. Data is monospaced with tabular figures
   because operators compare columns of numbers, not because it looks technical.

   Dark only, and not by category habit: the scene is one person at a desk at night
   dealing with something happening in a server right now.
   ========================================================================== */

:root {
  /* Chassis */
  --steel-950: #101316;
  --steel-900: #15181b;
  --steel-850: #191d21;
  --steel-800: #1e2226;
  --steel-750: #23282d;
  --steel-700: #282e33;
  --steel-650: #2f353b;
  --steel-600: #373e45;
  --steel-500: #454e56;
  --steel-450: #525c65;

  /* Ink */
  --ink-bright: #f0f4f6;
  --ink: #ced5da;
  --ink-muted: #a3adb5;
  --ink-dim: #8b959d;

  /* State roles */
  --signal: #4cc487;
  --signal-ink: #82e2b0;
  --signal-deep: #1c3a2b;

  --amber: #e2a63c;
  --amber-ink: #f2c065;
  --amber-deep: #43320f;

  --crimson: #d9483f;
  --crimson-ink: #ff8e84;
  --crimson-deep: #401815;

  /* Type */
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;

  /* Geometry */
  --radius: 3px;
  --radius-lg: 5px;
  --rail-width: 236px;
  --shell-max: 1440px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 120ms;
  --medium: 260ms;
  --cover: 620ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(120% 80% at 50% -10%, #22282e 0%, rgba(34, 40, 46, 0) 62%),
    var(--steel-850);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink-bright);
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 { font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem); }
h2 { font-size: 1.125rem; }
h3 { font-size: 0.9375rem; }

p { margin: 0; }

a {
  color: var(--amber-ink);
  text-decoration-color: color-mix(in srgb, var(--amber-ink) 40%, transparent);
  text-underline-offset: 3px;
}

a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection {
  background: color-mix(in srgb, var(--amber) 35%, transparent);
  color: var(--ink-bright);
}

/* --------------------------------------------------------------------------
   Primitives
   -------------------------------------------------------------------------- */

.micro {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.data {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "zero" 1;
  letter-spacing: -0.01em;
}

.hidden { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Panels sit into the chassis: dark seam below, work light catching the top edge. */
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--steel-750) 0%, var(--steel-800) 100%);
  border: 1px solid var(--steel-600);
  border-radius: var(--radius-lg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 2px 5px rgba(0, 0, 0, 0.4),
    0 10px 24px -14px rgba(0, 0, 0, 0.85);
}

.panel__strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 18px;
  background: linear-gradient(180deg, var(--steel-700) 0%, var(--steel-750) 100%);
  border-bottom: 1px solid var(--steel-600);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.panel__strip h2,
.panel__strip h3 {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.panel__strip-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.panel__body {
  padding: 20px 18px;
}

.panel__body--flush { padding: 0; }

/* --------------------------------------------------------------------------
   Readouts and indicators
   -------------------------------------------------------------------------- */

.readout {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.readout__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.readout__value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.0625rem;
  color: var(--ink-bright);
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.readout__value--lg { font-size: 1.5rem; }
.readout__value--sm { font-size: 0.875rem; }
.readout__note {
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.readout--nominal .readout__value { color: var(--signal-ink); }
.readout--attention .readout__value { color: var(--amber-ink); }
.readout--fault .readout__value { color: var(--crimson-ink); }

.readouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 22px 26px;
}

/* An LED never carries meaning alone — it always sits beside its label. */
.led {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.led::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--steel-500);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5);
  flex: none;
}

.led--nominal::before {
  background: var(--signal);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 0 7px color-mix(in srgb, var(--signal) 60%, transparent);
}

.led--attention::before {
  background: var(--amber);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 0 7px color-mix(in srgb, var(--amber) 60%, transparent);
}

.led--fault::before {
  background: var(--crimson);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 0 7px color-mix(in srgb, var(--crimson) 65%, transparent);
}

.led--live::before { animation: pulse 1.9s var(--ease-out) infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--steel-500);
  border-radius: 2px;
  background: var(--steel-800);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}

.tag--primary {
  border-color: color-mix(in srgb, var(--amber) 55%, transparent);
  background: var(--amber-deep);
  color: var(--amber-ink);
}

.tag--owner {
  border-color: color-mix(in srgb, var(--crimson) 55%, transparent);
  background: var(--crimson-deep);
  color: var(--crimson-ink);
}

.tag--nominal {
  border-color: color-mix(in srgb, var(--signal) 45%, transparent);
  background: var(--signal-deep);
  color: var(--signal-ink);
}

/* --------------------------------------------------------------------------
   Monogram plate — the stamped identity tile on every server
   -------------------------------------------------------------------------- */

.plate {
  --plate-size: 48px;
  display: grid;
  place-items: center;
  width: var(--plate-size);
  height: var(--plate-size);
  flex: none;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, hsl(var(--hue, 210) 30% 55%) 45%, var(--steel-600));
  background:
    linear-gradient(180deg, hsl(var(--hue, 210) 22% 26%) 0%, hsl(var(--hue, 210) 24% 17%) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 1px 3px rgba(0, 0, 0, 0.45);
  font-family: var(--mono);
  font-size: calc(var(--plate-size) * 0.34);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: hsl(var(--hue, 210) 45% 82%);
}

.plate--lg { --plate-size: 72px; }

/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--steel-500);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--steel-650) 0%, var(--steel-700) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 1px 2px rgba(0, 0, 0, 0.4);
  color: var(--ink-bright);
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background var(--fast) ease, border-color var(--fast) ease, transform var(--fast) ease;
}

.button:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--steel-600) 0%, var(--steel-650) 100%);
  border-color: var(--steel-450);
}

.button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.button--primary {
  border-color: color-mix(in srgb, var(--amber) 70%, black);
  background: linear-gradient(180deg, #eeb352 0%, var(--amber) 100%);
  color: #241a05;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 3px rgba(0, 0, 0, 0.45);
}

.button--primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #f5be62 0%, #e7ad46 100%);
  border-color: color-mix(in srgb, var(--amber) 85%, black);
}

.button--danger {
  border-color: color-mix(in srgb, var(--crimson) 65%, black);
  background: linear-gradient(180deg, #e05a50 0%, var(--crimson) 100%);
  color: #2a0d0b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 1px 3px rgba(0, 0, 0, 0.45);
}

.button--danger:hover:not(:disabled) {
  background: linear-gradient(180deg, #e96a60 0%, #d64f45 100%);
}

.button--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--ink-muted);
  box-shadow: none;
}

.button--quiet:hover:not(:disabled) {
  background: var(--steel-750);
  border-color: var(--steel-600);
  color: var(--ink-bright);
}

.button--sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.button[aria-busy="true"] {
  color: transparent;
  position: relative;
  pointer-events: none;
}

.button[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: var(--ink-bright);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Throw switch: a lever that physically travels across a lit track. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

/* The real checkbox stays in the accessibility tree and keeps keyboard focus; the lever is
   what a sighted operator sees move. */
.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.switch__track {
  position: relative;
  width: 52px;
  height: 26px;
  flex: none;
  border: 1px solid var(--steel-600);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--steel-900) 0%, var(--steel-850) 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
  transition: background var(--fast) ease, border-color var(--fast) ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 20px;
  border: 1px solid var(--steel-500);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--steel-600) 0%, var(--steel-700) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 3px rgba(0, 0, 0, 0.55);
  transition: transform var(--medium) var(--ease-out), background var(--fast) ease;
}

.switch input:checked + .switch__track {
  background: linear-gradient(180deg, var(--amber-deep) 0%, #35270c 100%);
  border-color: color-mix(in srgb, var(--amber) 45%, var(--steel-600));
}

.switch input:checked + .switch__track::after {
  transform: translateX(24px);
  background: linear-gradient(180deg, #efb655 0%, var(--amber) 100%);
  border-color: color-mix(in srgb, var(--amber) 70%, black);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.switch input:disabled + .switch__track {
  opacity: 0.42;
  cursor: not-allowed;
}

.switch__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-dim);
  min-width: 3.5em;
}

.switch input:checked ~ .switch__label { color: var(--amber-ink); }

/* Guarded control: the cover must be lifted before the control underneath is live.
   This is the panel's one authored motion, and it mirrors the bot's own two-step
   confirmation rather than decorating over it. */
.guard {
  position: relative;
  padding: 14px;
  border: 1px solid var(--steel-600);
  border-radius: var(--radius);
  background: var(--steel-850);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
  perspective: 900px;
}

.guard__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  opacity: 0.25;
  filter: saturate(0.2);
  transition: opacity var(--medium) var(--ease-out) 160ms, filter var(--medium) var(--ease-out) 160ms;
}

.guard__cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--crimson) 40%, var(--steel-500));
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(217, 72, 63, 0.16) 0 10px,
      rgba(0, 0, 0, 0) 10px 20px
    ),
    linear-gradient(180deg, var(--steel-700) 0%, var(--steel-800) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 4px 12px -4px rgba(0, 0, 0, 0.7);
  color: var(--crimson-ink);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  cursor: pointer;
  transform-origin: top center;
  transition: transform var(--cover) var(--ease-out), opacity var(--fast) linear var(--medium);
}

.guard__cover:hover { border-color: color-mix(in srgb, var(--crimson) 70%, var(--steel-500)); }

/* A cover that cannot be lifted at all: the control is not yours, so it reads as inert
   metal rather than as something you failed to operate. */
.guard__cover--disabled {
  background: linear-gradient(180deg, var(--steel-750) 0%, var(--steel-800) 100%);
  border-color: var(--steel-600);
  color: var(--ink-dim);
  cursor: not-allowed;
}

.guard__cover--disabled:hover { border-color: var(--steel-600); }

.guard--open .guard__cover {
  transform: rotateX(-108deg);
  opacity: 0;
  pointer-events: none;
}

.guard--open .guard__inner {
  opacity: 1;
  filter: none;
}

.guard__hint {
  flex: 1 1 220px;
  font-size: 0.75rem;
  color: var(--ink-muted);
  max-width: 58ch;
}

/* --------------------------------------------------------------------------
   Fields
   -------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.field__help {
  font-size: 0.75rem;
  color: var(--ink-dim);
  max-width: 62ch;
}

.field__row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--steel-600);
  border-radius: var(--radius);
  background: var(--steel-900);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
  color: var(--ink-bright);
  font-family: var(--sans);
  font-size: 0.875rem;
  transition: border-color var(--fast) ease, box-shadow var(--fast) ease;
}

input.data,
textarea.data,
input[type="number"] {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-dim);
}

input:hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) {
  border-color: var(--steel-500);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45), 0 0 0 2px color-mix(in srgb, var(--amber) 28%, transparent);
}

textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}

select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%), linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: right 13px center, right 8px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid var(--steel-600);
  border-radius: var(--radius);
  background: var(--steel-800);
  color: var(--ink-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color var(--fast) ease, color var(--fast) ease, background var(--fast) ease;
}

.chip:hover { border-color: var(--steel-450); color: var(--ink); }

.chip--locked {
  cursor: default;
  border-color: var(--steel-600);
  color: var(--ink-dim);
}

.chip--locked:hover {
  border-color: var(--steel-600);
  color: var(--ink-dim);
}

.chip[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--amber) 55%, transparent);
  background: var(--amber-deep);
  color: var(--amber-ink);
}

.chip__swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

thead th {
  position: sticky;
  top: 0;
  padding: 9px 14px;
  background: var(--steel-800);
  border-bottom: 1px solid var(--steel-600);
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--steel-700);
  vertical-align: top;
  color: var(--ink);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background var(--fast) ease;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.022); }

td.data, th.data { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* A value and the tag that qualifies it, kept from colliding inside a cell. */
.inline-pair {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.cell-id { color: var(--ink-dim); white-space: nowrap; }
.cell-reason { min-width: 220px; max-width: 46ch; }
.cell-actions { text-align: right; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Shell chrome
   -------------------------------------------------------------------------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(16px, 3vw, 32px);
  height: 56px;
  background: linear-gradient(180deg, var(--steel-800) 0%, var(--steel-850) 100%);
  border-bottom: 1px solid var(--steel-600);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 0 6px 18px -12px rgba(0, 0, 0, 0.9);
}

.masthead__mark {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink-bright);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.masthead__mark::before {
  content: "";
  width: 10px;
  height: 22px;
  border-radius: 1px;
  background: linear-gradient(180deg, var(--amber) 0%, #9a6d18 100%);
  box-shadow: 0 0 10px color-mix(in srgb, var(--amber) 45%, transparent);
}

.masthead__spacer { flex: 1; }

.masthead__account {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.masthead__avatar {
  width: 26px;
  height: 26px;
  border-radius: 2px;
  border: 1px solid var(--steel-500);
  background: var(--steel-700);
  object-fit: cover;
}

.shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: clamp(24px, 3.4vw, 44px) clamp(16px, 3vw, 32px) 72px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.page-head__lead {
  margin-top: 8px;
  color: var(--ink-muted);
  font-size: 0.9375rem;
  max-width: 68ch;
}

.page-head__aside {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
}

/* --------------------------------------------------------------------------
   Roster — flagship panel plus the rack
   -------------------------------------------------------------------------- */

.flagship {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  margin-bottom: 34px;
}

.flagship__identity {
  padding: 26px 26px 24px;
  border-right: 1px solid var(--steel-600);
}

.flagship__row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.flagship__name {
  font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);
  line-height: 1.2;
}

.flagship__id {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.flagship__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.flagship__leds {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--steel-700);
}

.flagship__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.flagship__telemetry {
  padding: 26px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.18) 0%, rgba(0, 0, 0, 0) 100%),
    var(--steel-850);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.rack {
  border: 1px solid var(--steel-600);
  border-radius: var(--radius-lg);
  background: var(--steel-850);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 5px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.rack__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)) auto;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-bottom: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: default;
  transition: background var(--fast) ease;
}

.rack__item {
  border-bottom: 1px solid var(--steel-750);
}

.rack__item:last-child { border-bottom: none; }

.rack__row:hover {
  background: linear-gradient(90deg, rgba(226, 166, 60, 0.07) 0%, rgba(255, 255, 255, 0.024) 34%, rgba(255, 255, 255, 0.012) 100%);
}

.rack__row:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: -2px;
}

.rack__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.rack__editor {
  padding: 0 20px 20px 72px;
  background: var(--steel-900);
}

.rack__editor-body {
  max-width: 820px;
  padding: 20px;
  border: 1px solid var(--steel-650);
  border-radius: var(--radius-md);
  background: var(--steel-825);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.rack__editor-body h3 {
  margin: 0 0 8px;
  color: var(--ink-bright);
  font-size: 1rem;
}

.rack__role-list {
  margin-block: 18px;
  max-height: 240px;
  overflow-y: auto;
}

.min-zero {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rack__name {
  font-weight: 600;
  color: var(--ink-bright);
  letter-spacing: -0.01em;
}

.rack__meta {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-dim);
}

.rack__leds {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rack__go {
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 0.8125rem;
  transition: color var(--fast) ease, transform var(--fast) ease;
}

.rack__row:hover .rack__go {
  color: var(--amber-ink);
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   Console layout
   -------------------------------------------------------------------------- */

.console {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  align-items: start;
  gap: 28px;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: clamp(20px, 2.6vw, 32px) clamp(16px, 3vw, 32px) 72px;
}

/* Grid items default to a min-width of auto, which lets one wide child — the scrolling
   nav, a long table — push the whole console past the viewport. Both columns opt out. */
.console > * {
  min-width: 0;
}

.rail {
  position: sticky;
  top: 78px;
  border: 1px solid var(--steel-600);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--steel-800) 0%, var(--steel-850) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 2px 6px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.rail__identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--steel-700);
}

.rail__name {
  font-weight: 600;
  color: var(--ink-bright);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.rail__role {
  margin-top: 3px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.rail__nav {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}

.rail__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 16px;
  border-left: 2px solid transparent;
  color: var(--ink-muted);
  font-size: 0.875rem;
  text-decoration: none;
  transition: background var(--fast) ease, color var(--fast) ease, border-color var(--fast) ease;
}

.rail__link:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-bright);
}

.rail__link[aria-current="page"] {
  border-left-color: var(--amber);
  background: linear-gradient(90deg, rgba(226, 166, 60, 0.12) 0%, rgba(226, 166, 60, 0) 78%);
  color: var(--ink-bright);
  font-weight: 600;
}

.rail__count {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-dim);
}

.rail__foot {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--steel-700);
}

.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 26px;
  padding: 12px 18px;
  margin-bottom: 22px;
  border: 1px solid var(--steel-600);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--steel-800) 0%, var(--steel-850) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.strip__item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.75rem;
}

.strip__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.strip__value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: var(--ink-bright);
}

.view {
  display: grid;
  gap: 22px;
}

.view > * {
  min-width: 0;
}

.view__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.view__lead {
  margin-top: 7px;
  color: var(--ink-muted);
  font-size: 0.875rem;
  max-width: 70ch;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 22px;
}

.stack {
  display: grid;
  gap: 16px;
}

.stack--tight { gap: 10px; }
.stack--loose { gap: 26px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.toolbar__search {
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 340px;
}

/* Module rows: a rack of switches, not a grid of marketing cards. */
.module-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--steel-750);
}

.module-row:last-child { border-bottom: none; }

.module-row__name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--ink-bright);
}

.module-row__summary {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  max-width: 68ch;
}

.module-row__backing {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-dim);
}

.command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--steel-750);
}

.command-row:last-child { border-bottom: none; }

.module-row__controls,
.command-row__controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.command-row__name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 0.9375rem;
  color: var(--ink-bright);
}

.command-row__summary {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  max-width: 70ch;
}

.option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.option {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--steel-700);
  border-radius: 2px;
  background: var(--steel-850);
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-muted);
}

.option--required { border-color: color-mix(in srgb, var(--amber) 35%, var(--steel-700)); }
.option__type { color: var(--ink-dim); }

/* Paging sits on the bottom lip of a panel, reading like a counter on a case. */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 18px;
  border-top: 1px solid var(--steel-700);
}

.pager__count {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.pager__buttons {
  display: flex;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Feedback: empty, error, loading, toast
   -------------------------------------------------------------------------- */

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 52px 24px;
  text-align: center;
}

.empty__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-bright);
}

.empty__body {
  font-size: 0.875rem;
  color: var(--ink-muted);
  max-width: 46ch;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 15px;
  border: 1px solid var(--steel-600);
  border-radius: var(--radius);
  background: var(--steel-850);
  font-size: 0.8125rem;
  color: var(--ink);
}

.notice--fault {
  border-color: color-mix(in srgb, var(--crimson) 45%, transparent);
  background: var(--crimson-deep);
  color: var(--crimson-ink);
}

.notice--attention {
  border-color: color-mix(in srgb, var(--amber) 45%, transparent);
  background: var(--amber-deep);
  color: var(--amber-ink);
}

.notice--nominal {
  border-color: color-mix(in srgb, var(--signal) 40%, transparent);
  background: var(--signal-deep);
  color: var(--signal-ink);
}

.skeleton {
  display: grid;
  gap: 10px;
  padding: 20px 18px;
}

.skeleton__bar {
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--steel-750) 0%, var(--steel-700) 50%, var(--steel-750) 100%);
  background-size: 200% 100%;
  animation: sweep 1.4s linear infinite;
}

.skeleton__bar:nth-child(1) { width: 40%; }
.skeleton__bar:nth-child(2) { width: 76%; }
.skeleton__bar:nth-child(3) { width: 58%; }

@keyframes sweep {
  from { background-position: 160% 0; }
  to { background-position: -60% 0; }
}

.toast-tray {
  position: fixed;
  right: clamp(12px, 3vw, 28px);
  bottom: clamp(12px, 3vw, 28px);
  z-index: 60;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100vw - 24px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--steel-500);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--steel-700) 0%, var(--steel-750) 100%);
  box-shadow: 0 8px 22px -10px rgba(0, 0, 0, 0.9);
  font-size: 0.8125rem;
  color: var(--ink);
  animation: toast-in var(--medium) var(--ease-out);
}

.toast--fault { border-color: color-mix(in srgb, var(--crimson) 55%, transparent); color: var(--crimson-ink); }
.toast--nominal { border-color: color-mix(in srgb, var(--signal) 45%, transparent); color: var(--signal-ink); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 20px;
}

.login__panel {
  width: min(430px, 100%);
}

.login__body {
  display: grid;
  gap: 18px;
  padding: 30px 28px 28px;
}

.login__title {
  font-size: 1.375rem;
}

.login__lead {
  color: var(--ink-muted);
  font-size: 0.875rem;
  max-width: 46ch;
}

.login__form { display: grid; gap: 10px; }

.login__note {
  font-size: 0.75rem;
  color: var(--ink-dim);
  max-width: 52ch;
}

.login-error {
  padding: 10px 13px;
  border: 1px solid color-mix(in srgb, var(--crimson) 45%, transparent);
  border-radius: var(--radius);
  background: var(--crimson-deep);
  color: var(--crimson-ink);
  font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .flagship { grid-template-columns: 1fr; }

  .flagship__identity {
    border-right: none;
    border-bottom: 1px solid var(--steel-600);
  }

  .flagship__telemetry { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

  .console {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .rail {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .rail__nav {
    flex-direction: row;
    min-width: 0;
    overflow-x: auto;
    padding: 0;
    scrollbar-width: thin;
  }

  .rail__link {
    border-left: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
  }

  .rail__link[aria-current="page"] {
    border-left-color: transparent;
    border-bottom-color: var(--amber);
    background: linear-gradient(180deg, rgba(226, 166, 60, 0) 40%, rgba(226, 166, 60, 0.12) 100%);
  }

  .rail__foot { display: none; }
}

@media (max-width: 820px) {
  .rack__row {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 14px;
    padding: 14px 16px;
  }

  .rack__cell--optional { display: none; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }

  .masthead { height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .masthead__spacer { flex-basis: 100%; height: 0; }

  .panel__body { padding: 16px 14px; }
  .readouts { gap: 18px; }

  .module-row,
  .command-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .module-row__controls,
  .command-row__controls { justify-self: start; }

  .flagship__identity,
  .flagship__telemetry { padding: 20px 16px; }

  .rack__row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
  }

  .rack__leds {
    grid-column: 2 / -1;
    grid-row: 2;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    min-width: 0;
  }

  .rack__leds .rack__meta {
    flex-basis: 100%;
    margin-top: 0;
    overflow-wrap: anywhere;
  }

  .rack__actions {
    grid-column: 2 / -1;
    grid-row: 3;
    justify-content: flex-start;
  }

  .rack__editor { padding: 0 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .guard--open .guard__cover { transform: none; opacity: 0; }
}
