/* KT-Control webapp – huisstijl Ketelaartechniek. Mobile-first; vanaf 1150px drie kolommen.
   Geen externe fonts of CDN's (CSP: alles van eigen origin). */

:root {
  --brand: var(--kop); --brand-ink: var(--kop); --bg: var(--grond);
  --surface: var(--oppervlak); --ink: var(--tekst); --ink-soft: var(--tekst-zacht);
  --line: var(--rand);
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --ok-bg: #e3f5ec; --ok-ink: #0f7a44; --ok-dot: #16a35a;
  --warn-bg: #fdf0db; --warn-ink: #9a6206; --warn-dot: #d8901a;
  --off-bg: #eceff1; --off-ink: #5a6b78; --off-dot: #90a0ab;
  --radius: 14px;
  --home-top: var(--kop); --home-mid: var(--accent); --home-end: var(--chev-3);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg); font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
h1, h2 { line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--chev-3); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.center { text-align: center; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--surface); padding: 8px 12px; }
.skip:focus { left: 8px; top: 8px; }
.icon { width: 22px; height: 22px; flex: none; }

/* ---------- Logo (woordmerk + drie chevrons) ---------- */
.logo-mark { display: inline-flex; gap: 2px; align-items: center; }
.logo-mark i { display: block; width: 9px; height: 18px; clip-path: polygon(0 0, 45% 0, 100% 50%, 45% 100%, 0 100%, 55% 50%); }
.logo-mark i:nth-child(1) { background: var(--chev-1); }
.logo-mark i:nth-child(2) { background: var(--chev-2); }
.logo-mark i:nth-child(3) { background: var(--chev-3); }
.logo-text { font-weight: 800; letter-spacing: .01em; font-size: 20px; }
.brand-logo { display: block; height: 24px; width: auto; }
.auth-logo { display: block; width: min(320px, 80vw); height: auto; }

/* ---------- Knoppen ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 22px; border-radius: 999px; border: 1.5px solid transparent; font-weight: 600; text-decoration: none; cursor: pointer; background: none; }
.btn-primary { background: var(--brand); color: var(--kop-tekst); }
.btn-primary:hover { background: var(--brand-ink); }
.btn-secondary { background: var(--surface); color: var(--brand); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-text { color: var(--accent); padding-left: 12px; padding-right: 12px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--accent); cursor: pointer; }
.icon-btn:hover { background: var(--accent-zacht); }

/* ---------- Meldingen ---------- */
.flash { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; font-size: 14px; border-left: 4px solid; }
.flash ul { margin: 0; padding-left: 18px; }
.flash-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-dot); }
.flash-info { background: var(--accent-zacht); color: var(--brand-ink); border-color: var(--accent); }
.flash-fout { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.flash a:not(.btn) { color: inherit; }
.flashes { padding: 12px 16px 0; }

/* ---------- Formulieren ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 4px; margin: 0 0 14px; }
.field > span { font-size: 12.5px; color: var(--ink-soft); }
.field input, .field textarea { width: 100%; border: 0; border-bottom: 1.5px solid var(--line); background: transparent; padding: 8px 2px; font-size: 16px; border-radius: 0; }
.field textarea { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field input:disabled, .field textarea:disabled { color: var(--ink-soft); background: var(--accent-zacht); }
.field.is-readonly { margin: 4px 4px 14px; }
.field.is-readonly output { font-size: 17px; padding: 4px 2px; border-bottom: 1.5px solid var(--line); }
/* Huidige unitwaarden zijn tekst, ook bij gedeeltelijk vrijgegeven formulieren. */
.field > output.is-readonly { padding: 8px 2px; font-size: 16px; overflow-wrap: anywhere; }
.edit-form label:has(> output.is-readonly) { cursor: default; }
.edit-form .day:has(> output.is-readonly) { display: inline-flex; flex-direction: column-reverse; align-items: center; gap: 4px; min-width: 42px; }
.edit-form .day:has(> output.is-readonly) span { width: auto; height: auto; border: 0; border-radius: 0; }
.edit-form .day > output.is-readonly { font-size: 12.5px; color: var(--ink-soft); }
.field-error { color: var(--danger); font-size: 13px; }
.field.indent { margin-left: 32px; }
.grow { flex: 1; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-size: 12.5px; color: var(--ink-soft); padding: 0; margin-bottom: 8px; }
.radio { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; cursor: pointer; }
.radio input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
fieldset:disabled { opacity: .5; }

/* Pil-schakelaar (checkbox) */
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--accent-zacht); position: relative; cursor: pointer; margin: 0; transition: background .15s; }
.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--kop-tekst); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(18px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }

/* Wachtwoordsterkte */
.strength { margin: -6px 0 6px; }
.strength-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.strength-bar i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.strength-text { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; }
.strength[data-score="1"] .strength-bar i { width: 25%; background: var(--danger); }
.strength[data-score="2"] .strength-bar i { width: 50%; background: var(--warn-dot); }
.strength[data-score="3"] .strength-bar i { width: 75%; background: var(--chev-2); }
.strength[data-score="4"] .strength-bar i { width: 100%; background: var(--ok-dot); }

