:root {
  --navy: #13263B; --navy-2: #0C1A2A; --ink: #172230; --muted: #4D5B6A; --line: #DDE3EA; --line-2: #C5CFDA;
  --bg: #EEF1F4; --card: #FFFFFF; --blue: #0B5CAD;
  --green: #1E7B34; --green-bg: #E3F2E8; --green-ink: #155C2E;
  --amber: #A15C00; --amber-bg: #FFF6D9; --amber-ink: #6B4E00;
  --red: #B42318; --red-bg: #FBE4E4; --red-ink: #7A2424;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid #F5B400; outline-offset: 2px; }
.skip { position: absolute; left: -9999px; } .skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 10; }

header.top { background: var(--navy); color: #fff; padding: 12px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
header.top .brand { flex: 1 1 220px; display: flex; flex-direction: column; }
header.top .brand b { font-size: 20px; }
header.top .brand span { font-size: 14px; color: #B9C6D4; }
nav.tabs { display: flex; gap: 6px; background: var(--navy-2); padding: 4px; border-radius: 10px; }
nav.tabs a { color: #DCE4EC; text-decoration: none; padding: 10px 16px; border-radius: 8px; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
nav.tabs a[aria-current="page"] { background: #fff; color: var(--navy); }
.who { font-size: 13px; color: #B9C6D4; display: flex; align-items: center; gap: 8px; }
.who form { display: inline; }
.linkbtn { background: none; border: 0; color: #DCE4EC; text-decoration: underline; cursor: pointer; font-size: 13px; padding: 6px; min-height: 32px; }

.pill { border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 14px; }
.pill.ok { background: var(--green-bg); color: var(--green-ink); }
.pill.stop { background: var(--red); color: #fff; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 10px 18px; font-size: 16px; font-weight: 600; min-height: 48px; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.go { background: var(--green); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line-2); }
.btn.small { min-height: 40px; padding: 8px 12px; font-size: 14px; }
.btn.kill { background: var(--red); color: #fff; font-size: 17px; min-height: 52px; padding: 10px 22px; }
.btn.kill.off { background: #fff; color: var(--red-ink); border: 2px solid #fff; }

main { max-width: 1400px; margin: 0 auto; padding: 16px 20px 32px; display: flex; flex-direction: column; gap: 16px; }
main.narrow { max-width: 1100px; }
.card { background: var(--card); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font-size: 20px; }
.card h3 { margin: 0; font-size: 17px; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.empty { background: var(--card); border: 2px dashed var(--line-2); border-radius: 14px; padding: 28px; text-align: center; color: var(--muted); }

.alert { border-radius: 10px; padding: 10px 14px; font-size: 15px; }
.alert.critical { background: var(--red-bg); color: var(--red-ink); border-left: 6px solid var(--red); }
.alert.warning { background: var(--amber-bg); color: var(--amber-ink); border-left: 6px solid var(--amber); }
.alert.info { background: #E6EEF7; color: #0B3A6B; border-left: 6px solid var(--blue); }
.alert.ok { background: var(--green-bg); color: var(--green-ink); border-left: 6px solid var(--green); }

.totals { background: var(--navy); color: #fff; border-radius: 12px; padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; }
.totals .k { font-size: 12px; color: #B9C6D4; margin-right: 6px; }
.totals .v { font-family: var(--mono); font-size: 18px; }

.floor { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.floor .left { flex: 3 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.floor .right { flex: 2 1 320px; min-width: 0; border: 2px solid var(--blue); position: sticky; top: 12px; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 8px; text-align: right; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
th:first-child, td:first-child { text-align: left; }
td.num { font-family: var(--mono); }
tr.sel td { background: #E6EEF7; }
tr.total td { border-top: 2px solid var(--ink); font-weight: 700; }
td a.row { color: var(--ink); text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; min-height: 32px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.GROEN { color: var(--green); } .ORANJE { color: var(--amber); } .ROOD { color: var(--red); } .ONBEKEND { color: var(--muted); }
.dot.GROEN { background: var(--green); } .dot.ORANJE { background: var(--amber); } .dot.ROOD { background: var(--red); } .dot.ONBEKEND { background: var(--line-2); }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #FFE7C2; color: #7A4300; }

.band { border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.band.vooraan { background: var(--green-bg); } .band.vooraan b { color: var(--green-ink); }
.band.overloop { background: var(--amber-bg); } .band.overloop b { color: var(--amber-ink); }
.band.achteraan { background: #F1E6E6; } .band.achteraan b { color: var(--red-ink); }
.band .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #fff; border-radius: 999px; padding: 5px 10px; font-size: 14px; }
.chip small { color: var(--muted); }

.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
label.f { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
select, input[type=text], input[type=date], input[type=time], input[type=search] { font: inherit; font-weight: 400; padding: 10px 12px; min-height: 48px; border: 2px solid var(--line-2); border-radius: 10px; background: #fff; width: 100%; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; }
legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.checks label, label.chk { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 400; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; accent-color: var(--blue); }

.agents { display: flex; flex-direction: column; }
.agent-row { display: grid; grid-template-columns: minmax(170px, 2fr) repeat(4, minmax(110px, 1fr)) auto; gap: 8px; align-items: center; padding: 8px 6px; border-top: 1px solid var(--line); }
.agent-row.head { font-size: 12px; font-weight: 700; color: var(--muted); border-top: 0; }
.agent-row.geen { background: #FBF3F3; }
.agent-row .nm { display: flex; flex-direction: column; } .agent-row .nm small { color: var(--muted); font-size: 12px; }

.rule { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.rule .meta { font-size: 13px; color: var(--muted); }

.confirm { border: 3px solid var(--blue); }
.confirm.danger { border-color: var(--red); }
.confirm .sentence { font-size: 19px; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.log td, .log th { text-align: left; vertical-align: top; font-size: 14px; }
.log code { font-family: var(--mono); font-size: 12px; word-break: break-word; }
.subtabs { display: flex; gap: 6px; background: #fff; padding: 4px; border-radius: 10px; align-self: flex-start; }
.subtabs a { padding: 10px 16px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; }
.subtabs a[aria-current="page"] { background: var(--navy); color: #fff; }
.placeholder { border: 2px dashed var(--line-2); border-radius: 12px; padding: 14px; color: var(--muted); }
.login { max-width: 460px; margin: 8vh auto; }

@media (max-width: 760px) {
  .agent-row { grid-template-columns: 1fr 1fr; }
  .agent-row.head { display: none; }
  .agent-row .nm { grid-column: 1 / -1; }
  header.top { padding: 10px 12px; }
  main { padding: 12px; }
}

/* hulpklassen (geen inline styles: CSP style-src 'self') */
.h1 { margin: 0; font-size: 24px; }
.h-small { font-size: 16px; }
.h-empty { margin: 0 0 6px; }
.m0 { margin: 0; }
.devbox { background: var(--amber-bg); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.small { font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.agents { min-width: 680px; }
.red-ink { color: var(--red-ink); }
th.left, td.left { text-align: left; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.w320 { max-width: 320px; }
.grid-form .full { grid-column: 1 / -1; }
.grid-form { align-items: start; }
.grid-form > div:last-child { align-self: end; }
.m-only { display: none; }
@media (max-width: 760px) {
  .m-only { display: inline; } .d-only { display: none; }
  .agents { min-width: 0; }
}

/* Inbound-schakelaar (positief: Aan/Uit) */
.switch { display: inline-flex; border: 2px solid var(--line-2); border-radius: 10px; padding: 0; overflow: hidden; margin: 0; }
.switch label { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; min-height: 44px; cursor: pointer; font-weight: 600; }
.switch input { width: 18px; height: 18px; }
.switch label.on:has(input:checked) { background: var(--green-bg); color: var(--green-ink); }
.switch label.off:has(input:checked) { background: #EEF1F4; color: var(--muted); }
.agent-row.uit { background: #F7F8FA; }
.agent-row.uit .sub, .agent-row:has(input[value=uit]:checked) .sub { opacity: .4; }

/* Schuifjes (toggle switches): native checkbox met role="switch" -> toetsenbord (spatie) en
   schermlezer werken zonder script; tekst Aan/Uit volgt de toestand. */
.sw { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 600; font-size: 14px; }
.sw input { position: absolute; opacity: 0; width: 52px; height: 30px; margin: 0; cursor: pointer; }
.sw .track { width: 52px; height: 30px; border-radius: 999px; background: var(--red); position: relative; flex: 0 0 auto; transition: background .15s; }
.sw .knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .15s; }
.sw input:checked + .track .knob { left: 25px; }
.sw input:checked + .track { background: var(--green); }
.sw .knob::after { content: "\2715"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--red); }
.sw input:checked + .track .knob::after { content: "\2713"; color: var(--green); }
.sw input:focus-visible + .track { outline: 3px solid #F5B400; outline-offset: 2px; }
.sw .t-on { display: none; color: var(--green-ink); } .sw .t-off { display: inline; color: var(--red-ink); }
.sw input:checked ~ .t-on { display: inline; } .sw input:checked ~ .t-off { display: none; }
.sw .sw-name { display: none; }
.sw input:disabled ~ * { cursor: default; }
/* Inbound uit: lijnsoort-schuifjes grijs (uitgeschakeld), ongeacht hun waarde */
.agent-row.uit .sw.sub, .agent-row:has(.sw-inbound input:not(:checked)) .sw.sub { pointer-events: none; }
.agent-row.uit .sw.sub .track, .agent-row:has(.sw-inbound input:not(:checked)) .sw.sub .track { background: #C5CFDA; }
.agent-row.uit .sw.sub .knob::after, .agent-row:has(.sw-inbound input:not(:checked)) .sw.sub .knob::after { color: #8A96A3; }
.agent-row.uit .sw.sub .t-on, .agent-row.uit .sw.sub .t-off, .agent-row:has(.sw-inbound input:not(:checked)) .sw.sub .t-on, .agent-row:has(.sw-inbound input:not(:checked)) .sw.sub .t-off { color: var(--muted); }
@media (max-width: 760px) { .sw .sw-name { display: inline; } }
