/* ---------- thema ----------
   Rustig en compact. Licht en donker; automatisch volgens het systeem, of vast via data-theme op <html>.
   Accentkleur: helder blauw (goed leesbaar in beide thema's, niet vermoeiend). */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --surface-3: #e5e8ec;
  --text: #16191d;
  --text-2: #5b636e;
  --text-3: #8b939e;
  --border: #e3e6ea;
  --accent: #2f6fde;
  --accent-2: #4a84e8;
  --accent-soft: rgba(47, 111, 222, .09);
  --on-accent: #ffffff;
  --ok: #1f9d55;
  --ok-soft: rgba(31, 157, 85, .11);
  --warn: #c27c0e;
  --warn-soft: rgba(194, 124, 14, .12);
  --rec: #d64045;
  --rec-soft: rgba(214, 64, 69, .1);
  --off: #b9bfc8;
  --energy: #e09b12;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-pop: 0 8px 28px rgba(16, 24, 40, .14);
  --radius: 10px;
  --radius-sm: 8px;
  --gutter: 14px;
  --nav-h: 58px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1115;
  --surface: #151920;
  --surface-2: #1b2028;
  --surface-3: #252b35;
  --text: #e4e7eb;
  --text-2: #9aa3af;
  --text-3: #6b7380;
  --border: #232932;
  --accent: #6b9ff5;
  --accent-2: #4a84e8;
  --accent-soft: rgba(107, 159, 245, .13);
  --on-accent: #0e1115;
  --ok: #3fb96f;
  --ok-soft: rgba(63, 185, 111, .14);
  --warn: #e0a43a;
  --warn-soft: rgba(224, 164, 58, .14);
  --rec: #f06a6e;
  --rec-soft: rgba(240, 106, 110, .14);
  --off: #4a525e;
  --energy: #f2b84b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1115;
    --surface: #151920;
    --surface-2: #1b2028;
    --surface-3: #252b35;
    --text: #e4e7eb;
    --text-2: #9aa3af;
    --text-3: #6b7380;
    --border: #232932;
    --accent: #6b9ff5;
    --accent-2: #4a84e8;
    --accent-soft: rgba(107, 159, 245, .13);
    --on-accent: #0e1115;
    --ok: #3fb96f;
    --ok-soft: rgba(63, 185, 111, .14);
    --warn: #e0a43a;
    --warn-soft: rgba(224, 164, 58, .14);
    --rec: #f06a6e;
    --rec-soft: rgba(240, 106, 110, .14);
    --off: #4a525e;
    --energy: #f2b84b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}
h1 { font-size: 19px; line-height: 1.2; letter-spacing: -.015em; margin: 0; font-weight: 650; display: flex; align-items: center; gap: 6px; }
h2 { font-size: 14px; margin: 20px 0 8px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
h3 { font-size: 14px; margin: 0; font-weight: 650; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
button, select, input { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---------- bovenbalk en tabbladen ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(7px + env(safe-area-inset-top)) var(--gutter) 7px;
  /* Geen backdrop-filter op mobiel: dat zou de vaste tabbalk onderaan in de header opsluiten */
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 900px) {
  .topbar {
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  }
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.logo {
  width: 22px; height: 22px; border-radius: 6px;
  background: url(/static/icons/logo.svg) center / cover no-repeat;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); transition: background .3s; }
.live-dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

/* Eén hoofdmenu-optie: geen menubalk */
.tabs[hidden] { display: none !important; }
body.no-nav { --nav-h: 0px; }

/* Mobiel: tabbalk onderaan */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  /* Aantal tabbladen hangt af van de plugins: bij veel tabbladen kun je zijwaarts vegen */
  display: flex; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--border);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: 1 0 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--text-3); cursor: pointer;
  font-size: 11px; font-weight: 600; padding: 6px 2px; min-width: 0;
  -webkit-tap-highlight-color: transparent;
}
.tab svg { width: 21px; height: 21px; }
.tab span.lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab[aria-selected="true"] { color: var(--accent); }
.badge {
  position: absolute; top: 4px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--rec); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.badge[hidden] { display: none; }

.bell-btn { position: relative; width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; -webkit-tap-highlight-color: transparent; }
.bell-btn svg { width: 18px; height: 18px; }
.bell-btn[aria-pressed="true"] { color: var(--accent); }
.bell-btn .badge { position: absolute; top: -2px; left: auto; right: -3px; min-width: 15px; height: 15px; padding: 0 4px; font-size: 10px; line-height: 15px; border-radius: 8px; pointer-events: none; }
.bell-btn .badge[hidden] { display: none; }

