:root {
  --bg: #f4f6fa; --card: #fff; --text: #0b0b0f; --muted: #555b66; --line: #d5dae3; --lime: #c8ec4c;
  --brand: #1758f4; --brand-text: #fff; --route: #1758f4; --route-halo: #fff; --focus: #ff9d00;
  --ok: #0a6b3c; --danger: #b3261e;
  --unit: #ffffff; --unit-line: #8f99a8; --level-bg: #f4f6f9; --floor: #c3c9d2; --c-dest: #d9e4fe; --pin: #f08c00;
  --c-cafe: #fff0d4; --c-restroom: #e0ecfa; --c-exhibition: var(--unit); --c-elevator: #e8e5f6; --c-meeting: var(--unit);
  --c-lobby: var(--unit); --c-restaurant: #fff0d4; --c-cloakroom: var(--unit); --c-auditorium: var(--unit); --c-terrace: var(--unit); --c-office: var(--unit);
  --radius: 14px; --tap: 48px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07080b; --card: #101217; --text: #fff; --muted: #a8adb8; --line: #2b303b;
    --brand: #c8ec4c; --brand-text: #000; --route: #c8ec4c; --route-halo: #07080b; --focus: #ffb629;
    --unit: #171a21; --unit-line: #5b6272; --level-bg: #0b0d12; --floor: #2a2f3a; --c-dest: #3a4a12; --pin: #ffa94d;
    --c-cafe: #4a3b1f; --c-restroom: #1d2a45; --c-exhibition: var(--unit); --c-elevator: #2b2a45; --c-meeting: var(--unit);
    --c-lobby: var(--unit); --c-restaurant: #4a3b1f; --c-cloakroom: var(--unit); --c-auditorium: var(--unit); --c-terrace: var(--unit); --c-office: var(--unit);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; margin: 0; font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
h1, h2 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.15rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: var(--brand-text); padding: .75rem 1rem; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }

.app-header { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top)); background: var(--brand); color: var(--brand-text); }
.app-header h1 { margin: 0; display: flex; align-items: center; gap: .6rem; }
.h1-logo { height: 1.6rem; width: auto; flex: none; }
.h1-sub { font-weight: 400; opacity: .85; }
main { flex: 1 0 auto; width: 100%; max-width: 760px; margin: 0 auto; padding: 1rem; padding-bottom: max(1rem, env(safe-area-inset-bottom)); display: grid; gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.field { margin-bottom: 1rem; }
.label { display: block; font-weight: 600; margin-bottom: .3rem; }
.hint { color: var(--muted); font-size: .9rem; margin: .3rem 0 0; }
.start-row { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.btn { min-height: var(--tap); min-width: var(--tap); padding: .5rem 1rem; font: inherit; font-weight: 600; border-radius: 10px; border: 2px solid var(--brand); background: transparent; color: var(--brand); cursor: pointer; }
.btn:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.btn-primary { background: var(--brand); color: var(--brand-text); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 85%, #000); }
.btn-ghost { border-color: currentColor; color: inherit; min-height: 44px; }
.btn-icon { padding: 0; font-size: 1.3rem; line-height: 1; }

input[type=text], select { width: 100%; min-height: var(--tap); padding: .5rem .75rem; font: inherit; color: var(--text); background: var(--card); border: 2px solid var(--unit-line); border-radius: 10px; }
.combo { position: relative; }
.combo input { padding-right: 3.2rem; }
#dest-clear { position: absolute; right: 0; top: 0; border: 0; color: var(--muted); }
#dest-list { position: absolute; z-index: 20; left: 0; right: 0; margin: 4px 0 0; padding: 0; list-style: none; background: var(--card); border: 2px solid var(--brand); border-radius: 10px; max-height: 50vh; overflow: auto; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
#dest-list li { padding: .65rem .85rem; min-height: var(--tap); display: flex; flex-direction: column; justify-content: center; cursor: pointer; border-bottom: 1px solid var(--line); }
#dest-list li:last-child { border-bottom: 0; }
#dest-list li small { color: var(--muted); }
#dest-list li[aria-selected=true] { background: var(--brand); color: var(--brand-text); }
#dest-list li[aria-selected=true] small { color: inherit; }

.switch { display: flex; gap: .75rem; align-items: center; min-height: var(--tap); cursor: pointer; }
.switch input { width: 1.6rem; height: 1.6rem; accent-color: var(--brand); flex: none; }
.switch small { color: var(--muted); }

.status { min-height: 1.5rem; padding: 0 .25rem; font-weight: 600; }
.status.error { color: var(--danger); }

.tabs { display: flex; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.tab { min-height: var(--tap); padding: .4rem 1rem; border-radius: 999px; border: 2px solid var(--brand); background: transparent; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }
.tab[aria-selected=true] { background: var(--brand); color: var(--brand-text); }
.tab .dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--route); border: 2px solid currentColor; margin-left: .4rem; }
.map-wrap { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--level-bg); }
#map { display: block; width: 100%; height: auto; touch-action: pan-y; }
.zoom { position: absolute; right: 8px; bottom: 8px; display: grid; gap: 6px; }
.zoom .btn { background: var(--card); }

.summary { font-weight: 600; }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: .5rem; }
.steps li { counter-increment: s; }
.step { display: flex; gap: .75rem; align-items: flex-start; width: 100%; min-height: var(--tap); text-align: left; font: inherit; color: var(--text); background: transparent; border: 2px solid var(--line); border-radius: 10px; padding: .6rem .75rem; cursor: pointer; }
.step::before { content: counter(s); flex: none; width: 2rem; height: 2rem; border-radius: 50%; background: var(--brand); color: var(--brand-text); display: grid; place-items: center; font-weight: 700; }
.step[aria-current=step] { border-color: var(--route); background: color-mix(in srgb, var(--route) 12%, transparent); }
.step .meta { display: block; color: var(--muted); font-size: .85rem; }