/* ---------- Inlogschermen ---------- */
body.auth { min-height: 100vh; background: linear-gradient(180deg, var(--brand-ink) 0, var(--brand) 220px, var(--bg) 220px); }
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 40px 16px 24px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--kop-tekst); margin: 8px 0 28px; }
.auth-brand .logo-mark i:nth-child(1) { background: var(--accent); }
.auth-brand .logo-mark i:nth-child(2) { background: var(--accent); }
.auth-brand .logo-mark i:nth-child(3) { background: var(--accent-zacht); }
.auth-brand .logo-text { font-size: 26px; }
.auth-card { background: var(--surface); border-radius: 18px; padding: 28px 24px; box-shadow: 0 10px 30px rgba(8, 51, 87, .15); }
.auth-card h1 { margin: 0 0 16px; font-size: 22px; color: var(--brand-ink); }
.auth-card .field input { border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.auth-card .field input:focus { border-color: var(--accent); }
.auth-link { text-align: center; margin: 18px 0 0; }
.auth-foot { text-align: center; color: var(--ink-soft); font-size: 13px; margin-top: 20px; }
.auth-foot a, .app-foot a { color: inherit; text-decoration: none; }
.auth-foot a:hover, .app-foot a:hover { text-decoration: underline; }
.app-foot { text-align: center; color: var(--ink-soft); font-size: 12px; padding: 24px 16px calc(16px + env(safe-area-inset-bottom)); }

/* ---------- App-shell ---------- */
.shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(86vw, 340px); background: var(--surface); border-radius: 0 22px 22px 0; display: flex; flex-direction: column; overflow-y: auto; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 4px 0 30px rgba(8, 51, 87, .25); }
.sidebar:target { transform: none; }
.scrim { display: none; position: fixed; inset: 0; z-index: 40; background: rgba(8, 51, 87, .55); }
.sidebar:target ~ .scrim { display: block; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 14px 8px 20px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--brand); text-decoration: none; }
.drawer-close { display: grid; place-items: center; width: 40px; height: 40px; color: var(--ink-soft); border-radius: 10px; }
.me { padding: 10px 20px 16px; border-bottom: 1px dashed var(--line); margin: 0 0 8px; }
.me-name { font-size: 18px; font-weight: 600; }
.badge-role { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: var(--accent-zacht); color: var(--brand); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.side-item { display: flex; align-items: center; gap: 12px; margin: 4px 10px; padding: 10px 12px; border-radius: 999px; background: var(--accent-zacht); color: var(--ink-soft); }
.side-item > span:nth-child(2) { flex: 1; white-space: nowrap; }
.side-plus { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--accent-zacht); }
.side-title { padding: 14px 20px 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.side-error, .side-empty { padding: 8px 20px; color: var(--ink-soft); font-size: 14px; list-style: none; }
.inst-search { padding: 4px 16px 8px; }
.inst-search input { width: 100%; box-sizing: border-box; min-height: 42px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 21px; background: var(--bg); font: inherit; color: var(--ink); }
.inst-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.inst-list { list-style: none; margin: 0; padding: 0 8px; flex: 1; }
.inst { display: flex; align-items: center; gap: 14px; padding: 9px 12px; border-radius: 14px; color: var(--ink); text-decoration: none; }
.inst:hover { background: var(--accent-zacht); }
.inst.is-active { background: var(--accent-zacht); }
.avatar { position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--accent) 0, var(--chev-2) 45%, var(--brand) 100%); display: grid; place-items: center; }
.avatar-letter { color: var(--kop-tekst); font-weight: 700; font-size: 16px; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; border: 2px solid var(--kop-tekst); }
/* Installation list: calm line icon of the main output instead of a coloured initial. */
.avatar.avatar-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-zacht); color: var(--brand); }
.inst.is-active .avatar-icon { background: var(--kop-tekst); }
.avatar-icon .icon { width: 24px; height: 24px; }
.inst-text { display: grid; min-width: 0; }
.inst-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inst-status { font-size: 12px; color: var(--ink-soft); }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; flex: none; }
.dot-on { background: var(--ok-dot); }
.dot-off { background: var(--off-dot); }
.sidebar-foot { border-top: 1px dashed var(--line); padding: 8px 10px 16px; position: sticky; bottom: 0; background: var(--surface); }
.side-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; background: none; color: var(--ink); text-decoration: none; border-radius: 10px; cursor: pointer; text-align: left; font-size: 15px; }
.side-link:hover { background: var(--accent-zacht); }
.logout { margin: 0; }

/* Mobiel: één kolom tegelijk */
.col-menu, .col-detail { min-height: 100vh; min-height: 100dvh; }
/* Startscherm: onder de gradient geen witte strook als de schermhoogte anders uitvalt (zoom, adresbalk) */
@media (max-width: 1149px) { body.mode-start { background: var(--home-end); } }
.mode-start .col-menu, .mode-detail .col-menu { display: none; }
.mode-menu .col-detail { display: none; }

/* ---------- Schermkop en lijsten ---------- */
.screen-head { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; min-height: 56px; padding: 4px 6px; background: var(--bg); }
.screen-head h1 { margin: 0; font-size: 16px; font-weight: 600; text-align: center; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--ink-soft); text-decoration: none; }
a.head-btn:hover { background: rgba(11, 67, 113, .08); }
.screen-body { padding: 8px 12px 28px; }
.screen-body.narrow { max-width: 620px; margin: 0 auto; }
.card { background: var(--surface); border-radius: var(--radius); margin: 0 0 16px; box-shadow: 0 1px 2px rgba(22, 33, 43, .04); }
.card.pad { padding: 16px; }
.card-title { margin: 0 0 8px; font-size: 18px; color: var(--brand-ink); }
.list { list-style: none; padding: 0; overflow: hidden; }
.list > li + li { border-top: 1px solid var(--accent-zacht); }
.row { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 10px 16px; color: var(--ink); text-decoration: none; }
a.row:hover { background: var(--accent-zacht); }
.row.is-active { background: var(--accent-zacht); box-shadow: inset 3px 0 0 var(--accent); }
.row-label { flex: 1; min-width: 0; }
.row-label.is-empty { color: var(--ink-soft); font-style: italic; }
.row-text { flex: 1; display: grid; min-width: 0; }
.row-text .row-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-note { font-size: 12px; color: var(--ink-soft); }
.row-time { font-size: 12.5px; color: var(--ink-soft); }
.row-icon { position: relative; display: inline-flex; align-items: center; gap: 2px; color: var(--accent); }
.row-icon .icon { width: 28px; height: 28px; }
.num { font-size: 12px; font-weight: 700; color: var(--accent); align-self: flex-end; }
.slot { flex: none; min-width: 34px; font-weight: 700; color: var(--accent); font-size: 14px; }
.chev { color: var(--accent); width: 18px; height: 18px; }
.is-soon { color: var(--accent); cursor: default; }
.is-soon .row-label { color: var(--accent); }
.soon { flex: none; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--off-bg); color: var(--off-ink); }
.group-title { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin: 18px 6px 8px; }
.group-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 4px; flex: 1; max-width: 340px; margin: 10px 0 8px; background: var(--surface); border-radius: 999px; padding: 0 4px 0 14px; border: 1.5px solid var(--line); }
.search input { flex: 1; border: 0; background: none; padding: 8px 0; min-width: 0; font-size: 15px; }
.search input:focus { outline: none; }
.hint { color: var(--ink-soft); font-size: 13.5px; margin: 4px 6px 16px; }
.empty { color: var(--ink-soft); text-align: center; padding: 28px 12px; }
.sub { color: var(--ink-soft); font-size: 13px; margin: 0 6px 8px; }
.counter-pill { display: block; width: max-content; margin: 8px 0 0 auto; padding: 4px 14px; border-radius: 999px; background: var(--accent); color: var(--kop-tekst); font-size: 13px; font-weight: 600; }
.kv { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--accent-zacht); }
.kv:last-child { border-bottom: 0; }
.kv-label { font-size: 12.5px; color: var(--ink-soft); }
.kv-value { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 16px; }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.status-ok { background: var(--ok-bg); color: var(--ok-ink); }
.status-warn { background: var(--warn-bg); color: var(--warn-ink); }
.status-off { background: var(--off-bg); color: var(--off-ink); }
.ev-row .ev-icon { color: var(--ink-soft); }
.ev-icon.is-warn { color: var(--warn-dot); }
.toggle-row { display: flex; align-items: center; gap: 12px; width: 100%; cursor: pointer; }
.toggles .row { padding-top: 6px; padding-bottom: 6px; }

