/* Console -- stylesheet.
 *
 * De kleuren komen uit één gevalideerd palet en staan hier als custom
 * properties, zodat licht en donker op één plek wisselen en de rest van het
 * bestand tegen rollen is geschreven in plaats van tegen hex-codes.
 *
 * Donker is een eigen keuze en niet een omgeklapt licht: het zijn stappen die
 * tegen het donkere vlak zijn gekozen. De statuskleuren zijn in beide modes
 * hetzelfde -- dat is opzet, want een statuskleur die van thema verandert is
 * geen statuskleur meer. Op het lichte vlak haalt het geel geen 3:1 contrast;
 * daarom staat er bij elke status altijd óók een vorm en een woord.
 *
 * De donkere waarden staan twee keer: één keer voor de OS-voorkeur en één keer
 * voor de schakelaar in de kop. Die schakelaar moet beide kanten kunnen winnen,
 * dus de :not()-guard laat een expliciete lichte keuze het van OS-donker winnen.
 */

:root {
  color-scheme: light;

  --plane:        #f9f9f7;
  --surface:      #fcfcfb;
  --surface-sunk: #f4f4f0;

  --ink:          #0b0b0b;
  --ink-2:        #52514e;
  --ink-muted:    #898781;

  --line:         #e1e0d9;
  --line-strong:  #c3c2b7;
  --border:       rgba(11, 11, 11, 0.10);

  --accent:       #2a78d6;
  --success-text: #006300;

  --good:         #0ca30c;
  --warning:      #fab219;
  --critical:     #d03b3b;

  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 8px 24px -16px rgba(11, 11, 11, 0.18);

  --radius:   10px;
  --radius-sm: 6px;
  --mark-end:  4px;

  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;

    --plane:        #0d0d0d;
    --surface:      #1a1a19;
    --surface-sunk: #131312;

    --ink:          #ffffff;
    --ink-2:        #c3c2b7;
    --ink-muted:    #898781;

    --line:         #2c2c2a;
    --line-strong:  #383835;
    --border:       rgba(255, 255, 255, 0.10);

    --accent:       #3987e5;
    --success-text: #0ca30c;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -16px rgba(0, 0, 0, 0.8);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --plane:        #0d0d0d;
  --surface:      #1a1a19;
  --surface-sunk: #131312;

  --ink:          #ffffff;
  --ink-2:        #c3c2b7;
  --ink-muted:    #898781;

  --line:         #2c2c2a;
  --line-strong:  #383835;
  --border:       rgba(255, 255, 255, 0.10);

  --accent:       #3987e5;
  --success-text: #0ca30c;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -16px rgba(0, 0, 0, 0.8);
}

/* --- basis ---------------------------------------------------------------- */

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

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

body {
  margin: 0;
  padding: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, pre { margin: 0; }
ul { padding: 0; list-style: none; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--ink-muted); }
.dash { color: var(--ink-muted); }
.num { font-variant-numeric: tabular-nums; }

:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --- kop en voet --------------------------------------------------------- */

body.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 0;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar__title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar__sub { color: var(--ink-2); font-size: 13px; }
.topbar__actions { display: flex; gap: 8px; align-items: center; }
.inline { display: contents; }

main {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 32px) clamp(16px, 4vw, 40px) 48px;
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 3vw, 36px);
}

/* Bij het verversen wisselt de inhoud, niet de layout. Even iets doorzichtig is
 * genoeg signaal; een skeleton dat opflitst kost een sprong in de pagina. */
main[data-busy="1"] { opacity: 0.55; transition: opacity 120ms ease-out; }

