/* ============================
   P2000 – clean responsive UI
   ============================ */

:root{
  --fs-1: 12px;
  --fs-2: 13px;
  --fs-3: 14px;
  --radius: 10px;
  --gap-1: 6px;
  --gap-2: 10px;
  --gap-3: 14px;

  color-scheme: light dark;

  --bg:        #0f1419;
  --panel:     #161c22;
  --panel-2:   #11161b;
  --border:    #22303c;
  --text:      #dfe7ee;
  --muted:     #9fb0bf;
  --primary:   #3aa0ff;
  --primary-2: #2785df;
  --accent:    #3aa0ff;
  --success:   #29c979;
  --warning:   #ffb020;
  --danger:    #ff5b6a;
  --chip:      #1d2530;
}


:root.light{
  --bg:#f7f8fb; --panel:#ffffff; --panel-2:#f4f6f8;
  --border:#e4e9ef; --text:#0f1419; --muted:#5b6b7a; --chip:#eef2f6;
  --accent:#2563eb;
}

:root.dark{
  --bg:        #0f1419;
  --panel:     #161c22;
  --panel-2:   #11161b;
  --border:    #22303c;
  --text:      #dfe7ee;
  --muted:     #9fb0bf;
  --primary:   #3aa0ff;
  --primary-2: #2785df;
  --success:   #29c979;
  --warning:   #ffb020;
  --danger:    #ff5b6a;
  --chip:      #1d2530;
}

@media (prefers-color-scheme: light){
  :root:not(.light):not(.dark){
    --bg:#f7f8fb; --panel:#fff; --panel-2:#f4f6f8;
    --border:#e4e9ef; --text:#0f1419; --muted:#5b6b7a;
    --chip:#eef2f6;
  }
}