/* Uitgang bewerken: naam + icoon */
.name-icon { display: flex; align-items: flex-end; gap: 16px; }
.icon-preview { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--accent-zacht); color: var(--accent); margin-bottom: 14px; flex: none; }
.icon-preview .icon { width: 34px; height: 34px; }
.icon-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.icon-choice legend { grid-column: 1 / -1; }
.icon-opt { position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; border: 1.5px solid var(--line); cursor: pointer; font-size: 12.5px; color: var(--ink-soft); }
.icon-opt input { position: absolute; opacity: 0; }
.icon-opt-face { color: var(--accent); }
.icon-opt-face .icon { width: 30px; height: 30px; }
.icon-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-zacht); color: var(--brand-ink); font-weight: 600; }
.icon-opt:has(input:focus-visible) { outline: 3px solid var(--chev-3); outline-offset: 2px; }

/* Vaste actiebalk onderaan bewerkschermen */
.has-actionbar { padding-bottom: 96px; }
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.actionbar .btn-primary { min-width: 140px; }

/* ---------- Startscherm (verticale gradient in merkblauw) ---------- */
.mode-start .col-detail, .mode-menu .col-detail { background: linear-gradient(180deg, var(--home-top) 0, var(--home-mid) 42%, var(--home-end) 100%); color: var(--kop-tekst); }
.mode-start .flashes .flash, .mode-menu .flashes .flash { box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.home { padding: 8px 18px 36px; min-height: 100%; }
.home-bar { display: flex; justify-content: space-between; }
.head-btn.on-dark { color: var(--kop-tekst); }
a.head-btn.on-dark:hover { background: rgba(255,255,255,.12); }
.home-bar .icon { width: 28px; height: 28px; }
.home-name { margin: 18px 0 4px; text-align: center; font-size: 30px; font-weight: 600; letter-spacing: .01em; overflow-wrap: anywhere; }
.home-status { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 6px; font-size: 15px; }
.home-status .dot { border: 2px solid rgba(255,255,255,.7); }
.signal { width: 20px; height: 20px; stroke-width: 2.4; }
.home-status ~ [data-identity-confirmation], .home-status ~ [data-sms-offline-hint] { text-align: center; }
.home-pill { width: max-content; max-width: 100%; margin: 6px auto 0; padding: 3px 12px; border-radius: 999px; background: rgba(253, 240, 219, .95); color: var(--warn-ink); font-size: 12.5px; font-weight: 600; text-align: center; }
.home-events { margin: 22px 0 8px; }
.home-events ul { list-style: none; margin: 0; padding: 0; }
.ev { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.22); }
.ev .ev-icon { width: 26px; height: 26px; }
.ev-text { flex: 1; font-size: 14.5px; }
.ev-time { text-align: right; font-size: 13px; line-height: 1.3; opacity: .92; white-space: nowrap; }
.home-empty { text-align: center; opacity: .9; margin: 14px 0; }
.more-link { display: block; width: max-content; margin: 12px auto 18px; color: var(--kop-tekst); letter-spacing: .14em; font-size: 14px; text-underline-offset: 4px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 14px; max-width: 520px; }
.tile { display: grid; gap: 8px; justify-items: center; color: var(--kop-tekst); text-decoration: none; }
.tile-face { display: grid; place-items: center; width: 56%; aspect-ratio: 1; border-radius: 16px; background: rgba(246, 249, 252, .95); color: var(--accent); box-shadow: 0 6px 18px rgba(8, 51, 87, .25); transition: transform .1s; }
.tile:hover .tile-face { transform: translateY(-2px); }
.tile:active .tile-face { transform: scale(.97); }
.tile-icon { width: 44px; height: 44px; stroke-width: 1.5; }
.tile-label { font-weight: 700; font-size: 14px; text-align: center; overflow-wrap: anywhere; }

/* Bevestigingsvenster (bottom sheet op mobiel) */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 51, 87, .6); }
.sheet { position: relative; width: 100%; max-width: 480px; background: var(--surface); color: var(--ink); border-radius: 22px 22px 0 0; padding: 22px 20px calc(18px + env(safe-area-inset-bottom)); text-align: center; box-shadow: 0 -10px 40px rgba(0,0,0,.25); }
.sheet h2 { margin: 6px 0 6px; font-size: 20px; color: var(--brand-ink); }
.sheet-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--accent-zacht); color: var(--accent); }
.sheet-icon .icon { width: 36px; height: 36px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.sheet-actions .btn { flex: 1 1 140px; }

/* ---------- Desktop: drie kolommen vanaf 1150px ---------- */
@media (min-width: 1150px) {
  .shell { display: grid; grid-template-columns: 300px 380px minmax(0, 1fr); height: 100vh; }
  .no-menu .shell { grid-template-columns: 300px minmax(0, 1fr); }
  .sidebar { position: static; transform: none; width: auto; border-radius: 0; box-shadow: none; border-right: 1px solid var(--line); z-index: auto; }
  .scrim, .drawer-close, .hamburger, .home-bar .more { display: none !important; }
  .col-menu .back { visibility: hidden; }
  .home-bar { min-height: 44px; }
  .col-menu, .col-detail { min-height: 0; height: 100vh; overflow-y: auto; position: relative; }
  .col-menu { display: block !important; border-right: 1px solid var(--line); }
  .mode-menu .col-detail { display: block; }
  .col-detail { display: block; }
  .screen-body { padding: 8px 20px 32px; }
  .mode-detail .col-detail > .screen-head, .mode-detail .col-detail form > .screen-head, .mode-plain .col-detail > .screen-head { background: var(--bg); }
  .mode-detail .screen-body, .mode-plain .screen-body { max-width: 720px; }
  .actionbar { position: sticky; left: auto; right: auto; }
  .has-actionbar { padding-bottom: 24px; }
  .home { max-width: 760px; margin: 0 auto; }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 640px; margin: 0 auto; }
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 22px; }
}

