/* BeukersAudio beheer — "regietafel naast de bak", in daglicht.
   Grond is een lichte kalkgroen-grijs (staldeur, gewitte muur), panelen zijn
   wit. Die twee lagen doen het werk: geen vlak wit scherm, wel rustig.
   Oker voor selectie en primaire acties, groen uitsluitend voor "live",
   rood uitsluitend voor fout. De tegels die jij kleurt blijven het felste. */

:root {
  --ground: #E6EAE5;
  --ground-2: #DCE1DA;
  --panel: #FFFFFF;
  --panel-2: #F2F5F1;

  --line: #CDD4CB;
  --line-soft: #E2E7E0;

  --text: #1A211B;
  --text-2: #4C554E;
  --text-3: #6B746D;

  --ochre: #B8801F;
  --ochre-fill: #E7AC3E;
  --ochre-soft: #FBF1DC;
  --live: #2E7D4F;
  --live-soft: #E2F1E7;
  --alarm: #B3382B;
  --alarm-soft: #FBEAE7;

  --r-panel: 12px;
  --r-control: 8px;

  --ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;

  color-scheme: light;
}

* { box-sizing: border-box; }

/* Een klasse als .grid met display:grid verslaat de browserregel voor [hidden].
   Zonder dit blijft een verborgen element gewoon staan. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 15px/1.5 var(--ui);
  color: var(--text);
  background: var(--ground);
}

/* Waarden zien er anders uit dan woorden: alles wat een getal of een code is,
   krijgt mono met tabulaire cijfers. */
.val, td.val, .mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: .92em;
}

h1 { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -.02em; }

/* Paneelkopjes: klein, gespatieerd, hoofdletters. De labels van een regietafel. */
.eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text-3);
}

.muted { color: var(--text-3); }
.lead { margin: 6px 0 0; color: var(--text-2); max-width: 68ch; }
.error { color: var(--alarm); }
.warn { color: var(--ochre); }
a { color: var(--ochre); }

/* ---------- Inloggen ---------- */
#gate { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
#gate[hidden] { display: none; }
#gate form {
  width: min(400px, 100%);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 14px 40px rgb(26 33 27 / .10);
}
#gate h1 { margin-bottom: 6px; }
#gate p { margin: 0 0 22px; color: var(--text-3); font-size: 14px; }
#gate input { width: 100%; margin-bottom: 14px; }
#gate button { width: 100%; }
#gate .error { margin: 14px 0 0; font-size: 14px; }

/* ---------- Schil ---------- */
#app { display: flex; min-height: 100vh; }
#app[hidden] { display: none; }

aside {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: 216px;
  height: 100vh;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 22px 12px 16px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.brand { padding: 0 10px 22px; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.brand span { color: var(--ochre); }

#nav { flex: 1; display: flex; flex-direction: column; gap: 1px; }
#nav button {
  position: relative;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r-control);
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
}
#nav button:hover { background: var(--panel-2); color: var(--text); }
#nav button[aria-current="page"] { background: var(--ochre-soft); color: var(--text); }
/* Okerstaaf i.p.v. een gevulde knop: rustiger, en de kleur blijft voorbehouden
   aan wat je kunt aanraken. */
#nav button[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0; top: 9px; bottom: 9px;
  width: 3px; border-radius: 2px;
  background: var(--ochre);
}

main { flex: 1; min-width: 0; padding: 26px 30px 64px; }
.wrap { max-width: 1080px; }

/* ---------- Besturing ---------- */
button, input, select, textarea { font-family: inherit; font-size: 14px; }

button {
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--panel);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
button:hover { background: var(--panel-2); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--ochre);
  outline-offset: 2px;
}

button.primary { border-color: var(--ochre-fill); background: var(--ochre-fill); color: #241B06; }
button.primary:hover { background: #F2B94E; }
button.danger { border-color: transparent; background: none; color: var(--alarm); }
button.danger:hover { background: var(--alarm-soft); }
button.quiet { border-color: transparent; background: none; color: var(--text-2); }
button.quiet:hover { background: var(--panel-2); color: var(--text); }
button.tiny { padding: 5px 10px; font-size: 13px; }
button[disabled] { opacity: .4; cursor: not-allowed; }

input[type=text], input[type=password], input[type=search], input[type=url],
input[type=number], select {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--panel);
  color: var(--text);
}
input::placeholder { color: var(--text-3); }
input[type=color] {
  width: 44px; height: 38px; padding: 3px;
  border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--panel); cursor: pointer;
}