*{ box-sizing: border-box }
[hidden]{ display:none !important }
html,body{ height:100% }
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font: 400 var(--fs-2)/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.hidden{ display:none }
.muted{ color: var(--muted) }
.section-title{ margin:0 0 8px 0; font-size:14px; color:var(--muted) }
a{
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a.btn{ color: var(--text); text-decoration: none }
a.btn.primary{ color: #fff }
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.menu-toggle:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible{
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible{
  border-color: var(--primary);
}
.chip:focus-within{
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.ios-steps{
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
.ios-steps li{ margin: 4px 0 }
.share-icon{
  display:inline-block;
  width:16px; height:16px;
  border:1px solid var(--border);
  border-radius:4px;
  position:relative;
  vertical-align:-3px;
  background: var(--panel-2);
}
.share-icon::before{
  content:'';
  position:absolute;
  left:50%; top:-3px;
  width:8px; height:8px;
  border-left:2px solid currentColor;
  border-top:2px solid currentColor;
  transform:translateX(-50%) rotate(45deg);
}
.share-icon::after{
  content:'';
  position:absolute;
  left:50%; top:6px;
  width:2px; height:7px;
  background: currentColor;
  transform:translateX(-50%);
}

/* ---------- layout ---------- */
.app{
  display:grid;
  grid-template-columns: 240px 1fr;
  gap: var(--gap-3);
  min-height:100dvh;
  align-items:start;
  padding: var(--gap-3);
}

@media (min-width:1200px){
  .app{ grid-template-columns: 260px minmax(0, 1fr) }
}

@media (max-width: 960px){
  .app{
    grid-template-columns: 1fr;
    padding: var(--gap-2);
  }
}

/* ---------- sidebar ---------- */
.sidebar{
  position: sticky;
  top: var(--gap-3);
  align-self:start;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap-3);
  max-height: calc(100dvh - var(--gap-3)*2);
  overflow:auto;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial;
}
body.has-adsense-bottom-bar .sidebar{
  max-height: calc(100dvh - var(--gap-3)*2 - var(--adsense-bottom-h, 0px));
  padding-bottom: calc(var(--gap-2) + var(--adsense-bottom-h, 0px));
}
.sidebar h3{
  margin:0 0 var(--gap-2);
  font-size: var(--fs-3);
  letter-spacing:.2px;
  opacity:.9;
}

.section{ margin-bottom: var(--gap-3) }
.section .row{ display:flex; gap:var(--gap-1); align-items:center; flex-wrap:wrap }
.section .row + .row{ margin-top: var(--gap-1) }
.sidebar [data-sidebar-group="menu"] .row{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px;
  align-items:stretch;
}
.sidebar [data-sidebar-group="menu"] .row .btn{
  width:100%;
  justify-content:center;
  text-align:center;
}

/* chips */
.chip{
  display:inline-flex; align-items:center; gap:6px;
  border:1px solid var(--border);
  background:var(--chip);
  color:var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: var(--fs-1);
  cursor: pointer;
  white-space: nowrap;
  user-select:none;
}
.chip input{ margin:0 }
.chip.is-on{
  border-color: rgba(58,160,255,.35);
  outline:2px solid rgba(58,160,255,.15);
}

/* buttons */
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px;
  border:1px solid var(--border);
  background:var(--panel-2);
  color:var(--text);
  padding: 8px 12px;
  min-height: 44px;
  min-width: 44px;
  font-size: var(--fs-1);
  line-height:1;
  border-radius: 10px;
  cursor:pointer;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial;
}
select.btn{
  appearance:none;
  -webkit-appearance:none;
  padding-right:30px;
  line-height:1.2;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px);
  background-size:5px 5px, 5px 5px;
  background-repeat:no-repeat;
}

.btn.primary{ background:var(--primary); border-color:var(--primary-2); color:#fff }
.btn:active{ transform: translateY(1px) }
.btn:hover{ filter: brightness(1.06) }

/* zoekbalk */
.toolbar{ display:flex; gap:var(--gap-1) }
.toolbar input[type="text"]{
  flex:1; min-width: 0;
  background: var(--panel-2);
  color: var(--text);
  border:1px solid var(--border);
  border-radius:8px;
  padding:8px 10px;
  font-size: var(--fs-2);
}
.input, input.input, textarea.input, select.input{
  background: var(--panel-2);
  color: var(--text);
  border:1px solid var(--border);
  border-radius:8px;
  padding:8px 10px;
  min-height: 44px;
  font-size: var(--fs-2);
  width: 100%;
}
.form-row{ display:flex; gap: var(--gap-2); flex-wrap:wrap }
.form-row .field{ flex:1; min-width:180px }
.form-label{ font-size: var(--fs-1); color: var(--muted); margin-bottom:4px }
.switch-row{
  display:flex;
  align-items:center;
  gap:12px;
  min-height:44px;
}
.switch-row input{
  position:absolute;
  opacity:0;
  width:1px;
  height:1px;
  pointer-events:none;
}
.switch-slider{
  position:relative;
  width:48px;
  height:28px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--panel-2);
  transition:background .2s ease, border-color .2s ease;
  flex:0 0 auto;
}
.switch-slider::after{
  content:'';
  position:absolute;
  top:3px;
  left:3px;
  width:20px;
  height:20px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 2px 6px rgba(0,0,0,.25);
  transition:transform .2s ease;
}
.switch-row input:checked + .switch-slider{
  background:var(--primary);
  border-color:var(--primary-2);
}
.switch-row input:checked + .switch-slider::after{
  transform:translateX(20px);
}
.switch-copy{
  display:flex;
  flex-direction:column;
  gap:2px;
  line-height:1.2;
}
.switch-copy small{
  color:var(--muted);
}

/* mobile drawer button */
.menu-toggle{
  position: fixed; top: 10px; left: 10px; z-index: 1003;
  border:1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding:8px 10px; border-radius: 8px; display:none;
}
@media (max-width:960px){
  .menu-toggle{ display:none }
  .mobile-dup{ display:none !important }
  .sidebar{
    position: fixed;
    top:0; left:0; height:100dvh; width:min(88vw, 360px);
    border-radius:0;
    transform: translateX(-102%);
    transition: transform .25s ease;
    z-index: 1002;
    padding-bottom: calc(var(--mobile-tabbar-h, 0px) + 12px);
  }
  body.has-adsense-bottom-bar .sidebar{
    padding-bottom: calc(var(--mobile-tabbar-h, 0px) + 58px);
  }
  body.sidebar-open[data-sidebar-mode="filters"] .sidebar{
    padding-bottom: calc(var(--mobile-tabbar-h, 0px) + 86px);
  }
  body.sidebar-open.has-adsense-bottom-bar[data-sidebar-mode="filters"] .sidebar{
    padding-bottom: calc(var(--mobile-tabbar-h, 0px) + 132px);
  }
  .sidebar.open{ transform: translateX(0) }
  .backdrop{
    position:fixed;
    inset:0;
    background: rgba(0,0,0,.28);   /* iets donker, geen blur */
    display:none;
    pointer-events:none;
    z-index:1001;
  }
  .backdrop.show{
    display:block;
    pointer-events:auto;
  }
}

/* mobile bottom nav (index) */
.mobile-tabbar{ display:none }
.mobile-only{ display:none }
@media (max-width:960px){
  body.has-mobile-tabbar{
    --mobile-tabbar-h: calc(66px + env(safe-area-inset-bottom));
  }
  .mobile-tabbar{
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    z-index:1004;
    display:grid;
    grid-template-columns:repeat(4, minmax(0,1fr));
    gap:8px;
    padding:8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top:1px solid var(--border);
    background:color-mix(in srgb, var(--panel) 92%, transparent);
    backdrop-filter: blur(8px);
  }
  .mobile-tabbar .tab-item{
    min-height:52px;
    border:1px solid var(--border);
    border-radius:12px;
    background:var(--panel-2);
    color:var(--muted);
    text-decoration:none;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    line-height:1.1;
  }
  .mobile-tabbar .tab-item-button{
    font: inherit;
    appearance: none;
    cursor: pointer;
    padding: 0;
  }
  .mobile-tabbar .tab-item.is-active,
  .mobile-tabbar .tab-item[aria-current="page"]{
    color:var(--text);
    border-color:color-mix(in srgb, var(--primary) 50%, var(--border));
    background:color-mix(in srgb, var(--primary) 14%, var(--panel-2));
  }
  .mobile-tabbar .tab-ico{ font-size:16px; margin-bottom:3px }
  .mobile-tabbar .tab-label{ font-size:12px; font-weight:600 }
  body.has-mobile-tabbar .app{ padding-bottom:calc(var(--mobile-tabbar-h) + 8px) }
  body.has-mobile-tabbar .detail-wrap{ padding-bottom:calc(var(--mobile-tabbar-h) + 28px) }
  .mobile-only{ display:block }
  .sidebar-apply-dock{
    display: none;
    position: fixed;
    left: 0;
    width: min(88vw, 360px);
    bottom: calc(var(--mobile-tabbar-h, 0px) + 8px);
    margin: 0;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    backdrop-filter: blur(6px);
    z-index: 1003;
  }
  body.sidebar-open[data-sidebar-mode="filters"] .sidebar-apply-dock{ display: block }
  body.has-adsense-bottom-bar .sidebar-apply-dock{
    bottom: calc(var(--mobile-tabbar-h, 0px) + 54px);
  }
  .sidebar-apply-dock .btn{
    width: 100%;
    min-height: 42px;
  }
  body.sidebar-open .adsense-bottom-bar{
    display: none !important;
  }
}

.sticky-cta{
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--mobile-tabbar-h, 66px) + 10px);
  z-index: 1005;
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 95%, transparent);
}
.sticky-cta .btn{
  flex: 1;
}
body.has-adsense-bottom-bar .sticky-cta{
  bottom: calc(var(--mobile-tabbar-h, 66px) + 56px);
}
body.sidebar-open .sticky-cta{
  display: none;
}

.ui-alert{
  position:fixed;
  left:50%;
  transform:translate(-50%,10px);
  bottom:calc(var(--mobile-tabbar-h,66px) + 70px);
  z-index:1100;
  padding:10px 14px;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--text);
  opacity:0;
  transition:opacity .2s ease, transform .2s ease;
}
.ui-alert.show{ opacity:1; transform:translate(-50%,0) }
.ui-alert-info{ border-color:color-mix(in srgb, var(--primary) 55%, var(--border)) }
.ui-alert-success{ border-color:color-mix(in srgb, var(--success) 50%, var(--border)) }
.ui-alert-error{ border-color:color-mix(in srgb, var(--danger) 60%, var(--border)) }
.ui-modal-wrap{ position:fixed; inset:0; z-index:1200 }
.ui-modal-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.45) }
.ui-modal{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:min(92vw,520px);
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  padding:14px;
}
.ui-modal h3{ margin:0 0 6px 0 }
.ui-modal p{ margin:0 0 10px 0; color:var(--muted) }
.ui-modal-actions{ display:flex; gap:8px; justify-content:flex-end }

/* ---------- content ---------- */
.content{ min-width:0 }

.page-title{font-size:28px;margin:2px 0 6px 0;letter-spacing:.2px}


/* statusbar */
.statusbar{
  display:flex; align-items:center; justify-content:space-between;
  gap: var(--gap-2);
  margin-bottom: var(--gap-2);
  font-size: var(--fs-1);
  color: var(--muted);
}
.statusbar #status{
  flex:1;
  min-width:0;
}

/* panels */
.panel{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap-3);
  margin-bottom: var(--gap-2);
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.panel.notice{
  font-size: var(--fs-2);
  color: var(--text);
}

