/* Gårdsboken v1 */
:root {
  --aubergine: #302733;
  --aubergine-2: #4a3f4e;
  --krita: #F5F2ED;
  --kort: #FFFDFA;
  --aprikos: #EDB493;
  --aprikos-2: #f6d9c6;
  --petrol: #245B60;
  --petrol-2: #1b474b;
  --linje: #e4ddd3;
  --dim: #7a6f7c;
  --rod: #a8412c;
  --gron: #3d7a4e;
  --radie: 14px;
  --skugga: 0 1px 2px rgba(48,39,51,.06), 0 6px 20px rgba(48,39,51,.08);
  --nav-h: 64px;
  --top-h: 56px;
  --serif: 'Marcellus', Georgia, serif;
  --sans: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--aubergine);
  background: var(--krita);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--petrol); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: .01em; margin: 0; }
h1 { font-size: 1.65rem; line-height: 1.2; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }

/* ---------- Grundlayout ---------- */
#app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: var(--top-h); flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 0 12px 0 16px; padding-top: env(safe-area-inset-top);
  height: calc(var(--top-h) + env(safe-area-inset-top));
  background: var(--aubergine); color: var(--krita); z-index: 30;
}
.brand { font-family: var(--serif); font-size: 1.3rem; letter-spacing: .02em; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { font-family: var(--sans); font-size: .75rem; opacity: .6; margin-left: 6px; letter-spacing: .04em; }
.iconbtn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; border-radius: 12px;
  background: transparent; color: inherit;
}
.iconbtn:hover { background: rgba(255,255,255,.08); }
.iconbtn svg { width: 22px; height: 22px; }

main { flex: 1 1 auto; position: relative; overflow: hidden; order: 2; }
.view { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; }

.bottomnav {
  flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--kort); border-top: 1px solid var(--linje); z-index: 30; order: 3;
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--dim); font-size: .75rem; letter-spacing: .02em; position: relative;
}
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a.active { color: var(--petrol); }
.bottomnav a.active::before {
  content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--petrol);
}
.badge {
  position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--rod); color: #fff; font-size: .7rem; line-height: 18px; text-align: center; font-weight: 500;
}