/* Wijzigingen (concepten naar de unit) */
.change-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.change-list { list-style: none; margin: 8px 0 0; padding: 0; }
.change-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.change-label { color: var(--ink-soft); }
.change-values { text-align: right; overflow-wrap: anywhere; }
.change-before { color: var(--ink-soft); text-decoration: line-through; }
.change-actions { margin-top: 12px; display: flex; gap: 8px; }
.btn.is-disabled { opacity: .5; pointer-events: none; }
.sheet .change-list { text-align: left; margin: 8px 0 12px; }

/* ---------- Achtergronden startscherm (keuze per installatie; 0 = huisstijl) ---------- */
.bg-0 { --home-top: var(--kop); --home-mid: var(--accent); --home-end: var(--accent); }
.bg-1 { --home-top: var(--accent); --home-mid: var(--accent); --home-end: var(--accent); }
.bg-2 { --home-top: var(--accent); --home-mid: var(--accent); --home-end: var(--accent); }
.bg-3 { --home-top: var(--accent); --home-mid: var(--accent); --home-end: var(--accent-zacht); }
.bg-4 { --home-top: var(--accent); --home-mid: var(--accent); --home-end: var(--accent-zacht); }
.bg-5 { --home-top: var(--accent); --home-mid: var(--accent); --home-end: var(--accent-zacht); }
.bg-6 { --home-top: var(--accent); --home-mid: var(--accent); --home-end: var(--accent); }
.bg-7 { --home-top: var(--accent); --home-mid: var(--accent); --home-end: var(--accent); }
.bg-8 { --home-top: var(--accent-zacht); --home-mid: var(--accent-zacht); --home-end: var(--accent-zacht); }
.bg-9 { --home-top: var(--accent); --home-mid: var(--accent); --home-end: var(--accent); }
.avatar[class*="bg-"] { background: radial-gradient(circle at 35% 30%, var(--home-end) 0, var(--home-mid) 45%, var(--home-top) 100%); }
.bg-choice { border: 0; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.bg-choice legend { font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; padding: 0; }
.bg-opt { position: relative; cursor: pointer; }
.bg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bg-swatch { display: block; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(180deg, var(--home-top), var(--home-mid) 50%, var(--home-end)); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.bg-opt input:checked + .bg-swatch { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.bg-opt input:focus-visible + .bg-swatch { outline: 3px solid var(--chev-3); outline-offset: 4px; }
fieldset[disabled] .bg-opt { cursor: default; opacity: .8; }
.home-actions { display: flex; gap: 4px; }
.stack { display: grid; gap: 10px; margin: 0 0 12px; }
.btn-small { min-height: 36px; padding: 6px 18px; font-size: 14px; }

/* ---------- Bovenbalk (browserversie, vanaf 1150px) ---------- */
.topbar { display: none; }
@media (min-width: 1150px) {
  body.app { display: flex; flex-direction: column; height: 100vh; }
  .topbar { display: flex; align-items: center; gap: 28px; height: 68px; flex: none; padding: 0 24px; background: var(--surface); box-shadow: 0 1px 0 var(--line), 0 2px 12px rgba(8, 51, 87, .06); position: relative; z-index: 10; }
  .topbar .brand { margin-right: 8px; }
  .topnav { display: flex; align-items: stretch; gap: 6px; height: 100%; }
  .topnav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 92px; padding: 0 10px; color: var(--brand); text-decoration: none; font-size: 12.5px; font-weight: 600; border-bottom: 3px solid transparent; }
  .topnav-item .icon { width: 26px; height: 26px; padding: 3px; border: 1.6px solid currentColor; border-radius: 50%; }
  .topnav-item:hover { background: var(--accent-zacht); }
  .topnav-item.is-active { border-bottom-color: var(--accent); }
  .topnav-item.is-soon { color: var(--accent); cursor: default; }
  .topnav-item.is-soon:hover { background: none; }
  .topuser { margin-left: auto; display: flex; align-items: center; gap: 14px; }
  .topuser-text { display: grid; justify-items: end; font-size: 15px; line-height: 1.2; }
  .topuser-text .hello { color: var(--accent); }
  .topuser-text .badge-role { margin-top: 3px; }
  .topuser-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1.6px solid var(--brand); color: var(--brand); }
  .topuser-icon:hover { background: var(--accent-zacht); }
  .shell { flex: 1; height: auto; min-height: 0; }
  .col-menu, .col-detail { height: 100%; }
  .sidebar .sidebar-head, .sidebar .me, .sidebar .side-item, .sidebar .sidebar-foot { display: none; }
  .sidebar .side-title { padding-top: 18px; }
}

/* Zwevende knop (gebruiker toevoegen) en gevaarlijke tekstknop */
.fab { position: fixed; right: 20px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 15; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--brand); color: var(--kop-tekst); box-shadow: 0 6px 18px rgba(8, 51, 87, .3); }
.fab:hover { background: var(--brand-ink); }
.fab .icon { width: 28px; height: 28px; }
.btn-danger { color: var(--danger); }
@media (min-width: 1150px) { .fab { position: sticky; float: right; bottom: 24px; margin: 8px 0 0 12px; } }
.danger-form { padding: 0 12px 110px; }
@media (min-width: 1150px) { .danger-form { padding: 0 20px 24px; max-width: 720px; } }
.field select { width: 100%; border: 0; border-bottom: 1.5px solid var(--line); background: transparent url("/select-chevron.svg") no-repeat right 4px center / 18px; padding: 8px 28px 8px 2px; font-size: 16px; border-radius: 0; appearance: none; -webkit-appearance: none; }
.field select:focus { outline: none; border-color: var(--accent); }
.field select:disabled { color: var(--ink-soft); }