/* sw update banner */
.sw-update{
  position:fixed; right:16px; bottom:16px;
  background:var(--panel); border:1px solid var(--border); color:var(--text);
  padding:10px 12px; border-radius:10px; z-index:9999;
  display:flex; align-items:center; gap:10px;
  box-shadow:0 10px 30px rgba(0,0,0,.25);
}

/* consent banner */
.consent-banner{
  position:fixed; left:16px; right:16px; bottom:16px;
  background:var(--panel); border:1px solid var(--border); color:var(--text);
  border-radius:12px; padding:14px; z-index:9999; box-shadow:0 10px 30px rgba(0,0,0,.25);
  display:flex; gap:12px; align-items:center; justify-content:space-between; flex-wrap:wrap;
}
.consent-banner a{ color:var(--accent); text-decoration:underline }
.consent-text{ font-size:14px; color:var(--text); flex:1 1 320px }
.consent-actions{ display:flex; gap:8px; flex-wrap:wrap }
.consent-modal{ position:fixed; inset:0; background:rgba(0,0,0,.45); display:none; align-items:center; justify-content:center; z-index:10000 }
.consent-modal.show{ display:flex }
.consent-modal-card{
  background:var(--panel); border:1px solid var(--border); border-radius:12px;
  padding:16px; width:min(520px, 92vw); color:var(--text); box-shadow:0 10px 30px rgba(0,0,0,.25);
}
.consent-row{ display:flex; align-items:center; gap:10px; margin:10px 0; font-size:14px }

/* feed */
.feed{ display:flex; flex-direction:column; gap: var(--gap-2) }

