/* Fältappen 2.0. Dagtema från designkonceptet: stark kontrast, stora knappar (minst 44 px, oftast 52–56 px), 17 px text. */
:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --surface: #F2F2EE;
  --surface2: #E4E4DD;
  --line: #C9C9C0;
  --fg: #111111;
  --muted: #4D4D47;
  --accent: #FFD400;
  --on-accent: #111111;
  --ink: #111111;
  --on-ink: #FFFFFF;
  --info: #1F5BD8;
  --warn: #A84300;
  --warn-bg: #FFF0DD;
  --bad: #B3261E;
  --bad-bg: #FDE7E5;
  --ok: #1E7B34;
  --scrim: rgba(17, 17, 17, .42);
  --shadow: 0 2px 10px rgba(0, 0, 0, .18);
  --nav: 92px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg);
  font: 17px/1.35 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a, label, summary, input, select, textarea { touch-action: manipulation; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
.ikon { display: block; flex: none; }
.kursiv, i { font-style: italic; }
.note { color: var(--muted); font-size: 15px; }
p.note { margin: 6px 0; }
.note.varn { color: var(--warn); font-weight: 700; }
.dold { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rubrik { margin: 22px 0 10px; font-size: 15px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rubrik:first-child { margin-top: 4px; }
.rubrik label { font: inherit; letter-spacing: inherit; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }

/* ---------- Knappar ---------- */
.knapp { min-height: 52px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 16px;
  border-radius: 14px; border: 1px solid var(--fg); background: var(--bg); color: var(--fg); font-weight: 800; font-size: 17px;
  text-align: center; text-decoration: none; line-height: 1.2; }
.knapp:disabled { opacity: .5; }
.knapp:active { background: var(--surface2); }
.knapp.accent { background: var(--accent); color: var(--on-accent); border: 2px solid var(--ink); }
.knapp.accent:active { background: #E6BF00; }
.knapp.svart { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.knapp.fara { color: var(--bad); border-color: var(--bad); }
.knapp.liten { min-height: 44px; padding: 4px 14px; border-radius: 22px; font-size: 16px; }
.knapp.bred, .knapp.hel { width: 100%; }
.knapp.mork { background: rgba(0, 0, 0, .55); color: #fff; border-color: rgba(255, 255, 255, .6); }
.knapp.vanster { justify-content: flex-start; text-align: left; padding: 10px 14px; }
.knapp.vanster > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.knapp.vanster small { font-weight: 400; font-size: 15px; color: var(--muted); }
.knapp.accent.vanster small { color: #3A3A30; }
.knapp.tillbaka { border: 0; background: transparent; padding-left: 4px; gap: 2px; }
.knapprad { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.knapprad .knapp { flex: 1 1 auto; }
.knappkolumn { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.ikonknapp { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.ikonknapp.stor { width: 56px; height: 56px; border-radius: 12px; }

/* Chips och val */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.rull { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
.chips.rull::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 48px; display: inline-flex; align-items: center; gap: 6px; padding: 0 16px; border-radius: 24px;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg); font-weight: 700; font-size: 17px; white-space: nowrap; }
.chips.rull .chip { min-height: 44px; font-size: 16px; font-weight: 800; padding: 0 14px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.seg3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.seg3 .chip { justify-content: center; border-radius: 12px; padding: 0 4px; font-size: 16px; font-weight: 800; white-space: normal; text-align: center; line-height: 1.1; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.val { display: flex; gap: 12px; align-items: center; padding: 12px 2px; border-top: 1px solid var(--line); font-weight: 700; margin: 0; }
.val input { width: 28px; height: 28px; flex: none; accent-color: #111; margin: 0; }
.val small { display: block; font-weight: 400; color: var(--muted); font-size: 15px; }
.val.av { opacity: .5; }
.vaxel { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 2px; border: 0;
  border-top: 1px solid var(--line); background: transparent; text-align: left; }
.vaxel > span:first-child { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.vaxel-spar { flex: none; position: relative; width: 56px; height: 34px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface2); }
.vaxel-spar span { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); transition: left .15s; }
.vaxel[aria-checked="true"] .vaxel-spar { background: var(--ink); border-color: var(--ink); }
.vaxel[aria-checked="true"] .vaxel-spar span { left: 25px; }

/* Fält */
.falt { width: 100%; min-height: 52px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  font-size: 17px; line-height: 1.4; -webkit-appearance: none; appearance: none; }
textarea.falt { resize: vertical; }
.falt:focus { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--fg); background: var(--bg); }
.falt-etikett { display: block; margin: 16px 0 6px; font-weight: 800; }
.sokfalt { position: relative; display: block; }
.sokfalt .ikon { position: absolute; left: 14px; top: 15px; color: var(--muted); pointer-events: none; }
.sokfalt input { width: 100%; height: 52px; padding: 0 14px 0 46px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); font-size: 17px; -webkit-appearance: none; appearance: none; }
.sokfalt input:focus { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--fg); background: var(--bg); }

/* Märken */
.marken { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.marke { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 6px; background: var(--surface2);
  font-size: 14px; font-weight: 800; font-style: normal; color: var(--muted); white-space: nowrap; }
.marke.bestam, .marke.varn { background: var(--warn-bg); color: var(--warn); }
.marke.ok { background: transparent; padding: 0; font-weight: 600; }
.rl { display: inline-block; min-width: 2.3em; padding: 1px 6px; border-radius: 6px; font: 800 14px/1.35 -apple-system, system-ui, sans-serif;
  text-align: center; border: 1px solid rgba(0, 0, 0, .4); vertical-align: 2px; font-style: normal; white-space: nowrap; }
.rl-RE { background: #000; color: #fff; } .rl-CR { background: #D81E05; color: #fff; } .rl-EN { background: #FC7F3F; color: #111; }
.rl-VU { background: #F9E814; color: #111; } .rl-NT { background: #CCE226; color: #111; } .rl-DD { background: #D1D1C6; color: #111; }
.acc { font-weight: 800; }
.acc.ok { color: var(--info); } .acc.warn { color: var(--warn); } .acc.bad { color: var(--bad); }
.box { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 12px 0; background: var(--bg); }
.box h3 { margin: 0 0 6px; font-size: 18px; }
.box p { margin: 6px 0; }
.box.slu { border: 2px solid var(--accent); }
.tomt { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px; text-align: center; }
.tomt p { margin: 0; }

/* ---------- Kartan ---------- */
#karta { position: fixed; inset: 0; z-index: 0; background: #E8E8E0; }
.leaflet-container { font: inherit; }
.leaflet-bottom { bottom: calc(var(--safe-b) + 162px); }
body.flyttar .leaflet-bottom { bottom: calc(var(--safe-b) + 150px); }
/* Källorna på en rad bredvid skalan, så att de inte täcker etiketten. Ett tryck visar alla. */
.leaflet-control-attribution { max-width: calc(100vw - 140px); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.leaflet-control-attribution.hel { max-width: calc(100vw - 24px); white-space: normal; }
/* Bakgrundskartan och lagren ovanpå, ovanför skalan. Tryck öppnar Kartlager. */
.leaflet-bottom .leaflet-control.karta-etikett { display: block; max-width: calc(100vw - 24px); min-height: 38px; margin: 0 0 6px 12px; padding: 8px 14px;
  border-radius: 19px; border: 1px solid var(--line); background: rgba(255, 255, 255, .94); color: var(--fg); font-size: 15px; line-height: 1.3;
  text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--shadow); cursor: pointer; }
.karta-etikett b { font-weight: 800; }
.karta-etikett span { color: var(--muted); }
body.flyttar .karta-etikett { display: none !important; }
.leaflet-popup-content { font-size: 16px; margin: 12px 14px; }
.leaflet-popup-content b { font-size: 18px; }
.pinfo { max-height: 40vh; overflow-y: auto; font-size: 15px; }
.pin-yta { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.pin { width: 20px; height: 20px; border-radius: 50%; background: var(--ink); border: 3px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  display: flex; align-items: center; justify-content: center; font: 800 12px/1 -apple-system, system-ui, sans-serif; color: var(--ink); }
.pin.bestam { width: 22px; height: 22px; background: #fff; border-color: var(--ink); }
.pin.bestam::after { content: "?"; }
.pin.vald { width: 28px; height: 28px; box-shadow: 0 0 0 4px var(--accent), 0 0 0 6px var(--ink); }
#kors { position: fixed; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; pointer-events: none; z-index: 350; }
#kors::before, #kors::after { content: ""; position: absolute; background: var(--ink); box-shadow: 0 0 0 2px #fff; }
#kors::before { left: 21px; top: 0; width: 2px; height: 44px; }
#kors::after { top: 21px; left: 0; height: 2px; width: 44px; }

#kartaTopp { position: fixed; top: calc(var(--safe-t) + 12px); left: 12px; right: 12px; z-index: 300; display: flex; flex-direction: column;
  gap: 8px; align-items: flex-start; pointer-events: none; }
#kartaTopp > *, .topprad > * { pointer-events: auto; }
.topprad { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 100%; pointer-events: none; }
.sokknapp { width: 100%; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--bg); color: var(--muted); font-size: 17px; text-align: left; box-shadow: var(--shadow); }
.sokknapp .ikon { color: var(--fg); }
.sokknapp span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-gps { height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line);
  background: var(--bg); color: var(--muted); font-size: 16px; font-weight: 800; box-shadow: var(--shadow); white-space: nowrap; }
.chip-gps .punkt { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.chip-gps.ok { color: var(--info); } .chip-gps.warn { color: var(--warn); } .chip-gps.bad { color: var(--bad); }
.obs-chip { display: flex; align-items: center; gap: 6px; max-width: 100%; min-height: 44px; padding: 0 0 0 14px; border-radius: 22px;
  border: 1px solid #6A1B9A; background: #F6EDFB; font-size: 15px; font-weight: 700; box-shadow: var(--shadow); }
.obs-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obs-chip .ikonknapp { border: 0; background: transparent; }
.hs-chip { border-color: #AD1457; background: #FCE4EC; }
.hs-chip-text { flex: 1; min-width: 0; min-height: 44px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-nr { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; border: 2px solid #fff; background: #AD1457; color: #fff;
  font-size: 16px; font-weight: 800; box-shadow: var(--shadow); }
.traff-ikon.hs-nr { flex: none; color: #fff; }
.leaflet-image-layer.hs-yta { image-rendering: pixelated; }
.hs-lista { margin: 8px 0; }
.hs-lista summary { min-height: 44px; display: flex; align-items: center; font-weight: 800; cursor: pointer; }
#banners { display: flex; flex-direction: column; gap: 8px; width: 100%; }
#banners:empty { display: none; }
.banner { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 14px; border-radius: 16px; background: var(--ink); color: var(--on-ink);
  font-size: 15px; box-shadow: var(--shadow); }
.banner > span { flex: 1; min-width: 0; }
.banner .knapp { background: var(--accent); color: var(--on-accent); border: 0; flex: none; }
.banner .ikonknapp { background: transparent; border: 0; color: var(--on-ink); }
.banner.fel { background: var(--bad); }
#kartaKnappar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-b) + var(--nav) + 12px); z-index: 300;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; pointer-events: none; }
#kartaKnappar > * { pointer-events: auto; }
.pill { height: 52px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 8px; border-radius: 26px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); font-size: 17px; font-weight: 800; box-shadow: var(--shadow); white-space: nowrap; }
.pill.pa { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.kartaval { position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-b) + var(--nav) + 12px); z-index: 310; display: flex; flex-direction: column;
  gap: 12px; padding: 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--bg); box-shadow: var(--shadow); }
.val-rad { display: flex; align-items: flex-start; gap: 12px; }
.val-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.val-text b { font-size: 19px; line-height: 1.2; }
.val-text i, .val-text span { font-size: 15px; color: var(--muted); }
.flyttarad { position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-b) + 16px); z-index: 600; padding: 14px; border-radius: 18px;
  border: 2px solid var(--ink); background: var(--bg); box-shadow: var(--shadow); }
.flyttarad p { margin: 0 0 4px; font-weight: 800; }
body.flyttar #kartaTopp, body.flyttar #kartaKnappar, body.flyttar #kartaVal, body.flyttar #nav, body.flyttar .plats,
body.flyttar .panel, body.flyttar .hylla, body.flyttar #toaster { display: none !important; }
body.flyttar .leaflet-marker-icon { pointer-events: none; }

/* Områden: namnet på kartan öppnar området. Under ritningen går bara hörnen att trycka på, resten av kartan tar emot nya hörn. */
.omr-etikett span { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); padding: 3px 10px; border-radius: 12px;
  border: 2px solid #6A1B9A; background: rgba(255, 255, 255, .92); color: #4A148C; font-size: 14px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.omr-etikett span::after { content: ""; position: absolute; inset: -8px; }
.horn div { width: 22px; height: 22px; margin: 11px; border-radius: 50%; border: 4px solid #6A1B9A; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.horn.forsta div { background: #6A1B9A; }
body.ritar .leaflet-interactive:not(.horn) { pointer-events: none !important; }
body.ritar .leaflet-marker-icon.horn { pointer-events: auto; }
body.ritar .leaflet-bottom { bottom: calc(var(--safe-b) + var(--rit-h, 210px) + 24px); }
.rit-info b { display: block; font-size: 18px; line-height: 1.25; }
.rit-info span { display: block; margin-top: 2px; color: var(--muted); font-size: 15px; }
.rit-info i { font-style: normal; font-weight: 700; color: var(--fg); }
.flyttarad .knapprad { margin: 10px 0 0; }
.flyttarad .knapprad .knapp { flex: 1 1 0; min-width: 0; padding: 6px 10px; }
.omr-matt { display: flex; flex-direction: column; gap: 2px; margin: 16px 0 4px; padding: 12px 14px; border-radius: 14px; background: var(--surface); }
.omr-radera { margin-top: 18px; }
.omr-alla { margin-top: 12px; }

/* ---------- Bottenraden ---------- */
#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 500; height: calc(var(--nav) + var(--safe-b)); padding: 6px 4px var(--safe-b);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 112px minmax(0, 1fr) minmax(0, 1fr); align-items: start;
  background: var(--bg); border-top: 1px solid var(--line); }
.nav-knapp { height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0; border: 0;
  background: transparent; color: var(--muted); font-size: 16px; font-weight: 600; min-width: 0; }
.nav-ikon { width: 56px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; }
.nav-knapp[aria-current="page"] { color: var(--fg); font-weight: 800; }
.nav-knapp[aria-current="page"] .nav-ikon { background: var(--accent); }
.nav-nytt { justify-self: center; width: 104px; height: 76px; margin-top: -24px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; padding: 0; border-radius: 22px; border: 2px solid var(--ink); background: var(--accent); color: var(--on-accent);
  font-size: 17px; font-weight: 800; box-shadow: var(--shadow); }
.nav-nytt:active { background: #E6BF00; }

/* ---------- Platserna Fynd, Arter och Mer ---------- */
.plats { position: fixed; left: 0; right: 0; top: 0; bottom: calc(var(--nav) + var(--safe-b)); z-index: 400; display: flex; flex-direction: column;
  background: var(--bg); }
.plats-huvud { flex: none; display: flex; flex-direction: column; gap: 10px; padding: calc(var(--safe-t) + 14px) 16px 12px; border-bottom: 1px solid var(--line); }
.plats-titelrad { display: flex; align-items: center; gap: 10px; }
.plats-titelrad h1 { font-size: 28px; font-weight: 800; }
.plats-titelrad .knapp { margin-left: auto; }
.plats-kropp { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 0 32px; }
#platsMer .plats-kropp { padding: 4px 16px 32px; }
.daggrupp { display: flex; flex-direction: column; }
.dag-rubrik { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 16px 16px 6px; }
.dag-rubrik h2 { font-size: 18px; font-weight: 800; }
.fyndrad { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; color: var(--fg); text-align: left; }
button.fyndrad:active { background: var(--surface); }
.fyndrad-bild { flex: none; width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--surface2); overflow: hidden; }
.fyndrad-bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fyndrad-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fyndrad-text b { font-size: 17px; font-weight: 800; line-height: 1.2; }
.fyndrad-text b.kursiv { font-style: italic; }
.fyndrad-text i, .fyndrad-text .note { font-size: 15px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.fyndrad-marken { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; max-width: 40%; }
.plats-kropp > .knapp.bred, .panel-kropp > .knapp.bred { margin-top: 12px; }
#lKropp > .knapp.bred { width: calc(100% - 32px); margin: 16px; }
#platsArter .seg3 .chip { min-height: 44px; }
.merrad { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; margin-bottom: 8px; padding: 10px 14px; border: 0;
  border-radius: 14px; background: var(--surface); color: var(--fg); text-align: left; }
.merrad:active { background: var(--surface2); }
.merrad-ikon { flex: none; }
.merrad-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.merrad-text b { font-size: 17px; }
.merrad > .ikon:last-child { color: var(--muted); }

/* ---------- Paneler (helskärm) och ark ---------- */
.panel { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: var(--bg); }
.panel-huvud { flex: none; min-height: calc(var(--safe-t) + 60px); display: flex; align-items: center; gap: 8px; padding: var(--safe-t) 14px 0 4px;
  border-bottom: 1px solid var(--line); background: var(--bg); }
.panel-huvud h2 { flex: 1; min-width: 0; font-size: 20px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-huvud > .knapp:last-child:not(.tillbaka) { margin-left: auto; }
.panel-kropp { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 16px calc(var(--safe-b) + 48px); }
.panel-kropp > p:first-child { margin-top: 0; }
.sokhuvud { gap: 4px; padding-right: 12px; }
.sokhuvud .sokfalt { flex: 1; min-width: 0; }
.sokhuvud .knapp.tillbaka { padding: 0 6px; }
.hylla { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; justify-content: flex-end; }
.hylla-bakgrund { position: absolute; inset: 0; background: var(--scrim); }
.ark { position: relative; max-height: calc(100% - var(--safe-t) - 24px); display: flex; flex-direction: column; border-radius: 22px 22px 0 0;
  background: var(--bg); box-shadow: 0 -2px 14px rgba(0, 0, 0, .2); padding-bottom: var(--safe-b); animation: upp .18s ease-out; }
.ark.hog { height: calc(100% - var(--safe-t) - 24px); }
@keyframes upp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.ark-greppet { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; flex: none; }
.ark-huvud { flex: none; display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px 10px; }
.ark-titlar { flex: 1; min-width: 0; }
.ark-titlar h2 { font-size: 22px; font-weight: 800; }
.ark-sub { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.ark > .sokfalt { margin: 0 16px 8px; flex: none; }
.ark-kropp { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px 16px; }
.ark-fot { flex: none; display: flex; gap: 8px; padding: 10px 16px 12px; border-top: 1px solid var(--line); }
.ark-fot .knapp { flex: 1; }
.dialog-hylla { justify-content: center; align-items: center; padding: 20px; }
.dialog { position: relative; width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; padding: 20px; border-radius: 20px; background: var(--bg);
  box-shadow: var(--shadow); }
.dialog h2 { font-size: 21px; font-weight: 800; }
.dialog p { margin: 10px 0 0; }
.dialog .falt { margin-top: 14px; }
.dialog-knappar { display: flex; gap: 8px; margin-top: 18px; }
.dialog-knappar .knapp { flex: 1; }
.dialog-knappar.rutnat { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dialog-knappar.rutnat .knapp { font-family: var(--mono); font-size: 19px; }
.dialog-knappar.rutnat .knapp.hel { grid-column: 1 / -1; font-family: inherit; font-size: 17px; }

/* Meddelanden */
/* Ovanför den upphöjda Nytt fynd-knappen (24 px över raden). */
#toaster { position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-b) + var(--nav) + 36px); z-index: 3000; display: flex;
  flex-direction: column; gap: 8px; pointer-events: none; }
/* På kartan ovanför knapparna Lager, Platsen och Centrera. */
body[data-plats="karta"] #toaster { bottom: calc(var(--safe-b) + var(--nav) + 76px); }
.toast { pointer-events: auto; display: flex; flex-direction: column; gap: 12px; padding: 14px 14px 0; border-radius: 18px; overflow: hidden;
  background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow); animation: upp .18s ease-out; }
.toast-rad { display: flex; align-items: flex-start; gap: 12px; }
.toast-ikon { flex: none; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent); }
.toast-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toast-text b { font-size: 18px; line-height: 1.25; }
.toast-text span { font-size: 15px; opacity: .85; overflow-wrap: anywhere; }
.toast-knappar { display: flex; gap: 8px; }
.toast-knappar .knapp { flex: 1; min-height: 56px; border: 2px solid var(--on-ink); background: transparent; color: var(--on-ink); border-radius: 14px; padding: 0 8px; }
.toast-knappar .knapp.accent { flex: 1.4; background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.toast-knappar .sek { font-family: var(--mono); opacity: .8; }
.toast-tid { height: 4px; margin: 0 -14px; background: #3A3A36; }
.toast-tid div { height: 4px; background: var(--accent); }
.toast > :last-child:not(.toast-tid) { margin-bottom: 14px; }

/* ---------- Artväljaren ---------- */
.artrutnat { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.artknapp { position: relative; min-height: 72px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  padding: 8px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-align: left; }
.artknapp:active { background: var(--accent); }
.artknapp-namn { font-weight: 800; font-size: 17px; line-height: 1.2; }
.artknapp i, .artknapp .note { font-size: 14px; color: var(--muted); }
.redan { display: inline-flex; align-items: center; gap: 3px; font-size: 14px; font-weight: 800; color: var(--info); }
.artknapp .redan { position: absolute; top: 6px; right: 8px; }
.traff { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 60px; padding: 8px 4px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; text-align: left; }
.traff:active { background: var(--surface); }
.traff-ikon { flex: none; color: var(--muted); }
.traff-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.traff-text b { font-size: 17px; }
.traff.fri { background: var(--surface); border-radius: 12px; border: 0; margin-top: 8px; padding: 8px 12px; }

/* ---------- Fyndkortet ---------- */
.sparstatus { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--muted); }
.sparstatus.fel { color: var(--bad); font-weight: 800; }
.fyndkort .panel-kropp { padding-top: 18px; }
.fk-del { margin-bottom: 26px; }
.fk-del .rubrik:first-child { margin-top: 0; }
.fk-arthuvud { display: flex; align-items: flex-start; gap: 12px; }
.fk-artikon { flex: none; width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--surface2); }
.fk-artnamn { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fk-artnamn h2 { font-size: 26px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.fk-artnamn h2.kursiv { font-style: italic; }
.fk-artnamn h2.okand { color: var(--warn); }
.fk-artnamn .vet { font-size: 17px; color: var(--muted); }
.fk-rubrikrad { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 0 10px; }
.fk-rubrikrad .rubrik { margin: 0; }
.fk-del > .fk-rubrikrad:first-child { margin-top: 0; }
.fk-rubrikrad > .note { font-size: 19px; font-weight: 800; color: var(--fg); }
.fk-falt { margin-bottom: 4px; }
.bildremsa { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 10px; padding: 0 16px 2px; scrollbar-width: none; }
.bildremsa::-webkit-scrollbar { display: none; }
.bild, .bildknapp { position: relative; flex: none; width: 92px; height: 92px; border-radius: 14px; padding: 0; overflow: hidden; }
.bild { border: 1px solid var(--line); background: var(--surface2); }
.bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.huvudbild { position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: 6px; background: var(--ink); color: var(--on-ink); font-size: 12px; font-weight: 800; }
.bildknapp { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line);
  background: var(--surface); font-size: 15px; font-weight: 800; }
.bildknapp[data-fk="kamera"] { border: 2px solid var(--ink); background: var(--bg); }
.fk-del .chips + .chips, .fk-del .chips + .raknare, .fk-del .raknare + .chips { margin-top: 10px; }
.raknare { display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; align-items: center; gap: 8px; margin-top: 10px; }
.raknare .falt { text-align: center; font-family: var(--mono); font-size: 24px; font-weight: 700; }
.ovrig { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.fk-del .falt + .rubrik, .fk-del .chips + .falt { margin-top: 10px; }
.platsruta { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: var(--surface); }
.platsruta p.note { margin: 0; }
.fk-acc { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.punkt { width: 12px; height: 12px; border-radius: 50%; background: var(--info); flex: none; }
.punkt.warn { background: var(--warn); } .punkt.bad { background: var(--bad); }
.koordrad { display: flex; flex-direction: column; gap: 2px; font-family: var(--mono); font-size: 15px; }
.platsruta .knapprad { margin: 0; }
.platsruta .knapprad .knapp { min-height: 48px; border-radius: 12px; font-size: 16px; padding: 4px 10px; flex: 1 1 45%; }
.fk-tid { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); font-weight: 800; }
.tidrad { display: flex; gap: 8px; }
.tidrad .falt { flex: 1; min-width: 0; background: var(--bg); }
.fk-merknapp { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 56px; padding: 8px 14px;
  border-radius: 14px; border: 1px solid var(--line); background: transparent; text-align: left; }
.fk-merknapp > span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fk-mer { margin: 10px 0 4px; padding: 4px 14px 14px; border-radius: 16px; background: var(--surface); }
.fk-mer .falt { background: var(--bg); }
.fk-mer .vaxel:first-of-type { margin-top: 12px; }
.fakta { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 16px 0 0; font-size: 15px; }
.fakta dt { font-weight: 800; }
.fakta dd { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.fakta dd.id { font-family: var(--mono); font-size: 13px; }
.fk-del > .knapp.fara { margin-top: 18px; }

/* ---------- Om arten, platskortet, sök ---------- */
.tx-name { font-size: 25px; font-weight: 800; margin: 2px 0 0; line-height: 1.2; }
.tx-sub { color: var(--muted); margin: 6px 0; }
.tlink { display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding: 4px 0; min-height: 56px; }
.tlink:first-of-type { border-top: 0; }
.tlink .go { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 6px 2px; }
.tlink .lvl { display: block; color: var(--muted); font-size: 14px; }
.tlank { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 56px; padding: 8px 2px; border: 0;
  border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.tlank:disabled { color: var(--muted); }
.afakta h4 { margin: 14px 0 4px; font-size: 17px; }
.afakta p { margin: 4px 0 8px; }
.obsrow { border-top: 1px solid var(--line); padding: 8px 0; font-size: 15px; }
.obsrow:first-child { border-top: 0; }
.pf { margin: 0 0 10px; }
.koordruta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--surface); }
.koordruta > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.koordruta b { font-family: var(--mono); font-size: 15px; overflow-wrap: anywhere; }
.lanknapp { display: inline-block; color: inherit; font-weight: 800; padding: 10px 0; min-height: 44px; }
#rTeknikText { white-space: pre-wrap; word-break: break-word; font-size: 13px; background: var(--surface); padding: 8px 10px; border-radius: 8px; margin: 6px 0; }
details summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; }
#rTyp { margin-bottom: 8px; }

/* ---------- Bildvisaren ---------- */
.bildvisare { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: #000; color: #fff; }
.bv-topp, .bv-fot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; }
.bv-topp { padding-top: calc(var(--safe-t) + 8px); }
.bv-fot { padding-bottom: calc(var(--safe-b) + 8px); }
.bv-fot .note { color: #ddd; }
.bv-yta { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.bv-yta img { max-width: 100%; max-height: 100%; transform-origin: center; user-select: none; -webkit-user-drag: none; }

/* ---------- Första starten och nödläget ---------- */
.startskarm { position: fixed; inset: 0; z-index: 2500; display: flex; flex-direction: column; background: var(--bg); }
.start-kropp { flex: 1; min-height: 0; overflow-y: auto; padding: calc(var(--safe-t) + 24px) 20px 24px; }
.start-kropp h1 { font-size: 28px; font-weight: 800; margin-bottom: 12px; }
.start-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.start-lista li { display: flex; gap: 12px; align-items: flex-start; }
.start-lista .ikon { margin-top: 1px; }
.start-fot { flex: none; display: flex; gap: 8px; padding: 12px 20px calc(var(--safe-b) + 12px); border-top: 1px solid var(--line); }
.start-fot .knapp { flex: 1; white-space: nowrap; }
.start-fot .knapp.accent { flex: 2; }

@media (min-width: 700px) {
  .ark { width: 600px; margin: 0 auto; border-radius: 22px 22px 0 0; }
  #toaster { left: 50%; right: auto; width: 480px; transform: translateX(-50%); }
  .kartaval, #kartaKnappar { left: 50%; right: auto; width: 480px; transform: translateX(-50%); }
  #kartaTopp { right: auto; width: 480px; }
  .plats-huvud, .plats-kropp > *, .panel-kropp > *, .start-kropp > * { max-width: 760px; }
  .panel-kropp, .start-kropp { padding-left: max(16px, calc(50% - 380px)); padding-right: max(16px, calc(50% - 380px)); }
}
@media (prefers-reduced-motion: reduce) { .ark, .toast { animation: none; } .vaxel-spar span { transition: none; } }

/* ---------- Konto och synk (3.0) ---------- */
/* Villkoren kan öppnas från startskärmen och ska då ligga ovanpå den. */
#villkorArk { z-index: 3000 !important; }
.ark-kropp.villkor p { margin: 6px 0 10px; }
.qr { display: flex; justify-content: center; margin: 8px 0; }
.qr svg { width: min(260px, 70vw); height: auto; background: #fff; border-radius: 12px; }
.kopplingskod { margin: 8px 0; text-align: center; font: 800 34px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; }
.box.anvandare .knapp { margin-top: 6px; }
.box.anvandare.avstangd { opacity: .75; }
.varn { color: var(--warn); font-weight: 700; }