/* Tijdschema's */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.days { border: 0; padding: 0; margin: 4px 0 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.days legend { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; padding: 0; }
.day { position: relative; cursor: pointer; }
.day input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--line); font-weight: 600; font-size: 14px; color: var(--ink-soft); }
.day input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--kop-tekst); }
.day input:focus-visible + span { outline: 3px solid var(--chev-3); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 14px; }
details.more summary { cursor: pointer; color: var(--accent); font-size: 14px; margin: 6px 0; }
.right { text-align: right; margin: 8px 0 0; }
.field input[type=time], .field input[type=date] { font-variant-numeric: tabular-nums; }

/* Meldingen */
.push-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.plain-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; }

/* Live stand van uitgangen (tegels) en ingangen (lijst): rust- en actief-icoon, kleur, bezig-puls. */
:root { --on: var(--ok-dot); --on-glow: rgba(22, 163, 90, .55); --light-on: var(--accent-zacht); --light-ink: var(--warn-ink); --light-glow: rgba(255, 200, 61, .7); }
.icon-actief { display: none; }
.is-on > .tile-face > .icon-rust, .is-on > .row-icon > .icon-rust { display: none; }
.is-on > .tile-face > .icon-actief, .is-on > .row-icon > .icon-actief { display: block; }
.tile-face { transition: transform .1s, background .25s, color .25s, box-shadow .25s; }
.tile.is-on .tile-face { background: var(--on); color: var(--kop-tekst); box-shadow: 0 0 0 3px rgba(255, 255, 255, .9), 0 0 26px var(--on-glow); }
.tile.is-light.is-on .tile-face { background: var(--kop-tekst); color: var(--light-ink); box-shadow: 0 0 0 3px var(--light-on), 0 0 30px var(--light-glow); }
.tile.is-switch.is-on .tile-face { box-shadow: 0 0 0 3px var(--on), 0 0 26px var(--on-glow); }
.tile.is-busy .tile-face { animation: io-busy 1.1s ease-in-out infinite; }
.tile.is-failed .tile-face { box-shadow: 0 0 0 3px var(--accent-zacht), 0 6px 18px rgba(8, 51, 87, .25); }
.tile-state { min-height: 1.3em; margin-top: -6px; font-size: 12.5px; font-weight: 600; text-align: center; opacity: .95; }
.tile.is-failed .tile-state { color: var(--accent-zacht); }
@keyframes io-busy { 50% { transform: scale(.96); box-shadow: 0 0 0 7px rgba(255, 255, 255, .45), 0 6px 18px rgba(8, 51, 87, .25); } }
.row.is-on .row-icon, .row.is-on .num { color: var(--on); }
.io-chip:empty { display: none; }
.io-chip { flex: none; padding: 2px 10px; border-radius: 999px; background: var(--off-bg); color: var(--off-ink); font-size: 12px; font-weight: 600; }
.row.is-on .io-chip { background: var(--ok-bg); color: var(--ok-ink); }
@media (prefers-reduced-motion: reduce) {
  .tile.is-busy .tile-face { animation: none; outline: 3px dashed rgba(255, 255, 255, .85); outline-offset: 3px; }
}

/* Tekstgrootte (Instellingen, per apparaat): de hele weergave schaalt mee. */
.tekst-80 body { zoom: .8; }
.tekst-90 body { zoom: .9; }
.tekst-115 body { zoom: 1.15; }

/* Foutmelding als dialoog. Zonder JS (geen showModal) staat hij gewoon open in de pagina. */
.msg-dialog { border: 0; border-radius: 16px; padding: 20px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0,0,0,.25); color: var(--ink); background: var(--card, var(--kop-tekst)); }
dialog.msg-dialog[open]:not(:modal) { position: static; margin: 12px 16px; box-shadow: none; }
.msg-dialog::backdrop { background: rgba(0, 20, 40, .45); }
.msg-title { margin: 0 0 12px; font-size: 18px; color: var(--danger); }
.msg-dialog .flash { margin-bottom: 16px; }

/* Verzendbalk: een verzending met meerdere onderdelen die nog niet af is. */
.queue-bar p { margin: 0 0 8px; }
.queue-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Klaargezette wijzigingen (mandje) op de Wijzigingen-pagina. */
.basket-item { border-top: 1px solid var(--line, var(--accent-zacht)); padding-top: 10px; margin-top: 10px; }
.basket-item:first-of-type { border-top: 0; margin-top: 0; }
.basket-title { margin: 0; font-size: 15px; }
.send-now { margin: 4px 16px 16px; }

/* Voortgang van een opdracht als venster boven het startscherm. */
.cmd-dialog { color: var(--ink); }
.cmd-title { margin: 0 0 8px; font-size: 18px; color: var(--ink); }
.cmd-body .card { box-shadow: none; padding: 0; background: transparent; }
.cmd-body .btn-block { margin-top: 12px; }

/* Meldingsbolletje op het tandwiel (startscherm) en in het menu. */
.head-btn.more { position: relative; }
.badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: var(--kop-tekst); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.badge-inline { position: static; margin-left: 8px; }
.notice-list .row-label strong { color: var(--brand, var(--kop)); }

/* Installatiewizard */
.wizard-steps { display: flex; gap: 6px; list-style: none; margin: 4px 0 14px; padding: 0; counter-reset: stap; }
.wizard-steps li { flex: 1; counter-increment: stap; font-size: 12.5px; color: var(--ink-soft); text-align: center; padding-top: 30px; position: relative; }
.wizard-steps li::before { content: counter(stap); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; line-height: 24px;
  border-radius: 50%; background: var(--off-bg); color: var(--off-ink); font-weight: 600; }