label.field { display: block; margin-bottom: 14px; }
label.field > span {
  display: block; margin-bottom: 5px;
  font-size: 12px; font-weight: 600; color: var(--text-3);
}
label.field > input, label.field > select, label.field > .picked { width: 100%; }

.row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 8px; }

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  background: var(--panel);
}
.head { margin-bottom: 22px; }

/* ---------- Tabellen ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
  background: var(--panel);
}
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); }
th {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3); background: var(--panel-2);
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }
td.right, th.right { text-align: right; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.ok { background: var(--live-soft); color: var(--live); }
.pill.wait { background: var(--ochre-soft); color: var(--ochre); }
.pill.off { background: var(--ground-2); color: var(--text-3); }

/* ---------- Uploaden ---------- */
#drop {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 34px; margin-bottom: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--r-panel);
  background: var(--panel);
  text-align: center; cursor: pointer;
  transition: border-color .12s, background .12s;
}
#drop:hover, #drop.over { border-color: var(--ochre); background: var(--ochre-soft); }
#drop strong { font-size: 15px; }

.bar { height: 6px; border-radius: 3px; background: var(--ground-2); overflow: hidden; margin-bottom: 8px; }
.bar i { display: block; height: 100%; width: 0; background: var(--ochre-fill); transition: width .15s; }

/* ---------- Profiel-designer ---------- */
.designer {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr) 316px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1240px) { .designer { grid-template-columns: 180px minmax(0, 1fr); } }

.col {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  background: var(--panel);
}

.pagelist button.page {
  display: flex; align-items: center; gap: 8px;
  width: 100%; margin-bottom: 3px; padding: 9px 10px;
  border: 1px solid transparent; border-radius: var(--r-control);
  background: none; color: var(--text-2);
  text-align: left; font-weight: 600; font-size: 14px;
}
.pagelist button.page:hover { background: var(--panel-2); color: var(--text); }
.pagelist button.page[aria-current="true"] {
  border-color: var(--ochre); background: var(--ochre-soft); color: var(--text);
}
.pagelist .count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-3); }

/* Het signature-element: de preview is een tablet, geen los raster. Je ziet je
   eigen tabjes en de spelerbalk eromheen. De donkere rand maakt er een apparaat
   van in plaats van nog een paneel. */
