:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1c1f24;
  --muted: #626a75;
  --border: #dfe2e7;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --ok: #1a7f37;
  --ok-bg: #e6f4ea;
  --error: #c62828;
  --error-bg: #fdecea;
  --off: #9aa1ab;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1b1e24;
    --text: #e8eaed;
    --muted: #9aa1ab;
    --border: #2d323a;
    --accent: #4c8dff;
    --ok: #3fb950;
    --ok-bg: #15301d;
    --error: #ff6b6b;
    --error-bg: #3a1717;
    --off: #5c636d;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; display: flex; align-items: center; gap: .5rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
code, .mono, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Bovenbalk */
.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .75rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; color: var(--text); font-size: 1.1rem; }
.topbar nav { display: flex; gap: 1rem; flex: 1; }
.topbar nav a { color: var(--muted); padding: .25rem 0; border-bottom: 2px solid transparent; }
.topbar nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.topbar nav a:hover { text-decoration: none; color: var(--text); }
.who { display: flex; align-items: center; gap: .75rem; margin: 0; color: var(--muted); }

/* Pagina */
.page { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.page.narrow { max-width: 420px; padding-top: 12vh; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head p { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.highlight { border-color: var(--accent); }
.card.danger { border-color: color-mix(in srgb, var(--error) 40%, var(--border)); }
.card.empty { text-align: center; padding: 3rem 1rem; }
.auth h1 { margin-bottom: .25rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.device { color: var(--text); display: block; margin: 0; transition: border-color .15s; }
.device:hover { text-decoration: none; border-color: var(--accent); }
.device-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.device-head h2 { margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }

.dot { width: .65rem; height: .65rem; border-radius: 50%; display: inline-block; flex: none; background: var(--off); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.badge { font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); color: var(--muted); font-weight: 500; }

.alert { padding: .65rem .9rem; border-radius: 8px; margin: 0 0 1rem; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.error { background: var(--error-bg); color: var(--error); }

/* Formulieren */
form { margin: 0; }
.stack { display: grid; gap: 1rem; max-width: 460px; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.row label { flex: 1 1 180px; }
label { display: grid; gap: .3rem; font-weight: 500; }
label.inline { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; margin-right: 1rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 500; margin-bottom: .3rem; }
input, select { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .55rem .7rem; width: 100%; min-height: 40px; }
input[type=radio], input[type=checkbox] { width: auto; min-height: 0; padding: 0; }
input:focus, select:focus, button:focus-visible, .button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth form { display: grid; gap: 1rem; margin: 1rem 0; }

button, .button { font: inherit; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; min-height: 40px; }
button:hover, .button:hover { text-decoration: none; border-color: var(--muted); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { background: var(--error); border-color: var(--error); color: #fff; }
button.small { padding: .3rem .65rem; min-height: 32px; font-size: .85rem; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; }
.wide { width: 100%; }

.code { font: 700 2rem/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; margin: .25rem 0 1.25rem; }
.copy { position: relative; }
.copy pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .85rem 1rem; padding-right: 6.5rem; overflow-x: auto; margin: 0 0 .75rem; white-space: pre-wrap; word-break: break-all; }
.copy button { position: absolute; top: .5rem; right: .5rem; }
.steps { padding-left: 1.2rem; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: .85rem; }
.table tr:last-child td { border-bottom: 0; }
.table tr.muted td { color: var(--muted); }
.table .actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }
.table select { padding: .3rem .5rem; width: auto; }
.inline-form { display: inline; }

@media (max-width: 700px) {
  .topbar { gap: .75rem; padding: .6rem 1rem; flex-wrap: wrap; }
  .who span { display: none; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .table td { border: 0; padding: .15rem 0; }
  .table .actions { justify-content: flex-start; padding-top: .4rem; }
  .code { font-size: 1.5rem; }
}

/* Toestel: bediening en opdrachten */
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.screenshot { margin: 0; }
.screenshot img { display: block; width: 100%; max-height: 60vh; object-fit: contain; background: #000; border-radius: 8px; border: 1px solid var(--border); }
.screenshot figcaption { margin-top: .4rem; }
.table.compact td { padding: .45rem .25rem; }
.table td.status { text-align: right; white-space: nowrap; }
.badge.status-ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.badge.status-error { color: var(--error); background: var(--error-bg); border-color: transparent; }
.badge.status-busy { color: var(--accent); border-color: var(--accent); }
@media (max-width: 700px) { .table.compact tr { display: table-row; } .table.compact td { display: table-cell; } }

/* Media en afspeellijsten */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.title-form { flex: 1; }
.title-input { font-size: 1.4rem; font-weight: 600; max-width: 520px; }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1rem; font-weight: 400; }
.dropzone input { border: 0; background: none; padding: 0; }
progress { width: 100%; height: .6rem; accent-color: var(--accent); }
.media-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card.media { margin: 0; padding: .75rem; display: flex; flex-direction: column; gap: .35rem; }
.card.media h3 { font-size: .95rem; margin: .25rem 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.media p { margin: 0; }
.card.media form { margin-top: auto; }
.thumb { aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; display: grid; place-items: center; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: contain; }
.web-host { color: #fff; font-size: .85rem; padding: .5rem; text-align: center; overflow-wrap: anywhere; }
.mini-thumb { width: 96px; flex: none; }
.mini-thumb img, .mini-thumb video, .mini-thumb .web-host { width: 96px; height: 54px; object-fit: contain; background: #000; border-radius: 4px; display: grid; place-items: center; }
.table.playlist td { vertical-align: middle; }
.duration { width: 6.5rem; }
.picker { display: grid; gap: .4rem; max-height: 420px; overflow-y: auto; margin-bottom: 1rem; }
.pick { display: flex; align-items: center; gap: .6rem; font-weight: 400; padding: .3rem; border-radius: 6px; }
.pick:hover { background: var(--bg); }
.pick input { width: auto; }
.pick-name { overflow: hidden; text-overflow: ellipsis; }
button[disabled] { opacity: .4; cursor: default; }

/* Updates en installatie */
.update-box { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .65rem .9rem; border: 1px solid var(--accent); border-radius: 8px; margin-bottom: 1rem; }
details { margin-top: 1rem; }
summary { cursor: pointer; }

/* Campagnes */
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
textarea { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .55rem .7rem; width: 100%; }
@media print {
  .topbar, .no-print, form, .button, button { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; padding: 0; }
}

/* Layout van een afspeellijst */
.layout-form { display: grid; gap: 1rem; }
.layout-choices { display: flex; gap: 1rem; flex-wrap: wrap; }
.layout-choice { display: grid; justify-items: center; gap: .4rem; font-weight: 400; padding: .6rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.layout-choice:has(input:checked) { border-color: var(--accent); outline: 1px solid var(--accent); }
.layout-choice input { position: absolute; opacity: 0; }
.layout-sketch { width: 128px; aspect-ratio: 16 / 9; background: #111; border-radius: 4px; display: grid; grid-template-rows: 1fr; gap: 3px; padding: 3px; }
.layout-sketch.banner { grid-template-rows: 18% 1fr; }
.layout-sketch span { background: #3a3a3a; border-radius: 2px; }
.layout-sketch .z-banner { background: var(--accent); }
.layout-form:has(input[value=Full]:checked) .banner-options { display: none; }
.banner-options { display: grid; gap: .75rem; max-width: 640px; }
.label { font-weight: 500; margin-right: .5rem; }
.partner-picker { max-height: 260px; margin: .4rem 0 0; }
.qr-preview { display: flex; align-items: center; gap: .8rem; }
.qr-preview img { width: 96px; height: 96px; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.filter-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 1rem; }
.filter-tabs a { padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; }
.filter-tabs a.on { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.media-category { display: flex; gap: .4rem; align-items: center; margin-top: .4rem; }

/* Datapagina's en baaninfo */
.level { display: inline-flex; align-items: center; gap: .35rem; }
.level::before { content: ""; width: .65rem; height: .65rem; border-radius: 50%; background: #2d9d5b; }
.level.Limited::before { background: #e8a317; }
.level.Closed::before { background: #d64545; }
.presets { display: flex; flex-wrap: wrap; gap: .5rem; }
.events input { min-width: 0; }
.events td { padding: .25rem; }
.events .c-date { width: 9.5rem; }
.events .c-time { width: 6rem; }
.preview-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.preview-list li { display: flex; gap: .75rem; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 6px; }
.preview-list .when { min-width: 9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pending { border-color: var(--accent); }
pre.api { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); padding: .75rem; border-radius: 8px; font-size: .8rem; }

/* Log met opdrachten onderaan een toestel: één regel per opdracht */
.log-wrap { overflow-x: auto; }
.table.log th, .table.log td { padding: .35rem .5rem; font-size: .85rem; vertical-align: middle; }
.table.log .nowrap { white-space: nowrap; }
.table.log .result { max-width: 32rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Vertoningen per uur */
.hours { display: flex; align-items: flex-end; gap: 3px; height: 110px; margin: .5rem 0 1rem; padding-bottom: 1.1rem; position: relative; }
.hour { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 14px; }
.hour .bar { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 1px; }
.hour .lbl { position: absolute; bottom: -1.1rem; font-size: .7rem; color: var(--muted); }

.version { color: var(--muted); font-size: .75rem; font-family: ui-monospace, Menlo, Consolas, monospace; white-space: nowrap; }
@media (max-width: 700px) { .version { display: none; } }

/* Rol en bedrijf (info) per gebruiker */
.role-form { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; margin: 0; }
.role-form select, .role-form input { width: auto; min-height: 32px; padding: .25rem .5rem; font-size: .85rem; }
.role-form .company { width: 11rem; }
.wide-stack { max-width: 720px; }

[hidden] { display: none !important; }

/* Baaninfo: baanstatus per onderdeel (segmentknoppen) */
.facilities { border-collapse: collapse; margin-bottom: 1rem; }
.facilities th { text-align: left; font-weight: 600; padding: .35rem 1rem .35rem 0; white-space: nowrap; }
.facilities td { padding: .35rem 0; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid #d1d5db; border-radius: .5rem; overflow: hidden; }
.seg label { position: relative; cursor: pointer; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: .4rem .8rem; border-left: 1px solid #d1d5db; }
.seg label:first-child span { border-left: 0; }
.seg input:focus-visible + span { outline: 2px solid #2d6a4f; outline-offset: -2px; }
.seg input:checked + span { color: #fff; font-weight: 600; background: #6b7280; }
.seg .tone-Good input:checked + span { background: #2d9d5b; }
.seg .tone-Warn input:checked + span { background: #d58b0a; }
.seg .tone-Bad input:checked + span { background: #d64545; }
.seg .tone-hide input:checked + span { background: #e5e7eb; color: #374151; }
.facilities.weekhours td { padding-right: .6rem; }
.facilities.weekhours input[type=time] { width: auto; }

/* Modules bij een toestel */
.module-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.module-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid #e5e7eb; }
.module-list li:last-child { border-bottom: 0; }
.module-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.module-cards .card { margin: 0; }
.niko-lights { display: flex; flex-direction: column; gap: .25rem; margin: .5rem 0; }
.niko-lights .label { font-weight: 600; }