.wizard-steps li.is-current::before, .wizard-steps[data-stap="2"] li:nth-child(2)::before, .wizard-steps[data-stap="3"] li:nth-child(3)::before,
.wizard-steps[data-stap="4"] li:nth-child(4)::before { background: var(--accent); color: var(--kop-tekst); }
.wizard-steps li.is-done::before, .wizard-steps[data-stap="3"] li:nth-child(2)::before, .wizard-steps[data-stap="4"] li:nth-child(-n+3)::before,
.wizard-steps[data-stap="5"] li::before { content: ""; background: var(--ok-dot); }
/* Vinkje getekend met een rand: geen afhankelijkheid van een lettertype met ✓. */
.wizard-steps li.is-done::after, .wizard-steps[data-stap="3"] li:nth-child(2)::after, .wizard-steps[data-stap="4"] li:nth-child(-n+3)::after,
.wizard-steps[data-stap="5"] li::after { content: ""; position: absolute; top: 5px; left: calc(50% - 3px); width: 6px; height: 11px;
  border: solid var(--kop-tekst); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.scan-btn[hidden], .wizard-status [hidden], .wizard-steps [hidden], .wizard-status form[hidden] { display: none; }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; min-width: 0; }
.scan-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.scanner { margin: 4px 0 12px; }
.scanner video { width: 100%; max-height: 50vh; border-radius: 10px; background: var(--tekst); object-fit: cover; }
.wizard-status { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.wizard-status p { margin: 0; }
.wizard-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: wizard-spin 1s linear infinite; }
.wizard-status[data-fase="klaar"] .wizard-spinner { animation: none; border-color: var(--ok-dot); background: var(--ok-dot); }
.wizard-status[data-fase="niet_ondersteund"] .wizard-spinner, .wizard-status[data-fase="fout"] .wizard-spinner { animation: none; border-color: var(--warn-dot); }
@keyframes wizard-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wizard-spinner { animation: none; } }

/* Vakantiedagen en gebruikersgroepen: bestaande kaarten, begrensd op brede schermen. */
.settings-screen { max-width: 720px; margin-inline: auto; }
.settings-screen .row-text { min-width: 0; overflow-wrap: anywhere; }
.settings-screen .list > .pad { padding: 16px; }
.settings-actions { display: flex; flex-direction: column; gap: 10px; margin-block: 12px; }
@media (min-width: 600px) { .settings-actions { flex-direction: row; flex-wrap: wrap; } }
@media (max-width: 480px) { .settings-screen .two-col { grid-template-columns: minmax(0, 1fr); } }

/* Conflict details stay readable on narrow settings screens. */
.settings-screen .conflict-table-wrap { overflow-x: auto; }
.settings-screen .conflict-table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
.settings-screen .conflict-table th, .settings-screen .conflict-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; vertical-align: top; }

/* Installatiemelding (telefoon): onderin, los van de header. Koen 24-10. */
.install-hint { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 55; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); color: var(--ink); border-radius: 16px; box-shadow: 0 8px 28px rgba(8, 51, 87, .28); max-width: 520px; margin: 0 auto; }
.install-hint[hidden] { display: none; }
.install-icon { flex: none; border-radius: 10px; }
.install-text { flex: 1; display: grid; gap: 2px; font-size: 14px; min-width: 0; }
.install-text strong { color: var(--brand-ink); }
.install-actions { display: flex; flex-direction: column; gap: 4px; flex: none; }
.install-share { width: 16px; height: 16px; vertical-align: -3px; color: var(--accent); }
.install-hint.is-ios .install-android, .install-hint.is-android .install-ios { display: none; }


/* Beheerder: ruimte voor Leegmaken binnen de bestaande schermkop. */
.administrator-edit > .screen-head { grid-template-columns: 96px minmax(0, 1fr) 96px; }
.administrator-edit > .screen-head > span.head-btn,
.administrator-edit .mobile-head-actions > span.head-btn { width: auto; justify-self: end; }
.ev-filters { margin-bottom: 12px; }
.ev-filters > summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; }
.ev-filters > summary::-webkit-details-marker { display: none; }
.ev-filters > summary::after { content: ""; width: 8px; height: 8px; margin-left: 4px; border: solid var(--ink-soft); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; flex: none; }
.ev-filters[open] > summary::after { transform: rotate(-135deg); }
.ev-filters-label { font-weight: 600; flex: none; }
.ev-filters-now { flex: 1; min-width: 0; text-align: right; color: var(--ink-soft); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-filters > form { padding-top: 0; }
/* i-knop met uitleg (info_tip): klik/tik opent, muis erop toont; verticaal midden achter de tekst (Koen 26-10). */
.tip { display: inline-block; vertical-align: -0.22em; line-height: 0; margin-left: 2px; }
.tip-btn { display: inline-flex; align-items: center; justify-content: center; width: 1.3em; height: 1.3em; margin: -0.15em 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--accent); cursor: pointer; font-size: inherit; }
.tip-btn .icon { width: 1.1em; height: 1.1em; }
.tip-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tip-text { display: none; position: fixed; z-index: 60; left: 16px; top: 0; width: max-content; max-width: min(300px, calc(100vw - 32px)); padding: 10px 12px; border-radius: 10px; background: var(--ink); color: var(--kop-tekst); font-size: 13.5px; font-weight: 400; line-height: 1.45; letter-spacing: normal; text-align: left; text-transform: none; white-space: normal; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.tip.open .tip-text, .tip.hover .tip-text { display: block; }
.screen-head h1 { display: flex; align-items: center; justify-content: center; gap: 2px; min-width: 0; }
.screen-head h1 .head-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-head h1 .tip { flex: none; }
/* Balk "Meldingen aanzetten?" op het startscherm (Koen 26-10). */
.push-nudge { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; max-width: 520px; margin: 10px auto 4px; padding: 10px 12px 10px 14px; border-radius: 14px; background: var(--surface, var(--kop-tekst)); color: var(--ink); box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.push-nudge[hidden] { display: none; }
.push-nudge--popup { position: fixed; z-index: 1000; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); margin: 0; padding: 18px 18px 16px 20px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45), 0 12px 32px rgba(0,0,0,.25); }
.push-nudge > .icon { flex: none; width: 22px; height: 22px; color: var(--accent); }
.push-nudge-text { flex: 1 1 140px; min-width: 0; font-size: 14.5px; text-align: left; }
.push-nudge .btn-small { flex: none; }

