/* Huisje — rustig groen ontwerp, licht + donker, duimvriendelijk */
:root {
  --bg: #f3f5f0;
  --surface: #ffffff;
  --surface-2: #eaf0e6;
  --glass: rgba(255, 255, 255, 0.86);
  --fg: #1c2920;
  --muted: #5b6b5f;
  --accent: #2f6b45;
  --accent-2: #5d9a6f;
  --accent-soft: #dcebdf;
  --accent-fg: #ffffff;
  --line: #d4ddd0;
  --sky: #e5ece2;
  --ground: #a7bb97;
  --weg: #c43d32;
  --nieuw: #2b9a55;
  --blijft: #9aa79c;
  --z-gemeten: #2b8a52;
  --z-afgeleid: #c9921a;
  --z-aanname: #c4513f;
  --shadow: 0 6px 24px rgba(28, 41, 32, 0.14), 0 1px 3px rgba(28, 41, 32, 0.08);
  --radius: 16px;
  --tap: 48px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --topbar-h: 56px;
  --tabbar-h: 62px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, "New York", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1511; --surface: #171f1a; --surface-2: #1f2a23; --glass: rgba(23, 31, 26, 0.86);
    --fg: #e3ebe4; --muted: #98aa9d; --accent: #8cc79f; --accent-2: #6aa67e; --accent-soft: #233528;
    --accent-fg: #0c140f; --line: #2b372f; --sky: #161f19; --ground: #2a392b;
    --weg: #ff7a6b; --nieuw: #6fd39a; --blijft: #5d6b61;
    --z-gemeten: #6fd39a; --z-afgeleid: #f0b44c; --z-aanname: #ff8a73;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1511; --surface: #171f1a; --surface-2: #1f2a23; --glass: rgba(23, 31, 26, 0.86);
  --fg: #e3ebe4; --muted: #98aa9d; --accent: #8cc79f; --accent-2: #6aa67e; --accent-soft: #233528;
  --accent-fg: #0c140f; --line: #2b372f; --sky: #161f19; --ground: #2a392b;
  --weg: #ff7a6b; --nieuw: #6fd39a; --blijft: #5d6b61;
  --z-gemeten: #6fd39a; --z-afgeleid: #f0b44c; --z-aanname: #ff8a73;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg); font: 16px/1.45 var(--font);
  overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, select, input { font: inherit; color: inherit; }
button { touch-action: manipulation; }
h1, h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 1.6rem; margin: 4px 0 6px; }
h2 { font-size: 1.15rem; margin: 22px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico-sm { width: 18px; height: 18px; }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */
.topbar {
  position: relative; z-index: 20; flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-t) + 6px) calc(var(--safe-r) + 12px) 6px calc(var(--safe-l) + 14px);
  min-height: calc(var(--topbar-h) + var(--safe-t));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: var(--accent); }