/* card */
.card{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.card .head{
  display:flex; align-items:center; justify-content:space-between;
  gap: var(--gap-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.card .body{ padding: 14px 16px; overflow:auto; }

/* compact setup card (incidentregistratie) */
.setup-steps{ display:flex; flex-direction:column; gap:10px }
.setup-step{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  border:1px solid var(--border);
  background:var(--panel-2);
  border-radius:12px;
  padding:12px;
}
.setup-left{ display:flex; gap:10px; align-items:flex-start }
.setup-num{
  width:22px; height:22px;
  border-radius:999px;
  display:flex; align-items:center; justify-content:center;
  font-weight:700;
  font-size:12px;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--text);
  flex:0 0 auto;
}
.setup-title{ font-weight:700; line-height:1.2 }
.setup-sub{ margin-top:2px; color:var(--muted); font-size:13px }
.setup-actions{ display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end }
.setup-done{
  border-color: rgba(41,201,121,.35);
  outline:2px solid rgba(41,201,121,.10);
}
.setup-done .setup-num{ border-color: rgba(41,201,121,.35) }
.setup-active{
  border-color: rgba(58,160,255,.45);
  outline:2px solid rgba(58,160,255,.14);
}
.setup-active .setup-num{
  border-color: rgba(58,160,255,.45);
  color: var(--primary);
}

.msghead{
  display:flex; align-items:baseline; justify-content:space-between; gap:12px;
  margin-bottom:6px;
}
.msgtitle{
  font-weight:700;
  font-size:18px;
  line-height:1.35;
  overflow-wrap:anywhere;
}
.time{
  background:var(--panel-2);
  color:var(--muted);
  border:1px solid var(--border);
  font-size:12.5px;
  padding:3px 8px;
  border-radius:999px;
}
.subline{
  display:flex; align-items:center; gap:8px;
  color: var(--muted);
  font-size:13px;
  margin-bottom:8px;
}
.subline .dot{ opacity:.7 }

.badge.brandweer{ color:#fff; background:#b91c1c; border:1px solid #7f1d1d; padding:2px 8px; border-radius:999px }
.badge.ambulance{ color:#fff; background:#b45309; border:1px solid #92400e; padding:2px 8px; border-radius:999px }
.badge.lifeliner{ color:#fff; background:#7c3aed; border:1px solid #5b21b6; padding:2px 8px; border-radius:999px }
.badge.politie{ color:#fff; background:#2563eb; border:1px solid #1e3a8a; padding:2px 8px; border-radius:999px }
.badge.overig{ color:#fff; background:#475569; border:1px solid #334155; padding:2px 8px; border-radius:999px }
.badge.premium{
  color:#fff;
  background:#16a34a;
  border:1px solid #15803d;
  padding:4px 10px;
  border-radius:999px;
  font-weight:600;
}
.badge.premium::before{
  content:"★";
  margin-right:6px;
}
.premium-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border:1px solid var(--border);
  border-radius:12px;
  background:linear-gradient(135deg, rgba(34,197,94,.12), rgba(34,197,94,.02));
}
.premium-card .title{ font-weight:700 }
.premium-card .sub{ color:var(--muted); font-size:12px }

.caplist{ display:flex; flex-direction:column; gap:2px; margin:8px 0 6px }
.capline{ display:block; font-size:13px; color:var(--text); opacity:.95 }
.capline{ overflow-wrap:anywhere }
.capline .capcode{ font-variant-numeric: tabular-nums; font-weight:600 }
.capcode-link{ color:var(--text); text-decoration:none; border-bottom:1px dotted var(--border) }
.capcode-link:hover{ color:var(--primary) }
.capline .sep{ margin:0 6px; color:var(--muted) }
.capline .dash{ margin:0 6px; color:var(--muted) }
.capline .plaats{ color:var(--muted) }
.capline .functie{ color:var(--muted) }
.capline .cap-suggest{ margin-left:8px; font-size:11px; color:var(--muted); border:1px solid var(--border); border-radius:999px; padding:1px 6px }
.capline .cap-suggest{ display:inline-flex; align-items:center; gap:4px }
.capline .cap-suggest-icon{ display:inline-flex; font-size:11px; line-height:1; opacity:.9 }
.capcode-link:hover .cap-suggest{ color:var(--primary); border-color:color-mix(in srgb, var(--primary) 35%, var(--border)) }

.capcode-wrap{ max-width:980px; margin:0 auto; padding:16px }
.capcode-head{ display:flex; flex-direction:column; gap:6px; margin-bottom:10px }
.back{ display:inline-flex; margin-bottom:8px; color:var(--muted); text-decoration:none }
.back:hover{ color:var(--text) }

/* detail page */
.detail-wrap{ max-width:980px; margin:0 auto; padding:16px }
.detail-wrap h1{ margin:8px 0 6px }
.detail-wrap .meta{ color:var(--muted); display:flex; align-items:center; gap:8px; flex-wrap:wrap }
.detail-wrap .view-count{ display:inline-flex; align-items:center; gap:6px; padding:2px 8px; border:1px solid var(--border); border-radius:999px; background:var(--panel-2); font-size:12px; color:var(--muted) }
.detail-wrap .view-count svg{ width:14px; height:14px; fill:currentColor; opacity:.8 }
.detail-wrap .capcodes{
  margin:14px 0 6px;
}
.detail-wrap .caplist-wrap{
  border:1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius:14px;
  background:
    radial-gradient(120% 180% at 100% 0%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 55%),
    var(--panel-2);
  padding:12px;
}
.detail-wrap .caplist{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.detail-wrap .caplist-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.detail-wrap .caplist-title{
  margin:0;
  font-size:14px;
  letter-spacing:.02em;
  text-transform:uppercase;
  color:var(--muted);
}
.detail-wrap .caplist-count{
  font-variant-numeric:tabular-nums;
  font-size:12px;
  font-weight:700;
  color:var(--text);
  border:1px solid color-mix(in srgb, var(--border) 92%, transparent);
  background:var(--panel);
  border-radius:999px;
  padding:3px 8px;
}
.detail-wrap .capline{
  display:block;
  min-width:0;
  overflow:hidden;
  border:1px solid color-mix(in srgb, var(--border) 92%, transparent);
  border-radius:10px;
  padding:8px 10px;
  background:linear-gradient(180deg, color-mix(in srgb, var(--panel) 78%, transparent), color-mix(in srgb, var(--panel-2) 86%, transparent));
  text-decoration:none;
  color:var(--text);
  font-size:23px;
  line-height:1.4;
  transition:border-color .15s ease, transform .15s ease, box-shadow .15s ease;
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
}
.detail-wrap .capline .capcode{
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
  font-size:inherit;
  font-weight:700;
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
  flex:0 0 auto;
}
.detail-wrap .capline .sep,
.detail-wrap .capline .dash,
.detail-wrap .capline .plaats{
  color:var(--muted);
  white-space:nowrap;
  flex:0 0 auto;
}
.detail-wrap .capline .functie{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--muted);
}
.detail-wrap .cap-suggest{
  margin-left:auto;
  display:inline-flex;
  align-items:center;
  gap:5px;
  border:1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius:999px;
  background:var(--panel);
  padding:2px 8px;
  font-size:11px;
  white-space:nowrap;
  color:var(--muted);
  flex:0 0 auto;
}
.detail-wrap .cap-suggest-icon{
  display:inline-flex;
  font-size:11px;
  line-height:1;
  opacity:.9;
}
.detail-wrap .capcode-link:hover .cap-suggest{
  color:var(--primary);
  border-color:color-mix(in srgb, var(--primary) 38%, var(--border));
}
.detail-wrap .capcode-link:hover{
  border-color:color-mix(in srgb, var(--primary) 40%, var(--border));
  color:var(--text);
  transform:translateY(-1px);
  box-shadow:0 6px 16px rgba(0,0,0,.18);
}
.detail-wrap .text{ margin:10px 0 8px; font-size:22px; line-height:1.45; font-weight:600 }
.detail-wrap .timer{ font-weight:600; color:var(--text); margin:6px 0 2px }
.detail-wrap .map{ border:1px solid var(--border); border-radius:12px; overflow:hidden }
.map-shell{ position:relative; border-radius:12px; overflow:hidden }
.map-shell .map-fill{ width:100%; height:100% }
.map-loading{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
  background:color-mix(in srgb, var(--panel) 84%, transparent);
  z-index:450;
  pointer-events:none;
}
.map-loading-spinner{
  width:30px;
  height:30px;
  border-radius:999px;
  border:3px solid color-mix(in srgb, var(--muted) 48%, transparent);
  border-top-color:var(--primary);
  animation:map-spin .85s linear infinite;
}
.map-loading-label{ color:var(--muted); font-size:12px; font-weight:600 }
@keyframes map-spin { to { transform: rotate(360deg); } }

/* detail header + tabs (used by incidentregistratie/postlog/etc.) */
.detail-card{ padding:1rem 1.1rem }
.detail-head{ display:flex; gap:1rem; align-items:flex-start; justify-content:space-between; flex-wrap:wrap }
.detail-actions{ display:flex; gap:.5rem; flex-wrap:wrap }
.detail-actions-secondary{ margin-top:.6rem }
.detail-sub{ display:flex; gap:.8rem; align-items:center; flex-wrap:wrap }
.tabs{ display:flex; gap:8px; flex-wrap:wrap }
.tab.is-active{ border-color:var(--accent); color:var(--text); }
.tab-panel{ padding:1rem 1.1rem }
.sep{ border:0; border-top:1px solid var(--border); margin:12px 0 }

/* incidentregistratie layout */
.postlog-layout{ display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap:12px }
.incident-list{ display:flex; flex-direction:column; gap:10px }
.incident-table-wrap{
  border:1px solid var(--border);
  border-radius:12px;
  overflow:auto;
  background:var(--panel);
  max-height:58vh;
}
.incident-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:13px;
}
.incident-table th,
.incident-table td{
  padding:9px 10px;
  text-align:left;
  border-bottom:1px solid var(--border);
  vertical-align:middle;
}
.incident-table-head th{
  position:sticky;
  top:0;
  z-index:2;
  background:var(--panel);
  color:var(--muted);
  font-weight:600;
}
.incident-table tbody tr:nth-child(even){ background:color-mix(in srgb, var(--panel-2) 75%, transparent) }
.incident-table tbody tr{ cursor:pointer; transition: background-color .12s ease }
.incident-table tbody tr:hover{ background:color-mix(in srgb, var(--panel-2) 92%, transparent) }
.incident-item.is-selected{ outline:2px solid rgba(58,160,255,.35); outline-offset:-2px }
.incident-pager{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:8px; flex-wrap:wrap }
.incident-cards{ display:flex; flex-direction:column; gap:10px }
.incident-card{
  padding:10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--panel);
}
.incident-card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.incident-card-no{
  font-size:13px;
  font-weight:700;
  color:var(--text);
}
.incident-card-meta{
  margin-top:8px;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.incident-card-meta span{
  display:inline-flex;
  align-items:center;
  min-height:24px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--panel-2);
  color:var(--muted);
  font-size:12px;
}
.incident-card-title{
  margin-top:8px;
  font-size:17px;
  line-height:1.3;
  font-weight:700;
  color:var(--text);
  overflow-wrap:anywhere;
}
.incident-card-place{
  margin-top:3px;
  font-size:14px;
  color:var(--muted);
  overflow-wrap:anywhere;
}
.incident-card-action{
  width:100%;
  margin-top:10px;
}
.status-pill{
  display:inline-flex; align-items:center; justify-content:center;
  border-radius:999px; padding:3px 8px; font-size:11px; font-weight:700;
  border:1px solid var(--border); background:var(--chip); color:var(--text);
}
.status-pill.done{ background:rgba(41,201,121,.15); border-color:rgba(41,201,121,.4) }
.status-pill.wip{ background:rgba(58,160,255,.14); border-color:rgba(58,160,255,.35) }
.status-pill.skip{ background:rgba(255,176,32,.14); border-color:rgba(255,176,32,.38) }
.status-pill.new{ background:var(--chip) }
.incident-detail{
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  min-height:120px;
  background:var(--panel);
}
.incident-form-root{ display:flex; flex-direction:column; gap:10px }
.incident-summary{ padding:12px }
.section-header{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px; flex-wrap:wrap }
.section-header h3,.section-header h4{ margin:0; font-size:15px }
.summary-badges{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px }
.auto-chip{ border-color:rgba(58,160,255,.4); color:var(--primary); background:rgba(58,160,255,.1) }
.incident-main-grid{ display:grid; grid-template-columns:1.35fr 1fr; gap:10px }
.incident-col{ display:flex; flex-direction:column; gap:10px; min-width:0 }
.form-card{ padding:10px 12px }
.field-grid{ display:grid; gap:10px }
.field-grid-1{ grid-template-columns:1fr }
.field-grid-2{ grid-template-columns:repeat(2, minmax(0,1fr)) }
.field-grid-3{ grid-template-columns:repeat(3, minmax(0,1fr)) }
.field-row{ display:flex; flex-direction:column; gap:4px; min-width:0 }
.helper{ color:var(--muted); font-size:12px; line-height:1.35 }
.error-text{ color:var(--danger); font-size:12px; min-height:16px }
.has-error{ border-color:var(--danger) !important; box-shadow:0 0 0 1px rgba(255,91,106,.28) inset }
.details-more{ border-top:1px solid var(--border); margin-top:8px; padding-top:8px }
.details-more > summary{ cursor:pointer; font-size:13px; color:var(--muted) }
.auto-field-input{
  background:color-mix(in srgb, var(--panel-2) 88%, transparent);
  border-style:dashed;
}
.auto-field-input.is-locked{ opacity:.96 }
.time-stack{ display:flex; flex-direction:column; gap:8px }
.time-grid{ display:grid; grid-template-columns:minmax(0,1fr) 120px; gap:6px }
.duration-box{
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--panel-2);
  padding:8px 10px;
  font-size:13px;
  display:grid;
  gap:4px;
}
.vehicle-check-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:6px; margin-bottom:8px }
.vehicle-check{
  display:flex; align-items:center; gap:8px;
  border:1px solid var(--border); border-radius:9px;
  padding:8px; background:var(--panel-2); cursor:pointer;
}
.vehicle-check:hover{ border-color:rgba(58,160,255,.35) }
.sticky-action-bar{
  position:sticky;
  bottom:0;
  z-index:4;
  border:1px solid var(--border);
  border-radius:12px;
  padding:9px 10px;
  background:color-mix(in srgb, var(--panel) 86%, transparent);
  backdrop-filter: blur(8px);
  display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap;
}
.action-bar-buttons{ display:flex; gap:8px; flex-wrap:wrap }
.btn.btn-danger{ border-color:rgba(255,91,106,.35); color:#ffdce1 }
.chip-x{ margin-left:6px; background:transparent; border:0; color:var(--muted); cursor:pointer }
.toast{
  position:fixed;
  right:14px;
  bottom:14px;
  z-index:1200;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--text);
  padding:8px 11px;
  box-shadow:0 10px 24px rgba(0,0,0,.2);
  opacity:0;
  transform:translateY(8px);
  pointer-events:none;
  transition:opacity .15s ease, transform .15s ease;
}
.toast.show{ opacity:1; transform:translateY(0) }
.toast.is-ok{ border-color:rgba(41,201,121,.35) }
.toast.is-error{ border-color:rgba(255,91,106,.35) }

/* postlog UI polish */
.detail-wide{ max-width: 1320px; }
.postlog-page .tabs{
  margin-top: 2px;
  gap: 10px;
}
.postlog-page .tabs .tab{
  min-height: 42px;
  padding-inline: 14px;
}
.postlog-quicknav .body{ padding:10px 12px; }
.postlog-quicknav-row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.postlog-quicknav-row .btn{
  min-height:40px;
}
.postlog-filter-grid{
  display:grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap:8px;
}
.postlog-filter-grid > *{
  min-height:42px;
}
.postlog-filter-grid > #filterProfile,
.postlog-filter-grid > #filterStatus,
.postlog-filter-grid > #filterPrio,
.postlog-filter-grid > #filterKanaal,
.postlog-filter-grid > #filterPlace,
.postlog-filter-grid > #filterType,
.postlog-filter-grid > #filterYear{
  grid-column: span 2;
}
.postlog-filter-grid > #filterFrom,
.postlog-filter-grid > #filterTo{
  grid-column: span 2;
}
.postlog-filter-grid > #filterQ{
  grid-column: span 4;
}
.postlog-filter-grid > #btnFilter,
.postlog-filter-grid > #btnExport{
  grid-column: span 2;
}
.postlog-import-row{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.postlog-import-row > *{
  min-height:42px;
}
.postlog-layout-improved .incident-detail{
  min-height: 220px;
}

/* dashboard stats */
.stats-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
  flex-wrap:wrap;
}
.stats-topbar h2{ margin:0; font-size:28px }
.stats-controls{
  display:grid;
  grid-template-columns: auto 1fr;
  gap:10px;
  align-items:center;
}
.period-switch{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.period-btn{
  min-width:78px;
}
.period-btn.is-active{
  background:color-mix(in srgb, var(--primary) 24%, var(--panel-2));
  border-color:color-mix(in srgb, var(--primary) 46%, var(--border));
}
.period-nav{
  display:flex;
  align-items:center;
  gap:8px;
  justify-content:flex-end;
  min-width:0;
}
.period-arrow{
  width:44px;
  font-size:18px;
  padding:0;
}
.period-arrow.is-disabled,
.period-arrow:disabled{
  opacity:.45;
  cursor:not-allowed;
}
.period-label{
  min-height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--panel-2);
  padding:8px 12px;
  font-weight:700;
  min-width:220px;
}
.stats-compare{
  grid-column:1 / -1;
  font-size:12px;
}
.stats-main{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:14px;
}
.stats-composition{
  display:flex;
  align-items:center;
  gap:16px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--panel-2);
  padding:14px;
  min-width:0;
}
.stats-donut{
  width:170px;
  height:170px;
  border-radius:999px;
  position:relative;
  flex:0 0 auto;
}
.stats-donut::after{
  content:'';
  position:absolute;
  inset:24px;
  border-radius:999px;
  background:var(--panel-2);
  border:1px solid var(--border);
}
.stats-donut-center{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:24px;
  z-index:2;
}
.stats-legend{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-width:0;
  flex:1;
}
.stats-legend-row{
  display:grid;
  grid-template-columns: 14px 1fr auto;
  gap:8px;
  align-items:center;
  min-width:0;
}
.stats-legend-dot{
  width:14px;
  height:14px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.24);
}
.stats-legend-label{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.stats-kpi-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:10px;
}
.kpi-card{
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--panel-2);
  padding:12px;
}
.kpi-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.kpi-head h4{
  margin:0;
  font-size:16px;
  line-height:1.25;
  display:flex;
  align-items:center;
  gap:6px;
}
.mini-help{
  width:20px;
  height:20px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--muted);
  font-size:11px;
  padding:0;
  cursor:help;
}
.kpi-main{
  margin-top:8px;
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  gap:4px;
}
.kpi-value{
  font-size:40px;
  font-weight:800;
  letter-spacing:.2px;
  line-height:1;
  color:#ff5266;
}
.kpi-unit{
  font-size:22px;
  font-weight:700;
  color:#ff5266;
}
.kpi-prev{
  width:100%;
  color:var(--muted);
  font-size:14px;
}
.kpi-help{
  margin-top:8px;
  font-size:12px;
  line-height:1.35;
}
.trend-badge{
  border-radius:999px;
  padding:3px 10px;
  font-size:13px;
  font-weight:700;
  border:1px solid var(--border);
  white-space:nowrap;
}
.trend-badge.is-up{
  background:rgba(255,91,106,.16);
  border-color:rgba(255,91,106,.42);
  color:#ff8a96;
}
.trend-badge.is-down{
  background:rgba(41,201,121,.16);
  border-color:rgba(41,201,121,.42);
  color:#5dd496;
}
.trend-badge.is-flat{
  color:var(--muted);
  background:var(--panel);
}
.stats-highlight-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:10px;
}
.highlight-card{
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
  background:var(--panel-2);
}
.highlight-val{
  margin-top:8px;
  font-size:18px;
  font-weight:700;
  line-height:1.3;
}
.stats-inline-help{
  margin-top:10px;
  font-size:12px;
  color:var(--muted);
}
.trend-bars{
  margin-top:10px;
  display:grid;
  grid-template-columns:repeat(7, minmax(0, 1fr));
  gap:8px;
  min-height:170px;
}
.trend-bar-col{
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  gap:6px;
  min-width:0;
}
.trend-bar-rail{
  height:110px;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--panel-2);
  display:flex;
  align-items:flex-end;
  padding:4px;
}
.trend-bar-fill{
  width:100%;
  border-radius:6px;
  background:linear-gradient(180deg, #f97316 0%, #ef4444 100%);
}
.trend-bar-count{
  font-size:12px;
  font-weight:700;
  text-align:center;
}
.trend-bar-label{
  font-size:11px;
  text-align:center;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.trend-narrative{
  margin-top:10px;
}
.signal-context{
  margin-top:6px;
}
.pressure-wrap{
  margin-top:10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--panel-2);
  padding:10px;
}
.pressure-head{
  display:flex;
  justify-content:space-between;
  gap:8px;
  flex-wrap:wrap;
}
.pressure-track{
  margin-top:8px;
  width:100%;
  height:14px;
  border-radius:999px;
  border:1px solid var(--border);
  background:color-mix(in srgb, var(--panel) 70%, transparent);
  overflow:hidden;
}
.pressure-fill{
  height:100%;
  width:8%;
  transition:width .25s ease;
}
.pressure-fill.is-low{
  background:linear-gradient(90deg, #16a34a, #22c55e);
}
.pressure-fill.is-mid{
  background:linear-gradient(90deg, #f59e0b, #f97316);
}
.pressure-fill.is-high{
  background:linear-gradient(90deg, #fb7185, #ef4444);
}
.reliability-block{
  margin-top:10px;
  border:1px solid var(--border);
  border-radius:10px;
  padding:10px;
  font-size:13px;
}
.reliability-block.is-ok{
  border-color:rgba(34,197,94,.45);
  background:rgba(34,197,94,.08);
}
.reliability-block.is-warn{
  border-color:rgba(245,158,11,.48);
  background:rgba(245,158,11,.09);
}
.reliability-block.is-bad{
  border-color:rgba(239,68,68,.5);
  background:rgba(239,68,68,.1);
}
.watchlist-form{
  margin-top:10px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.watchlist-form .input{
  flex:1 1 260px;
}
.watchlist-rows{
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.watchlist-row{
  display:flex;
  justify-content:space-between;
  gap:8px;
  align-items:flex-start;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--panel-2);
  padding:9px 10px;
}
.btn.btn-small{
  min-height:36px;
  padding:6px 10px;
}
@media (max-width: 1280px){
  .stats-main{
    grid-template-columns: 1fr;
  }
  .stats-kpi-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px){
  .stats-controls{
    grid-template-columns: 1fr;
  }
  .period-nav{
    justify-content:flex-start;
  }
  .period-label{
    min-width:0;
    flex:1;
  }
  .stats-composition{
    flex-direction:column;
    align-items:flex-start;
  }
  .stats-donut{
    width:150px;
    height:150px;
  }
  .stats-kpi-grid{
    grid-template-columns: 1fr;
  }
  .kpi-value{
    font-size:34px;
  }
  .stats-highlight-grid{
    grid-template-columns: 1fr;
  }
  .trend-bars{
    grid-template-columns:repeat(4, minmax(0, 1fr));
  }
  .watchlist-row{
    flex-direction:column;
  }
}
.postlog-layout-improved{
  grid-template-columns:minmax(0, 1.7fr) minmax(360px, 1fr);
}
.postlog-layout-improved:not(.has-selection){
  grid-template-columns:1fr;
}
.postlog-layout-improved:not(.has-selection) > :nth-child(2){
  display:none;
}
.postlog-page .input,
.postlog-page .btn,
.postlog-page select.btn{
  min-height: 42px;
}
.postlog-page .form-label{
  font-size:13px;
  color:var(--muted);
}
.postlog-page .helper{
  font-size:12px;
  line-height:1.4;
}
.postlog-page .section-header h3,
.postlog-page .section-header h4{
  font-size:22px;
  line-height:1.15;
  letter-spacing:.2px;
}
.postlog-page .summary-badges .chip{
  max-width:100%;
}
.postlog-page .summary-badges .chip-text{
  display:inline-block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.report-section{
  margin-top:10px;
  padding:12px;
}
.report-section-head{
  font-size:16px;
  font-weight:700;
  margin-bottom:8px;
}
.report-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(190px, 1fr));
  gap:8px;
  margin-top:8px;
}
.report-metric{
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--panel-2);
  padding:10px;
}
.report-metric-label{
  color:var(--muted);
  font-size:12px;
  margin-bottom:4px;
}
.report-metric-value{
  color:var(--text);
  font-size:18px;
  font-weight:700;
  line-height:1.2;
}
.report-metric-value span{
  font-size:13px;
  font-weight:600;
  color:var(--muted);
}
.report-table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}
.report-table th,
.report-table td{
  text-align:left;
  padding:7px 8px;
  border-top:1px solid var(--border);
}
.report-table th:last-child,
.report-table td:last-child{
  text-align:right;
}

@media (min-width: 981px) and (max-width: 1450px){
  .incident-table{
    font-size:14px;
  }
  .incident-table th,
  .incident-table td{
    padding:10px 11px;
  }
  .incident-table th:nth-child(4),
  .incident-table td:nth-child(4),
  .incident-table th:nth-child(5),
  .incident-table td:nth-child(5){
    display:none;
  }
}

@media (max-width: 980px){
  .sticky-action-bar{
    bottom:calc(var(--mobile-tabbar-h, 0px) + 10px);
    padding-bottom:calc(9px + env(safe-area-inset-bottom));
  }
  body.has-adsense-bottom-bar .sticky-action-bar{
    bottom:calc(var(--mobile-tabbar-h, 0px) + 56px);
  }
  body.sidebar-open .sticky-action-bar{
    bottom:calc(var(--mobile-tabbar-h, 0px) + 10px);
  }
  .postlog-layout{ grid-template-columns:1fr }
  .incident-main-grid{ grid-template-columns:1fr }
  .field-grid-2, .field-grid-3{ grid-template-columns:1fr }
  .postlog-filter-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .postlog-filter-grid > *{
    grid-column: span 2 !important;
  }
  .postlog-layout-improved .incident-detail{
    min-height: 140px;
  }
  .postlog-page .tab-panel{
    padding:12px;
  }
  .postlog-page .section-header h3,
  .postlog-page .section-header h4{
    font-size:20px;
    line-height:1.2;
  }
  .postlog-page .input,
  .postlog-page .btn,
  .postlog-page select.btn{
    font-size:16px;
  }
  .postlog-page .helper{
    font-size:14px;
  }
  .postlog-page .form-label{
    font-size:14px;
  }
  .postlog-page .sticky-action-bar{
    position:sticky;
    bottom:calc(var(--mobile-tabbar-h, 0px) + 8px);
    padding-bottom:calc(9px + env(safe-area-inset-bottom));
  }
  body.has-adsense-bottom-bar .postlog-page .sticky-action-bar{
    bottom:calc(var(--mobile-tabbar-h, 0px) + 54px);
  }
  body.sidebar-open .postlog-page .sticky-action-bar{
    bottom:calc(var(--mobile-tabbar-h, 0px) + 8px);
  }
}

@media (max-width: 760px){
  .incident-table-wrap{
    display:none;
  }
  .postlog-page .tabs{
    display:grid;
    grid-template-columns:1fr;
    gap:8px;
  }
  .postlog-page .tabs .tab{
    width:100%;
  }
  .postlog-page .incident-summary{
    padding:10px;
  }
  .postlog-page .summary-badges{
    gap:6px;
  }
  .postlog-page .summary-badges .chip{
    font-size:14px;
    padding:8px 10px;
  }
  .postlog-page .section-header h3,
  .postlog-page .section-header h4{
    font-size:18px;
    line-height:1.2;
  }
  .postlog-page .helper{
    font-size:14px;
    line-height:1.35;
  }
  .postlog-page .form-label{
    font-size:15px;
  }
  .postlog-page .sticky-action-bar{
    gap:10px;
  }
  .postlog-page .sticky-action-bar .muted{
    width:100%;
  }
  .postlog-page .action-bar-buttons{
    width:100%;
  }
  .postlog-page .action-bar-buttons .btn{
    flex:1 1 calc(50% - 6px);
  }
  .postlog-page .action-bar-buttons .btn.btn-danger{
    flex-basis:100%;
  }
}

@media(max-width:700px){
  .detail-head{ flex-direction:column; align-items:flex-start }
}

/* Search list items (used by incidentregistratie/postlog) */
.search-results{ margin-top:6px }
.search-item{ padding:8px 10px; border:1px solid var(--border); border-radius:8px; margin-top:6px; cursor:pointer; background:var(--panel-2); display:flex; gap:10px; align-items:flex-start }
.search-item input{ margin-top:2px }
.search-item:hover{ border-color:var(--accent) }

/* scrollbars */
*::-webkit-scrollbar{ height:12px; width:12px }
*::-webkit-scrollbar-thumb{
  background: #2a3440; border-radius:10px; border:3px solid transparent; background-clip:content-box;
}
@media (prefers-color-scheme: light){
  *::-webkit-scrollbar-thumb{ background:#cfd7e1; border-color:#fff }
}

/* toolbar rechts */
.toolbar-right{
  display:flex;
  gap:var(--gap-1);
  flex-wrap:wrap;
  justify-content:flex-end;
}

@media (max-width:1100px){
  .sidebar [data-sidebar-group="menu"] .row{
    grid-template-columns:1fr;
  }
}

/* map hoogtes */
#map, #dbMap, #fullmap{ min-height:320px }
#fullmap{
  height: calc(100vh - 160px);
  border-radius: 12px;
  border: 1px solid var(--border);
}
@media (min-width:960px){ #dbMap{ min-height:420px } }

/* small screens */
@media (max-width:480px){
  .detail-wrap .actions{ display:flex; flex-direction:column; gap:8px }
  .detail-wrap .caplist-wrap{ padding:10px }
  .detail-wrap .capline{
    font-size:16px;
    padding:8px 9px;
  }
  .detail-wrap .capline .functie{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .chip{ padding:4px 8px }
  .app{ padding-top:52px }
  .toolbar{ flex-direction:column; align-items:stretch }
  .toolbar .btn{ width:100% }
  .statusbar{ flex-direction:column; align-items:stretch; gap:8px }
  .toolbar-right{ width:100% }
  .toolbar-right .btn{ flex:1 }
  .msghead{ flex-direction:column; align-items:flex-start; gap:6px }
  .time{ align-self:flex-start }
  .card .body{ padding:12px }
  .subline{ flex-wrap:wrap }
}

.map-layout{
  display:grid;
  grid-template-columns: minmax(0,1fr) 320px;
  gap:16px;
  margin-top:12px;
}
.map-main{ min-width:0 }
.map-side{ min-width:0 }
.map-side .panel{ padding:14px 16px }

.legend{ display:flex; flex-direction:column; gap:8px; margin-top:8px }
.legend-row{ display:flex; align-items:center; gap:8px; color:var(--text) }
.legend-dot{
  width:12px; height:12px; border-radius:50%; display:inline-block;
  border:2px solid rgba(255,255,255,0.7);
}
.legend-dot.brand{ background:#ef4444 }
.legend-dot.reanim{ background:#f97316 }
.legend-dot.ongeval{ background:#eab308 }
.legend-dot.politie{ background:#3b82f6 }
.legend-dot.overige{ background:#22c55e }

.cluster-list{ display:flex; flex-direction:column; gap:8px; margin-top:8px }
.cluster-item{
  padding:10px 12px; border:1px solid var(--border); border-radius:10px;
  background:var(--panel-2); cursor:pointer; transition:transform .12s ease, border-color .12s ease;
}
.cluster-item:hover{ transform:translateY(-1px); border-color:var(--accent) }
.cluster-title{ font-weight:700; font-size:14px }
.cluster-sub{ color:var(--muted); font-size:12px; margin-top:2px }

@media (max-width: 1100px){
  .map-layout{ grid-template-columns:1fr }
  #fullmap{ height: 60vh; }
}

/* Leaflet popup theming */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip{
  background: #0f172a !important;
  color: #e5e7eb !important;
  border: 1px solid #1f2937 !important;
  box-shadow: 0 10px 24px rgba(0,0,0,.45) !important;
}
.leaflet-popup-content{
  margin: 12px 14px;
  color: #e5e7eb !important;
}
.leaflet-popup-content a{
  color: #e5e7eb !important;
}
.leaflet-container a.leaflet-popup-close-button{
  color: #94a3b8 !important;
}
.leaflet-container a.leaflet-popup-close-button:hover{
  color: #e5e7eb !important;
}

.map-popup .pop-title{ font-weight:700; color:var(--text); }
.map-popup .pop-meta{ color:var(--muted); font-size:12px; margin-top:2px; }
.map-popup .pop-text{ margin:6px 0; white-space:pre-wrap; color:var(--text); }
.map-popup .pop-caps{ font-family:ui-monospace; font-size:12px; line-height:1.25; color:var(--text); }
.map-popup .pop-actions{ margin-top:8px; }
.map-popup .pop-coords{ margin-top:6px; font-size:12px; color:var(--muted); }

.leaflet-popup-content-wrapper .map-popup,
.leaflet-popup-content-wrapper .map-popup *{
  color:#e5e7eb !important;
}
.leaflet-popup-content-wrapper .map-popup .pop-meta,
.leaflet-popup-content-wrapper .map-popup .pop-coords{
  color:#9ca3af !important;
}

/* Chips tikbaar fix (iPhone) */
label.chip {
  position: relative;
}
label.chip input.chip-input{
  position:absolute;
  inset:0;
  opacity:0;
  pointer-events:auto;
  cursor:pointer;
}
.chip-text{ pointer-events:none }

/* sortable headers */
th[data-sort]{ cursor:pointer; user-select:none; }
th.sort-asc::after{ content:' ↑'; color:var(--muted); }
th.sort-desc::after{ content:' ↓'; color:var(--muted); }

/* dashboard stats page polish */
body.stats-page .content{
  max-width: 1320px;
}
body.stats-page .stats-topbar{
  margin-bottom: 12px;
}
body.stats-page .stats-topbar h2{
  font-size: 32px;
  line-height: 1.05;
}
body.stats-page .stats-controls{
  grid-template-columns: auto minmax(320px, 1fr);
  gap: 14px;
}
body.stats-page .period-nav{
  justify-content: flex-start;
}
body.stats-page .period-label{
  min-width: 280px;
  font-size: 18px;
  font-weight: 700;
}
body.stats-page .stats-main{
  grid-template-columns: minmax(320px, 360px) 1fr;
  align-items: stretch;
}
body.stats-page .stats-composition{
  min-height: 100%;
}
body.stats-page .stats-donut{
  width: 190px;
  height: 190px;
}
body.stats-page .stats-donut::after{
  inset: 30px;
}
body.stats-page .stats-donut-center{
  font-size: 28px;
}
body.stats-page .stats-kpi-grid{
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
}
body.stats-page .kpi-card{
  min-height: 168px;
}
body.stats-page .kpi-value{
  font-size: 38px;
}
body.stats-page .stats-highlight-grid{
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1160px){
  body.stats-page .stats-main{
    grid-template-columns: 1fr;
  }
  body.stats-page .stats-kpi-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px){
  body.stats-page .stats-topbar h2{
    font-size: 26px;
  }
  body.stats-page .stats-controls{
    grid-template-columns: 1fr;
  }
  body.stats-page .period-nav{
    width: 100%;
    flex-wrap: wrap;
  }
  body.stats-page .period-label{
    min-width: 0;
    flex: 1 1 220px;
  }
  body.stats-page .stats-kpi-grid{
    grid-template-columns: 1fr;
  }
  body.stats-page .kpi-card{
    min-height: 0;
  }
  body.stats-page .stats-highlight-grid{
    grid-template-columns: 1fr;
  }
}

/* Hard layout guards for dashboard blocks */
body.stats-page .stats-controls{
  display:grid !important;
  grid-template-columns:auto minmax(320px, 1fr) !important;
  gap:14px !important;
  align-items:center !important;
}
body.stats-page .period-nav{
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  flex-wrap:nowrap !important;
}
body.stats-page .period-label{
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
}
body.stats-page .stats-main{
  display:grid !important;
  grid-template-columns:minmax(320px, 360px) 1fr !important;
  gap:14px !important;
}
body.stats-page .stats-composition{
  display:flex !important;
  align-items:center !important;
  gap:16px !important;
}
body.stats-page #disciplineDonut{
  width:190px !important;
  height:190px !important;
  min-width:190px !important;
  border-radius:999px !important;
}
body.stats-page #kpiGrid{
  display:grid !important;
  grid-template-columns:repeat(3, minmax(0, 1fr)) !important;
  gap:12px !important;
}
body.stats-page #kpiGrid .kpi-card{
  display:block !important;
  border:1px solid var(--border) !important;
  border-radius:12px !important;
  background:var(--panel-2) !important;
  padding:12px !important;
  min-height:168px !important;
}

@media (max-width: 1160px){
  body.stats-page .stats-main{
    grid-template-columns:1fr !important;
  }
  body.stats-page #kpiGrid{
    grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 760px){
  body.stats-page .stats-controls{
    grid-template-columns:1fr !important;
  }
  body.stats-page .period-nav{
    width:100%;
    flex-wrap:wrap !important;
  }
  body.stats-page #kpiGrid{
    grid-template-columns:1fr !important;
  }
}