/* Meldingen (Koen 27-10, app ook 30-10): bovenaan onder de statusbalk, verdwijnen vanzelf op website en in de geïnstalleerde app. */
.flashes.flash-toasts { position: fixed; z-index: 1100; top: calc(16px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(480px, calc(100vw - 32px)); padding: 0; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.flash-toasts .flash { pointer-events: auto; }
@media (min-width: 1150px) { .flashes.flash-toasts { top: calc(80px + env(safe-area-inset-top, 0px)); } }
.flash-toasts .flash { position: relative; margin: 0; padding-right: 38px; box-shadow: 0 8px 24px rgba(0,0,0,.18); transition: opacity .25s, transform .25s; }
.flash-toasts .flash-leaving { opacity: 0; transform: translateY(-8px); }
.flash-close { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; }
.flash-close:hover, .flash-close:focus-visible { background: rgba(0,0,0,.08); }
@media (prefers-reduced-motion: reduce) { .flash-toasts .flash { transition: none; } }

/* KT-chevron: alleen presentatie; dezelfde tegel- en statusattributen. */
.mode-start .col-detail, .mode-menu .col-detail { background: var(--grond); color: var(--tekst); }
.home { position: relative; isolation: isolate; }
.home-heading { position: relative; isolation: isolate; margin: -8px -18px 0; padding: 8px 18px 58px; }
/* Optie C: onderrand met knik rechts van het midden; alle kopinhoud blijft boven de laagste rand (58 px ondermarge). */
.home-heading::before { content: ""; position: absolute; z-index: -1; inset: 0 0 auto; height: 100%; background: var(--kop-achtergrond); clip-path: polygon(0 0,100% 0,100% calc(100% - 34px),62% 100%,0 calc(100% - 18px)); }
.home-bar { position: relative; align-items: center; }
.home-heading .home-name { margin: 6px 0 8px; text-align: left; font-size: 32px; line-height: 1.05; letter-spacing: -.01em; }
.home-heading .home-status { justify-content: flex-start; margin: 0 0 4px; font-weight: 600; }
.home-heading > [data-identity-confirmation], .home-heading > [data-sms-offline-hint] { text-align: left !important; opacity: .75; margin: 0; }
.home-bar, .home-name, .home-status, .home-heading > [data-identity-confirmation], .home-heading > [data-sms-offline-hint] { color: var(--kop-tekst); }
.home-name { text-transform: uppercase; font-weight: 800; }
/* Pijltjes vóór de naam, zoals in het logo 'KT»»» CONTROL' (Koen 28-10). */
.home-chevrons { display: inline-block; width: 1.45em; height: .53em; margin: 0 .3em 0 0; vertical-align: .09em; } /* midden van de hoofdletters (Open Sans: hoogte ±.71em) */
.home-chevrons path:nth-child(1) { fill: var(--chev-1); }
.home-chevrons path:nth-child(2) { fill: var(--chev-2); }
.home-chevrons path:nth-child(3) { fill: var(--chev-3); }
.home-events { margin-top: 12px; }
.more-link { letter-spacing: normal; text-transform: none; color: var(--accent); min-height: 44px; padding: 12px; }
.more-link::after { content: " »"; }
.ev { border-color: var(--rand); }
.tiles { margin: 20px auto 0; }
.tile { gap: 4px; padding: 10px 6px; min-height: 92px; border: 2px solid var(--rand); border-radius: 14px; background: var(--oppervlak); color: var(--tekst); }
.tile .tile-icon { width: 34px; height: 34px; }
.tile .tile-label { font-size: 14px; }
.tile .tile-state { margin-top: 0; font-size: 12px; }
.tile-face, .tile.is-on .tile-face, .tile.is-light.is-on .tile-face, .tile.is-switch.is-on .tile-face { background: transparent; color: inherit; box-shadow: none; }
.tile.is-on { background: var(--accent); border-color: var(--accent); color: var(--kop-tekst); }
.home .section-title { text-transform: uppercase; letter-spacing: .1em; font-size: 12px; }

.tile.is-failed { border-color: var(--danger); }
.tile.is-failed .tile-state { color: var(--danger); }

@media (max-width: 699px) { html, body, body.mode-start, .shell { background: var(--grond); } }

.home-events-title { display: none; }
@media (max-width: 1149px) { .ev-extra { display: none; } }
/* Desktop (Koen 28-10, optie B): links kop + tegels, rechts de gebeurtenissen over de volle hoogte. */
@media (min-width: 1150px) {
  .home { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); grid-template-areas: "kop gebeurtenissen" "balk gebeurtenissen" "pil gebeurtenissen" "tegels gebeurtenissen"; grid-template-rows: auto auto auto 1fr; align-content: start; max-width: none; margin: 0; padding: 0; min-height: 100%; }
  .home > :not(.push-nudge--popup) { grid-column: 1; margin-left: 32px; margin-right: 32px; }
  .home > .push-nudge:not(.push-nudge--popup) { grid-area: balk; }
  .home > .home-heading { grid-area: kop; margin: 0; padding: 8px 32px 58px; }
  .home > .tiles { grid-area: tegels; align-self: start; max-width: 760px; margin: 24px 32px 32px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .home > .home-pill { grid-area: pil; justify-self: start; margin-top: 16px; }
  .home > .home-events { grid-area: gebeurtenissen; grid-column: 2; grid-row: 1 / -1; margin: 0; padding: 24px 24px 32px; background: var(--accent-zacht); border-left: 1px solid var(--rand); }
  .home-events-title { display: block; margin: 0 0 12px; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--kop); }
}

/* Desktop-bovenbalk (Koen 28-10, A+B 1): donker zoals de kop, menu als pil-knoppen met icoon; actief = accent-pil. */
@media (min-width: 1150px) {
  .topbar { background: var(--kop); color: var(--kop-tekst); box-shadow: none; }
  .topnav { align-items: center; gap: 4px; }
  .topnav-item { flex-direction: row; gap: 8px; min-width: 0; height: 40px; padding: 0 14px; border: 0; border-radius: 999px; color: var(--kop-tekst); font-size: 14px; }
  .topnav-item .icon { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 0; }
  .topnav-item:hover { background: rgba(255, 255, 255, .1); }
  .topnav-item.is-active { background: var(--accent); color: var(--kop-tekst); opacity: 1; font-weight: 700; }
  .topuser-text { color: var(--kop-tekst); }
  .topuser-text .hello { color: var(--kop-tekst); }
  .topuser-icon { border-color: var(--kop-tekst); color: var(--kop-tekst); }
  .topuser-icon:hover { background: rgba(255, 255, 255, .1); }
  .topbar .logout .btn { background: transparent; color: var(--kop-tekst); border-color: rgba(255, 255, 255, .5); }
  .topbar .logout .btn:hover { background: rgba(255, 255, 255, .1); }
}

/* Desktop (Koen 28-10): naam hoger (lege balk weg) en een witte streep tussen bovenbalk en kop. */
@media (min-width: 1150px) {
  .home-heading .home-bar { display: none; }
  .home > .home-heading { padding-top: 26px; }
  .home-heading .home-name { margin-top: 0; }
  .topbar { border-bottom: 3px solid var(--grond); }
  .app-foot { text-align: left; } /* app (telefoon) gecentreerd, desktop links (Koen 28-10) */
}

/* Online/bereik is een knop: tik = statuslezing (Koen 28-10). Streepjes boven het gemeten aantal zijn gedimd; 0 = nog niet gemeten. */
.home-status-form { margin: 0; }
button.home-status { background: none; border: 0; padding: 0; min-height: 44px; font: inherit; cursor: pointer; text-align: left; }
button.home-status:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 6px; }
button.home-status:disabled { cursor: progress; opacity: .7; }
.signal path { transition: opacity .2s; }
.signal[data-bars="0"] path, .signal[data-bars="1"] .sb2, .signal[data-bars="1"] .sb3, .signal[data-bars="1"] .sb4,
.signal[data-bars="2"] .sb3, .signal[data-bars="2"] .sb4, .signal[data-bars="3"] .sb4 { opacity: .3; }
/* Taalkeuze onder inlogkaart als tekstlinks (Koen 30-10). */
.auth-foot button { background: none; border: 0; padding: 0 2px; font: inherit; color: inherit; cursor: pointer; }
.auth-foot button:hover, .auth-foot button:focus-visible { text-decoration: underline; color: var(--brand-ink); }
.auth-card .auth-google { margin-top: 12px; }
/* Google-knop volgens Google-huisstijl (vaste merkkleuren, bewust niet uit het thema): wit, grijze rand, gekleurde G (Koen 30-10). */
.btn-google { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: rgb(255 255 255); color: rgb(31 31 31); border: 1px solid rgb(116 119 117); font-weight: 500; }
.btn-google:hover, .btn-google:focus-visible { background: rgb(242 242 242); }
.btn-google img { width: 18px; height: 18px; flex: none; }