.brand span { color: var(--fg); }
.brand-mark { width: 26px; height: 26px; }
.variant-chip {
  margin-left: auto; min-width: 0; max-width: 62%;
  display: flex; align-items: center; gap: 6px; min-height: 44px;
  padding: 4px 12px 4px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); cursor: pointer; text-align: left;
}
.variant-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.variant-name { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.icon-btn {
  width: var(--tap); height: var(--tap); flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
}
.icon-btn.small { width: 40px; height: 40px; }
.icon-btn:active, .fab:active, .pill:active, .btn:active { transform: scale(0.96); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.fixture-banner {
  flex: none; z-index: 19; font-size: 0.78rem; text-align: center; padding: 4px 12px;
  background: #f5e7b8; color: #5a4300;
}
:root[data-theme="dark"] .fixture-banner { background: #3a3215; color: #f3dc8d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fixture-banner { background: #3a3215; color: #f3dc8d; } }

main { position: relative; flex: 1; min-height: 0; }
.tabpanel { position: absolute; inset: 0; }
.page { overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--bg); }
.page-inner { max-width: 820px; margin: 0 auto; padding: 18px calc(var(--safe-r) + 16px) 32px calc(var(--safe-l) + 16px); }

/* ---------- 3D-scherm ---------- */
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; background: var(--sky); outline: none; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.lbl {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; white-space: nowrap; pointer-events: auto;
  font-size: 0.78rem; font-weight: 600; padding: 4px 9px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--fg);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.lbl.measure { background: var(--accent); color: var(--accent-fg); border-color: transparent; font-size: 0.9rem; }
.lbl.measure small { display: block; font-weight: 400; opacity: 0.85; font-size: 0.7rem; }
.lbl.warn, .lbl.pin { max-width: 170px; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border-radius: 10px; }
.lbl.warn { background: #fff4d6; color: #5a4300; border-color: #e7c66b; }
.lbl.pin { background: var(--surface); border-left: 4px solid var(--z-aanname); }
.lbl .lbl-detail { display: none; font-weight: 400; margin-top: 3px; font-size: 0.74rem; }
.lbl.open { white-space: normal; max-width: 240px; z-index: 2; }
.lbl.open .lbl-detail { display: block; }
.lbl.side { background: transparent; border: 0; box-shadow: none; color: var(--muted); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.7rem; pointer-events: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
:root[data-theme="dark"] .lbl.warn { background: #3a3215; color: #f3dc8d; border-color: #6d5a1e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lbl.warn { background: #3a3215; color: #f3dc8d; border-color: #6d5a1e; } }

.hud-top {
  position: absolute; z-index: 6; top: 10px; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
  padding: 0 calc(var(--safe-r) + 12px) 0 calc(var(--safe-l) + 12px);
}
.hud-top > * { pointer-events: auto; }
.seg {
  display: flex; padding: 4px; gap: 2px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); max-width: 100%;
}
.seg button {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; min-width: 0;
  padding: 0 14px; border: 0; background: transparent; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: 0.9rem; color: var(--muted); white-space: nowrap;
}
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-fg); }
.seg button:disabled { opacity: 0.45; cursor: not-allowed; }
.compare-hud { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ab-seg button span { max-width: 9em; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.pill {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--glass); box-shadow: var(--shadow); cursor: pointer; font-weight: 600; font-size: 0.9rem;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.pill.accent { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.pill[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.pill.holding { background: var(--accent); color: var(--accent-fg); }
.where {
  font-size: 0.88rem; padding: 6px 14px; border-radius: 999px; background: var(--glass);
  border: 1px solid var(--line); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.split-labels { position: absolute; z-index: 5; left: 0; right: 0; bottom: 130px; display: flex; pointer-events: none; }
.split-labels span { flex: 1; text-align: center; font-weight: 600; }
.split-labels span::before { content: attr(data-tag); display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 6px; background: var(--accent); color: var(--accent-fg); }

.minimap {
  position: absolute; z-index: 5; left: calc(var(--safe-l) + 12px); top: 118px;
  width: 150px; padding: 6px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line);
  box-shadow: var(--shadow); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.minimap svg { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.minimap.big { width: min(420px, calc(100% - 24px)); }
.mm-room { fill: var(--surface-2); stroke: none; }
.mm-room.cur { fill: var(--accent-soft); }
.mm-wall { stroke: var(--fg); stroke-linecap: square; opacity: 0.75; }
.mm-door { stroke: var(--accent-2); stroke-width: 0.05; stroke-linecap: round; }
.mm-me { fill: var(--accent); stroke: var(--surface); stroke-width: 0.06; }
.mm-cone { fill: var(--accent); opacity: 0.25; }

.fab-col {
  position: absolute; z-index: 6; right: calc(var(--safe-r) + 10px); top: 118px;
  display: flex; flex-direction: column; gap: 10px;
}
.fab {
  width: 56px; min-height: 56px; padding: 6px 0 5px; border-radius: 16px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; cursor: pointer;
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.fab span { font-size: 0.66rem; font-weight: 600; color: var(--muted); }
.fab[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.fab[aria-pressed="true"] span { color: inherit; }

.bottom-stack {
  position: absolute; z-index: 6; left: 0; right: 0; bottom: 74px; display: flex; flex-direction: column-reverse;
  align-items: center; gap: 8px; pointer-events: none; padding: 0 calc(var(--safe-r) + 12px) 0 calc(var(--safe-l) + 12px);
}
#app[data-mode="wandel"] .bottom-stack, #app[data-mode="kompas"] .bottom-stack { bottom: 226px; }
.toast-bar {
  width: min(100%, 440px); padding: 9px 14px; border-radius: 14px; text-align: center; pointer-events: auto;
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.toast-bar span { display: block; font-weight: 600; }
.toast-bar small { color: var(--muted); }
.compass-bar { position: absolute; z-index: 6; right: calc(var(--safe-r) + 12px); bottom: 84px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

.joystick {
  position: absolute; z-index: 6; left: calc(var(--safe-l) + 22px); bottom: 86px;
  width: 128px; height: 128px; border-radius: 50%; touch-action: none;
  background: radial-gradient(circle, rgba(127, 160, 135, 0.18), rgba(127, 160, 135, 0.32));
  border: 2px solid var(--line); box-shadow: var(--shadow);
}
.joy-knob {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  background: var(--accent); opacity: 0.92; box-shadow: var(--shadow); pointer-events: none;
}
.room-strip {
  position: absolute; z-index: 6; left: 0; right: 0; bottom: 0;
  padding: 10px calc(var(--safe-r) + 12px) 12px calc(var(--safe-l) + 12px);
  background: linear-gradient(to top, var(--bg) 20%, transparent); pointer-events: none;
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; pointer-events: auto; padding: 2px; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 500; font-size: 0.92rem; white-space: nowrap; scroll-snap-align: start;
}
.chip[aria-current="true"] { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.hint {
  position: absolute; z-index: 5; left: 0; right: 0; bottom: 70px; text-align: center; pointer-events: none;
  font-size: 0.78rem; color: var(--muted); transition: opacity 0.6s; padding: 0 80px;
}
.hint.gone { opacity: 0; }
#app[data-mode="wandel"] .hint, #app[data-mode="kompas"] .hint { text-align: left; padding: 0 16px 0 calc(var(--safe-l) + 166px); bottom: 76px; }

/* modus-afhankelijke elementen */
#app[data-mode="overzicht"] .walk-only { display: none !important; }

/* ---------- Tabbar ---------- */
.tabbar {
  flex: none; z-index: 20; display: flex; justify-content: space-around;
  padding: 4px calc(var(--safe-r) + 8px) calc(var(--safe-b) + 4px) calc(var(--safe-l) + 8px);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; max-width: 160px; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: transparent; border: 0; cursor: pointer; color: var(--muted); font-size: 0.72rem; font-weight: 600; border-radius: 12px;
}
.tabbar button[aria-current="page"] { color: var(--accent); }
.tabbar button[aria-current="page"] .ico { stroke-width: 2.2; }

/* ---------- Sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(10, 16, 12, 0.28); }
.sheet {
  position: fixed; z-index: 31; left: 0; right: 0; bottom: 0; max-height: min(78vh, 78dvh);
  display: flex; flex-direction: column; background: var(--surface); color: var(--fg);
  border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
  padding: 6px calc(var(--safe-r) + 18px) calc(var(--safe-b) + 16px) calc(var(--safe-l) + 18px);
  animation: sheet-in 0.22s ease-out;
}
@keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 6px; }
.sheet-head { display: flex; align-items: center; gap: 10px; }
.sheet-head h2 { margin: 6px 0; flex: 1; font-size: 1.3rem; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
@media (min-width: 900px) {
  .sheet { left: auto; top: calc(var(--topbar-h) + 12px); bottom: 12px; right: 12px; width: 380px; max-height: none; border-radius: 20px; }
  .sheet-handle { display: none; }
  .sheet-backdrop { background: transparent; }
}
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

.opt-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; text-align: left;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
}
.opt[aria-checked="true"], .opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt .opt-text { flex: 1; min-width: 0; }
.opt .opt-text b { display: block; }
.opt .opt-text small { color: var(--muted); display: block; }
.switch { width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex: none; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform 0.15s; }
.opt[aria-pressed="true"] .switch { background: var(--accent); }
.opt[aria-pressed="true"] .switch::after { transform: translateX(18px); }
.radio-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.opt[aria-checked="true"] .radio-dot { border: 7px solid var(--accent); }
.legend-z { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.82rem; margin: 6px 0 2px; }
.legend-z i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.z-gemeten { background: var(--z-gemeten); } .z-afgeleid { background: var(--z-afgeleid); } .z-aanname { background: var(--z-aanname); }
.note { font-size: 0.82rem; color: var(--muted); padding: 10px 12px; border-radius: 12px; background: var(--surface-2); margin: 10px 0 0; }
.note.warn { background: #fff4d6; color: #5a4300; }
:root[data-theme="dark"] .note.warn { background: #3a3215; color: #f3dc8d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .note.warn { background: #3a3215; color: #f3dc8d; } }

/* Kamerinfo */
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 12px; }
.fact { padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.fact small { display: block; color: var(--muted); font-size: 0.74rem; }
.fact b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.qty { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.qty td { padding: 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.qty td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 10px; }
.qty small { display: block; color: var(--muted); font-size: 0.76rem; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.74rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); }
.badge i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn {
  min-height: var(--tap); padding: 0 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; color: var(--fg);
}
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn-row .btn { flex: 1; }

/* ---------- Vergelijken ---------- */
.ab-pick { display: flex; align-items: flex-end; gap: 8px; margin-top: 12px; }
.ab-pick label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ab-tag { font-weight: 700; font-size: 0.8rem; }
.ab-tag.a::after { content: " · basis"; color: var(--muted); font-weight: 500; }
.ab-tag.b::after { content: " · vergelijk met"; color: var(--muted); font-weight: 500; }
select {
  width: 100%; min-height: var(--tap); padding: 0 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); appearance: auto;
}
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 14px; font-size: 0.85rem; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.diff-wrap { padding: 10px; }
.diff-wrap svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.84rem; margin-bottom: 8px; }
.lg { display: inline-block; width: 22px; height: 0; vertical-align: middle; margin-right: 6px; border-top: 4px solid; }
.lg-weg { border-color: var(--weg); border-top-style: dashed; }
.lg-nieuw { border-color: var(--nieuw); }
.lg-blijft { border-color: var(--blijft); }
.d-room { fill: var(--surface-2); }
.d-room-label { font-size: 0.24px; fill: var(--muted); text-anchor: middle; font-family: var(--font); }
.d-blijft { stroke: var(--blijft); stroke-linecap: square; }
.d-weg { stroke: var(--weg); stroke-dasharray: 0.12 0.08; stroke-linecap: butt; }
.d-nieuw { stroke: var(--nieuw); stroke-linecap: square; }
.d-open { stroke: var(--z-afgeleid); stroke-dasharray: 0.04 0.06; stroke-linecap: round; }
.lg-open { border-color: var(--z-afgeleid); border-top-style: dotted; }
.table-wrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.cmp-table th, .cmp-table td { padding: 10px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; white-space: normal; }
.cmp-table thead th { font-size: 0.76rem; color: var(--muted); font-weight: 600; }
.cmp-table tbody tr:last-child td { border-bottom: 0; }
.cmp-table tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
.cmp-table td:first-child { padding-left: 12px; } .cmp-table td:last-child, .cmp-table th:last-child { padding-right: 12px; }
@media (max-width: 440px) { .cmp-table { font-size: 0.82rem; } .cmp-table td:first-child { min-width: 7.5em; } }
#app.comparing .fab-col, #app.comparing .minimap { top: 228px; }
@media (min-width: 900px) and (pointer: fine) { #app.comparing .fab-col, #app.comparing .minimap { top: 80px; } }
.pos { color: var(--nieuw); font-weight: 600; } .neg { color: var(--weg); font-weight: 600; }

/* ---------- Plannen ---------- */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.plan-card { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; cursor: pointer; text-align: left; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.plan-card img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: top; background: #fff; display: block; }
.plan-card span { padding: 9px 11px; font-size: 0.86rem; font-weight: 600; }
.planviewer { position: fixed; inset: 0; z-index: 40; background: #0c120e; display: flex; flex-direction: column; }
.pv-stage { flex: 1; overflow: hidden; position: relative; touch-action: none; cursor: grab; }
.pv-stage img { position: absolute; left: 0; top: 0; transform-origin: 0 0; user-select: none; -webkit-user-select: none; max-width: none; background: #fff; }
.pv-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px calc(var(--safe-r) + 10px) calc(var(--safe-b) + 8px) calc(var(--safe-l) + 10px);
  background: var(--surface); border-top: 1px solid var(--line);
}
.pv-title { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: center; }
.pv-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Laden / toast ---------- */
.loading { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--bg); transition: opacity 0.3s; }
.loading.done { opacity: 0; pointer-events: none; }
.loading-card { text-align: center; width: min(280px, 80%); }
.loading-mark { width: 54px; height: 54px; color: var(--accent); }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  top: 36%;
  max-width: min(92%, 460px); padding: 11px 16px; border-radius: 14px; font-size: 0.9rem;
  background: var(--fg); color: var(--bg); box-shadow: var(--shadow); text-align: center;
}

.desktop-only { display: none; }
@media (min-width: 900px) and (pointer: fine) {
  .desktop-only { display: inline-flex; align-items: center; }
  .fab-col { top: 80px; }
  .minimap { top: 80px; width: 200px; }
  .hud-top { flex-direction: row; justify-content: center; flex-wrap: wrap; }
}
@media (max-width: 440px) {
  .variant-label { display: none; }
  .fixture-banner { font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 370px) {
  .seg button { padding: 0 10px; font-size: 0.84rem; }
  .seg button .ico { display: none; }
}
@media (orientation: landscape) and (max-height: 500px) {
  :root { --topbar-h: 46px; }
  .fab-col { top: 60px; flex-direction: row; right: calc(var(--safe-r) + 10px); }
  .minimap { top: 60px; width: 120px; }
  .joystick { bottom: 70px; width: 110px; height: 110px; }
}

.layer-note { pointer-events: none; }
.layer-note .legend-z { margin: 0; justify-content: center; }
.layer-note .small { text-align: center; margin-top: 2px; }

.op-list { margin: 12px 0 0; border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px; }
.op-list summary { min-height: 44px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; cursor: pointer; font-weight: 600; }
.op-list ul { margin: 4px 0 10px; padding-left: 18px; font-size: 0.88rem; }
.op-list li { margin: 8px 0; }
.contents { display: contents; }
.badge-row { margin: 2px 0 8px; }
.sheet-body h2.first { margin-top: 4px; }