dialog { border: 0; border-radius: var(--radius); padding: 1.25rem; max-width: min(92vw, 30rem); width: 100%; background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.55); }
.dlg-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
#scan-video { width: 100%; border-radius: 10px; background: #000; max-height: 40vh; }

/* Kaart */
.u { fill: var(--unit); stroke: var(--unit-line); stroke-width: .18; }
.u-cafe { fill: var(--c-cafe); } .u-restroom { fill: var(--c-restroom); } .u-exhibition { fill: var(--c-exhibition); }
.u-elevator { fill: var(--c-elevator); } .u-meeting { fill: var(--c-meeting); } .u-lobby { fill: var(--c-lobby); }
.u-restaurant { fill: var(--c-restaurant); } .u-cloakroom { fill: var(--c-cloakroom); } .u-auditorium { fill: var(--c-auditorium); }
.u-terrace { fill: var(--c-terrace); } .u-office { fill: var(--c-office); } .u-walkway { fill: none; stroke: none; }
.lvl { fill: var(--level-bg); stroke: var(--unit-line); stroke-width: .3; }
.lbl { fill: var(--text); font-weight: 500; paint-order: stroke; stroke: var(--unit); stroke-width: .35px; stroke-linejoin: round; font-family: system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.r-halo { fill: none; stroke: var(--route-halo); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.r-line { fill: none; stroke: var(--route); stroke-width: .8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1.6 1.2; }
.r-active .r-line { stroke-width: 1.3; stroke-dasharray: none; }
.pin-start { fill: var(--route); stroke: var(--route-halo); stroke-width: .5; }
.pin-end { fill: var(--pin); stroke: var(--route-halo); stroke-width: .5; }
.vert { fill: var(--card); stroke: var(--text); stroke-width: .25; }
.vert-t { fill: var(--text); font: 700 1.3px system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; }
@media (prefers-reduced-motion: no-preference) { .r-line { animation: dash 1.2s linear infinite; } .r-active .r-line { animation: none; } }
@keyframes dash { to { stroke-dashoffset: -2.8; } }
@media (forced-colors: active) { .r-line { stroke: Highlight; } .u { stroke: CanvasText; } }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.opt-text { display: flex; flex-direction: column; min-width: 0; }
#dest-list li { flex-direction: row; align-items: center; justify-content: flex-start; gap: .75rem; }
.opt-slot { width: 40px; height: 40px; flex: none; display: grid; place-items: center; }
.opt-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--line); padding: 2px; }
.dest-card { display: flex; gap: 1rem; align-items: flex-start; padding: .85rem; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--brand) 6%, var(--card)); }
.dest-card h3 { margin: 0; font-size: 1.05rem; }
.dest-card p { margin: .25rem 0 0; }
.dest-card a { display: inline-block; margin-top: .4rem; color: var(--brand); font-weight: 600; min-height: 24px; }
.dest-logo { width: 72px; height: 72px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); flex: none; padding: 4px; }

/* Bestemming en lege stands op de kaart */
.u-dest { fill: var(--c-dest); stroke: var(--route); stroke-width: .45; }
.u-empty { fill: var(--level-bg); stroke-dasharray: .5 .4; }
.lbl-empty { opacity: .5; }
.lbl-dest { font-weight: 700; }

