:root {
  --bg: #ffffff; --fg: #0b1f3a; --muted: #5b6b82; --line: #d9e1ec; --card: #f4f7fb;
  --accent: #1f4e8c; --accent-fg: #ffffff; --danger: #b3261e;
  --c-police: #1f4e8c; --c-traffic: #c77700; --c-accident: #b3261e; --c-other: #5b6b82;
  --shadow: 0 6px 24px rgba(11,31,58,.18);
  --bar-h: 52px;
}
:root[data-theme="dark"] {
  --bg: #0b1f3a; --fg: #eaf1fb; --muted: #9db0c9; --line: #213a5e; --card: #12294a;
  --accent: #5aa2ff; --accent-fg: #06142a; --danger: #ff8a80;
  --c-police: #5aa2ff; --c-traffic: #f0a63a; --c-accident: #ff6b61; --c-other: #9db0c9;
  --shadow: 0 6px 24px rgba(0,0,0,.5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1f3a; --fg: #eaf1fb; --muted: #9db0c9; --line: #213a5e; --card: #12294a;
    --accent: #5aa2ff; --accent-fg: #06142a; --danger: #ff8a80;
    --c-police: #5aa2ff; --c-traffic: #f0a63a; --c-accident: #ff6b61; --c-other: #9db0c9;
    --shadow: 0 6px 24px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--fg); background: var(--bg); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }

.bar { position: fixed; z-index: 1000; top: 0; left: 0; right: 0; height: calc(var(--bar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; justify-content: space-between; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; }
nav { display: flex; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 14px; text-decoration: none; color: var(--fg); }

#map { position: fixed; inset: calc(var(--bar-h) + env(safe-area-inset-top)) 0 0 0; background: var(--card); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(200deg) brightness(.85) contrast(.9) saturate(.7); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(200deg) brightness(.85) contrast(.9) saturate(.7); } }
.leaflet-container { font: inherit; background: var(--card); }
.leaflet-control-attribution { font-size: 10px; }

.fab { position: fixed; z-index: 900; right: 14px; bottom: calc(96px + env(safe-area-inset-bottom)); width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg); color: var(--accent); box-shadow: var(--shadow); display: grid; place-items: center; }
.report { position: fixed; z-index: 900; left: 50%; transform: translateX(-50%); bottom: calc(22px + env(safe-area-inset-bottom));
  min-width: min(86vw, 360px); padding: 18px 28px; border: 0; border-radius: 999px; font-size: 20px; font-weight: 700;
  background: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow); }
.report:active { transform: translateX(-50%) scale(.98); }

.sheet { position: fixed; z-index: 1100; left: 0; right: 0; bottom: 0; max-height: 80vh; overflow: auto; background: var(--bg); color: var(--fg);
  border-top-left-radius: 20px; border-top-right-radius: 20px; padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: var(--shadow);
  border-top: 1px solid var(--line); max-width: 640px; margin: 0 auto; }
.sheet[hidden], #toast[hidden] { display: none; }
.grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 10px; }
.sheet h2 { margin: 4px 0; font-size: 20px; }
.sheet h3 { margin: 16px 0 6px; font-size: 15px; color: var(--muted); }
.row { display: flex; align-items: center; } .between { justify-content: space-between; } .gap { gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.type { padding: 20px 8px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); font-size: 18px; font-weight: 600; }
.type::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; background: var(--c); }
.police { --c: var(--c-police); } .traffic { --c: var(--c-traffic); } .accident { --c: var(--c-accident); } .other { --c: var(--c-other); }
.type:hover, .type:focus-visible { border-color: var(--c); }
.primary, .secondary, .ghost { border-radius: 12px; padding: 10px 14px; border: 1px solid var(--accent); font-weight: 600; }
.primary { background: var(--accent); color: var(--accent-fg); }
.secondary { background: transparent; color: var(--accent); }
.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.ghost.danger { color: var(--danger); }
.x { border: 0; background: transparent; font-size: 20px; padding: 4px 8px; color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.comments { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.comments li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; display: flex; gap: 8px; justify-content: space-between; align-items: flex-start; }
.comments .txt { overflow-wrap: anywhere; } .comments .when { color: var(--muted); font-size: 12px; display: block; }
.comments button { border: 0; background: transparent; color: var(--muted); font-size: 12px; text-decoration: underline; padding: 2px; }
textarea { width: 100%; resize: none; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--fg); padding: 10px; font: inherit; margin-bottom: 6px; }

#toast { position: fixed; z-index: 1200; left: 50%; transform: translateX(-50%); top: calc(var(--bar-h) + 14px + env(safe-area-inset-top)); max-width: 90vw;
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; }

.pin { width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.pin-wrap { background: none; border: 0; }
.pin-wrap.police { --c: var(--c-police); } .pin-wrap.traffic { --c: var(--c-traffic); } .pin-wrap.accident { --c: var(--c-accident); } .pin-wrap.other { --c: var(--c-other); }
.me { width: 16px; height: 16px; border-radius: 50%; background: #2f80ff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47,128,255,.25); }

/* privacy page */
.page { max-width: 680px; margin: 0 auto; padding: 24px 16px 60px; overflow: auto; height: 100%; }
body.doc { overflow: auto; }
.page h1 { font-size: 26px; } .page h2 { font-size: 18px; margin-top: 26px; } .page a { color: var(--accent); }

.en { display: none; } html[lang=en] .en { display: block; } html[lang=en] .sv { display: none; }
html[lang=en] .en.inl { display: inline; } .en.inl { display: none; }

/* tap-to-report: temporary pin + compact panel */
.pick { position: fixed; z-index: 1100; left: 8px; right: 8px; bottom: calc(10px + env(safe-area-inset-bottom)); max-width: 440px; margin: 0 auto;
  background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 18px; padding: 10px 12px 8px; box-shadow: var(--shadow); }
.pick[hidden] { display: none; }
.pick h2 { margin: 0; font-size: 18px; }
.ptypes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 4px; }
.ptype { padding: 12px 2px; min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-size: 15px; font-weight: 600; }
.ptype::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; background: var(--c); }
.ptype:hover, .ptype:focus-visible { border-color: var(--c); }
.pick .ghost { padding: 6px 12px; }
.pick p { margin: 4px 0 0; }
body.picking .report { display: none; }
body.picking .fab { bottom: calc(150px + env(safe-area-inset-bottom)); }
.pin-wrap.pending { --c: var(--accent); cursor: grab; }
.pin-wrap.pending .pin { animation: drop .18s ease-out; outline: 2px dashed var(--c); outline-offset: 4px; border-radius: 50% 50% 50% 0; }
@keyframes drop { from { transform: translateY(-14px) rotate(-45deg); } to { transform: rotate(-45deg); } }
@media (prefers-reduced-motion: reduce) { .pin-wrap.pending .pin { animation: none; } }
