:root {
  --bg: #0C0D0C; --panel: #171917; --chip: #222522; --line: #2A2D2A; --rule: #202320;
  --text: #F0F2EE; --muted: #A1A69E; --lime: #C8FF3E; --lime-soft: #DFFF9A; --lime-bg: #2A3A12;
  --warn: #FFB547; --warn-soft: #FFC46B;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Space Grotesk', system-ui, sans-serif; }
button { font-family: inherit; cursor: pointer; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.muted { color: var(--muted); }
.wrap { max-width: 1392px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card h2 { margin: 0; font-size: 18px; font-weight: 600; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .14em; }
.chip { padding: 6px 10px; border-radius: 8px; background: var(--chip); font-size: 13px; }
.pill { padding: 6px 12px; border-radius: 999px; font-size: 14px; border: 1px solid var(--line); background: var(--panel); display: inline-flex; align-items: center; gap: 8px; }
.pill.lime { border-color: var(--lime); color: var(--lime); font-weight: 600; background: transparent; }
.pill.warn { border-color: var(--warn); color: var(--warn-soft); background: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); display: inline-block; }
.btn { min-height: 48px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--chip); color: var(--text); font-size: 15px; }
.btn:hover { border-color: #4A5046; }
.btn.primary { border-color: var(--lime); background: var(--lime-bg); font-weight: 600; }
.btn.on { border-color: var(--lime); color: var(--lime); }
.btn.small { min-height: 44px; font-size: 14px; border-radius: 10px; }
.btn.ghost { background: transparent; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.title { font-size: 28px; font-weight: 700; line-height: 1.15; }
.wave { height: 72px; display: flex; align-items: center; gap: 2px; }
.wave span { flex: 1; min-width: 1px; border-radius: 2px; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.list-item:first-of-type { border-top: none; }
.lane { display: flex; gap: 12px; align-items: center; }
.lane > span { width: 120px; flex: none; font-size: 13px; color: var(--muted); }
.lane .track { flex: 1; height: 14px; background: var(--chip); border-radius: 4px; position: relative; overflow: hidden; }
.lane .seg { position: absolute; top: 0; bottom: 0; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: min(560px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.6); }
input[type=search] { height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 0 14px; font-size: 16px; font-family: inherit; width: 100%; }
input::placeholder { color: #7E837B; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* ------------------------------------------------------------------
   Tablet-cockpit (bijv. Samsung Galaxy Tab S8 Ultra, liggend):
   alles op één scherm, zonder scrollen, met grote knoppen.
   ------------------------------------------------------------------ */
body.cockpit { height: 100vh; overflow: hidden; }
body.cockpit .wrap {
  max-width: none; height: 100vh; padding: 16px 20px; gap: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .95fr);
  grid-template-rows: auto minmax(0, 1.15fr) auto minmax(0, 1fr);
  grid-template-areas:
    "head head head"
    "now  next ctrl"
    "trans trans ctrl"
    "req  dbk  dbk";
}
body.cockpit .row { display: contents; }
body.cockpit .s-head { grid-area: head; }
body.cockpit .s-now { grid-area: now; }
body.cockpit .s-next { grid-area: next; }
body.cockpit .s-trans { grid-area: trans; }
body.cockpit .s-ctrl { grid-area: ctrl; }
body.cockpit .s-req { grid-area: req; overflow-y: auto; }
body.cockpit .s-prev { grid-area: prev; overflow-y: auto; }
body.cockpit .s-qr { grid-area: qr; align-items: flex-start; overflow: hidden; }
body.cockpit .s-qr img { width: 128px !important; height: 128px !important; }
body.cockpit .s-qr #qrUrl { word-break: break-all; }
body.cockpit .s-now, body.cockpit .s-next { overflow: hidden; }
body.cockpit .s-now .btn.small { min-height: 44px; }
body.cockpit .s-prev .list-item { flex-wrap: nowrap; }
body.cockpit .s-prev .list-item .mono.muted[style*="font-size:13px"] { display: none; }
body.cockpit .s-hist, body.cockpit .s-qr, body.cockpit .s-prev, body.cockpit .dbk-legend { display: none !important; }
body.cockpit .next-preview { display: flex; }
body.cockpit .s-dbk { grid-area: dbk; }
body.cockpit .dbk-chart { flex: 1; height: auto; min-height: 90px; }
body.cockpit .dbk-meta { display: none; }
body.cockpit .card { padding: 16px; gap: 10px; min-height: 0; }
body.cockpit .title { font-size: 22px; }
body.cockpit .wave { height: 44px; }
@media (max-height: 860px) {
  body.cockpit .wave { height: 34px; }
  body.cockpit .card { padding: 12px 14px; gap: 8px; }
  body.cockpit .s-ctrl .btn { min-height: 56px; }
}
body.cockpit .s-ctrl .grid2 { gap: 12px; flex: 1; grid-auto-rows: minmax(64px, 1fr); }
body.cockpit .s-ctrl .btn { min-height: 64px; font-size: 17px; border-radius: 14px; }
body.cockpit .btn.small { min-height: 48px; }
body.cockpit #eta { font-size: 30px !important; }

/* Draaiboek: blokken per tijdvak (breedte = duur, hoogte = energie) */
.field { display: block; width: 100%; margin-top: 6px; height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--chip); color: var(--text); padding: 0 12px; font-size: 16px; font-family: inherit; color-scheme: dark; }
.dbk-chart { position: relative; height: 200px; border-bottom: 1px solid var(--line); touch-action: none; user-select: none; -webkit-user-select: none; }
.dbk-bars { position: absolute; inset: 0; }
.dbk-col { position: absolute; top: 0; bottom: 0; cursor: ns-resize; }
.dbk-bar { position: absolute; left: 0; right: 0; bottom: 0; box-sizing: border-box; border: 1px solid #4A5046; border-bottom: none; border-radius: 10px 10px 0 0;
  background: var(--chip); color: var(--text); padding: 14px 8px 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  overflow: hidden; text-align: left; min-width: 18px; font: inherit; cursor: inherit; transition: height .08s linear; }
.dbk-bar:hover { border-color: var(--muted); }
.dbk-bar.on { border-color: var(--lime); background: var(--lime-bg); }
.dbk-bar.edit { border-color: var(--text); box-shadow: 0 0 0 2px var(--text) inset; }
.dbk-grip { position: absolute; top: 5px; left: 50%; width: 26px; height: 4px; margin-left: -13px; border-radius: 2px; background: rgba(240,242,238,.3); }
.dbk-name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.dbk-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.dbk-edge { position: absolute; top: 0; bottom: 0; right: -14px; width: 28px; z-index: 3; cursor: ew-resize; }
.dbk-edge.l { right: auto; left: -14px; }
.dbk-edge::after { content: ''; position: absolute; left: 12px; bottom: 10px; width: 4px; height: 26px; border-radius: 2px; background: rgba(240,242,238,.3); }
.dbk-edge:hover::after, .dbk-edge:active::after { background: var(--lime); top: 0; bottom: 0; height: auto; width: 2px; left: 13px; }
.dbk-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.dbk-tip { position: absolute; top: 4px; transform: translateX(-50%); z-index: 5; pointer-events: none; white-space: nowrap;
  background: var(--bg); border: 1px solid var(--lime); color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.dbk-axis { position: relative; height: 16px; font-size: 12px; }
.dbk-axis span { position: absolute; top: 0; }
.dbk-foot { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; font-size: 13px; }
.dbk-hint { margin-right: auto; }
.dbk-undo { border-color: var(--lime) !important; }

.next-preview { display: none; flex-direction: column; gap: 2px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--rule); min-height: 0; overflow: hidden; }
.np-item { display: flex; gap: 10px; align-items: baseline; background: none; border: none; color: var(--text); font: inherit; font-size: 15px;
  padding: 6px 0; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-item .muted { font-size: 13px; }
[hidden] { display: none !important; }