/* Desktop: tabbladen bovenin */
@media (min-width: 900px) {
  body { padding-bottom: 40px; }
  .tabs {
    position: static; display: flex; gap: 2px; height: auto; padding: 3px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .tabs { max-width: 70vw; }
  .tab { flex: 0 0 auto; flex-direction: row; gap: 8px; font-size: 13px; padding: 6px 12px; border-radius: 7px; color: var(--text-2); }
  .tab svg { width: 18px; height: 18px; }
  .tab[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
  .badge { position: static; margin-left: 2px; }
}

main { max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); }
.view { display: none; padding-top: 14px; animation: fade .15s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }

/* ---------- basiselementen ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); min-width: 0;
}
.card-pad { padding: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 32px; padding: 5px 11px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 550; font-size: 13px; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--rec); }
.btn.icon { padding: 0; width: 32px; }
.btn.sm { min-height: 28px; padding: 3px 9px; font-size: 12.5px; border-radius: 6px; }
.btn.sm.icon { width: 28px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
select, input[type=text], input[type=number], input[type=url] {
  min-height: 32px; padding: 5px 9px; border-radius: 7px; font-size: 13px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); max-width: 100%;
}
.select-sm { min-height: 28px; padding: 3px 8px; font-size: 12.5px; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.switch { position: relative; width: 36px; height: 20px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 30px; background: var(--surface-3);
  transition: background .2s; pointer-events: none;
}
.switch span::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:disabled + span { opacity: .5; }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 10px;
  font-size: 11px; font-weight: 650; letter-spacing: .02em; background: var(--surface-2); color: var(--text-2);
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.rec { background: var(--rec); color: #fff; }
.pill .blink { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--off); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.err { color: var(--rec); font-size: 13px; overflow-wrap: anywhere; }
.err:empty { display: none; }

.notice {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 10px; font-size: 13px;
}
.notice svg { width: 16px; height: 16px; flex: none; color: var(--accent); margin-top: 1px; }
.notice code { font-size: 13px; background: var(--surface); padding: 1px 5px; border-radius: 6px; }

.empty {
  text-align: center; padding: 28px 14px; color: var(--text-2); font-size: 13px;
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty svg { width: 26px; height: 26px; color: var(--text-3); margin-bottom: 6px; }

/* ---------- camera's ---------- */
.camera-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.cam-body, .controls, .ctl, .dev, .settings-card, .event-list { grid-template-columns: minmax(0, 1fr); }
/* Camera's onder elkaar; instellingen als paneel rechts van het beeld (telefoon: lade onderaan) */
.cam { display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .cam { max-width: 720px; }
  .cam.has-panel { max-width: 1120px; grid-template-columns: minmax(0, 720px) minmax(280px, 1fr); }
  .cam-panel { position: relative; border-left: 1px solid var(--border); }
  .cam-panel-head { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .cam-panel-head .btn { display: none; }
  .cam-panel-body { position: absolute; inset: 41px 0 0 0; overflow-y: auto; padding: 8px 12px 12px; overscroll-behavior: contain; }
}
.cam-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (max-width: 899px) {
  .cam-panel {
    position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 40;
    max-height: 38vh; display: flex; flex-direction: column; background: var(--surface);
    border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-pop);
  }
  .cam-panel-head { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .cam-panel-body { overflow-y: auto; padding: 8px 12px 14px; overscroll-behavior: contain; }
}
.cam { overflow: hidden; scroll-margin-top: calc(56px + env(safe-area-inset-top)); }
.player {
  position: relative; aspect-ratio: 16 / 9; background: #07080a; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.player img, .player video { width: 100%; height: 100%; object-fit: contain; display: block; }
.player .placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: #c9ced6; font-size: 14px; text-align: center; padding: 16px; cursor: pointer;
  background: radial-gradient(circle at 50% 40%, #1d2129, #07080a 70%);
}
.player .placeholder svg { width: 52px; height: 52px; opacity: .9; }
.player .placeholder .err { color: #fda4af; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .2);
  border-top-color: #fff; animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.overlay-top {
  position: absolute; top: 0; left: 0; right: 0; padding: 12px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, .5), transparent);
}
.overlay-top .cam-title { color: #fff; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.overlay-top .cam-sub { color: rgba(255, 255, 255, .75); font-size: 12px; }
.overlay-top .pills { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.overlay-top .pill { background: rgba(0, 0, 0, .45); color: #fff; backdrop-filter: blur(6px); }
.overlay-top .pill.rec { background: var(--rec); }
.overlay-top .pill.ok { background: rgba(22, 163, 74, .85); color: #fff; }
.player.fs { position: fixed; inset: 0; z-index: 100; aspect-ratio: auto; background: #000; border-radius: 0; }
.player:fullscreen { aspect-ratio: auto; }
.player .fs-close { display: none; }
.player.fs .fs-close, .player:fullscreen .fs-close {
  display: flex; align-items: center; justify-content: center; position: absolute; z-index: 5;
  top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  width: 48px; height: 48px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: rgba(0,0,0,.6); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.player .fs-close svg { width: 26px; height: 26px; }
.player .fs-hd { display: none; }
.player.fs .fs-hd, .player:fullscreen .fs-hd {
  display: flex; align-items: center; justify-content: center; position: absolute; z-index: 5;
  top: max(12px, env(safe-area-inset-top)); right: calc(max(12px, env(safe-area-inset-right)) + 56px);
  height: 48px; min-width: 56px; padding: 0 14px; border-radius: 24px; border: 0; cursor: pointer;
  background: rgba(0,0,0,.6); color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .5px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.player .fs-hd.off { text-decoration: line-through; text-decoration-thickness: 3px; opacity: .8; }
/* Volledig scherm: video (en dus de eigen knoppen/tekst eronder) binnen de afgeronde hoeken van de iPhone houden */
.player.fs video, .player:fullscreen video {
  width: calc(100% - max(16px, env(safe-area-inset-left)) - max(16px, env(safe-area-inset-right)));
  height: calc(100% - max(12px, env(safe-area-inset-top)) - max(20px, env(safe-area-inset-bottom)));
  margin: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.player.fs .overlay-top, .player:fullscreen .overlay-top {
  padding: max(12px, env(safe-area-inset-top)) 130px 12px max(16px, env(safe-area-inset-left));
}

.cam-toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; flex-wrap: wrap; }
.cam-toolbar .spacer { flex: 1; }
.cam-toolbar .btn.rec-on { background: var(--rec); border-color: var(--rec); color: #fff; }
@media (max-width: 520px) {
  .cam-toolbar { gap: 4px; padding: 8px; }
  .cam-toolbar .spacer { display: none; }
  .cam-toolbar > .btn { padding: 8px 10px; min-width: 0; flex: 0 1 auto; }
  .cam-toolbar > .btn:not(.icon) span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cam-toolbar > .btn[aria-label="Foto"] span { display: none; }
  .cam-toolbar > .btn.icon:last-child { margin-left: auto; }
}
.cam-body { padding: 0 12px 12px; display: grid; gap: 10px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row .label { font-weight: 550; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.row .hint { font-size: 12px; color: var(--text-2); }
.ptz {
  display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(3, 52px); gap: 6px;
  justify-content: center; user-select: none; -webkit-user-select: none; padding: 4px 0;
}
.ptz button {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; touch-action: none; color: var(--text);
}
.ptz button:active, .ptz button.active { background: var(--accent); color: var(--on-accent); }
.ptz button svg { width: 22px; height: 22px; }
.ptz .center { background: transparent; border: 0; pointer-events: none; color: var(--text-3); }
.grid-gap { display: grid; gap: 10px; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.thumb {
  position: relative; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: var(--surface-2);
  border: 0; padding: 0; cursor: pointer;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .t { position: absolute; left: 6px; bottom: 5px; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; }
details.fold { border-top: 1px solid var(--border); padding-top: 6px; }
details.fold > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  font-weight: 550; font-size: 12.5px; color: var(--text-2); padding: 2px 0;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "›"; font-size: 16px; transform: rotate(90deg); transition: transform .2s; }
details.fold[open] > summary::after { transform: rotate(-90deg); }
details.fold > .fold-body { padding-top: 10px; }

/* ---------- energie ---------- */
.meter-list { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.meter { padding: 14px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.meter-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.meter-name { font-weight: 650; font-size: 14px; }
.meter-sub { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.meter-live { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.watts { font-size: 32px; font-weight: 650; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.watts small { font-size: 14px; font-weight: 550; color: var(--text-2); margin-left: 3px; letter-spacing: 0; }
.watts.pulse { animation: pulse .6s ease; }
@keyframes pulse { 30% { color: var(--energy); } }
.meter-extra { display: flex; gap: 12px; font-size: 13px; color: var(--text-2); padding-bottom: 4px; }
.meter-extra b { color: var(--text); font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .stats { grid-template-columns: repeat(6, 1fr); } }
.stat { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.stat .k { font-size: 11.5px; color: var(--text-2); font-weight: 550; }
.stat .v { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .v small { font-size: 12px; color: var(--text-2); font-weight: 600; margin-left: 3px; }
.stat .e { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.segmented {
  display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; gap: 2px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.segmented button {
  border: 0; background: none; padding: 4px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 550;
  color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chart-box { position: relative; height: 210px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.chart-note { font-size: 12px; color: var(--text-2); }

.device-grid { display: grid; align-items: start; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.dev { padding: 10px 12px; display: grid; gap: 8px; }
.dev-head { display: flex; align-items: center; gap: 12px; }
.dev-icon {
  width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-2); flex: none; transition: background .2s, color .2s;
}
.dev-icon.on { background: var(--ok-soft); color: var(--ok); }
.dev-icon svg { width: 16px; height: 16px; }
.dev-title { flex: 1; min-width: 0; }
.dev-title .name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-title .meta { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hint-line { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-2); }
.hint-line svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.controls { display: grid; gap: 12px; }
.ctl { display: grid; gap: 6px; }
.ctl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ctl label { font-size: 14px; }
.ctl .dp { font-size: 11px; color: var(--text-3); }
.ctl .val { font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: right; }
.ctl input[type=range] { width: 100%; accent-color: var(--accent); }
.ctl .inline { display: flex; gap: 6px; }
.ctl .inline input { flex: 1; min-width: 0; }
.ctl input[type=color] { width: 48px; height: 34px; border: 1px solid var(--border); border-radius: 10px; background: none; padding: 2px; }

/* ---------- meldingen ---------- */
.event-list { display: grid; gap: 8px; }
.day-label { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 16px 2px 2px; text-transform: capitalize; }
.event { display: flex; gap: 10px; align-items: center; padding: 8px; }
.event .thumb { width: 88px; flex: none; }
.event-main { flex: 1; min-width: 0; }
.event-main .ttl { font-weight: 650; }
.event-main .sub { font-size: 13px; color: var(--text-2); }
.event.unseen .ttl::after {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--rec);
  margin-left: 8px; vertical-align: middle;
}
.event-actions { display: flex; gap: 6px; flex: none; }

/* ---------- opnames ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; scrollbar-width: none; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 3px 11px;
  font-size: 12.5px; font-weight: 550; cursor: pointer; white-space: nowrap; color: var(--text-2);
}
.chip[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.media-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); margin-top: 12px; }
@media (min-width: 900px) { .media-grid { gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } }
.media-item { overflow: hidden; cursor: pointer; text-align: left; padding: 0; border: 1px solid var(--border); }
.media-item .preview { position: relative; aspect-ratio: 16 / 9; background: #07080a; }
.media-item .preview img, .media-item .preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-item .kind {
  position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 4px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px;
}
.media-item .kind svg { width: 13px; height: 13px; }
.media-item .info { padding: 10px 12px; }
.media-item .info .ttl { font-weight: 650; font-size: 14px; }
.media-item .info .sub { font-size: 12px; color: var(--text-2); }

/* ---------- instellingen ---------- */
.settings-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); align-items: start; }
.settings-card { padding: 12px 14px; display: grid; gap: 10px; }
.settings-card h3 { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.settings-card h3 svg { width: 16px; height: 16px; color: var(--accent); }
.field { display: grid; gap: 4px; }
.field label { font-size: 13px; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.field .hint { font-size: 12px; color: var(--text-2); }
.input-unit { display: flex; align-items: center; gap: 8px; }
.input-unit input { width: 140px; }
.list-plain { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.cam-settings { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 12px; display: grid; gap: 10px; }
.cam-settings[open] { padding-bottom: 12px; }
.cam-settings > summary { display: flex; align-items: center; gap: 8px; padding: 10px 0; font-weight: 650; font-size: 13.5px; cursor: pointer; list-style: none; }
.cam-settings > summary::-webkit-details-marker { display: none; }
.cam-settings > summary svg { width: 15px; height: 15px; color: var(--text-3); flex: none; }
.cam-settings > summary > span:first-child { display: inline-flex; }

/* ---------- lightbox en meldingen ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(5, 6, 8, .88);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top));
}
.lightbox[hidden] { display: none; }
.lightbox-inner { width: min(100%, 1100px); max-height: 100%; display: flex; flex-direction: column; gap: 10px; }
.lightbox-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #fff; }
.lightbox-title { font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-actions { display: flex; gap: 8px; }
.lightbox-actions .btn { background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }
.lightbox-body { min-height: 0; display: flex; justify-content: center; }
.lightbox-body img, .lightbox-body video { max-width: 100%; max-height: calc(100vh - 120px); border-radius: 12px; background: #000; }

.toasts {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 300;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  display: grid; gap: 8px; width: min(calc(100% - 32px), 420px); pointer-events: none;
}
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.notif-pops {
  position: fixed; z-index: 310; right: max(12px, env(safe-area-inset-right)); top: calc(var(--topbar-h, 42px) + 8px);
  display: grid; gap: 8px; width: min(360px, calc(100% - 24px)); pointer-events: none;
}
.notif-pops:empty { display: none; }
.notif-pop {
  display: flex; align-items: flex-start; gap: 10px; pointer-events: auto; padding: 10px 8px 10px 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 3px solid var(--rec);
  border-radius: 10px; box-shadow: var(--shadow-pop); font-size: 13px; animation: toast-in .2s ease;
}
.notif-pop img { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; flex: none; }
.np-body { flex: 1; min-width: 0; }
.np-title { font-weight: 650; overflow-wrap: anywhere; }
.np-msg { color: var(--text-2); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.np-open { margin-top: 6px; background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.np-close { flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); font-size: 22px; line-height: 1; cursor: pointer; }
.notif-panel-wrap { position: fixed; inset: 0; z-index: 320; }
.notif-panel-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); }
.notif-panel {
  position: absolute; right: max(12px, env(safe-area-inset-right)); top: calc(var(--topbar-h, 42px) + 8px);
  width: min(440px, calc(100% - 24px)); max-height: calc(100dvh - var(--topbar-h, 42px) - 20px - env(safe-area-inset-bottom));
  display: flex; flex-direction: column; padding: 0; overflow: hidden; box-shadow: var(--shadow-pop);
}
.notif-panel .np-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--border); flex: none; }
.notif-panel .np-head h2 { margin: 0; font-size: 16px; flex: 1; }
.notif-panel .event-list { overflow-y: auto; padding: 8px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.np-close:hover { background: var(--surface-2); }
.toast {
  display: flex; align-items: center; gap: 10px; pointer-events: auto;
  background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 8px;
  box-shadow: var(--shadow-pop); font-size: 13px; animation: toast-in .2s ease;
}
.toast.error { background: var(--rec); color: #fff; }
.toast img { width: 64px; height: 40px; object-fit: cover; border-radius: 8px; flex: none; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; font-weight: 700; cursor: pointer; }
.toast.bump { animation: toast-bump .3s ease; }
@keyframes toast-bump { 40% { transform: scale(1.03); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- plugins (instellingen) ---------- */
.plugin-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.plugin-row:first-of-type { border-top: 0; padding-top: 0; }
.plugin-row .dev-icon { width: 30px; height: 30px; }
.plugin-row .body { flex: 1; min-width: 0; }
.plugin-row .ttl { font-weight: 650; }
.plugin-row .sub { font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.badge-soft {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 8px;
  background: var(--surface-2); color: var(--text-2); vertical-align: middle; margin-left: 6px;
}
.badge-soft.ok { background: var(--ok-soft); color: var(--ok); }
.badge-soft.err { background: var(--rec-soft); color: var(--rec); }
.notif-src { font-size: 12px; color: var(--text-3); }
code { font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; overflow-wrap: anywhere; }

/* ---------- csa: inputs ---------- */
input[type=password], input[type=search] {
  min-height: 32px; padding: 5px 9px; border-radius: 7px; font-size: 13px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); max-width: 100%;
}
input:disabled { opacity: .65; cursor: not-allowed; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }

/* ---------- csa: compacte apparaatregel (dashboard) ---------- */
.drow-list { padding: 4px 0; }
.drow {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center;
  column-gap: 10px; padding: 8px 10px; border-top: 1px solid var(--border);
}
.drow:first-child { border-top: 0; }
.drow .dev-icon { width: 30px; height: 30px; }
.drow .dev-icon svg { width: 16px; height: 16px; }
.drow-main { min-width: 0; }
.drow-name { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drow-sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.drow-sub:empty { display: none; }
.drow-sub.err { color: var(--rec); }
.drow-ctl { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.drow-extra { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.drow-extra .select-sm { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.drow.offline .dev-icon { opacity: .5; }
.drow-range { width: 110px; accent-color: var(--accent); }
@media (max-width: 420px) { .drow-range { width: 80px; } }
.sp-inline { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.sp-mini { min-width: 46px; text-align: center; font-weight: 700; }
.dash { display: grid; gap: 14px; }
@media (min-width: 900px) { .dash { grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); align-items: start; } }
.dash-room { font-size: 11.5px; font-weight: 650; color: var(--text-3); margin: 0 2px 6px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- csa: apparatenlijst ---------- */
.dl-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.dl-search { flex: 1 1 200px; }
.dl-list { padding: 4px 0; }
.dl-row {
  display: grid; grid-template-columns: 40px 30px minmax(0, 1fr) 150px auto; align-items: center;
  gap: 8px; padding: 6px 10px; border-top: 1px solid var(--border);
}
.dl-row:first-child { border-top: 0; }
.dl-row.is-hidden { opacity: .55; }
.dl-row .dev-icon { width: 30px; height: 30px; }
.dl-id { font-size: 12px; color: var(--text-3); }
.dl-id-m { display: none; font-size: 11px; color: var(--text-3); }
.dl-main { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dl-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #888; }
.dl-dot.on { background: #2ea043; }
.dl-dot.off { background: #e5484d; }
.dl-dot.warn { background: #f59e0b; }
.dl-problem { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #f59e0b; min-width: 0; }
.dl-problem-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.dl-sub-tip { display: none; }
.dl-name { width: 220px; max-width: 100%; min-height: 28px; padding: 3px 7px; font-weight: 550; border-color: transparent; background: transparent; }
.dl-name:hover, .dl-name:focus { border-color: var(--border); background: var(--surface); }
.dl-room { width: 100%; min-height: 28px; padding: 3px 7px; font-size: 12.5px; }
.dl-sub { font-size: 12px; color: var(--text-2); padding-left: 9px; overflow-wrap: anywhere; }
.dl-actions { display: flex; gap: 6px; }
.btn.fav { color: var(--energy); }
@media (max-width: 700px) {
  .dl-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .dl-id { display: none; }
  .dl-id-m { display: inline; }
  .dl-sub-wide, .dl-problem-txt { display: none; }
  .dl-sub-tip { display: inline-flex; }
  .dl-name { flex: 1 1 0; width: auto; min-width: 0; }
  .dl-room { grid-column: 2 / 3; }
  .dl-actions { grid-row: 1; grid-column: 3; }
}

/* ---------- csa: inloggen ---------- */
.login { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; padding: var(--gutter); }
.login-card { width: min(100%, 320px); padding: 20px; display: grid; gap: 12px; }
.login-card .brand { justify-content: center; margin-bottom: 6px; }
.login-card input[type=password] { font-size: 20px; text-align: center; letter-spacing: .2em; }

/* ---------- csa: tabellen (bijv. storingslog) ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 7px 10px; border-top: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 12px; color: var(--text-2); font-weight: 650; border-top: 0; }
.table td.num { white-space: nowrap; }
.badge-soft.warn { background: rgba(217, 119, 6, .14); color: var(--warn); }
.settings-card > .hint, .hint { font-size: 13px; color: var(--text-2); }
.drow-list .drow-ctl .switch { margin-left: 2px; }
.zb-dev { border-top: 1px solid var(--border); }
.zb-dev:first-child { border-top: 0; }
.zb-dev .drow { border-top: 0; }
.zb-more { margin: -4px 14px 10px 66px; }
.zb-more > summary { font-size: 13px; color: var(--text-2); }
.ok-text { color: var(--ok); font-weight: 650; }
/* ---------- terugkijken ---------- */
.pb-player { background: #000; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 16 / 9; display: flex; }
.pb-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.timeline { position: relative; height: 38px; background: var(--surface-2); border-radius: 10px; cursor: pointer; overflow: hidden; }
.tl-seg { position: absolute; top: 5px; height: 17px; background: var(--accent); border-radius: 2px; opacity: .8; }
.tl-seg.busy { background: repeating-linear-gradient(45deg, var(--accent), var(--accent) 3px, transparent 3px, transparent 6px); }
.tl-cursor { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--rec); }
.tl-tick { position: absolute; bottom: 2px; font-size: 10px; color: var(--text-3); transform: translateX(2px); pointer-events: none; }
.tl-controls { display: flex; align-items: center; gap: 12px; }
.tl-slider { flex: 1; accent-color: var(--accent); }
.tl-time { font-weight: 700; min-width: 72px; }
.q-seg button { min-width: 40px; }
.pill.res { background: rgba(0,0,0,.55); color: #fff; }
.spacer { flex: 1; }
/* ---------- automatisering ---------- */
.auto-row, .log-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 10px; border-top: 1px solid var(--border); }
.auto-row:first-child, .log-row:first-child { border-top: 0; }
.log-row { grid-template-columns: 130px minmax(0, 1fr); align-items: start; }
.log-time { font-size: 12px; color: var(--text-2); padding-top: 2px; }
@media (max-width: 600px) { .log-row { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.blockly-area { height: min(70vh, 640px); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.code-editor { width: 100%; min-height: 420px; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); tab-size: 4; resize: vertical; white-space: pre; }
.code-preview { font: 12px/1.45 ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 12px; border-radius: 10px; overflow-x: auto; white-space: pre; margin: 0; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.dev-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.dash-widgets:not(:empty) { margin-bottom: 16px; }
.scene-chips { flex-wrap: wrap; overflow: visible; }
.scene-chip { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; font-weight: 650; }
.scene-chip svg { width: 16px; height: 16px; }
.blocklyToolboxDiv { background: var(--surface-2) !important; color: var(--text); }
/* menu bovenin: alleen icoontjes (naam bij aanwijzen met de muis) */
@media (min-width: 900px) {
  .tab .lbl { display: none; }
  .tab { padding: 6px 9px; gap: 0; }
  .tab svg { width: 17px; height: 17px; }
  .tabs { max-width: none; }
}
/* ---------- media ---------- */
.poster-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.poster-card { position: relative; display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 10px; padding: 8px; align-items: start; }
.poster-card.dim { opacity: .6; }
.poster { width: 60px; height: 90px; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.empty-poster { display: grid; place-items: center; color: var(--text-3); }
.poster-info { display: grid; gap: 6px; min-width: 0; align-content: start; }
.poster-info .ttl { font-weight: 650; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.poster-info .sub { font-size: 12px; color: var(--text-2); }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 4px 0; }
.progress span { display: block; height: 100%; background: var(--accent); }
/* ---------- aandelen ---------- */
.stock-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .stock-layout { grid-template-columns: 360px minmax(0, 1fr); align-items: start; } }
.stock-list { padding: 4px 0; }
.stock-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-top: 1px solid var(--border); background: none; color: inherit; cursor: pointer; font: inherit; }
.stock-row:first-child { border-top: 0; }
.stock-row.active { background: var(--accent-soft); }
.stock-price { text-align: right; font-weight: 650; }
/* ---------- log ---------- */
.log-list { padding: 2px 0; }
.log-item { border-top: 1px solid var(--border); padding: 5px 10px; font-size: 12.5px; }
.log-item:first-child { border-top: 0; }
.log-item > summary { list-style: none; cursor: pointer; }
.log-item > summary::-webkit-details-marker { display: none; }
.log-item .code-preview { margin-top: 8px; font-size: 11px; max-height: 300px; overflow: auto; }
.log-line { display: grid; grid-template-columns: 128px 104px 120px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.log-time { color: var(--text-2); font-size: 12px; }
.log-lv { text-align: center; justify-self: start; }
.log-src { color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-msg { overflow-wrap: anywhere; }
.lv-error { background: color-mix(in srgb, var(--rec) 6%, transparent); }
.lv-warning { background: color-mix(in srgb, var(--warn) 6%, transparent); }
@media (max-width: 700px) { .log-line { grid-template-columns: auto auto minmax(0, 1fr); } .log-src { display: none; } .log-msg { grid-column: 1 / -1; } }
.mova-map-box { background: #f5f5f0; border-radius: var(--radius-sm); overflow: hidden; }
.mova-map { width: 100%; height: auto; display: block; max-height: 70vh; object-fit: contain; }
/* ---------- submenu (onder de bovenbalk) ---------- */
.subnav { position: sticky; top: calc(49px + env(safe-area-inset-top)); z-index: 19; background: color-mix(in srgb, var(--bg) 94%, transparent); border-bottom: 1px solid var(--border); }
.subnav[hidden] { display: none; }
.subnav-inner { max-width: 1280px; margin: 0 auto; padding: 5px var(--gutter); display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.subnav-inner::-webkit-scrollbar { display: none; }
.subnav-title { font-weight: 650; font-size: 11px; color: var(--text-3); margin-right: 6px; white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.subtab { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 6px; padding: 3px 9px; font-size: 12.5px; font-weight: 550; cursor: pointer; }
.subtab svg { width: 13px; height: 13px; }
.subtab[aria-current="page"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
@media (min-width: 900px) { .subnav { backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); } }
/* ---------- plugins-pagina ---------- */
.plugin-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); align-items: start; }
.plugin-card { gap: 8px; }
.plugin-card .plugin-row { padding: 0; border: 0; }
.plugin-settings { display: grid; gap: 12px; padding-top: 6px; }
.plugin-settings h4 { display: flex; gap: 8px; align-items: center; margin: 4px 0 0; }
.plugin-settings h4 svg, .plugin-sec h4 svg { width: 16px; height: 16px; flex: none; }
.plugin-sec h4 { display: flex; gap: 8px; align-items: center; margin: 4px 0 0; }

/* ---------- uitleg (i) en let op (!) ---------- */
.tip-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 16px; height: 16px; padding: 0; border-radius: 50%; vertical-align: middle;
  border: 1px solid var(--text-3); background: transparent; color: var(--text-3);
  font: italic 650 10.5px/1 Georgia, "Times New Roman", serif; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.tip-btn:hover, .tip-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.tip-btn.warn { font: 750 10.5px/1 var(--font); font-style: normal; color: var(--warn); border-color: var(--warn); }
.tip-btn.warn:hover, .tip-btn.warn[aria-expanded="true"] { background: var(--warn-soft); }
.tip-bubble {
  position: absolute; z-index: 400; padding: 9px 11px; border-radius: 8px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; animation: fade .12s ease;
}
.tip-bubble.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.tip-bubble.warn::before { content: "Let op"; display: block; font-weight: 650; color: var(--warn); margin-bottom: 2px; }
.tip-bubble code { font-size: 11.5px; }
.hint-tip { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--text-3); }
.hint-tip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }

/* ---------- thema-knop in de bovenbalk ---------- */
.top-actions { display: flex; align-items: center; gap: 8px; }
.theme-btn { width: 28px; height: 28px; border-radius: 7px; border: 1px solid transparent; background: none; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.theme-btn:hover { background: var(--surface-2); border-color: var(--border); }
.theme-btn svg { width: 16px; height: 16px; }

/* ---------- kaarten: rustiger ---------- */
.card { box-shadow: none; }
.card:hover { border-color: color-mix(in srgb, var(--text-3) 30%, var(--border)); }
.btn.primary { font-weight: 600; }
.btn:hover { border-color: color-mix(in srgb, var(--text-3) 35%, var(--border)); }
.badge-soft { font-size: 10.5px; font-weight: 650; padding: 1px 6px; border-radius: 6px; }
.err { font-size: 12.5px; }
.hint, .settings-card > .hint, .field .hint, .row .hint { font-size: 12px; color: var(--text-2); }
/* grids mogen nooit breder worden dan hun kaart (lange invoervelden/teksten) */
.grid-gap, .plugin-settings, .settings-card, .settings-card-body, .cam-settings { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.check { max-width: 100%; }

/* ---------- apparaattegels (in- en uitklapbaar) ---------- */
.drow { grid-template-columns: 30px minmax(0, 1fr) auto auto; }
.drow:has(.drag-handle) { grid-template-columns: 14px 30px minmax(0, 1fr) auto auto; }
.drow-name {
  display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; color: var(--text);
  font: 550 13.5px/1.3 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default;
}
.drow.has-extra .drow-name { cursor: pointer; }
.drow.has-extra .drow-name:hover { color: var(--accent); }
.drow-more {
  width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: transform .15s, background .15s, color .15s;
}
.drow-more:hover { background: var(--surface-2); color: var(--text); }
.drow-more svg { width: 15px; height: 15px; }
.drow.open .drow-more { transform: rotate(180deg); color: var(--accent); }
.drow-extra { grid-column: 1 / -1; display: none; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); gap: 8px; flex-direction: column; align-items: stretch; }
.drow.open .drow-extra { display: flex; }
.x-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 28px; }
.x-label { font-size: 12px; color: var(--text-2); }
.x-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.x-ctl .drow-range { width: 150px; }
.input-sm { min-height: 28px; width: 92px; padding: 3px 8px; font-size: 12.5px; }
.x-more-btn { align-self: stretch; justify-content: center; }
.x-dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); padding: 0; width: min(520px, calc(100vw - 24px)); max-height: min(80vh, 640px); max-height: min(calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 640px); overflow: hidden; }
.x-dialog[open] { display: flex; flex-direction: column; }
.x-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.xm-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.xm-body { overflow-y: auto; padding: 4px 12px 12px; overscroll-behavior: contain; }
.hist-dialog { width: min(760px, calc(100vw - 24px)); max-height: min(90vh, 760px); max-height: min(calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 760px); }
.hist-body { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
.hist-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hist-key { display: flex; align-items: center; gap: 8px; }
.hist-ranges .segmented { display: flex; width: 100%; }
.hist-ranges .segmented button { flex: 1; padding-left: 2px; padding-right: 2px; font-size: 13px; white-space: nowrap; }
.hist-pane { display: flex; flex-direction: column; gap: 8px; }
.hist-pane[hidden] { display: none; }
.hist-day { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 10px 0 2px; }
.hist-day::first-letter { text-transform: uppercase; }
.hist-ev { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.hist-time { color: var(--text-2); font-size: 13px; grid-row: span 2; }
.hist-who { font-size: 12px; color: var(--text-2); }
.hist-who:empty { display: none; }
.hist-ev.k-automation .hist-who { color: var(--accent); }
.hist-more { align-self: center; }
.xm-head { margin: 12px 0 4px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.xm-list { display: flex; flex-direction: column; }
.xm-list > .x-item { padding: 6px 0; border-bottom: 1px solid var(--border); }
.xm-list > .x-item:last-child { border-bottom: 0; }
.xm-list .x-label { font-size: 13px; color: var(--text); }
.x-more > summary { cursor: pointer; font-size: 12px; color: var(--text-2); padding: 4px 0; }
.x-more[open] > summary { margin-bottom: 4px; }
.x-more > .x-item + .x-item { margin-top: 4px; }
.x-links { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.drag-handle { display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); cursor: grab; touch-action: none; opacity: .45; width: 14px; height: 28px; }
.drag-handle svg { width: 14px; height: 14px; }
.tile:hover .drag-handle { opacity: 1; }
.tile-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); align-items: start; }
.tile .drow { border-top: 0; padding: 8px 10px; }
.tile.dragging { opacity: .55; outline: 2px dashed var(--accent); outline-offset: -2px; }
.sorting, .sorting * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.dash { gap: 12px; }
@media (min-width: 900px) { .dash { grid-template-columns: minmax(0, 1fr); } }

/* ---------- inklapbare kaarten (Meer / Minder) ---------- */
.folded > .fold-rest { display: none; }
.fold-rest { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.fold-btn {
  justify-self: center; display: inline-flex; align-items: center; gap: 4px; margin: -2px auto -4px;
  border: 0; background: none; color: var(--text-3); font: 550 12px var(--font); cursor: pointer; padding: 2px 8px; border-radius: 6px;
}
.fold-btn:hover { color: var(--accent); background: var(--accent-soft); }
.fold-btn svg { width: 13px; height: 13px; transition: transform .15s; }
.fold-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
details.fold > summary { justify-content: center; gap: 4px; color: var(--text-3); font-size: 12px; }
details.fold > summary:hover { color: var(--accent); }

/* =====================================================================
   Telefoon (iPhone 14/16 e.d., ook als web-app op het beginscherm)
   ===================================================================== */
html, body { -webkit-tap-highlight-color: transparent; }
button, .btn, .chip, .subtab, .tab, a { touch-action: manipulation; }   /* geen dubbeltik-zoom */
body { overscroll-behavior-y: none; }
.topbar { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
main { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
.subnav { top: var(--topbar-h, 42px); }

@media (max-width: 899px) {
  :root { --gutter: 12px; --nav-h: 52px; }
  /* onderste menubalk: alle hoofdmenu's passen, alleen icoontjes (naam via de submenu-kop) */
  .tabs { overflow-x: hidden; justify-content: space-around; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .tab { flex: 1 1 0; min-width: 0; padding: 0; }
  .tab .lbl { display: none; }
  .tab svg { width: 22px; height: 22px; }
  .tab[aria-selected="true"]::after { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 2px; border-radius: 2px; background: var(--accent); }
  .badge { top: 6px; left: calc(50% + 4px); }
  .brand { font-size: 14px; }
  h1 { font-size: 18px; }
  .view { padding-top: 10px; }
  /* iOS zoomt in bij invoervelden kleiner dan 16px */
  input[type=text], input[type=number], input[type=url], input[type=password], input[type=search], input[type=date], input[type=email], select, textarea {
    font-size: 16px; min-height: 36px;
  }
  .select-sm { font-size: 16px; min-height: 34px; padding: 3px 8px; }
  /* vingervriendelijk, maar compact */
  .btn { min-height: 36px; }
  .btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
  .btn.icon { width: 36px; }
  .btn.sm.icon { width: 32px; }
  .switch { width: 42px; height: 24px; }
  .switch span::before { width: 20px; height: 20px; }
  .switch input:checked + span::before { transform: translateX(18px); }
  .drow { padding: 9px 10px; column-gap: 8px; }
  .drow-name { font-size: 14.5px; }
  .drow-sub { font-size: 12.5px; }
  .drow-more { width: 32px; height: 32px; }
  .drag-handle { opacity: .6; width: 18px; height: 36px; }
  .drow:has(.drag-handle) { grid-template-columns: 18px 30px minmax(0, 1fr) auto auto; }
  .x-ctl .drow-range { width: 140px; }
  .tip-btn { position: relative; width: 18px; height: 18px; font-size: 11.5px; }
  .tip-btn::after { content: ""; position: absolute; inset: -10px; }      /* groter tikvlak */
  .tile-grid { gap: 6px; }
  .settings-grid, .plugin-grid { grid-template-columns: minmax(0, 1fr); }
  .view-head { margin-bottom: 10px; }
  .dl-filters { gap: 6px; }
  .dl-search { flex: 1 1 100%; }
  .chips { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); }
  .subnav-inner { padding-top: 6px; padding-bottom: 6px; }
  .subtab { padding: 5px 10px; font-size: 13px; }
  .timeline { height: 44px; }
  .tl-controls { gap: 8px; }
  .tl-slider { height: 28px; }
  .lightbox { padding: calc(10px + env(safe-area-inset-top)) 8px calc(10px + env(safe-area-inset-bottom)); }
  .lightbox-body img, .lightbox-body video { max-height: calc(100vh - 110px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 8px; }
  .toasts { width: calc(100% - 24px); }
  .watts { font-size: 28px; }
  .meter { padding: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-box { height: 190px; }
  .poster-grid, .media-grid { grid-template-columns: minmax(0, 1fr); }
}
/* geen muis: aanwijs-effecten niet laten 'plakken' na een tik */
@media (hover: none) {
  .card:hover { border-color: var(--border); }
  .btn:hover { background: var(--surface); border-color: var(--border); }
  .btn.primary:hover { background: var(--accent); filter: none; }
  .drow-more:hover { background: none; color: var(--text-3); }
  .drow.has-extra .drow-name:hover { color: var(--text); }
}
/* als web-app op het beginscherm (zonder Safari-balken) */
@media (display-mode: standalone) {
  .topbar { padding-top: calc(6px + env(safe-area-inset-top)); }
}

/* ---------- terugkerende fouten (Log) ---------- */
.rec-box { padding: 8px 10px; margin-bottom: 10px; display: grid; gap: 6px; border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.rec-head { display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: 13px; color: var(--warn); }
.rec-head svg { width: 15px; height: 15px; }
.rec-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.rec-main { flex: 1; min-width: 0; }
.rec-msg { font-size: 12.5px; overflow-wrap: anywhere; }
.rec-item:not(.open) { opacity: .7; }
/* versies */
.ver-list { display: grid; gap: 4px; }
.ver-row { padding-top: 6px; border-top: 1px solid var(--border); }

/* ---------- beschermde apparaten ---------- */
.btn.locked { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: var(--warn-soft); }
.lock-mark { display: inline-flex; vertical-align: -1px; margin-left: 5px; color: var(--warn); }
.lock-mark svg { width: 12px; height: 12px; }

/* =====================================================================
   Extra thema's (per gebruiker te kiezen via het themamenu rechtsboven)
   ===================================================================== */
:root[data-theme="midnight"] { --bg:#000; --surface:#0b0d10; --surface-2:#12151a; --surface-3:#1b1f26; --text:#e8eaee; --text-2:#9aa1ad; --text-3:#666d78; --border:#1a1e24; --accent:#8ab4ff; --accent-soft:rgba(138,180,255,.13); --on-accent:#000; --ok:#4ade80; --ok-soft:rgba(74,222,128,.13); --warn:#fbbf24; --warn-soft:rgba(251,191,36,.13); --rec:#f87171; --rec-soft:rgba(248,113,113,.13); --off:#3a3f47; --energy:#fbbf24; --shadow:none; --shadow-pop:0 10px 30px rgba(0,0,0,.7); color-scheme:dark; }
:root[data-theme="ocean"] { --bg:#0b1a2a; --surface:#0f2336; --surface-2:#132b42; --surface-3:#1a3652; --text:#e3eef8; --text-2:#93acc4; --text-3:#5f7a94; --border:#1b3350; --accent:#38bdf8; --accent-soft:rgba(56,189,248,.14); --on-accent:#06121e; --ok:#34d399; --ok-soft:rgba(52,211,153,.14); --warn:#fbbf24; --warn-soft:rgba(251,191,36,.14); --rec:#fb7185; --rec-soft:rgba(251,113,133,.14); --off:#3c556e; --energy:#fcd34d; --shadow:none; --shadow-pop:0 10px 30px rgba(0,0,0,.5); color-scheme:dark; }
:root[data-theme="forest"] { --bg:#0f1a14; --surface:#14221a; --surface-2:#1a2b21; --surface-3:#22362a; --text:#e4efe7; --text-2:#9bb3a3; --text-3:#66806e; --border:#203227; --accent:#4ade80; --accent-soft:rgba(74,222,128,.13); --on-accent:#0b140f; --ok:#4ade80; --ok-soft:rgba(74,222,128,.13); --warn:#facc15; --warn-soft:rgba(250,204,21,.13); --rec:#f87171; --rec-soft:rgba(248,113,113,.13); --off:#40544a; --energy:#facc15; --shadow:none; --shadow-pop:0 10px 30px rgba(0,0,0,.5); color-scheme:dark; }
:root[data-theme="graphite"] { --bg:#17181b; --surface:#1f2024; --surface-2:#26282d; --surface-3:#303238; --text:#ececee; --text-2:#a3a5ad; --text-3:#6f727b; --border:#2c2e34; --accent:#f59e0b; --accent-soft:rgba(245,158,11,.14); --on-accent:#17181b; --ok:#22c55e; --ok-soft:rgba(34,197,94,.13); --warn:#f59e0b; --warn-soft:rgba(245,158,11,.13); --rec:#ef4444; --rec-soft:rgba(239,68,68,.13); --off:#4a4d55; --energy:#fbbf24; --shadow:none; --shadow-pop:0 10px 30px rgba(0,0,0,.55); color-scheme:dark; }
:root[data-theme="sand"] { --bg:#f6f1e8; --surface:#fffdf8; --surface-2:#f1ead9; --surface-3:#e7dcc4; --text:#2b2418; --text-2:#6e624d; --text-3:#9c907a; --border:#e6dcc7; --accent:#b45309; --accent-soft:rgba(180,83,9,.1); --on-accent:#fff; --ok:#3f8f4a; --ok-soft:rgba(63,143,74,.12); --warn:#b45309; --warn-soft:rgba(180,83,9,.12); --rec:#c2410c; --rec-soft:rgba(194,65,12,.1); --off:#cbbfa6; --energy:#d97706; --shadow:0 1px 2px rgba(60,40,10,.05); --shadow-pop:0 8px 28px rgba(60,40,10,.15); color-scheme:light; }
:root[data-theme="rose"] { --bg:#fbf3f5; --surface:#ffffff; --surface-2:#f8e9ee; --surface-3:#f1d6df; --text:#2a1820; --text-2:#77566a; --text-3:#a8899b; --border:#f0dce3; --accent:#db2777; --accent-soft:rgba(219,39,119,.09); --on-accent:#fff; --ok:#16a34a; --ok-soft:rgba(22,163,74,.11); --warn:#d97706; --warn-soft:rgba(217,119,6,.12); --rec:#e11d48; --rec-soft:rgba(225,29,72,.1); --off:#d9bfca; --energy:#ea8a0c; --shadow:0 1px 2px rgba(80,20,40,.05); --shadow-pop:0 8px 28px rgba(80,20,40,.15); color-scheme:light; }

/* themamenu + gebruikerskeuze */
.theme-menu { position: absolute; z-index: 400; min-width: 210px; padding: 6px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); display: grid; gap: 2px; }
.theme-menu-head { font-size: 11px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 4px 8px; }
.theme-opt { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border: 0; border-radius: 7px; background: none; color: var(--text); font: 500 13px var(--font); cursor: pointer; text-align: left; }
.theme-opt:hover, .theme-opt.on { background: var(--accent-soft); color: var(--accent); }
.theme-opt svg { width: 15px; height: 15px; }
.theme-sw { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border); flex: none; }
.user-switch { border-top: 1px solid var(--border); border-radius: 0 0 7px 7px; margin-top: 4px; color: var(--text-2); }
.user-pick { z-index: 500; }
.user-q { text-align: center; font-weight: 650; font-size: 16px; }
.user-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.user-btns .btn { min-height: 48px; font-size: 16px; }

/* =====================================================================
   Tegels: compacter, naam en waarden op één regel, ster voor het dashboard
   ===================================================================== */
.drow { grid-template-columns: 26px minmax(0, 1fr) auto auto auto; column-gap: 8px; padding: 6px 8px; }
.drow:has(.drag-handle) { grid-template-columns: 14px 26px minmax(0, 1fr) auto auto auto; }
.drow .dev-icon { width: 26px; height: 26px; border-radius: 7px; }
.drow .dev-icon svg { width: 14px; height: 14px; }
.drow-main { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.drow-name { flex: 0 1 auto; width: auto; max-width: 62%; font-size: 13.5px; }
.drow-sub { flex: 1 1 0; min-width: 0; font-size: 12px; }
.drow-sub::before { content: "·"; margin-right: 6px; color: var(--text-3); }
.drow-sub:empty::before { content: none; }
.drow-star { width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--text-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; opacity: .55; }
.drow-star svg { width: 14px; height: 14px; }
.drow-star.on { color: var(--energy); opacity: 1; }
.drow-star:hover { opacity: 1; background: var(--surface-2); }
.drow-more { width: 24px; height: 24px; }
.tile-grid { gap: 6px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.tile { border-radius: 9px; }
.tile .drow { padding: 5px 8px; }
.drow-ctl .switch { transform: scale(.9); }
@media (max-width: 899px) {
  .drow { padding: 7px 8px; }
  .drow-name { font-size: 14px; }
  .drow-star { width: 30px; height: 30px; }
  .drow-more { width: 30px; height: 30px; }
  .drow:has(.drag-handle) { grid-template-columns: 16px 26px minmax(0, 1fr) auto auto auto; }
}
.dev .dev-head .drag-handle { margin-right: -4px; }
.dev { padding: 8px 10px; }
.dev-title .name { font-size: 13.5px; }

/* ---------- 2026.10.18: stijl-thema's, inloggen, gebruikers, camera ---------- */
/* Stijl-thema's: niet alleen kleuren maar ook vorm, diepte en lettertype */
:root[data-theme="glass"] { --bg:#0d1424; --surface:rgba(255,255,255,.07); --surface-2:rgba(255,255,255,.1); --surface-3:rgba(255,255,255,.14); --text:#eef2fb; --text-2:#aab4c8; --text-3:#7a859b; --border:rgba(255,255,255,.12); --accent:#7cc4ff; --accent-soft:rgba(124,196,255,.16); --on-accent:#0d1424; --ok:#5ee6a0; --ok-soft:rgba(94,230,160,.15); --warn:#ffd166; --warn-soft:rgba(255,209,102,.15); --rec:#ff7a8a; --rec-soft:rgba(255,122,138,.15); --off:#566079; --energy:#ffd166; --shadow:0 8px 24px rgba(0,0,0,.25); --shadow-pop:0 16px 40px rgba(0,0,0,.45); --radius:16px; --radius-sm:12px; color-scheme:dark; }
:root[data-theme="glass"] body { background: radial-gradient(1200px 700px at 10% -10%, #3a2d7a 0%, transparent 60%), radial-gradient(900px 600px at 110% 10%, #0f6c8c 0%, transparent 55%), #0d1424 fixed; }
:root[data-theme="glass"] .card, :root[data-theme="glass"] .topbar, :root[data-theme="glass"] .subnav, :root[data-theme="glass"] .tabs { backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); }

:root[data-theme="neon"] { --bg:#07070c; --surface:#0e0e17; --surface-2:#151522; --surface-3:#1d1d2e; --text:#f1f0ff; --text-2:#a7a5c6; --text-3:#6e6c8f; --border:#2a2846; --accent:#ff2bd6; --accent-soft:rgba(255,43,214,.14); --on-accent:#07070c; --ok:#00f5a0; --ok-soft:rgba(0,245,160,.13); --warn:#ffe600; --warn-soft:rgba(255,230,0,.12); --rec:#ff3860; --rec-soft:rgba(255,56,96,.14); --off:#3b3958; --energy:#00e5ff; --shadow:0 0 0 1px rgba(255,43,214,.08), 0 0 18px rgba(255,43,214,.06); --shadow-pop:0 0 30px rgba(255,43,214,.25); --radius:6px; --radius-sm:4px; color-scheme:dark; }
:root[data-theme="neon"] .card { border-color: #2a2846; }
:root[data-theme="neon"] .btn.primary, :root[data-theme="neon"] .tab[aria-selected="true"] { box-shadow: 0 0 14px rgba(255,43,214,.45); }
:root[data-theme="neon"] h1, :root[data-theme="neon"] h2 { letter-spacing: .04em; text-transform: uppercase; }

:root[data-theme="paper"] { --bg:#f4f1ea; --surface:#fffdf8; --surface-2:#f7f3ea; --surface-3:#efe9dc; --text:#2b2722; --text-2:#6b6358; --text-3:#9a9183; --border:#d9d1c2; --accent:#3d5a80; --accent-soft:rgba(61,90,128,.1); --on-accent:#fffdf8; --ok:#4a7c59; --ok-soft:rgba(74,124,89,.12); --warn:#b7791f; --warn-soft:rgba(183,121,31,.12); --rec:#b23a48; --rec-soft:rgba(178,58,72,.1); --off:#c4bcae; --energy:#b7791f; --shadow:none; --shadow-pop:0 6px 18px rgba(60,50,30,.15); --radius:3px; --radius-sm:2px; --font: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; color-scheme:light; }
:root[data-theme="paper"] .card { border-width: 1px; box-shadow: none; }
:root[data-theme="paper"] .num, :root[data-theme="paper"] .drow-sub { font-family: ui-monospace, "SF Mono", Consolas, monospace; }

:root[data-theme="terminal"] { --bg:#050805; --surface:#0a100a; --surface-2:#0f170f; --surface-3:#142014; --text:#b8f5b0; --text-2:#7fc77a; --text-3:#4f8a4b; --border:#1d3a1c; --accent:#39ff14; --accent-soft:rgba(57,255,20,.1); --on-accent:#050805; --ok:#39ff14; --ok-soft:rgba(57,255,20,.1); --warn:#f5e663; --warn-soft:rgba(245,230,99,.1); --rec:#ff5f56; --rec-soft:rgba(255,95,86,.12); --off:#2a4a29; --energy:#f5e663; --shadow:none; --shadow-pop:0 0 0 1px #39ff14; --radius:0px; --radius-sm:0px; --font: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace; color-scheme:dark; }
:root[data-theme="terminal"] .card { border-style: dashed; }

:root[data-theme="contrast"] { --bg:#000; --surface:#000; --surface-2:#111; --surface-3:#1a1a1a; --text:#fff; --text-2:#e6e6e6; --text-3:#c8c8c8; --border:#fff; --accent:#ffde00; --accent-soft:rgba(255,222,0,.18); --on-accent:#000; --ok:#00ff6a; --ok-soft:rgba(0,255,106,.18); --warn:#ffde00; --warn-soft:rgba(255,222,0,.18); --rec:#ff4040; --rec-soft:rgba(255,64,64,.2); --off:#888; --energy:#ffde00; --shadow:none; --shadow-pop:0 0 0 2px #fff; --radius:8px; --radius-sm:6px; color-scheme:dark; }
:root[data-theme="contrast"] .card { border-width: 2px; }
:root[data-theme="contrast"] .btn { border-width: 2px; font-weight: 650; }

:root[data-theme="soft"] { --bg:#e9edf3; --surface:#eef2f7; --surface-2:#e6ebf2; --surface-3:#dde3ec; --text:#283245; --text-2:#5d6a80; --text-3:#8a95a8; --border:transparent; --accent:#6c63ff; --accent-soft:rgba(108,99,255,.12); --on-accent:#fff; --ok:#2bb673; --ok-soft:rgba(43,182,115,.12); --warn:#e8a33d; --warn-soft:rgba(232,163,61,.13); --rec:#e5566a; --rec-soft:rgba(229,86,106,.12); --off:#b8c1cf; --energy:#e8a33d; --shadow:6px 6px 14px rgba(163,177,198,.55), -6px -6px 14px rgba(255,255,255,.85); --shadow-pop:10px 10px 28px rgba(163,177,198,.6); --radius:18px; --radius-sm:12px; color-scheme:light; }
:root[data-theme="soft"] .card { border: 0; }
:root[data-theme="soft"] .btn { box-shadow: 3px 3px 7px rgba(163,177,198,.5), -3px -3px 7px rgba(255,255,255,.8); border-color: transparent; }

:root[data-theme="sunset"] { --bg:#1a1020; --surface:#24162c; --surface-2:#2d1c37; --surface-3:#382343; --text:#fbeef2; --text-2:#cfb2c2; --text-3:#94788a; --border:#3c2647; --accent:#ff8a5c; --accent-soft:rgba(255,138,92,.15); --on-accent:#1a1020; --ok:#7ee0a7; --ok-soft:rgba(126,224,167,.13); --warn:#ffc65c; --warn-soft:rgba(255,198,92,.14); --rec:#ff5d8f; --rec-soft:rgba(255,93,143,.14); --off:#5a4166; --energy:#ffc65c; --shadow:0 2px 10px rgba(0,0,0,.3); --shadow-pop:0 12px 32px rgba(0,0,0,.5); --radius:14px; --radius-sm:10px; color-scheme:dark; }
:root[data-theme="sunset"] body { background: linear-gradient(180deg, #2a1330 0%, #1a1020 40%) fixed; }

/* Desktop: dashboard-tegels groter en in meerdere kolommen; telefoon blijft compact */
@media (min-width: 1100px) {
  .dash .drow-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 8px; padding: 8px; align-items: start; }
  .dash .drow { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
  .dash .drow .dev-icon { width: 34px; height: 34px; }
  .dash .drow .dev-icon svg { width: 18px; height: 18px; }
  .dash .drow-name { font-size: 15px; }
  .dash .drow-sub { font-size: 13.5px; }
  .dash .drow { grid-template-columns: 34px minmax(0, 1fr) auto auto auto; }
  .dash .drow:has(.drag-handle) { grid-template-columns: 16px 34px minmax(0, 1fr) auto auto auto; }
}

/* Inloggen en gebruikers */
.login-links { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px 0; font: inherit; font-size: 13.5px; }
.btn-col { display: flex; flex-direction: column; gap: 8px; }
.btn-col .btn { justify-content: flex-start; }
.login-card input[type="password"], .login-card input[type="text"] { font-size: 16px; }
.acc-list { display: flex; flex-direction: column; gap: 8px; }
.acc { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.acc .row { gap: 8px; flex-wrap: wrap; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; padding: 8px 0 2px; border-top: 1px dashed var(--border); margin-top: 8px; }
.dev-mini { padding-top: 6px; border-top: 1px dashed var(--border); margin-top: 8px; }
.acc-new { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 8px; align-items: center; margin-top: 10px; }
.btn.danger { color: var(--rec); }
.menu-cfg .row { padding: 4px 0; }
.menu-cfg .label { display: flex; align-items: center; gap: 8px; }
.menu-cfg .label svg { width: 16px; height: 16px; }
.btn.icon-only { min-width: 30px; justify-content: center; padding: 4px 6px; }
@media (max-width: 640px) { .acc-new { grid-template-columns: 1fr; } }

/* Camera: beweging als schakelaar in de werkbalk; meldingen/draaien/instellingen als knoppen naast elkaar */
.cam-motion { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.switch.sm { width: 30px; height: 17px; }
.switch.sm span::before { width: 13px; height: 13px; }
.switch.sm input:checked + span::before { transform: translateX(13px); }
.cam-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.cam-tabs .btn.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.cam-panel[hidden] { display: none !important; }
.cam-body { padding: 0 12px 12px; }
@media (max-width: 640px) { .cam-motion .lbl { display: none; } }

.theme-menu { max-height: 72vh; overflow-y: auto; }

.color-pick { width: 40px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; }
.color-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.color-dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); cursor: pointer; padding: 0; }
.ct-range { accent-color: #f5c56b; background: linear-gradient(90deg, #ffd29a, #f4f8ff); border-radius: 6px; }

.pnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pnav-label { font-size: 13px; color: var(--text-2); min-width: 120px; text-align: center; }

/* Plugins: menu links (alfabetisch), instellingen van de gekozen plugin rechts */
.plugin-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px; align-items: start; }
.plugin-menu { display: flex; flex-direction: column; padding: 6px; position: sticky; top: calc(var(--topbar-h, 56px) + 52px); max-height: calc(100vh - 140px); overflow-y: auto; }
.plugin-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.plugin-item svg { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.plugin-item .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plugin-item:hover { background: var(--surface-2); }
.plugin-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.plugin-item[aria-current="true"] svg { color: var(--accent); }
.plugin-item .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--off); }
.plugin-item .dot.ok { background: var(--ok); }
.plugin-item .dot.err { background: var(--rec); }
.plugin-detail { display: flex; flex-direction: column; gap: 14px; }
.plugin-detail-wrap { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.plugin-head { padding: 12px 14px; display: grid; gap: 8px; }
.plugin-head .plugin-row { padding: 0; border: 0; }
.plugin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.plugin-actions:empty { display: none; }
.sync-result { flex-basis: 100%; display: grid; gap: 6px; }
.sync-result:empty { display: none; }
.sync-gone { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sync-gone .warn-text { display: flex; align-items: center; gap: 4px; color: var(--warn); font-weight: 650; font-size: 13px; }
.sync-gone .warn-text svg { width: 14px; height: 14px; }
.sync-gone .check-row { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.plugin-sec { padding: 0 14px; }
.plugin-sec[open] { padding-bottom: 14px; }
.plugin-sec > summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; cursor: pointer; list-style: none; font-weight: 650; font-size: 14px; }
.plugin-sec > summary::-webkit-details-marker { display: none; }
.plugin-sec > summary svg { width: 16px; height: 16px; flex: none; }
.plugin-sec > summary > span:first-child { color: var(--accent); display: inline-flex; }
.plugin-sec > summary .ttl { flex: 1; min-width: 0; }
.plugin-sec > summary .chev, .cam-settings > summary .chev { margin-left: auto; transition: transform .15s; transform: rotate(90deg); }
.plugin-sec[open] > summary .chev, .cam-settings[open] > summary .chev { transform: rotate(-90deg); }
.plugin-sec > .settings-card-body { display: grid; gap: 12px; min-width: 0; padding-top: 12px; border-top: 1px solid var(--border); }
.plugin-sec .btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.plugin-sec .field input:not([type="checkbox"]), .plugin-sec .field select { width: 100%; }
.sub-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin: 6px 0 0; }
@media (max-width: 760px) {
  .plugin-layout { grid-template-columns: 1fr; }
  .plugin-menu { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .plugin-item { width: auto; padding: 6px 10px; border: 1px solid var(--border); }
}

/* Rechten: alleen inzien */
.view[data-ro] .switch, .view[data-ro] .drow-ctl, .view[data-ro] .drow-extra input, .view[data-ro] .drow-extra select,
.view[data-ro] .sp-inline, .view[data-ro] .color-dots, .view[data-ro] .cam-motion, .view[data-ro] .drow-star { opacity: .45; pointer-events: none; }
.perm-box { padding-top: 8px; border-top: 1px dashed var(--border); margin-top: 8px; }
.perm-table th, .perm-table td { text-align: center; padding: 5px 8px; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; }
.perm-table .perm-sub td { padding-top: 2px; padding-bottom: 2px; font-size: .92em; color: var(--text-2); }
.perm-table .perm-sub td:first-child { padding-left: 22px; }
.perm-table .perm-sub select { width: 100%; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
.field-grid .field input, .acc-new .field input { width: 100%; }
.acc-new { align-items: end; }

/* Profielicoon */
.profile-btn { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.profile-btn.big { width: 38px; height: 38px; font-size: 14px; }
.profile-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.profile-menu { min-width: 230px; }
/* Dialoogvenster */
.pdlg-back { position: fixed; inset: 0; z-index: 90; background: rgba(5, 10, 20, .55); display: flex; align-items: center; justify-content: center; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); height: 100vh; height: 100dvh; box-sizing: border-box; }
.pdlg { width: min(560px, 100%); max-height: 100%; min-height: 0; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.pdlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.pdlg-head h3 { margin: 0; }
.pdlg-body { padding: 14px 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; }
.pdlg-foot { flex: none; padding: 12px 16px; border-top: 1px solid var(--border); justify-content: flex-end; }
/* Tegelkiezer */
.tile-pick { display: flex; flex-direction: column; gap: 14px; }
.tp-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 650; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin-bottom: 6px; }
.tp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.tp-item { font-size: 14px; }
/* Rondleiding */
.tour-shade { position: fixed; inset: 0; z-index: 95; background: rgba(5, 10, 20, .6); }
.tour-shade.clear { background: transparent; }
.tour-spot { position: fixed; z-index: 96; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(5, 10, 20, .6), 0 0 0 3px var(--accent); pointer-events: none; transition: all .25s ease; }
.tour-bubble { position: fixed; z-index: 97; padding: 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-pop); }
.tour-bubble h3 { margin: 0; }
.tour-bubble p { margin: 0; color: var(--text-2); line-height: 1.5; }
.tour-bubble .spacer { flex: 1; }
.tour-step { font-size: 12px; color: var(--text-3); }
.perm-list li { padding: 3px 0; }
.perm-list.ok li::before { content: "+ "; color: var(--ok); font-weight: 700; }
.perm-list.off li::before { content: "− "; color: var(--rec); font-weight: 700; }
.new-perms { margin: 4px 0 10px; }

.perm-list { list-style: none; padding-left: 0; }
.perm-list li { list-style: none; }

/* Verander van gebruiker */
.user-switch-list { display: flex; flex-direction: column; gap: 6px; }
.user-switch-list .btn { justify-content: flex-start; gap: 10px; padding: 8px 10px; }
.user-switch-list .profile-btn { width: 26px; height: 26px; font-size: 11px; }
.imp-bar { position: relative; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 12px; padding-top: calc(6px + env(safe-area-inset-top)); background: var(--warn); color: #1b1300; font-size: 13px; font-weight: 550; }
.imp-bar svg { width: 16px; height: 16px; }
.imp-bar .btn { background: rgba(255, 255, 255, .85); color: #1b1300; border-color: transparent; }

.pin-wrap { position: relative; display: flex; align-items: center; }
.pin-wrap input { width: 100%; padding-right: 52px; }
.pin-keys { position: absolute; right: 6px; border: 1px solid var(--border, #8884); background: transparent; color: inherit; border-radius: 6px; font-size: 12px; padding: 3px 7px; cursor: pointer; }

/* Anycubic ACE Pro: filamentvakken */
.ace-slots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 720px) { .ace-slots { grid-template-columns: repeat(4, 1fr); } }
.ace-slot { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; min-width: 0; border: 2px solid transparent; }
.ace-slot.loaded { border-color: var(--accent); }
.ace-color { width: 22px; height: 22px; border-radius: 50%; flex: none; border: 1px solid var(--border); }

/* ---------- dummy-apparaten: alles op één regel ---------- */
.dm-list { display: grid; gap: 0; padding-top: 4px; padding-bottom: 4px; }
.dm-row, .dm-new { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; }
.dm-row { padding: 8px 0; border-top: 1px solid var(--border); }
.dm-row:first-child { border-top: 0; }
.dm-id { display: grid; min-width: 78px; font-weight: 650; font-size: 13px; align-self: center; }
.dm-f { display: grid; gap: 2px; flex: 1 1 140px; min-width: 0; }
.dm-f .x-label { font-size: 11px; color: var(--text-2); }
.dm-f input, .dm-f select { min-height: 34px; padding: 5px 8px; font-size: 14px; }
.dm-val { align-self: center; flex: 1 1 140px; }
.dm-row .btn.icon { align-self: center; }
.dm-new .btn { align-self: flex-end; min-height: 34px; }
.x-detail { width: 100%; min-width: 0; }
.drow-extra.open-always { display: flex; }

/* Lade voor instellingen (app.ui.drawer): rechts op de computer, onderaan op de telefoon */
.drawer { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0; overflow: hidden; margin: 0; }
.drawer[open] { display: flex; flex-direction: column; }
.drawer::backdrop { background: rgba(0, 0, 0, .45); }
.drawer-btn { align-self: flex-start; }
@media (min-width: 900px) {
  .drawer { position: fixed; inset: 0 0 0 auto; width: min(420px, 100vw); height: 100vh; height: 100dvh; max-height: none; border-width: 0 0 0 1px; }
}
@media (max-width: 899px) {
  .drawer { position: fixed; inset: auto 0 0 0; width: 100%; max-width: none; max-height: 78vh; max-height: 78dvh; border-radius: 16px 16px 0 0; border-width: 1px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
.cam { scroll-margin-top: 110px; }

/* Kiezer van de stijl (profielmenu / thema-menu) */
.style-open { font-weight: 650; }
.style-dlg { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); padding: 0; width: min(920px, 96vw); max-height: 92vh; max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; box-shadow: var(--shadow-pop); }
.style-dlg::backdrop { background: rgba(0,0,0,.55); }
.style-dlg-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 12px 14px; background: var(--bg); border-bottom: 1px solid var(--border); }
.style-dlg-head .muted { flex: 1 1 200px; }
.style-dlg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; padding: 12px 14px 16px; }
.style-card { display: grid; align-content: start; gap: 3px; padding: 6px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: 13px var(--font); text-align: left; cursor: pointer; }
.style-card:hover { border-color: var(--accent); }
.style-card.on { border-color: var(--accent); background: var(--accent-soft); }
.style-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; background: var(--surface-2); display: block; }
.style-card b { padding: 3px 2px 0; }
.style-card small { padding: 0 2px 2px; color: var(--text-2); font-size: 11.5px; }
@media (max-width: 600px) { .style-dlg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-inline: 10px; } .style-card small { display: none; } }
.style-dlg-sec { padding: 12px 14px 0; font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.style-dlg-sec + .style-dlg-grid { padding-top: 8px; }

/* media: bladeren */
.browse-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.browse-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 12px; }
.filter-field { display: grid; gap: 2px; font-size: 13px; }
.filter-field select { min-width: 0; }
.browse-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.bcard { position: relative; display: grid; gap: 4px; align-content: start; cursor: pointer; min-width: 0; }
.bcard img, .bempty { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.bempty { display: grid; place-items: center; }
.bttl { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bcard .sub { font-size: 12px; color: var(--text-2); }
.bbadge { position: absolute; top: 6px; left: 6px; font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.bbadge.have { background: var(--accent, #2e7d32); color: #fff; }
.browse-foot { display: grid; justify-items: center; gap: 8px; margin: 14px 0; }
.detail-top { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; }
.detail-top .poster { width: 90px; height: 135px; }
.detail-row { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 8px; font-size: 14px; }
@media (max-width: 600px) { .browse-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .browse-filters .filter-field { flex: 1 1 42%; } .browse-filters select { width: 100%; } }
/* Media: tabblad met alleen leesrecht */
.media-ro [data-w] { display: none !important; }      /* alleen lezen: bediening helemaal weg */

/* =====================================================================
   Dashboard op telefoons: 1, 2 of 3 tegels per rij, met of zonder icoontjes
   ===================================================================== */
.dash-layout { display: none; }
.dash[data-icons="0"] .drow > .dev-icon { display: none; }
.dash[data-icons="0"] .drow { grid-template-columns: minmax(0, 1fr) auto auto auto; }
.dash[data-icons="0"] .drow:has(.drag-handle) { grid-template-columns: 14px minmax(0, 1fr) auto auto auto; }
@media (max-width: 700px) {
  .dash-layout { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: -2px 0 10px; font-size: 13px; color: var(--text-2); }
  .dash-layout .segmented button { min-width: 34px; }
  .dl-icons { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
  .dash[data-cols] .tile-grid { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 8px; }
  .dash[data-cols="2"] { --cols: 2; }
  .dash[data-cols="3"] { --cols: 3; }
  .dash[data-cols] .tile:has(.drow.open) { grid-column: 1 / -1; }     /* uitgeklapt: volle breedte */
  .dash[data-cols] .tile .drow:not(.open) {
    aspect-ratio: 1 / 1; padding: 8px; row-gap: 4px; align-content: stretch; overflow: hidden;
    grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "icon grip more" "main main main" "ctl ctl ctl";
  }
  .dash[data-cols] .tile .drow:not(.open) > .dev-icon { grid-area: icon; }
  .dash[data-cols] .tile .drow:not(.open) > .drag-handle { grid-area: grip; justify-self: center; height: 28px; }
  .dash[data-cols] .tile .drow:not(.open) > .drow-more { grid-area: more; width: 28px; height: 28px; }
  .dash[data-cols] .tile .drow:not(.open) > .drow-main { grid-area: main; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; overflow: hidden; }
  .dash[data-cols] .tile .drow:not(.open) > .drow-ctl { grid-area: ctl; justify-content: flex-start; }
  .dash[data-cols] .tile .drow:not(.open) .drow-name { max-width: 100%; width: 100%; text-align: left; white-space: normal; font-size: 13.5px; line-height: 1.2;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .dash[data-cols] .tile .drow:not(.open) .drow-sub { flex: 0 1 auto; width: 100%; white-space: normal; font-size: 12px; line-height: 1.25; }
  .dash[data-cols] .tile .drow:not(.open) .drow-sub::before { content: none; }
  .dash[data-cols] .tile .drow:not(.open) .drow-sub span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dash[data-cols="3"] .tile .drow:not(.open) { padding: 6px; }
  .dash[data-cols="3"] .tile .drow:not(.open) .drow-name { font-size: 12px; }
  .dash[data-cols="3"] .tile .drow:not(.open) .drow-sub { font-size: 11px; }
  .dash[data-cols="3"] .tile .drow:not(.open) .dev-icon { width: 22px; height: 22px; }
  .dash[data-icons="0"][data-cols] .tile .drow:not(.open) { grid-template-columns: auto minmax(0, 1fr) auto; }
}

/* Media (nieuw): knoppen met icoon, strook "recent toegevoegd", subkoppen in de bibliotheek */
.segmented.seg-icons button { display: inline-flex; align-items: center; gap: 5px; }
.segmented.seg-icons svg { width: 14px; height: 14px; flex: none; }
.recent-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.recent-item { flex: 0 0 92px; min-width: 0; }
.recent-item img, .recent-item .empty-poster { width: 92px; height: 138px; object-fit: cover; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.recent-item .sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.lib-head { display: flex; align-items: center; gap: 6px; }
.lib-head svg { width: 18px; height: 18px; }

/* ---------- veilige zones: iPhone (eiland/notch), Pixel (camera-gat), gebarenbalk ---------- */
html { min-height: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
/* menubalk altijd tegen de onderrand, ook bij weinig icoontjes of weinig inhoud */
.tabs { bottom: 0; }
.subnav { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabs { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* Media: film/serie-icoon rechtsboven in een kaart, seizoenenlijst */
.kind-ico { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); color: var(--text-2); }
.kind-ico svg { width: 15px; height: 15px; }
.season-list { display: grid; gap: 6px; }
.season { border: 1px solid var(--border, rgba(128,128,128,.25)); border-radius: 8px; overflow: hidden; }
.season-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; }
.season-name { flex: 1; min-width: 0; font-weight: 600; }
.season-chev { color: var(--text-2); font-size: 12px; }
.season-eps { display: grid; gap: 2px; padding: 4px 10px 8px 34px; font-size: 12.5px; }
.season-ep { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.season-all { padding: 2px 4px; }
.poster-card .poster-info { padding-right: 26px; }
