/* Deventer Live — vormgeving
   Rustige kaart, één donker merkblok, kleuren van de hulpdiensten als enige accenten. */

/* Lettertype Inter staat op je eigen hosting (fonts/), geen Google Fonts nodig */
@font-face { font-family: "Inter"; src: url("fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #eeece6;
  --paper: #ffffff;
  --paper-2: #f6f6f3;
  --ink: #111317;
  --ink-2: #474c55;
  --ink-3: #8b9099;
  --line: #e8e8e4;
  --brand-bg: #111317;
  --brand-ink: #ffffff;
  --sel: #f1f0ec;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 10px 32px rgba(17,19,23,.14);

  --brandweer: #d7263d;
  --ambulance: #e9a800;
  --politie:   #2557b5;
  --water:     #0e8fa0;
  --overig:    #6b7280;
  --file:      #b3122e;
  --incident:  #ea5a2a;
  --werk:      #ef8a00;

  --radius: 16px;
  --pw: clamp(300px, 40vw, 392px);   /* paneelbreedte, smaller op kleine schermen */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="dark"], :root.dark {
  --bg: #1b1e23;
  --paper: #17191d;
  --paper-2: #1f2227;
  --ink: #eef0f3;
  --ink-2: #b7bcc5;
  --ink-3: #7d838d;
  --line: #2a2e35;
  --brand-bg: #eef0f3;
  --brand-ink: #111317;
  --sel: #23272d;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 36px rgba(0,0,0,.45);
  --politie: #4f82e0;
  --overig: #8a919c;
}

* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; touch-action: manipulation; font-family: var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
svg { display: block; }
#map { position: fixed; inset: 0; background: var(--bg); }
.dark #map .leaflet-tile-pane { filter: none; }

/* ---------- merkblok ---------- */
.brand {
  position: fixed; top: 14px; left: 14px; z-index: 500;
  background: var(--brand-bg); color: var(--brand-ink); border-radius: 14px;
  padding: 11px 14px; box-shadow: var(--shadow); min-width: 210px;
}
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 26px; height: 26px; fill: var(--brandweer); stroke: currentColor; }
.brand-name { font-weight: 800; letter-spacing: -.025em; font-size: 17px; line-height: 1.1; }
.brand-name span { font-weight: 400; opacity: .65; }
.brand-status { display: flex; align-items: center; gap: 7px; font-size: 12px; opacity: .72; margin-top: 2px; font-variant-numeric: tabular-nums; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #3ddc84; animation: live 2s infinite; flex: none; }
.live-dot.is-stale { background: #f0b429; animation: none; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(61,220,132,.55); } 70%, 100% { box-shadow: 0 0 0 7px rgba(61,220,132,0); } }
.pause { margin-left: auto; width: 34px; height: 34px; flex: none; border: 0; border-radius: 10px; cursor: pointer; display: grid; place-items: center;
  background: color-mix(in srgb, currentColor 12%, transparent); color: inherit; }
.pause:hover { background: color-mix(in srgb, currentColor 20%, transparent); }
.pause:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.pause svg { width: 16px; height: 16px; fill: currentColor; }
.pause .i-play { display: none; }
.pause[aria-pressed="true"] { background: #f0b429; color: #111317; }
.pause[aria-pressed="true"] .i-play { display: block; }
.pause[aria-pressed="true"] .i-pause { display: none; }
.live-dot.is-paused { background: #f0b429; animation: none; }
.brand-stats { display: flex; gap: 12px; margin-top: 10px; padding-top: 9px; border-top: 1px solid color-mix(in srgb, currentColor 14%, transparent); font-size: 12px; }
.brand-stats:empty { display: none; }
.stat { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.stat b { font-weight: 700; font-variant-numeric: tabular-nums; }
.stat i { width: 8px; height: 8px; border-radius: 50%; }

.map-tools { position: fixed; left: 14px; bottom: 96px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.tool { width: 40px; height: 40px; border: 0; border-radius: 11px; background: var(--paper); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; }
.tool svg, .icon-btn svg, .search svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: var(--paper-2); }

/* ---------- paneel ---------- */
.panel {
  position: fixed; z-index: 600; background: var(--paper);
  box-shadow: var(--shadow); top: 14px; right: 14px; bottom: 14px; width: var(--pw);
  border-radius: var(--radius); overflow: hidden;
}
.panel-main { display: flex; flex-direction: column; height: 100%; }
.grip { display: none; }

.tabs { display: flex; gap: 3px; padding: 12px 12px 0; }
.tab {
  flex: 1; border: 0; background: transparent; border-radius: 10px; padding: 9px 4px;
  font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.tab b { font-weight: 600; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tab:hover { background: var(--paper-2); }
.tab.is-on { background: var(--ink); color: var(--paper); }
.tab.is-on b { color: color-mix(in srgb, var(--paper) 60%, transparent); }

.bar { display: flex; gap: 8px; padding: 10px 12px 0; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--paper-2); border-radius: 10px; padding: 0 10px; color: var(--ink-3); }
.search input { flex: 1; border: 0; background: transparent; outline: none; padding: 9px 0; font-size: 14px; color: var(--ink); }
.search:focus-within { box-shadow: 0 0 0 2px var(--ink); }
.icon-btn { width: 38px; height: 38px; flex: none; border: 0; border-radius: 10px; background: var(--paper-2); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { color: var(--ink); }
.icon-btn:focus-visible, .tab:focus-visible, .chip:focus-visible, .tool:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.chips { display: flex; gap: 6px; padding: 10px 12px 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 11px; font-size: 12px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600; }

.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.group-h { position: sticky; top: 0; z-index: 1; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); padding: 9px 14px 6px; font-size: 11.5px; font-weight: 700; color: var(--ink-3); display: flex; justify-content: space-between; }
.item { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 11px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.item:hover, .item.is-sel { background: var(--sel); }
.compact .item { padding: 7px 14px; grid-template-columns: 28px 1fr; gap: 10px; }
.compact .ico { width: 28px; height: 28px; border-radius: 8px; }
.compact .ico svg { width: 15px; height: 15px; }
.compact .sub { display: none; }

.ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; position: relative; }
.ico svg { width: 19px; height: 19px; fill: currentColor; }
.ico .prio { position: absolute; right: -5px; bottom: -5px; font-size: 9.5px; font-weight: 800; background: var(--paper); color: var(--ink); border-radius: 6px; padding: 1px 4px; box-shadow: 0 0 0 1.5px var(--line); letter-spacing: -.02em; }
.item.is-new .ico::after { content: ""; position: absolute; inset: -4px; border-radius: 14px; border: 2px solid currentColor; opacity: .35; }
.k-brandweer { background: var(--brandweer); }
.k-ambulance { background: var(--ambulance); color: #2a2000; }
.k-politie   { background: var(--politie); }
.k-water     { background: var(--water); }
.k-overig    { background: var(--overig); }
.k-file      { background: var(--file); }
.k-incident  { background: var(--incident); }
.k-werk      { background: repeating-linear-gradient(135deg, var(--werk) 0 6px, #f7a83e 6px 12px); color: #2a1600; }
.k-werk.is-planned { background: var(--paper); color: var(--werk); box-shadow: inset 0 0 0 2px var(--werk); }

.meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--ink-3); margin-bottom: 2px; }
.meta .tag { font-weight: 650; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.txt { font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.txt mark { background: color-mix(in srgb, var(--werk) 35%, transparent); color: inherit; border-radius: 3px; }
.sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.empty { padding: 44px 24px; text-align: center; color: var(--ink-3); font-size: 13px; line-height: 1.5; }
.empty strong { display: block; color: var(--ink-2); font-size: 14px; margin-bottom: 4px; }

.credits { font-size: 10.5px; line-height: 1.5; color: var(--ink-3); padding: 9px 14px 11px; border-top: 1px solid var(--line); }
.credits b { color: var(--brandweer); }

/* ---------- instellingen ---------- */
.settings { position: absolute; inset: 0; background: var(--paper); display: flex; flex-direction: column; z-index: 2; animation: slide .22s cubic-bezier(.2,.8,.2,1); }
.settings[hidden] { display: none; }
@keyframes slide { from { transform: translateX(16px); opacity: 0; } }
.settings-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.settings-head h2 { margin: 0; font-size: 17px; letter-spacing: -.015em; }
.settings-body { overflow-y: auto; flex: 1; padding: 4px 0 18px; overscroll-behavior: contain; }
.sec { padding: 14px 18px 6px; }
.sec h3 { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.sec .row:last-child { border-bottom: 0; }
.row small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 1px; }
.row .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; vertical-align: 0; }
.sw { position: relative; width: 40px; height: 24px; flex: none; }
.sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sw span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s; }
.sw span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.sw input:checked + span { background: var(--ink); }
.sw input:checked + span::after { transform: translateX(16px); background: var(--paper); }
.sw input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 10px; }
.seg .chip { padding: 7px 12px; font-size: 13px; }
.bases { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; padding: 4px 0 10px; }
.base { border: 1px solid var(--line); border-radius: 11px; background: var(--paper); padding: 6px 4px; cursor: pointer; text-align: center; font-size: 11.5px; color: var(--ink-2); overflow-wrap: anywhere; line-height: 1.2; }
.base i { display: block; height: 42px; border-radius: 7px; margin-bottom: 5px; }
.base.is-on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); color: var(--ink); font-weight: 600; }
.places { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 10px; }
.btn-line { display: flex; gap: 8px; padding: 6px 18px 0; }
.btn { border: 1px solid var(--line); background: var(--paper-2); border-radius: 10px; padding: 9px 14px; font-size: 13px; cursor: pointer; }
.btn:hover { border-color: var(--ink-3); }
.note { font-size: 12px; color: var(--ink-3); padding: 2px 0 8px; line-height: 1.45; }

/* ---------- kaart-markers ---------- */
.pin {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); position: relative; display: grid; place-items: center;
}
.pin svg { width: 14px; height: 14px; fill: currentColor; }
.pin.is-new::after {
  content: ""; position: absolute; inset: -10px; border-radius: 50%;
  border: 2px solid var(--c); animation: ping 1.8s ease-out infinite; opacity: 0;
}
@keyframes ping { 0% { transform: scale(.5); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.pin.is-old { opacity: .55; transform: scale(.82); }
.pin.p-approx { border-style: dashed; }
.small-pins .pin { width: 18px; height: 18px; }
.small-pins .pin svg { width: 10px; height: 10px; }
.warn {
  width: 24px; height: 24px; border-radius: 7px; background: var(--incident); color: #fff;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; transform: rotate(45deg);
}
.warn span { transform: rotate(-45deg); }
.wpin { width: 16px; height: 16px; border-radius: 4px; border: 2px solid #fff; background: var(--werk); box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.wpin.is-planned { background: #fff; border-color: var(--werk); }
.area-label { font: 600 11px var(--font); color: var(--ink-3); white-space: nowrap; }

.leaflet-container { font-family: var(--font); background: var(--bg); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--paper); color: var(--ink); }
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 13px 15px; font-size: 13px; line-height: 1.45; min-width: 220px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--ink-3); top: 6px; right: 6px; }
.pop-tag { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--ink-3); margin-bottom: 5px; }
.pop-tag i { width: 9px; height: 9px; border-radius: 50%; }
.pop-title { font-weight: 650; font-size: 14px; margin-bottom: 4px; }
.pop-sub { color: var(--ink-2); font-size: 12.5px; }
.pop-caps { color: var(--ink-3); font-size: 11.5px; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); }
.pop-caps a { color: var(--ink-2); }
.pop-caps b { color: var(--ink-2); font-weight: 650; }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow) !important; border-radius: 11px !important; overflow: hidden; }
.leaflet-control-zoom a { color: var(--ink) !important; background: var(--paper) !important; border-color: var(--line) !important; width: 40px !important; height: 40px !important; line-height: 40px !important; }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--paper) 80%, transparent) !important; color: var(--ink-3); }
.leaflet-control-attribution a { color: var(--ink-2); }

