:root {
  /* Standaardhuisstijl Vision. Per klant overschreven door /brand.css */
  --paper: #FBFCFD;
  --surface: #FFFFFF;
  --ink: #0F1729;
  --muted: #556070;
  --line: #E3E8EF;
  --sunken: #F3F6F9;
  --accent: #0891B2;
  --accent-hover: #0E7490;
  --accent-ink: #155E75;
  --accent-soft: #ECFEFF;
  --night: #0B1220;
  --ok: #15803D;
  --bad: #B91C1C;
  --warn: #B45309;
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --pill: 999px;
  --shadow: 0 4px 12px rgb(28 25 23 / 0.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
a { color: var(--accent-ink); }
code, pre { font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Merk ---------- */
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; }
.brand img { display: block; height: 40px; width: auto; }
.brand-sub { font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: .01em; padding-left: 2px; }
.brand-lg img { height: 56px; }
.brand-lg { margin-bottom: .25rem; }

/* ---------- Knoppen & velden ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 500;
  padding: .55rem 1rem; min-height: 40px;
  border: 1px solid var(--line); border-radius: var(--pill);
  background: var(--surface); color: var(--ink);
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: #CFC8C1; background: var(--sunken); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; box-shadow: 0 6px 16px rgb(249 115 22 / 0.24); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent-ink); box-shadow: none; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { min-height: 32px; padding: .3rem .65rem; font-size: .875rem; }
.btn.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent-ink); text-decoration: underline; box-shadow: none; }
.btn.link:hover { background: none; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.danger-text { color: var(--bad) !important; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label { display: grid; grid-template-columns: minmax(0, 1fr); gap: .3rem; font-weight: 500; font-size: .9rem; min-width: 0; }
input, select {
  font: inherit; font-weight: 400; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: #fff; padding: .5rem .65rem; min-height: 40px; width: 100%; min-width: 0;
}
input:focus, select:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
.form-error { color: var(--bad); min-height: 1.2em; margin: 0; font-size: .9rem; }

/* ---------- Inloggen ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-box {
  width: min(380px, 100%); display: grid; gap: 1rem;
  background: var(--surface); padding: 2rem; border-radius: var(--radius-l);
  border: 1px solid var(--line); box-shadow: 0 20px 45px rgb(28 25 23 / 0.10);
}

/* ---------- Indeling ---------- */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.rail {
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 1.25rem .75rem; display: flex; flex-direction: column; gap: .25rem;
  position: sticky; top: 0; height: 100vh;
}
.rail .brand { padding: 0 .5rem 1.25rem; }
.nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .65rem; border-radius: var(--radius-s);
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.nav-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-link:hover { background: var(--sunken); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav-badge { margin-left: auto; background: var(--bad); color: #fff; font-size: .75rem; border-radius: 999px; padding: 0 .45rem; font-weight: 700; }
.rail-foot { margin-top: auto; padding: .5rem; display: grid; gap: .25rem; font-size: .875rem; }

.view { padding: 1.25rem 1.5rem 3rem; min-width: 0; }
.view.narrow { max-width: 860px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.select-title { font-size: 1.35rem; font-weight: 700; width: auto; max-width: 340px; border-color: transparent; background-color: transparent; padding-left: .25rem; }
.select-title:hover { border-color: var(--line); background: #fff; }
.save-state { font-size: .875rem; color: var(--muted); min-width: 7em; text-align: right; }
.save-state.error { color: var(--bad); }
.playing-on { color: var(--muted); font-size: .9rem; margin: -.25rem 0 1rem .3rem; }

/* ---------- Diavoorstelling-editor ---------- */
.editor {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 300px;
  gap: 1.25rem; align-items: start;
}
.strip {
  list-style: none; margin: 0; padding: .25rem .25rem 1rem 0;
  display: grid; gap: .75rem; counter-reset: slide;
  max-height: calc(100vh - 150px); overflow-y: auto;
}
.slide {
  counter-increment: slide;
  display: grid; grid-template-columns: 1.6rem 1fr; gap: .4rem; align-items: start;
  cursor: grab;
}
.slide::before {
  content: counter(slide);
  font-weight: 700; font-size: .85rem; color: var(--muted);
  text-align: right; padding-top: .15rem; font-variant-numeric: tabular-nums;
}
.slide-thumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-s);
  background: #E9E6E2 center / cover no-repeat;
  border: 2px solid transparent; overflow: hidden;
  outline: 1px solid var(--line);
}
.slide:hover .slide-thumb { outline-color: #CFC8C1; }
.slide.selected .slide-thumb { border-color: var(--accent); outline: 2px solid var(--accent); }
.slide.selected::before { color: var(--accent-ink); }
.slide.disabled .slide-thumb { opacity: .4; }
.slide.dragging { opacity: .35; }
.slide.drop-before .slide-thumb { box-shadow: 0 -5px 0 -1px var(--accent); }
.slide.drop-after .slide-thumb { box-shadow: 0 5px 0 -1px var(--accent); }
.slide-tags {
  position: absolute; left: 4px; bottom: 4px; right: 4px;
  display: flex; gap: 3px; flex-wrap: wrap;
}
.tag {
  font-size: .7rem; font-weight: 700; line-height: 1;
  background: rgb(28 25 23 / .82); color: #fff;
  padding: .2rem .3rem; border-radius: 3px;
}
.tag.clock { background: var(--warn); }
.tag.off { background: var(--bad); }

.stage-wrap { min-width: 0; display: grid; gap: 1rem; }
.stage {
  aspect-ratio: 16 / 9; width: 100%;
  background: var(--night); border-radius: var(--radius-l);
  display: grid; place-items: center; overflow: hidden; position: relative;
}
.stage img, .stage video { width: 100%; height: 100%; display: block; }
.stage-empty { text-align: center; color: #E7E2DD; padding: 2rem; }
.stage-empty .muted { color: #A8A29E; }
.stage-empty-title { font-size: 1.3rem; font-weight: 700; color: #fff; }
.stage-empty b { color: #fff; }

.uploads { display: grid; gap: .4rem; }
.upload-row { display: grid; grid-template-columns: 1fr 160px auto; align-items: center; gap: .75rem; font-size: .875rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .4rem .7rem; }
.upload-row progress { width: 100%; accent-color: var(--accent); }
.upload-row.error { border-color: var(--bad); color: var(--bad); }

.library { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: .75rem 1rem; }
.library summary { cursor: pointer; font-weight: 500; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; margin-top: .5rem; }
.lib-item { display: grid; gap: .25rem; font-size: .8rem; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); font-family: inherit; }
.lib-item .slide-thumb { outline: 1px solid var(--line); }
.lib-item:hover .slide-thumb { outline: 2px solid var(--accent); }
.lib-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-actions { display: flex; gap: .5rem; }

/* Eigenschappenpaneel */
.props {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; position: sticky; top: 1rem;
}
.props > * { min-width: 0; }
.field-row > * { min-width: 0; }
.props-empty { color: var(--muted); }
.props h2 { margin: 0; font-size: 1rem; word-break: break-word; }
.props .meta { font-size: .8rem; color: var(--muted); margin: -.6rem 0 0; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .5rem; }
.field-row input[type="date"], .field-row input[type="time"] { padding-left: .4rem; padding-right: .2rem; font-size: .875rem; }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.seg button { flex: 1; font: inherit; font-size: .85rem; border: 0; background: #fff; padding: .45rem .3rem; cursor: pointer; color: var(--ink); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: .5rem; }
.fieldset legend { font-weight: 500; font-size: .9rem; padding: 0; margin-bottom: .3rem; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.days button { font: inherit; font-size: .8rem; padding: .35rem 0; border: 1px solid var(--line); background: #fff; border-radius: 4px; cursor: pointer; color: var(--ink); }
.days button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.props-actions { display: flex; flex-wrap: wrap; gap: .4rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.hint { font-size: .8rem; color: var(--muted); margin: 0; }

.dropzone {
  position: fixed; inset: 0; z-index: 50;
  background: rgb(249 115 22 / .88); color: #fff;
  display: grid; place-items: center; font-size: 1.6rem; font-weight: 700;
  border: 6px dashed rgba(255,255,255,.7);
}

/* ---------- Schermen ---------- */
.screen-list { display: grid; gap: 1rem; }
.screen {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
  display: grid; grid-template-columns: 280px 1fr; gap: 1.25rem; padding: 1rem; box-shadow: var(--shadow);
}
.shot {
  aspect-ratio: 16 / 9; border-radius: var(--radius-m); background: var(--night);
  display: grid; place-items: center; overflow: hidden; color: #A8A29E; font-size: .85rem;
  border: 0; padding: 0; cursor: zoom-in; width: 100%; font-family: inherit; text-align: center;
}
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-time { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.screen-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem; margin-bottom: .25rem; }
.screen-head h2 { margin: 0; font-size: 1.2rem; }
.state { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; font-size: .9rem; }
.state::before { content: ""; width: .65rem; height: .65rem; border-radius: 50%; background: currentColor; }
.state.online { color: var(--ok); }
.state.offline { color: var(--bad); }
.state.partial { color: var(--warn); }
.facts { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; font-size: .875rem; color: var(--muted); margin: .25rem 0 .75rem; }
.facts b { color: var(--ink); font-weight: 500; }
.screen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-bottom: .75rem; }
.screen-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.screen-actions .spacer { flex: 1; }
.pending { font-size: .8rem; color: var(--warn); }
.empty-state { background: var(--surface); border: 1px dashed #CFC8C1; border-radius: var(--radius-m); padding: 2.5rem 1.5rem; text-align: center; }

/* ---------- Instellingen ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.code { background: var(--night); color: #FDF1E7; padding: .85rem 1rem; border-radius: var(--radius-s); overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 0 0 .6rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin-top: .75rem; }
.inline-form label { flex: 1 1 200px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table td { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.table td:last-child { text-align: right; }

/* ---------- Dialogen ---------- */
.dialog { border: 0; border-radius: var(--radius-m); padding: 1.5rem; width: min(440px, calc(100% - 32px)); color: var(--ink); }
.dialog.wide { width: min(1100px, calc(100% - 32px)); }
.dialog::backdrop { background: rgb(28 25 23 / .55); }
.dialog form { display: grid; gap: .9rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; }
#shotImg { width: 100%; border-radius: var(--radius-s); display: block; margin-bottom: .75rem; }
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-transform: uppercase; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Voorstelling ---------- */
.preview-overlay { position: fixed; inset: 0; z-index: 60; background: #000; display: grid; grid-template-rows: 1fr auto; }
.preview-frame { position: relative; overflow: hidden; }
.preview-frame > * { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .8s ease, transform .8s ease; }
.preview-bar { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1rem; color: #E7E2DD; background: var(--night); font-size: .9rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70;
  background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: var(--radius-s);
  font-size: .95rem; max-width: calc(100% - 32px);
}
.toast.error { background: var(--bad); }

/* ---------- Responsief ---------- */
@media (max-width: 1150px) {
  .editor { grid-template-columns: 170px minmax(0, 1fr); }
  .props { grid-column: 1 / -1; position: static; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .6rem 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail .brand { padding: 0 .75rem 0 0; }
  .rail-foot { margin: 0 0 0 auto; display: flex; gap: .75rem; padding: 0; }
  .rail-foot #whoami { display: none; }
  .nav-link { padding: .45rem .55rem; }
  .view { padding: 1rem 16px 3rem; }
  .editor { grid-template-columns: 1fr; }
  .strip { grid-auto-flow: column; grid-auto-columns: 150px; overflow-x: auto; overflow-y: hidden; max-height: none; padding-bottom: .5rem; }
  .screen { grid-template-columns: 1fr; }
  .upload-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .preview-frame > * { transition: none; }
}

/* ---------- Monitoring: overzicht, nieuwe schermen, activiteit ---------- */
.overview { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: .6rem 1rem; display: flex; align-items: baseline; gap: .5rem; box-shadow: var(--shadow); }
.stat b { font-size: 1.5rem; font-weight: 800; }
.stat span { color: var(--muted); font-size: .9rem; }
.stat.ok b { color: var(--ok); }
.stat.bad b { color: var(--bad); }
.stat.warn b { color: var(--warn); }

.pending-block { background: var(--accent-soft); border: 1px solid #F6C89A; border-radius: var(--radius-l); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.pending-block h2 { color: var(--accent-ink); }
.pending-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m); padding: .6rem .9rem; margin-top: .6rem; }
.pending-actions { display: flex; gap: .4rem; }

.remote-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-m); padding: .5rem .8rem; margin-bottom: .75rem; font-size: .9rem; }
.remote-row .ico { width: 18px; height: 18px; flex: none; }
.remote-row .rd b { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.remote-row .spacer { flex: 1; }

.log-panel { margin-top: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: .5rem 1rem; }
.log-panel summary { cursor: pointer; font-weight: 500; color: var(--muted); }
.event-log { margin-top: .6rem; display: grid; gap: .3rem; max-height: 320px; overflow-y: auto; }
.event { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem; font-size: .875rem; padding: .25rem 0; border-bottom: 1px solid var(--line); }
.event-when { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 820px) { .event { grid-template-columns: 1fr; gap: 0; } .event-when { font-size: .8rem; } }

/* ---------- Dia maken (composer) ---------- */
.composer-overlay { position: fixed; inset: 0; z-index: 65; background: rgb(28 25 23 / .55); display: grid; place-items: center; padding: 2vh 2vw; }
.composer { background: var(--paper); border-radius: var(--radius-l); width: min(1180px, 100%); max-height: 96vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 70px rgb(0 0 0 / .35); }
.composer-head { display: flex; align-items: center; gap: .75rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.composer-head b { font-size: 1.15rem; }
.composer-head .spacer { flex: 1; }
.composer-body { display: grid; grid-template-columns: 340px 1fr; gap: 1.25rem; padding: 1.25rem; overflow-y: auto; }
.composer-form { display: grid; gap: .9rem; align-content: start; }
.composer-form label { font-size: .85rem; }
.composer-preview { display: grid; gap: .5rem; align-content: start; }
.canvas-wrap { border-radius: var(--radius-m); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
#composerCanvas { width: 100%; height: auto; display: block; }

.tmpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.tmpl { border: 2px solid var(--line); border-radius: var(--radius-s); background: #fff; padding: 0; cursor: pointer; overflow: hidden; aspect-ratio: 16/9; font: inherit; }
.tmpl[aria-pressed="true"] { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.tmpl canvas { width: 100%; height: 100%; display: block; }

.swatches { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
.swatch.photo { display: grid; place-items: center; background: var(--sunken); font-size: 1rem; }
.composer-form .seg { width: 100%; }
.field-hint { font-size: .78rem; color: var(--muted); margin: -.5rem 0 0; }
@media (max-width: 820px) {
  .composer-body { grid-template-columns: 1fr; }
  .composer-preview { order: -1; }
}
