/* WiFi Dashboard - opmaak in de huisstijl van LeisureIQ.
   Alle kleuren komen uit leisureiq-tokens.css (het gedeelde merkbestand, niet aanpassen).
   Hieronder alleen de vertaling naar de namen die dit scherm gebruikt.
   Donker is standaard; theme.js zet class="liq-licht" als het apparaat op licht staat. */
:root {
  --bg: var(--liq-bg);
  --surface: var(--liq-vlak);
  --surface-2: var(--liq-vlak-hoog);
  --border: var(--liq-rand);
  --border-strong: color-mix(in srgb, var(--liq-rand) 60%, var(--liq-tekst-uit));
  --text: var(--liq-tekst);
  --text-2: color-mix(in srgb, var(--liq-tekst) 55%, var(--liq-tekst-zacht));
  --text-3: var(--liq-tekst-zacht);
  --accent: var(--liq-cyaan);
  --accent-soft: var(--liq-blauw-zacht);
  --on-accent: var(--liq-ink);
  --ok: var(--liq-ok);
  --ok-soft: var(--liq-ok-zacht);
  --warn: var(--liq-let-op);
  --warn-soft: var(--liq-let-op-zacht);
  --bad: var(--liq-fout);
  --bad-soft: var(--liq-fout-zacht);
  --idle: var(--liq-tekst-uit);
  --idle-soft: var(--liq-vlak-hoog);
  /* tekstkleur in statuslabels */
  --ok-text: var(--liq-ok);
  --warn-text: var(--liq-let-op);
  --bad-text: color-mix(in srgb, var(--liq-fout) 80%, #fff);
  --shadow: none;
  --radius: var(--liq-radius);
  --mono: var(--liq-font-mono);
  color-scheme: dark;
}

.liq-licht {
  --accent: var(--liq-blauw);
  --border-strong: color-mix(in srgb, var(--liq-rand) 70%, var(--liq-tekst-uit));
  --text-2: color-mix(in srgb, var(--liq-tekst) 70%, var(--liq-tekst-zacht));
  --ok-text: color-mix(in srgb, var(--liq-ok) 45%, var(--liq-ink));
  --warn-text: color-mix(in srgb, var(--liq-let-op) 55%, var(--liq-ink));
  --bad-text: color-mix(in srgb, var(--liq-fout) 80%, var(--liq-ink));
  --shadow: 0 1px 2px rgba(9, 31, 47, .06), 0 1px 3px rgba(9, 31, 47, .05);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--liq-font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-3); }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  height: 56px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand .liq-merk { font-size: 19px; }
.brand-product {
  padding-left: 12px; border-left: 1px solid var(--border-strong);
  color: var(--text-2); font-weight: 600; font-size: 14px;
}
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 6px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 -2px 0 var(--liq-cyaan); }
.nav .count {
  display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: var(--liq-ink); font-size: 11px; line-height: 18px; text-align: center; font-weight: 600;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; color: var(--text-3); font-size: 13px; white-space: nowrap; }
.refresh-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; }
.refresh-dot.stale { background: var(--warn); }