.toast { position: fixed; left: 50%; top: 18px; transform: translate(-50%, -140%); z-index: 900; background: var(--brand-bg); color: var(--brand-ink); padding: 10px 16px; border-radius: 12px; font-size: 13px; box-shadow: var(--shadow); transition: transform .3s cubic-bezier(.2,.8,.2,1), visibility .3s; visibility: hidden; max-width: min(440px, calc(100vw - 24px)); cursor: pointer; }
.toast.is-on { transform: translate(-50%, 0); visibility: visible; }

/* ---------- breed of liggend scherm: paneel rechts ---------- */
.leaflet-right .leaflet-control-attribution { margin-right: calc(var(--pw) + 28px); }
@media (max-height: 640px) {
  .brand-stats { display: none; }
  .brand { padding: 9px 12px; }
  .map-tools { bottom: 100px; }
}
@media (max-height: 460px) {
  .panel { top: 8px; bottom: 8px; right: 8px; }
  .brand { top: 8px; left: 8px; }
  .credits { display: none; }
  .tabs { padding-top: 8px; }
  .bar { padding-top: 6px; }
  .chips { padding: 6px 12px; }
  .item { padding: 8px 12px; }
}
@media (max-width: 560px) and (max-height: 500px) {
  :root { --pw: 270px; }
  .tab { font-size: 12px; gap: 3px; }
  .tab b { display: none; }
}