/* Breed scherm: zoeken + stappen links, grote kaart rechts */
@media (min-width: 1000px) {
  main { max-width: 1320px; grid-template-columns: minmax(340px, 400px) minmax(0, 1fr); grid-template-areas: "route map" "status map" "steps map"; align-items: start; }
  main > section:nth-of-type(1) { grid-area: route; }
  main > .status { grid-area: status; }
  main > section.map-card { grid-area: map; position: sticky; top: 1rem; }
  main > section:nth-of-type(3) { grid-area: steps; }
}

.link-btn { display: block; background: none; border: 0; padding: .25rem 0; min-height: 32px; color: var(--brand); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

.switch[hidden] { display: none; }

/* Chat */
.btn-chat { width: 100%; margin-bottom: 1rem; text-align: left; }
.dlg-chat { max-width: min(94vw, 38rem); display: none; }
.dlg-chat[open] { display: flex; flex-direction: column; gap: .75rem; max-height: 90vh; }
.dlg-chat > * { flex: none; }
.chat-log { flex: 1 1 auto; min-height: 6rem; max-height: 52vh; overflow: auto; display: flex; flex-direction: column; gap: .6rem; padding: .25rem; }
.msg { max-width: 92%; padding: .6rem .8rem; border-radius: 14px; }
.msg p { margin: 0; }
.msg-user { align-self: flex-end; background: var(--brand); color: var(--brand-text); border-bottom-right-radius: 4px; }
.msg-bot { align-self: flex-start; background: color-mix(in srgb, var(--brand) 9%, var(--card)); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.picks { display: grid; gap: .5rem; margin-top: .6rem; }
.pick { display: flex; gap: .65rem; align-items: center; padding: .5rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.pick-logo { width: 40px; height: 40px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 2px; flex: none; }
.pick-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pick-why { font-size: .9rem; }
.pick-go { flex: none; min-height: 44px; padding: .25rem .75rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { min-height: 40px; padding: .25rem .8rem; border-radius: 999px; border: 1px solid var(--brand); background: transparent; color: var(--brand); font: inherit; cursor: pointer; text-transform: capitalize; }
.chip:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.chat-form { display: flex; gap: .5rem; }
.chat-form input { flex: 1; }
.chat-ai[hidden] { display: none; }
.chat-ai { align-items: flex-start; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--brand) 5%, var(--card)); }
.chat-ai input { margin-top: .1rem; }
.chat-ai span { display: flex; flex-direction: column; gap: .15rem; }
.chat-ai small { font-size: .85rem; line-height: 1.35; }

/* Popup bij een tik op de kaart */
.map-pop { position: absolute; z-index: 6; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.22); padding: .5rem; }
.map-pop[hidden] { display: none; }
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .15rem .25rem .4rem; }
.pop-x { min-width: 36px; min-height: 36px; border: 0; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; border-radius: 8px; }
.pop-x:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.pop-list { list-style: none; margin: 0; padding: 0; max-height: 190px; overflow: auto; display: grid; gap: .25rem; }
.pop-row { display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 44px; padding: .25rem .4rem; text-align: left; font: inherit; color: inherit; background: transparent; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.pop-row:hover, .pop-row:focus-visible { background: color-mix(in srgb, var(--brand) 10%, transparent); border-color: var(--line); }
.pop-logo { width: 32px; height: 32px; flex: none; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
.pop-logo.ph { background: transparent; border-style: dashed; }
.pop-name { font-weight: 600; }
.pop-go { width: 100%; }
.map-wrap .u { cursor: pointer; }
.u-sel { stroke: var(--pin); stroke-width: .5; }

/* Vloer van de hal (donkergrijs, zoals in de plattegrond): de vakken staan erop */
.floor { fill: var(--floor); stroke: var(--floor); stroke-width: .9; stroke-linejoin: round; } /* loopt iets onder de vakken door: geen gaatjes tussen vloer en tegels */

.wall { stroke: var(--text); stroke-width: .3; stroke-linecap: square; }

/* Verborgen is verborgen: geen enkele component-opmaak (display:flex e.d.) mag het hidden-attribuut overschrijven */
[hidden] { display: none !important; }

/* Onderbalk */
.app-footer { position: sticky; bottom: 0; z-index: 5; background: var(--card); display: flex; justify-content: center; align-items: center; gap: .6rem; padding: .9rem 1rem; padding-bottom: max(.9rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.app-footer img { display: block; height: 25px; width: auto; }