.device {
  border-radius: 16px;
  background: #2A2F2B;
  padding: 12px;
  box-shadow: 0 8px 24px rgb(26 33 27 / .16);
}
.device-screen {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  /* minmax(0,1fr) i.p.v. auto: anders duwt de inhoud de rij op en negeert de
     verhouding zichzelf. */
  grid-template-rows: minmax(0, 1fr) auto;
  /* Verhouding van een Surface Go, zodat de preview klopt en niet uitrekt. */
  aspect-ratio: 3 / 2;
  max-height: 66vh;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
  color: #1c2530;

  --tile-bg: #f1f3f5;
  --tile-border: #dfe3e8;
  --tile-text: #1c2530;
}
.device-tabs {
  min-height: 0;
  border-right: 1px solid #e4e7eb;
  padding: 10px 8px;
  display: flex; flex-direction: column; gap: 3px;
  overflow: hidden;
}
.device-tab {
  padding: 8px 9px; border-radius: 7px;
  font-size: 12px; font-weight: 600; color: #1c2530;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; border: 0; background: none; text-align: left;
}
.device-tab:hover { background: #f1f3f5; }
.device-tab[aria-current="true"] { background: #16a34a; color: #fff; }
.device-body { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 12px; }
.device-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: #1c2530; }
.device-grid { flex: 1; min-height: 0; }
.device-bar {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 44px; border-top: 1px solid #e4e7eb; background: #fafbfc;
  color: #6b7785; font-size: 13px;
}

.preview .tile { cursor: pointer; }
.preview .tile.selected { outline: 3px solid var(--ochre); outline-offset: -3px; }
.tile.add {
  border-style: dashed; border-color: #c9cfd6; color: #6b7785;
  background: none; font-size: clamp(14px, calc(30cqi / var(--cols, 4)), 30px);
}

.hint { margin: 10px 0 0; font-size: 12.5px; color: var(--text-3); }

/* ---------- Kiezer (modal) ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 24px;
  background: rgb(26 33 27 / .42);
}
.modal[hidden] { display: none; }
.modal-box {
  display: flex; flex-direction: column;
  width: min(720px, 100%); max-height: min(78vh, 720px);
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgb(26 33 27 / .28);
  overflow: hidden;
}
.modal-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line-soft); }
.modal-head input { width: 100%; margin-top: 12px; }
.modal-list { flex: 1; overflow-y: auto; padding: 6px; }
.modal-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 20px; border-top: 1px solid var(--line-soft); background: var(--panel-2);
}

.pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 14px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid transparent; border-radius: var(--r-control);
  background: none; text-align: left; cursor: pointer;
}
.pick:hover { background: var(--panel-2); }
.pick[aria-selected="true"] { border-color: var(--ochre); background: var(--ochre-soft); }
.pick-title { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-sub { grid-column: 1; font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-meta {
  grid-row: 1 / span 2; align-self: center;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 12px; color: var(--text-3);
}

/* Gekozen waarde in het eigenschappenpaneel */
.picked {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--panel);
  text-align: left; cursor: pointer;
}
.picked:hover { border-color: var(--ochre); }
.picked .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked.empty .label { color: var(--text-3); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  padding: 12px 20px; border-radius: 10px;
  background: #23291F; color: #F2F5F1;
  font-weight: 600; font-size: 14px;
  box-shadow: 0 12px 30px rgb(26 33 27 / .3); z-index: 80;
}
#toast[hidden] { display: none; }
#toast.bad { background: var(--alarm); }

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

/* Labels op nummers: klikbaar als snelfilter. */
.tag {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
}
.tag:hover { border-color: var(--ochre); background: var(--ochre-soft); color: var(--text); }

.notice-line {
  margin: 0;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.notice-line:last-child { border-bottom: 0; color: var(--text-3); }

/* ---------- Bedieningscentrum ---------- */
/* Eén layout voor bureaublad en telefoon: kolommen vullen zich vanzelf. */
.devices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.device-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  background: var(--panel);
}
.device-card.offline { background: var(--panel-2); }
.device-card.offline .now-label { color: var(--text-3); }

.device-card .now { margin: 14px 0 4px; min-height: 42px; }
.device-card .now strong { display: block; font-size: 16px; }
.device-card .now span { font-size: 13px; }

.ctls { justify-content: center; gap: 4px; margin-top: 6px; }
.ctl {
  display: grid; place-items: center;
  width: 46px; height: 46px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--text);
}
.ctl:hover:not([disabled]) { background: var(--panel-2); }
.ctl svg { width: 21px; height: 21px; }
.ctl.on { color: var(--ochre); }

.vol { margin-top: 12px; gap: 12px; }
.vol-icon { display: flex; color: var(--text-3); }
.vol-icon svg { width: 20px; height: 20px; }
.vol input[type=range] { flex: 1; accent-color: var(--ochre); }

.page-tabs { margin: 16px 0 10px; }
.card-grid[hidden] { display: none; }
/* Compacte tegels: dit is bedienen, niet ontwerpen. */
.card-grid .device-grid {
  --tile-bg: #f1f3f5; --tile-border: #dfe3e8; --tile-text: #1c2530;
  --tile-cap: 22cqi;
  max-height: 260px;
}

/* Plek in het raster: een klein kruis, zodat de richting klopt met wat je ziet. */
.nudge {
  display: grid;
  grid-template-areas: ". up ." "left pos right" ". down .";
  gap: 5px;
  justify-items: center;
  align-items: center;
  max-width: 190px;
}
.nudge button { min-width: 40px; }
.nudge-pos {
  grid-area: pos;
  font-family: var(--mono); font-size: 11px; color: var(--text-3); text-align: center;
}

/* Slepen in de designer */
.preview .tile[draggable="true"] { cursor: grab; }
.preview .tile.dragging { opacity: .35; cursor: grabbing; }
.preview .drop-target {
  outline: 3px dashed var(--ochre);
  outline-offset: -3px;
}
/* Tussenkopje is in de designer aanklikbaar om te wijzigen. */
.preview .grid-header { cursor: pointer; }
.preview .grid-header:hover { color: var(--ochre); }