/* The desktop menu already shows the same actionable draft notice. */
@media (min-width: 1150px) { .col-menu ~ .col-detail .draft-notice { display: none; } }

/* Persoonlijk postvak; kleur volgt het gekozen thema. */
.notification-bell { position: relative; display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; color: inherit; border-radius: 12px; }
.notification-count { position: absolute; top: 1px; right: 0; min-width: 18px; height: 18px; padding: 0 3px; border-radius: 12px; background: var(--danger); color: var(--kop-tekst); font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.notification-unread { font-weight: 700; }
.notification-list .row-label { min-width: 0; overflow-wrap: anywhere; }
.notification-list .ev-time { flex: none; }
/* Mobiel: gebruik de bestaande kop; geen extra bovenbalk of schermhoogte. */
.mobile-head-actions { display: contents; }
.mobile-notification { display: none; }
@media (max-width: 1149px) {
  .mobile-notification { display: block; flex: none; }
  .screen-head, .administrator-edit > .screen-head { grid-template-columns: 48px minmax(0, 1fr) 48px; padding-top: calc(4px + env(safe-area-inset-top, 0px)); }
  .screen-head > .mobile-head-actions { display: flex; align-items: center; justify-content: flex-end; min-width: 0; }
  .mobile-head-actions > .head-btn { flex: none; }
  .mobile-head-actions > .head-btn:empty { display: none; }
  /* Keep at least the old 156px title on 360px screens; the action track
     uses its actual width and the back control needs at least 48px. */
  .screen-head.has-head-action { grid-template-columns: minmax(48px, 1fr) minmax(156px, 1fr) auto; }
  .administrator-edit .mobile-head-actions .btn { padding-left: 8px; padding-right: 8px; }
  .home-bar { padding-top: env(safe-area-inset-top, 0px); }
  .home-bar .home-actions { display: flex; align-items: center; }
}

/* Offline: last known output state stays readable, without an active glow. */
[data-unit-control][aria-disabled="true"] {
  background: var(--surface); border-color: var(--line); color: var(--ink-soft);
  filter: grayscale(1);
  box-shadow: none; cursor: not-allowed; opacity: .7;
}
.tile[data-unit-control][aria-disabled="true"] .tile-face {
  background: var(--surface); color: var(--ink-soft); box-shadow: none;
  animation: none; outline: none; transform: none;
}
.tile[data-unit-control][aria-disabled="true"] .tile-state { color: inherit; }

/* hidden also wins over layout utilities such as .field display:grid. */
[hidden] { display:none !important; }
.home-heading > [data-unit-offline] { color:var(--kop-tekst); margin:0; }
button.home-status[aria-disabled="true"] { background:none; color:var(--kop-tekst); filter:none; opacity:.85; cursor:default; }

/* Shared user access fields. */
.edit-form .user-rfid, .rfid-groups { font-family: monospace; font-variant-numeric: tabular-nums; }
.rfid-groups { display: block; letter-spacing: .08em; overflow-wrap: anywhere; }
.pin-digits { display: flex; gap: .6rem; margin-block: .5rem; }
.pin-digits input { width: 2.8rem; min-width: 0; text-align: center; font: 1.5rem monospace; padding: .6rem .2rem; }
.pin-clear { display: inline-flex; align-items: center; gap: .5rem; }

/* Help: native disclosure controls, within the shared app shell. */
.help-page summary { cursor: pointer; font-weight: 600; }
.help-page summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.help-page p, .help-page li { overflow-wrap: anywhere; }