/* ---------- layout ---------- */
main { max-width: 1320px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; font-weight: 650; }
.page-head p { margin: 2px 0 0; color: var(--text-3); }
.crumbs { font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
section { margin-bottom: 28px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 15px; font-weight: 650; }
.section-title .muted { font-weight: 400; font-size: 13px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px 18px; }
section > .card + .card { margin-top: 12px; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 28px; }
.kpi { padding: 16px 18px; }
.kpi-label { color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.kpi-value small { font-size: 15px; color: var(--text-3); font-weight: 500; }
.kpi-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.kpi.alert { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.kpi.alert .kpi-value { color: var(--bad); }
.meter { height: 6px; border-radius: 3px; background: var(--idle-soft); overflow: hidden; margin-top: 10px; display: flex; }
.meter span { display: block; height: 100%; }
.meter .ok { background: var(--ok); }
.meter .bad { background: var(--bad); }
.meter .warn { background: var(--warn); }

/* ---------- controller cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ctrl-card { padding: 16px 18px; cursor: pointer; transition: border-color .15s; display: flex; flex-direction: column; gap: 10px; }
.ctrl-card:hover { border-color: var(--border-strong); }
.ctrl-top { display: flex; align-items: flex-start; gap: 10px; }
.ctrl-name { font-weight: 650; font-size: 15px; line-height: 1.3; }
.ctrl-meta { color: var(--text-3); font-size: 12.5px; }
.ctrl-loc { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.ctrl-loc.empty { color: var(--text-3); font-style: italic; }
.ctrl-stats { display: flex; gap: 18px; font-size: 13px; color: var(--text-2); }
.ctrl-stats b { color: var(--text); font-weight: 650; }
.ctrl-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--border); padding-top: 10px; }
.placeholder-card { padding: 16px 18px; color: var(--text-3); border-style: dashed; box-shadow: none; background: transparent; }

/* ---------- status ---------- */
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; background: var(--idle); }
.dot.up, .dot.online { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.down, .dot.offline { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dot.transitional, .dot.standby { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.ctrl-top .dot { margin-top: 5px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--idle-soft); color: var(--text-2);
}
.pill.up, .pill.online { background: var(--ok-soft); color: var(--ok-text); }
.pill.down, .pill.offline, .pill.critical { background: var(--bad-soft); color: var(--bad-text); }
.pill.transitional, .pill.standby, .pill.warning { background: var(--warn-soft); color: var(--warn-text); }
.pill.info { background: var(--accent-soft); color: var(--text); }
.badge-bad { background: var(--bad); color: var(--liq-ink); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13.5px;
}
.btn:hover { border-color: var(--liq-cyaan); }
.btn.primary { background: var(--liq-gradient); border-color: transparent; color: var(--liq-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad-text); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }
input[type=text], input[type=password], input[type=search], input[type=url], textarea, select {
  width: 100%; padding: 8px 11px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--bg); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--liq-cyaan); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 64px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row > * { flex: 1 1 180px; }
.form-row > .btn, .form-row > label.check { flex: 0 0 auto; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding-bottom: 8px; }
.error-text { color: var(--bad); font-size: 13px; margin-top: 8px; min-height: 1em; }
.saved-text { color: var(--ok); font-size: 12.5px; }

/* ---------- controller detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; margin-bottom: 24px; }
.meta-list { display: grid; grid-template-columns: 130px 1fr; gap: 7px 12px; font-size: 13.5px; margin: 0; }
.meta-list dt { color: var(--text-3); }
.meta-list dd { margin: 0; overflow-wrap: anywhere; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 280px; }
.chips { display: flex; gap: 6px; }
.chip {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2);
}
.chip.active { background: var(--accent-soft); border-color: var(--liq-cyaan); color: var(--text); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--surface-2); }
tr.is-offline td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
td.right, th.right { text-align: right; }
.ap-name { font-weight: 600; }
.ap-sub { font-size: 12px; color: var(--text-3); }
.radio { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; color: var(--text-2); }
.radio .dot { width: 7px; height: 7px; box-shadow: none !important; }
.empty-state { padding: 36px 18px; text-align: center; color: var(--text-3); }
.empty-state strong { display: block; color: var(--text-2); margin-bottom: 4px; font-size: 15px; }

/* ---------- incidents ---------- */
.incident { display: flex; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.incident:last-child { border-bottom: 0; }
.incident .stripe { width: 4px; align-self: stretch; border-radius: 2px; background: var(--idle); flex: none; }
.incident.critical .stripe { background: var(--bad); }
.incident.warning .stripe { background: var(--warn); }
.incident.info .stripe { background: var(--liq-cyaan); }
.incident-body { flex: 1; min-width: 0; }
.incident-title { font-weight: 600; }
.incident-meta { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.incident-detail { color: var(--text-2); font-size: 13px; margin-top: 4px; white-space: pre-line; }
.incident-actions { display: flex; gap: 6px; flex: none; }
.ack { font-size: 12px; color: var(--text-3); }

.event-row { display: grid; grid-template-columns: 130px 18px 1fr; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--border); font-size: 13px; align-items: baseline; }
.event-row:last-child { border-bottom: 0; }
.event-row time { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.event-row .dot { width: 7px; height: 7px; box-shadow: none !important; position: relative; top: -1px; }
.event-row .dot.critical { background: var(--bad); }
.event-row .dot.warning { background: var(--warn); }
.event-row .dot.info { background: var(--liq-cyaan); }
.event-row .ev-sub { color: var(--text-3); font-size: 12px; }

/* ---------- drawer & modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(4, 12, 20, .55); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); z-index: 41;
  background: var(--surface); border-left: 1px solid var(--border); overflow-y: auto; padding: 20px 22px;
}
.drawer-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.drawer-head h2 { margin: 0; font-size: 18px; flex: 1; }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--text-3); padding: 4px; border-radius: 6px; line-height: 0; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.modal {
  position: fixed; z-index: 41; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--liq-radius-groot); padding: 22px;
  box-shadow: var(--liq-schaduw);
}
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.codebox {
  font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; overflow-x: auto; white-space: pre; margin: 8px 0;
}
.subhead { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; margin: 20px 0 8px; }
.radio-cards { display: grid; gap: 8px; }
.radio-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 13px; }

.toast {
  box-shadow: var(--liq-schaduw);
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--surface); padding: 9px 16px; border-radius: 8px; font-size: 13.5px;
}

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 28px; }
.login-card .brand { margin-bottom: 26px; }
.login-card .liq-merk { font-size: 24px; }
.login-wrap { background: radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--liq-cyaan) 14%, transparent), transparent 70%), var(--bg); }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p { margin: 0 0 20px; color: var(--text-3); }
.login-card .btn { width: 100%; justify-content: center; padding: 10px; }
.login-card { border-radius: var(--liq-radius-groot); }

@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px 0; gap: 8px 12px; }
  .brand-product, .topbar-right .when, #user-name { display: none; }
  .nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 8px; }
  .nav a { white-space: nowrap; }
  main { padding: 16px; }
  .kpi-value { font-size: 24px; }
  .event-row { grid-template-columns: 1fr; gap: 2px; }
  .event-row .dot { display: none; }
  .incident { flex-wrap: wrap; }
}

/* ---------- controllers beheren ---------- */
.knoppen-rij { margin: 12px 0; gap: 8px; }
.knoppen-rij > .btn { flex: 0 0 auto; }
.veld-smal { flex: 0 1 140px !important; }
.let-op-blok { border-left: 3px solid var(--warn); background: var(--warn-soft); margin-bottom: 12px; }
.test-uitslag { font-size: 13.5px; border-radius: 8px; margin: 4px 0 0; }
.test-uitslag:empty { display: none; }
.test-uitslag.bezig, .test-uitslag.goed, .test-uitslag.fout { padding: 9px 12px; }
.test-uitslag.bezig { background: var(--accent-soft); color: var(--text); }
.test-uitslag.goed { background: var(--ok-soft); color: var(--ok-text); }
.test-uitslag.fout { background: var(--bad-soft); color: var(--bad-text); }
.modal .form-row { margin-bottom: 0; }
.modal label.check { margin-bottom: 8px; }

/* Merk kiezen bij Controller toevoegen */
[hidden] { display: none !important; }
.merk-keuze { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 12px 0 4px; }
.merk-knop { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 16px 18px; cursor: pointer;
  font: inherit; color: var(--liq-tekst); border: 1px solid var(--liq-rand); }
.merk-knop strong { font-size: 16px; }
.merk-knop span { color: var(--liq-tekst-zacht); font-size: 13px; line-height: 1.45; }
.merk-knop:hover, .merk-knop:focus-visible { background: var(--liq-vlak-hoog); border-color: var(--liq-cyaan); outline: none; }

/* Nieuwe versie (versie.js), zoals de balk in GateIQ */
.versiebalk {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 960;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--liq-blauw-zacht); border-top: 1px solid var(--liq-cyaan);
  color: var(--liq-tekst); font-size: 15px; box-shadow: var(--liq-schaduw);
}
.versiebalk-tekst { flex: 1; min-width: 0; }
.versiebalk .btn { flex: 0 0 auto; }
body.met-versiebalk { padding-bottom: 72px; }
body.met-versiebalk .toast { bottom: 84px; }