@media (min-width: 900px) {
  #app { flex-direction: row; flex-wrap: wrap; }
  .topbar { width: 100%; }
  .bottomnav {
    order: -1; width: 92px; height: calc(100% - var(--top-h)); grid-template-columns: 1fr; grid-auto-rows: 76px;
    align-content: start; border-top: 0; border-right: 1px solid var(--linje); padding-top: 8px; margin-top: var(--top-h);
    position: absolute; left: 0; top: 0;
  }
  .bottomnav a.active::before { top: 18%; bottom: 18%; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  main { position: absolute; left: 92px; right: 0; top: var(--top-h); bottom: 0; }
  .badge { top: 10px; }
}

/* ---------- Knappar och fält ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--linje);
  background: var(--kort); color: var(--aubergine); font-weight: 500; letter-spacing: .01em; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.btn.primary { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.btn.primary:hover { background: var(--petrol-2); }
.btn.accent { background: var(--aprikos); border-color: var(--aprikos); color: var(--aubergine); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--petrol); padding: 0 10px; }
.btn.danger { color: var(--rod); border-color: #e9cfc7; background: #fff8f5; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; border-radius: 10px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }

label.field { display: block; margin: 0 0 14px; }
label.field > span { display: block; font-size: .85rem; color: var(--dim); margin-bottom: 4px; letter-spacing: .02em; }
input[type=text], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--linje); border-radius: 10px;
  background: #fff; font-size: 16px;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--petrol); box-shadow: 0 0 0 3px rgba(36,91,96,.15); }
.check { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--petrol); }
.hint { font-size: .85rem; color: var(--dim); }

/* ---------- Kort och listor ---------- */
.card { background: var(--kort); border-radius: var(--radie); box-shadow: var(--skugga); padding: 16px; margin: 0 0 14px; }
.section { margin: 26px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section h2 { font-size: 1.1rem; }
.list { background: var(--kort); border-radius: var(--radie); box-shadow: var(--skugga); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 60px;
  border-bottom: 1px solid var(--linje); text-decoration: none; color: inherit; background: none; width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0;
}
.row:last-child { border-bottom: 0; }
a.row:hover, button.row:hover { background: #faf7f2; }
.row .main { flex: 1; min-width: 0; }
.row .title { display: block; font-weight: 500; overflow-wrap: anywhere; }
.row .sub { display: block; font-size: .85rem; color: var(--dim); overflow-wrap: anywhere; }
.row .chev { color: #c5bcc7; width: 18px; height: 18px; flex: 0 0 auto; }
.empty { padding: 18px 16px; color: var(--dim); font-size: .95rem; }
.kicon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--krita); color: var(--aubergine);
}
.kicon svg { width: 20px; height: 20px; }
.kicon.tech { background: var(--aprikos-2); color: #7a3e18; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  font-size: .78rem; background: #ebe5dc; color: var(--aubergine-2); letter-spacing: .02em; white-space: nowrap;
}
.chip.tech { background: var(--aprikos-2); color: #7a3e18; }
.chip.late { background: #f6dcd4; color: var(--rod); }
.chip.soon { background: #fbecd9; color: #8a5a17; }
.chip.ok { background: #dcebe0; color: var(--gron); }

.donebtn {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--petrol); background: #fff; color: var(--petrol);
  display: grid; place-items: center; flex: 0 0 auto;
}
.donebtn svg { width: 20px; height: 20px; }
.donebtn:hover { background: var(--petrol); color: #fff; }

/* ---------- Karta ---------- */
#mapview { overflow: hidden; background: #dfe7dc; touch-action: none; user-select: none; -webkit-user-select: none; }
.mapstage { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.mapstage img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.markers { position: absolute; inset: 0; }
.marker {
  position: absolute; width: 0; height: 0; border: 0; padding: 0; background: none;
}
.marker .hit {
  position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%;
  transform: scale(var(--inv, 1)); display: grid; place-items: center;
}
.marker { --amber: #c8682f; }
/* Alla platser: ikon i cirkel. Vanliga platser ljusa, dold teknik aprikos, platser utanför kartan petrol. */
.marker .dot {
  position: relative; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff;
  background: var(--kort); color: var(--petrol); display: grid; place-items: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.25), 0 2px 8px rgba(48,39,51,.28); transition: transform .15s, background .15s;
}
.marker .dot svg { width: 16px; height: 16px; }
.marker.tech .dot { background: var(--aprikos); }
.marker.off .dot { background: #fff; color: var(--petrol); border: 2.5px solid var(--petrol); }
.marker.off .dot svg { width: 17px; height: 17px; stroke-width: 2.1; }
/* Varning: försenat (röd) eller att göra denna månad (bärnsten) */
.marker.al-month .dot { border-color: var(--amber); }
.marker.al-late .dot { border-color: var(--rod); }
.marker .due {
  position: absolute; right: 3px; top: 3px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff;
  background: var(--amber); box-shadow: 0 1px 3px rgba(0,0,0,.3); pointer-events: none;
}
.marker.al-late .due { background: var(--rod); }
.marker.al-late .hit::before {
  content: ''; position: absolute; left: 7px; top: 7px; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--rod); opacity: 0; animation: halo 2.4s ease-out infinite; pointer-events: none;
}
@keyframes halo { 0% { transform: scale(.9); opacity: .7; } 70%, 100% { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .marker.al-late .hit::before { animation: none; } }
.duepill i { width: 9px; height: 9px; border-radius: 50%; background: #c8682f; flex: none; }
.duepill.late i { background: var(--rod); box-shadow: 0 0 0 3px rgba(168,65,44,.18); }
.marker .lbl {
  position: absolute; left: 50%; top: 40px; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  background: rgba(48,39,51,.86); color: #fff; font-size: 12.5px; padding: 2px 8px; border-radius: 6px; letter-spacing: .02em;
  opacity: 0; transition: opacity .15s;
}
.marker:hover .lbl, .marker:focus-visible .lbl, .marker.sel .lbl { opacity: 1; }
.marker:hover .dot, .marker.sel .dot { transform: scale(1.18); }
.marker.sel .dot { background: var(--aubergine); color: #fff; --hl: var(--aubergine); }
.editing .marker .dot { border-color: var(--rod); cursor: grab; }
.editing .marker.dragging .dot { cursor: grabbing; transform: scale(1.35); }
.ghostmarker .dot { background: var(--rod); border-color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.3); } }

.mapctl { position: absolute; right: 12px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 5; }
.mapctl .fab {
  width: 48px; height: 48px; border-radius: 14px; border: 0; background: var(--kort); color: var(--aubergine);
  box-shadow: var(--skugga); display: grid; place-items: center;
}
.mapctl .fab svg { width: 22px; height: 22px; }
.mapctl .fab.on { background: var(--aubergine); color: var(--krita); }
.mapbar {
  position: absolute; left: 12px; top: 12px; right: 76px; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none;
}
.mapbar > * { pointer-events: auto; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 0;
  background: var(--kort); box-shadow: var(--skugga); color: var(--aubergine); font-size: .92rem; font-weight: 500;
}
.pill.on { background: var(--aubergine); color: var(--krita); }
.pill svg { width: 18px; height: 18px; }
.editbanner {
  position: absolute; left: 12px; right: 12px; bottom: 16px; z-index: 6; margin-right: 64px;
  background: var(--aubergine); color: var(--krita); border-radius: 14px; padding: 12px 14px; font-size: .92rem;
  box-shadow: var(--skugga); display: flex; align-items: center; gap: 10px;
}
.editbanner .btn { min-height: 36px; }

/* ---------- Panel för plats (mobil: ark nerifrån, desktop: sidopanel) ---------- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88%; z-index: 20;
  background: var(--krita); border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(48,39,51,.18);
  overflow-y: auto; -webkit-overflow-scrolling: touch; transform: translateY(105%); transition: transform .25s ease;
  overscroll-behavior: contain; touch-action: pan-y;
}
.sheet.open { transform: translateY(0); }
.sheet .grab { position: sticky; top: 0; height: 22px; display: grid; place-items: center; background: var(--krita); z-index: 2; }
.sheet .grab::after { content: ''; width: 40px; height: 5px; border-radius: 3px; background: #d6cdd6; }
@media (min-width: 900px) {
  .sheet {
    left: auto; top: 0; width: 440px; max-height: none; border-radius: 0; transform: translateX(105%);
    box-shadow: -8px 0 30px rgba(48,39,51,.14);
  }
  .sheet.open { transform: translateX(0); }
  .sheet .grab { display: none; }
}
.sheethead { display: flex; align-items: flex-start; gap: 10px; padding: 4px 16px 0; }
.sheethead .main { flex: 1; min-width: 0; }
.crumb { font-size: .85rem; color: var(--dim); }
.crumb a { color: var(--dim); }

/* ---------- Innehåll ---------- */
.prose { overflow-wrap: anywhere; }
.prose p { margin: 0 0 .8em; }
.prose ol, .prose ul { margin: 0 0 .8em; padding-left: 1.4em; }
.prose li { margin: .25em 0; }
.prose h3 { margin: 1em 0 .4em; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.gallery a, .gallery .thumb { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #e9e3da; position: relative; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .rm {
  position: absolute; right: 4px; top: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(48,39,51,.75); color: #fff; display: grid; place-items: center;
}
.gallery .rm svg { width: 14px; height: 14px; }
.filelist a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--linje); margin-bottom: 6px; text-decoration: none; color: var(--aubergine); }
.filelist svg { width: 20px; height: 20px; color: var(--rod); flex: 0 0 auto; }

.timeline .month { font-family: var(--serif); font-size: 1.05rem; margin: 22px 0 8px; color: var(--aubergine-2); }
.entry { display: flex; gap: 12px; padding: 14px; border-bottom: 1px solid var(--linje); }
.entry:last-child { border-bottom: 0; }
.entry .when { width: 46px; flex: 0 0 auto; text-align: center; font-size: .8rem; color: var(--dim); line-height: 1.2; }
.entry .when b { display: block; font-size: 1.3rem; font-family: var(--sans); font-weight: 400; color: var(--aubergine); }
.entry .body { flex: 1; min-width: 0; }
.entry .body .title { font-weight: 500; }
.entry .body .txt { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.entry .gallery { margin-top: 8px; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }

.stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 18px; }
.stat a { background: var(--kort); border-radius: var(--radie); box-shadow: var(--skugga); padding: 12px; text-decoration: none; color: var(--aubergine); }
.stat b { display: block; font-family: var(--sans); font-size: 1.7rem; font-weight: 400; line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; }
.stat span { font-size: .82rem; color: var(--dim); }
.stat a.late b { color: var(--rod); }

.invrow { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--linje); flex-wrap: wrap; }
.invrow:last-child { border-bottom: 0; }
.invrow .main { flex: 1 1 180px; }
.seg { display: inline-flex; background: var(--krita); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 8px; min-height: 36px; padding: 0 10px; font-size: .85rem; color: var(--dim); }
.seg button.on { background: #fff; color: var(--aubergine); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 500; }

.searchbox { position: sticky; top: 0; background: var(--krita); padding: 12px 0; z-index: 2; }
mark { background: var(--aprikos-2); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Dialoger ---------- */
dialog {
  border: 0; padding: 0; width: min(560px, 100vw); max-width: 100vw; max-height: 100dvh; background: var(--krita); color: var(--aubergine);
  border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
dialog::backdrop { background: rgba(48,39,51,.45); }
@media (max-width: 600px) {
  dialog { width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 94dvh; }
}
.dlg { display: flex; flex-direction: column; max-height: inherit; }
.dlg header { display: flex; align-items: center; gap: 8px; padding: 14px 10px 6px 18px; }
.dlg header h2 { flex: 1; }
.dlg .content { padding: 8px 18px 8px; overflow-y: auto; }
.dlg footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--linje); background: var(--kort); flex-wrap: wrap; }
.dlg footer .spacer { flex: 1; }
.err { color: var(--rod); background: #fbe9e3; border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; font-size: .92rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--aubergine); color: var(--krita); padding: 12px 18px; border-radius: 12px; box-shadow: var(--skugga);
  opacity: 0; transition: .2s; z-index: 100; max-width: calc(100vw - 32px); font-size: .95rem; display: flex; gap: 14px; align-items: center;
}
.toast { pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.toast button { background: none; border: 0; color: var(--aprikos); font-weight: 500; padding: 4px 0; }

/* ---------- Inloggning ---------- */
.login { min-height: 100%; width: 100%; flex: 1 1 100%; display: grid; place-items: center; padding: 24px; background: var(--aubergine); }
.login form { width: min(380px, 100%); background: var(--krita); border-radius: 20px; padding: 28px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login h1 { font-size: 2rem; margin-bottom: 4px; }
.login p { color: var(--dim); margin: 0 0 20px; }
.login .btn { width: 100%; }

.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); }

/* ---------- QR och utskrift ---------- */
.qrbox { text-align: center; }
.qrbox svg { width: min(260px, 70vw); height: auto; background: #fff; padding: 10px; border-radius: 12px; }
.qrsheet { display: none; }
@media print {
  body > *:not(.qrsheet) { display: none !important; }
  .qrsheet { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 10mm; padding: 6mm; }
  .qrsheet .q { text-align: center; break-inside: avoid; border: 1px dashed #bbb; padding: 4mm; border-radius: 3mm; }
  .qrsheet svg { width: 42mm; height: 42mm; }
  .qrsheet .n { font-family: var(--serif); font-size: 13pt; margin-top: 2mm; }
  .qrsheet .s { font-family: var(--sans); font-size: 8pt; color: #555; }
}

/* ---------- v2: synk, textläsning, perioder, tidsmaskin ---------- */
.toppill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: var(--krita); font-size: .82rem; white-space: nowrap;
  max-width: 46vw; overflow: hidden;
}
.toppill span { overflow: hidden; text-overflow: ellipsis; }
.toppill svg { width: 16px; height: 16px; flex: 0 0 auto; }
.toppill.warn { background: var(--aprikos); color: var(--aubergine); border-color: var(--aprikos); }
#syncbtn:not(.warn) span::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--aprikos); margin-right: 6px; vertical-align: 1px; }
.tabs { display: flex; gap: 4px; background: #ebe5dc; border-radius: 12px; padding: 4px; margin: 0 0 16px; }
.tabs a, .tabs button { flex: 1; text-align: center; border: 0; background: none; border-radius: 9px; min-height: 40px; display: grid; place-items: center;
  font-size: .92rem; color: var(--aubergine-2); text-decoration: none; padding: 0 6px; }
.tabs .on { background: #fff; color: var(--aubergine); font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.tm-head { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; }
.tm-head h2 { flex: 1; text-align: center; font-size: 1.5rem; }
.tm-range { width: 100%; accent-color: var(--petrol); height: 32px; }
.tm-scale { display: flex; justify-content: space-between; font-size: .78rem; color: var(--dim); margin-top: -4px; }
.tm-map { position: relative; border-radius: var(--radie); overflow: hidden; box-shadow: var(--skugga); margin: 14px 0; background: #dfe7dc; }
.tm-map img { display: block; width: 100%; height: auto; filter: saturate(.75) sepia(.12); }
.tm-map .pin {
  position: absolute; transform: translate(-50%, -50%); min-width: 28px; height: 28px; padding: 0 7px; border-radius: 14px; border: 2px solid #fff;
  background: var(--petrol); color: #fff; font-size: .8rem; font-weight: 500; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.tm-map .pin.on { background: var(--aprikos); color: var(--aubergine); }
.tm-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 14px; }
.tm-photos a { aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; display: block; background: #e9e3da; }
.tm-photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.marker.tech .dot svg[viewBox] path[fill] { stroke: none; }

/* v3: rubriken får plats när synk/textläsning visas */
@media (max-width: 520px) { .topbar:has(.toppill:not(.hidden)) .brand small { display: none; } }
.sheet .grab { cursor: grab; }

/* ---------- v4: finslipning ---------- */
.iconbtn.soft { color: var(--aubergine-2); }
.iconbtn.soft:hover { background: #ebe5dc; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.act {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 70px; padding: 8px 4px;
  border-radius: 14px; border: 1px solid var(--linje); background: var(--kort); color: var(--aubergine); font-size: .82rem; letter-spacing: .01em;
  transition: background .15s, transform .05s;
}
.act svg { width: 22px; height: 22px; color: var(--petrol); }
.act:hover { background: #fff; }
.act:active { transform: translateY(1px); }
.act.primary { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.act.primary svg { color: #fff; }
.act.primary:hover { background: var(--petrol-2); }
/* tomma listor: lätt streckad ram i stället för ett tungt kort */
.list:has(> .empty:only-child) { background: transparent; box-shadow: none; border: 1px dashed #d9d0c4; }
.list > .empty:only-child { padding: 14px 16px; font-size: .9rem; }
.tabs .cnt { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--aprikos); color: var(--aubergine); font-size: .72rem; font-weight: 500; margin-left: 4px; }
.tip { background: #fbf3ec; border: 1px solid #f1dccb; box-shadow: none; }
.tip p { margin: 6px 0 0; font-size: .92rem; color: var(--aubergine-2); }
.login {
  background: linear-gradient(rgba(48,39,51,.80), rgba(48,39,51,.90)), url('/maps/joarsbo-karta-v29.webp') center / cover no-repeat;
}
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--aubergine); color: var(--krita); font-family: var(--serif); font-size: 1.8rem; letter-spacing: .03em; }
.boot span { animation: fadein 1.2s ease both; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.sheet .grab { touch-action: none; height: 26px; }

/* vald markering ligger alltid överst så namnet syns */
.marker.sel { z-index: 3; }
.marker:hover, .marker:focus-visible { z-index: 4; }
@media (max-width: 360px) { .act { font-size: .74rem; min-height: 64px; } .act svg { width: 20px; height: 20px; } }

/* v8: "Här finns" som fri text */
.list > .contents, .list > .contents-empty {
  display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; cursor: pointer;
}
.list > .contents { padding: 14px 16px; color: var(--aubergine); white-space: pre-wrap; line-height: 1.55; overflow-wrap: anywhere; }
.list > .contents:hover { background: #faf6f0; }
.list > .contents:not(:last-child), .list > .contents-empty:not(:last-child) { border-bottom: 1px solid var(--linje); }
.list > .contents-empty { color: var(--dim); }
