/* ============================================================================
 * The Control Room. Same material as index.css -- OLED black,
 * hairlines at 22% white, Inter for text, tabular figures for everything that
 * refreshes. This file only adds what an ADMIN SCREEN needs and the front
 * page does not: a left rail, dense tables and charts.
 *
 * Deliberately its own file, not an extension of index.css: that page must
 * stay light (every visitor loads it), and nobody who is not signed in
 * ever reaches here.
 * ========================================================================= */

:root {
  --zwart: #000000;
  --vlak: #0A0A0C;
  --vlak-2: #101014;
  --vlak-3: #16161B;
  --lijn: rgba(255,255,255,0.14);
  --lijn-sterk: rgba(255,255,255,0.22);
  --tekst: #FFFFFF;
  --gedempt: #82828A;
  --blauw: #007AFF;
  --blauw-knop: #0068E1;
  --groen: #00C853;
  --amber: #FF9F0A;
  --rood: #FF3B30;
  --violet: #AF7AFF;
  --r-sm: 8px;
  --r-md: 14px;
  --r-full: 999px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --dur: 180ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--zwart);
  color: var(--tekst);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
button { font-family: inherit; }

/* --- the gate -------------------------------------------------------------
 * Same shape as the input pill on the front page: it's the first thing you
 * see, and it should sound like the same product. */
.poort {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-6);
  text-align: center;
}
.poort h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.poort p { color: var(--gedempt); max-width: 42ch; font-size: 14px; }
.poort-pil {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: min(420px, 100%);
  padding: 10px 10px 10px 20px;
  border: 2px solid var(--lijn-sterk);
  border-radius: var(--r-full);
  background: var(--vlak);
}
.poort-pil input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--tekst); font-family: inherit; font-size: 15px;
}
.poort-pil input::placeholder { color: var(--gedempt); }
.poort-fout { color: var(--rood); font-size: 13px; min-height: 18px; }

/* --- the framework --------------------------------------------------------- */
.raam { display: grid; grid-template-columns: 214px 1fr; min-height: 100vh; }

.rail {
  position: sticky; top: 0; align-self: start; height: 100vh;
  background: var(--vlak);
  border-right: 1px solid var(--lijn);
  padding: var(--sp-4) var(--sp-3);
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--lijn-sterk) transparent;
}
.rail-merk {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3) var(--sp-5);
  font-weight: 600; font-size: 15px;
}
.brand-mark {
  display: block; flex: 0 0 auto;
  height: 26px; width: auto; aspect-ratio: 1599 / 2036;
  color: var(--tekst);
}
.rail-btn {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px var(--sp-3);
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--gedempt);
  font-size: 14px; text-align: left; width: 100%; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.rail-btn:hover { background: var(--vlak-2); color: var(--tekst); }
.rail-btn[aria-current="true"] { background: var(--vlak-3); color: var(--tekst); font-weight: 500; }
.rail-btn svg { flex: 0 0 auto; opacity: 0.8; }
.rail-btn [data-icon] { display: inline-flex; }
.rail-tel {
  margin-left: auto; font-family: var(--mono); font-size: 11px;
  color: var(--zwart); background: var(--amber);
  border-radius: var(--r-full); padding: 1px 7px; font-weight: 500;
}
.rail-voet { margin-top: auto; padding-top: var(--sp-4); }

.doek { padding: var(--sp-5) var(--sp-5) var(--sp-6); min-width: 0; }
.doek-kop {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5);
}
.doek-kop h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.012em; }
.doek-kop .sub { color: var(--gedempt); font-size: 13px; }