.foot {
  border-top: 1px solid var(--line);
  padding: 20px clamp(16px, 4vw, 40px) 32px;
  color: var(--ink-2);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footnote { color: var(--ink-muted); font-size: 12.5px; max-width: 92ch; }

.section__title { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.section__sub { color: var(--ink-muted); font-size: 13px; }
.section__head { margin-bottom: 12px; }

/* --- hero ---------------------------------------------------------------- */

.lede {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: clamp(20px, 4vw, 48px);
  align-items: start;
  padding: clamp(20px, 3vw, 28px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

.lede__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

/* Precies één hero-figure per pagina, in dezelfde sans als de rest, en met de
 * gewone proportionele cijfers: tabular-nums maakt een groot getal juist los. */
.hero {
  font-size: clamp(52px, 8vw, 76px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 6px 0 4px;
}

.lede__caption { color: var(--ink-2); font-size: 14px; max-width: 26ch; }

.lede__aside { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.lede__binding { font-size: 14.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.lede__binding strong { font-weight: 600; }
.lede__split { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* --- statuschips --------------------------------------------------------- */

/* De kleur is nooit het enige signaal: er zit altijd een vorm (de glyph) en een
 * woord in. Dat is ook wat het lage contrast van het geel op licht opvangt. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--surface-sunk);
  color: var(--ink-2);
}

.chip__glyph { font-size: 10px; line-height: 1; }
.chip--good    .chip__glyph { color: var(--good); }
.chip--warning .chip__glyph { color: var(--warning); }
.chip--critical .chip__glyph { color: var(--critical); }
.chip--muted   .chip__glyph { color: var(--ink-muted); }

.chip--critical { border-color: color-mix(in oklab, var(--critical) 40%, var(--border)); }
.chip--warning  { border-color: color-mix(in oklab, var(--warning) 40%, var(--border)); }

.chip--lg { align-self: start; font-size: 13px; padding: 4px 12px 4px 9px; }
.chip--lg .chip__glyph { font-size: 11px; }

/* --- meters (stat-tiles) ------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow);
}

.stat__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.stat__value {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 4px 0 12px;
}

.stat__unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-muted);
  letter-spacing: 0;
}

/* De baan is een lichtere stap van dezelfde kleur als de vulling, zodat de
 * toestand over de hele breedte leest en niet alleen in het gevulde deel. */
.meter {
  height: 8px;
  border-radius: var(--mark-end);
  background: color-mix(in oklab, var(--meter-color, var(--accent)) 18%, var(--surface));
  overflow: hidden;
}

.meter--good     { --meter-color: var(--good); }
.meter--warning  { --meter-color: var(--warning); }
.meter--critical { --meter-color: var(--critical); }
.meter--muted    { --meter-color: var(--ink-muted); }

/* Vierkant aan de nullijn, 4px rond aan het data-einde. */
.meter__fill {
  height: 100%;
  background: var(--meter-color, var(--accent));
  border-radius: 0 var(--mark-end) var(--mark-end) 0;
  min-width: 2px;
}

.stat__detail {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.stat__pct { font-weight: 600; color: var(--ink); }
.stat__sep { color: var(--ink-muted); }
.stat__state { margin-left: auto; font-weight: 500; }
.stat__state--good     { color: var(--success-text); }
.stat__state--warning  { color: var(--ink-2); }
.stat__state--critical { color: var(--critical); }
.stat__state--muted    { color: var(--ink-muted); }

/* --- filterrij ----------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin-bottom: 12px;
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field__label { font-size: 12px; color: var(--ink-muted); font-weight: 500; }

input[type="search"], input[type="password"] {
  font: inherit;
  font-size: 14px;
  padding: 7px 10px;
  min-width: 260px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

input[type="password"] { width: 100%; }
input::placeholder { color: var(--ink-muted); }

.toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 15px; height: 15px; }
.filters__count { margin-left: auto; font-size: 12.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* --- tabellen ------------------------------------------------------------ */

.tablewrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  padding: 10px 14px;
  /* Hairline, solid, één stap van het vlak af -- geen streepjes. */
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.table thead th.num { text-align: right; }
.th__unit { font-weight: 400; text-transform: none; letter-spacing: 0; }

.table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-sunk); }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table--compact tbody td { padding: 8px 14px; }

.col-status { width: 1%; white-space: nowrap; }
.col-port { width: 1%; }

.app__name { display: block; font-weight: 600; color: var(--ink); }
.app__meta { display: block; font-size: 12px; color: var(--ink-muted); margin-top: 1px; }

.url { display: block; word-break: break-all; }
.url--extra { margin-top: 2px; font-size: 12.5px; }

.rt__name { display: block; margin-top: 2px; font-variant-numeric: tabular-nums; }
.rt__meta { display: block; font-size: 12px; color: var(--ink-muted); margin-top: 1px; }

.tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-sunk);
  color: var(--ink-2);
}

.tag--unknown {
  border-color: color-mix(in oklab, var(--warning) 35%, var(--border));
  color: var(--ink-2);
}

.notes {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--ink-2);
  max-width: 46ch;
}

/* De uitleg staat in de pagina en niet in een tooltip: een waarde die alleen
 * bij hover te lezen is, is voor toetsenbord en aanraking geen waarde. */
.notes li { position: relative; padding-left: 11px; }
.notes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 1px;
  background: var(--line-strong);
}

/* Micro-meter in een tabelregel: één serie, dus één kleur. De lengte zegt het
 * al, dus geen kleurverloop naar gebruik erbovenop. */
.rowbar { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.rowbar__num { font-variant-numeric: tabular-nums; }

.rowbar__track {
  width: 64px;
  height: 5px;
  border-radius: var(--mark-end);
  background: color-mix(in oklab, var(--accent) 15%, var(--surface));
  overflow: hidden;
}

.rowbar__fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 0 var(--mark-end) var(--mark-end) 0;
  min-width: 1px;
}

/* --- meldingen ----------------------------------------------------------- */

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13.5px;
  color: var(--ink);
}

.banner--warning { border-color: color-mix(in oklab, var(--warning) 45%, var(--border)); }
.banner__glyph { color: var(--warning); font-size: 12px; line-height: 1.5; }
.banner code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-sunk); padding: 1px 5px; border-radius: 4px; }

.warnings {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.warnings li {
  padding: 11px 16px 11px 34px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  position: relative;
}

.warnings li:last-child { border-bottom: 0; }
.warnings li::before {
  content: "▲";
  position: absolute;
  left: 14px;
  top: 12px;
  font-size: 10px;
  color: var(--warning);
}

/* --- knoppen ------------------------------------------------------------- */

.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn:hover { background: var(--surface-sunk); }
.btn--ghost { background: transparent; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  padding: 9px 16px;
  font-size: 14px;
  width: 100%;
}

.btn--primary:hover { filter: brightness(0.94); background: var(--accent); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* --- inlogpagina --------------------------------------------------------- */

body.plain { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login { width: 100%; max-width: 380px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.card--login { display: flex; flex-direction: column; gap: 16px; }
.login__title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.login__sub { color: var(--ink-2); font-size: 13.5px; margin-top: -8px; }

.alert {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-sunk);
}

.alert--critical { border-color: color-mix(in oklab, var(--critical) 45%, var(--border)); }
.alert--critical > span:first-child { color: var(--critical); font-size: 11px; }
.alert--warning { border-color: color-mix(in oklab, var(--warning) 45%, var(--border)); }
.alert--warning > span:first-child { color: var(--warning); font-size: 11px; }

.pre {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  overflow-x: auto;
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