/* ---------- mobiel: onderblad ---------- */
@media (max-width: 760px) and (min-height: 501px) {
  .leaflet-right .leaflet-control-attribution { margin-right: 0; }
  .brand { top: calc(10px + env(safe-area-inset-top)); left: 10px; padding: 9px 12px; min-width: 0; }
  .brand-name { font-size: 15px; }
  .brand-mark { width: 22px; height: 22px; }
  .brand-stats { display: none; }
  .map-tools { left: auto; right: 10px; top: calc(10px + env(safe-area-inset-top)); bottom: auto; flex-direction: row; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    height: 54vh; border-radius: 20px 20px 0 0;
    transition: height .28s cubic-bezier(.2,.8,.2,1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel.is-low { height: 146px; }
  .panel.is-full { height: calc(100vh - 70px - env(safe-area-inset-top)); }
  .panel.is-low .list, .panel.is-low .credits, .panel.is-low .chips { visibility: hidden; }
  .grip { display: grid; place-items: center; border: 0; background: transparent; padding: 8px 0 0; cursor: pointer; width: 100%; }
  .grip span { width: 38px; height: 4px; border-radius: 2px; background: var(--line); }
  .panel-main { height: calc(100% - 12px); }
  .settings { top: 12px; }
  .tabs { padding-top: 6px; }
  .tab { font-size: 12.5px; padding: 8px 2px; gap: 4px; }
  .leaflet-bottom { bottom: 54vh; transition: bottom .28s; }
  body.sheet-low .leaflet-bottom { bottom: 146px; }
  .search input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- plaatsnamen op de eigen kaart ---------- */
.plaats { width: 0 !important; height: 0 !important; pointer-events: none; }
.plaats span { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); white-space: nowrap; font-family: var(--font); font-weight: 600; color: var(--ink-2); font-size: 12px; letter-spacing: .01em;
  text-shadow: 0 0 3px var(--bg), 0 0 3px var(--bg), 0 0 3px var(--bg), 0 0 6px var(--bg); }
.plaats.r1 span { font-size: 17px; font-weight: 800; color: var(--ink); letter-spacing: .02em; }
.plaats.r2 span { font-size: 14px; font-weight: 750; color: var(--ink); }
.plaats.r3 span { font-size: 12.5px; font-weight: 650; }
.plaats.r4 span, .plaats.r5 span { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: none; }
.plaats.r6 span { font-size: 10.5px; font-weight: 500; color: var(--ink-3); }