.knop {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 8px 15px; border: 2px solid var(--lijn-sterk); border-radius: var(--r-full);
  background: var(--zwart); color: var(--tekst);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: border-color var(--dur) var(--ease);
}
.knop:hover { border-color: rgba(255,255,255,0.42); }
.knop.primair { background: var(--blauw-knop); border-color: var(--blauw-knop); }
.knop.gevaar { border-color: rgba(255,59,48,0.5); color: #FF8A82; }
.knop:disabled { opacity: 0.5; cursor: default; }

/* --- cards and figures --------------------------------------------------- */
.rooster { display: grid; gap: var(--sp-3); }
.rooster.k4 { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.rooster.k2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.card {
  background: var(--vlak); border: 1px solid var(--lijn);
  border-radius: var(--r-md); padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0;
}
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.card-heading h3 { font-size: 14px; font-weight: 600; }
.card-heading .hint { color: var(--gedempt); font-size: 12px; }

.cijfer { display: flex; flex-direction: column; gap: 1px; }
.cijfer .v {
  font-family: var(--mono); font-size: 27px; font-weight: 500;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.cijfer .n { font-size: 12.5px; color: var(--gedempt); }
.cijfer.g .v { color: var(--groen); } .cijfer.a .v { color: var(--amber); }
.cijfer.r .v { color: var(--rood); }  .cijfer.v2 .v { color: var(--violet); }

/* --- charts -----------------------------------------------------------
 * SVG and no canvas: they're bars and a line, the codebase is vanilla, and
 * an SVG bar is selectable, scales along, and needs no text layout. */
.grafiek { width: 100%; height: 132px; display: block; overflow: visible; }
.grafiek .bar { fill: var(--blauw); }
.grafiek .bar.piek { fill: var(--amber); }
.grafiek .as { stroke: var(--lijn); stroke-width: 1; }
.grafiek-voet {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10.5px; color: var(--gedempt);
}

.reep { display: flex; align-items: center; gap: var(--sp-3); font-size: 12.5px; }
.reep .nm { color: var(--gedempt); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 0 34%; }
.reep .spoor { flex: 1; height: 6px; border-radius: var(--r-full); background: var(--vlak-3); overflow: hidden; }
.reep .vul { display: block; height: 100%; border-radius: var(--r-full); background: var(--blauw); }
.reep .vl { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12px; flex: 0 0 auto; }

/* --- tables ------------------------------------------------------------- */
.tabelvak {
  border: 1px solid var(--lijn); border-radius: var(--r-md);
  background: var(--vlak); overflow-x: auto;
  scrollbar-width: thin; scrollbar-color: var(--lijn-sterk) transparent;
}
.tabelrol { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--lijn-sterk) transparent; }
table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 13px; }
th {
  position: sticky; top: 0; background: var(--vlak-2); text-align: left;
  font-weight: 600; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--gedempt); padding: 10px var(--sp-4);
  border-bottom: 1px solid var(--lijn); white-space: nowrap;
}
td { padding: 9px var(--sp-4); border-bottom: 1px solid rgba(255,255,255,0.06); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
td.zacht { color: var(--gedempt); }
td.knip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pil-status {
  display: inline-block; font-family: var(--mono); font-size: 10.5px;
  border: 1px solid currentColor; border-radius: var(--r-full);
  padding: 2px 8px; white-space: nowrap;
}
.st-active, .st-geslaagd { color: var(--groen); }
.st-paused, .st-waarschuwing { color: var(--amber); }
.st-unreachable, .st-mislukt, .st-fout { color: var(--rood); }
.st-triggered { color: var(--blauw); }
.st-expired, .st-info { color: var(--gedempt); }

/* --- notifications ------------------------------------------------------------ */
.message {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm);
  border: 1px solid var(--lijn); background: var(--vlak-2); font-size: 13.5px;
}
.message .stip { width: 8px; height: 8px; border-radius: var(--r-full); margin-top: 6px; flex: 0 0 auto; }
.message.waarschuwing { border-color: rgba(255,159,10,0.35); }
.message.waarschuwing .stip { background: var(--amber); }
.message.fout { border-color: rgba(255,59,48,0.35); }
.message.fout .stip { background: var(--rood); }
.message button { margin-left: auto; }

.empty { color: var(--gedempt); font-size: 13px; padding: var(--sp-4); text-align: center; }
.laden { color: var(--gedempt); font-size: 13px; }
.letop {
  color: var(--gedempt); font-size: 12.5px; font-style: normal;
  border-left: 2px solid var(--lijn-sterk); padding-left: var(--sp-3);
}

.screen[hidden] { display: none !important; }
[hidden] { display: none !important; }

@media (max-width: 860px) {
  .raam { grid-template-columns: 1fr; }
  .rail {
    position: static; height: auto; flex-direction: row; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--lijn); padding: var(--sp-3);
  }
  .rail-merk, .rail-voet { display: none; }
  .rail-btn { width: auto; white-space: nowrap; }
  .doek { padding: var(--sp-4) var(--sp-3) var(--sp-6); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
