/* Sporlag – kartet er arbeidsflaten. Venstre spalte: spor og egenskaper. Flytende verktøylinje øverst, høydeprofil nederst. */
:root {
  --paper: #F2F4F1;
  --panel: #FFFFFF;
  --sunken: #E8ECE8;
  --ink: #1A2124;
  --muted: #5B686D;
  --line: #D6DCD7;
  --accent: #D4521D;
  --accent-ink: #FFFFFF;
  --accent-soft: #FBE7DD;
  --sel: #1D6A86;
  --sel-soft: #DCEFF5;
  --sel-ink: #0F4C61;
  --danger: #B43A2A;
  --shadow: 0 1px 2px rgba(18, 28, 32, .10), 0 6px 20px rgba(18, 28, 32, .12);
  --f-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12171A; --panel: #1A2125; --sunken: #232C31; --ink: #E6ECEA; --muted: #95A2A7;
    --line: #2D383D; --accent: #EE6A33; --accent-ink: #160B06; --accent-soft: #3A2117;
    --sel: #5DB2D0; --sel-soft: #173845; --sel-ink: #BFE6F3; --danger: #F07B6A;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12171A; --panel: #1A2125; --sunken: #232C31; --ink: #E6ECEA; --muted: #95A2A7;
  --line: #2D383D; --accent: #EE6A33; --accent-ink: #160B06; --accent-soft: #3A2117;
  --sel: #5DB2D0; --sel-soft: #173845; --sel-ink: #BFE6F3; --danger: #F07B6A;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
  color-scheme: dark;
}
[hidden] { display: none !important; }
.btn, .inp, .seg, .side, .layers, .coach, .profile, .stat, .search { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font: 14px/1.45 var(--f-body); overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

#app { height: 100%; display: grid; grid-template-columns: 340px minmax(0, 1fr); grid-template-rows: 52px minmax(0, 1fr); }

/* Topplinje */
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 1000;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; width: 308px; flex: none; }
.brand svg { width: 26px; height: 26px; }
.brand b { font: 700 23px/1 var(--f-display); letter-spacing: .03em; text-transform: uppercase; }
.tag { font: 500 11px/1 var(--f-mono); color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 4px 8px; white-space: nowrap; }
.top .sp { flex: 1; }
.search { position: relative; width: 340px; max-width: 100%; min-width: 0; }
.search svg { position: absolute; left: 10px; top: 9px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 34px; border-radius: var(--r); border: 1px solid var(--line); background: var(--paper); padding: 0 10px 0 34px; }
.search input:focus { outline: none; border-color: var(--sel); }
.results { position: absolute; top: 40px; left: 0; right: 0; background: var(--panel); border-radius: 8px; box-shadow: var(--shadow); border: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; }
.results button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 5px; }
.results button:hover, .results button.on { background: var(--sunken); }
.results small { color: var(--muted); font-size: 12px; }
.results .none { padding: 8px 10px; color: var(--muted); font-size: 13px; }

.btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); white-space: nowrap; }
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn.sm.icon { width: 28px; }
kbd { font: 500 11px/1 var(--f-mono); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--line); border-bottom-width: 2px; color: var(--muted); background: var(--paper); }
.btn.primary kbd { color: inherit; background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.35); }

/* Sidepanel */
.side { grid-row: 2; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.sec { padding: 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sec-h .acts { flex-wrap: nowrap; }
.lbl { font: 700 13px/1 var(--f-display); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.count { font: 500 12px/1 var(--f-mono); color: var(--muted); }
.list { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.item { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r); border: 0; background: none; text-align: left; width: 100%; }
.item:hover { background: var(--sunken); }
.item.on { background: var(--accent-soft); }
.sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.item .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .mt { font: 12px/1.3 var(--f-mono); color: var(--muted); white-space: nowrap; }
.empty { color: var(--muted); font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); }
.inp { height: 34px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); padding: 0 10px; width: 100%; min-width: 0; }
.inp:focus { border-color: var(--sel); outline: none; }
.row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 110px; }
.seg { display: flex; background: var(--sunken); border-radius: var(--r); padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; height: 28px; border-radius: 4px; font-size: 13px; color: var(--muted); white-space: nowrap; padding: 0 6px; }
.seg.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg button.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.swatches { display: flex; gap: 6px; }
.swatches button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); padding: 0; }
.swatches button.on { box-shadow: 0 0 0 2px var(--ink); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stat { background: var(--panel); padding: 8px 10px; }
.stat span { display: block; font-size: 11px; color: var(--muted); }
.stat b { font: 500 16px/1.3 var(--f-mono); font-variant-numeric: tabular-nums; }
.plan { background: var(--sunken); border-radius: var(--r); padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.plan b { font: 500 15px/1.35 var(--f-mono); font-variant-numeric: tabular-nums; }
.plan .muted { color: var(--muted); }
.acts { display: flex; flex-wrap: wrap; gap: 6px; }
.danger { color: var(--danger); }

.foot { margin-top: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); border-top: 1px solid var(--line); font-size: 13px; }
.foot p { margin: 0; color: var(--muted); }
.foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.foot li { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.foot li svg { width: 14px; height: 14px; }
.foot a { color: var(--sel); }

/* Kart */
.mapwrap { grid-row: 2; position: relative; min-width: 0; min-height: 0; }
#map { position: absolute; inset: 0; background: #E4E8E3; }
.leaflet-container { font: 12px/1.4 var(--f-body); }
/* Leaflets egne kontroller (zoom, målestokk, kreditering) skal ligge under våre paneler. */
.leaflet-top, .leaflet-bottom { z-index: 700; }
button, .btn, .seg button { touch-action: manipulation; }
.leaflet-container.drawing, .leaflet-container.drawing .leaflet-interactive { cursor: crosshair; }

.toolbar { position: absolute; z-index: 800; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 5px; background: var(--panel); border-radius: 9px; box-shadow: var(--shadow); max-width: calc(100% - 24px); flex-wrap: wrap; justify-content: center; }
.toolbar .div { width: 1px; align-self: stretch; background: var(--line); margin: 2px 4px; }
.toolbar .status { font: 500 13px/1 var(--f-mono); padding: 0 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.toolbar .status i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.toggle[aria-pressed="true"] { background: var(--sel-soft); border-color: var(--sel); color: var(--sel-ink); }

.hint { position: absolute; z-index: 790; top: 64px; left: 50%; transform: translateX(-50%); background: rgba(26, 33, 36, .86); color: #F2F4F1; padding: 7px 12px; border-radius: 99px; font-size: 13px; white-space: nowrap; pointer-events: none; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.hint kbd { color: #F2F4F1; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); }
.busy { position: absolute; z-index: 790; left: 12px; top: 12px; background: var(--panel); border-radius: 99px; box-shadow: var(--shadow); padding: 6px 12px 6px 10px; font-size: 12px; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.busy i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--sel); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.layers { position: absolute; z-index: 800; top: 12px; right: max(12px, env(safe-area-inset-right, 0px)); background: var(--panel); border-radius: 9px; box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 8px; width: 196px; }
.layers .lbl { font-size: 11px; }
.layers .seg button { font-size: 12px; }
.chk { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; padding: 0 2px; }
.layers .acts .btn { flex: 1; justify-content: center; }
.layers-toggle { display: none; }

.profile { position: absolute; z-index: 780; left: 12px; right: 60px; bottom: 12px; background: var(--panel); border-radius: 9px; box-shadow: var(--shadow); padding: 10px 14px 6px; display: flex; flex-direction: column; gap: 4px; }
.profile-h { display: flex; align-items: center; gap: 10px; min-width: 0; }
.profile-h .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout { margin-left: auto; font: 500 12px/1 var(--f-mono); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.readout b { color: var(--ink); font-weight: 500; }
#prof { width: 100%; height: 104px; display: block; touch-action: none; cursor: col-resize; }
#prof text { font: 10px var(--f-mono); fill: var(--muted); }
#prof .grid { stroke: var(--line); stroke-width: 1; }

.coach { position: absolute; z-index: 850; left: 12px; bottom: 12px; width: 310px; max-width: calc(100% - 24px); background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.coach .step { font: 500 11px/1 var(--f-mono); color: var(--accent); letter-spacing: .04em; }
.coach h3 { margin: 0; font: 700 22px/1.05 var(--f-display); text-transform: uppercase; letter-spacing: .02em; text-wrap: balance; }
.coach p { margin: 0; color: var(--muted); }
.coach .demo { height: 74px; border-radius: var(--r); background: var(--sunken); }
.coach .demo svg { width: 100%; height: 100%; }
.coach .nav { display: flex; justify-content: space-between; align-items: center; }
.dots { display: flex; gap: 5px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); }

.toast { position: absolute; z-index: 900; left: 50%; bottom: 150px; transform: translateX(-50%); background: var(--ink); color: var(--paper); border-radius: 8px; padding: 9px 10px 9px 14px; display: flex; gap: 12px; align-items: center; font-size: 13px; box-shadow: var(--shadow); max-width: calc(100% - 24px); }
.toast button { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 2px 6px; white-space: nowrap; }

/* Kartsymboler */
.pen { pointer-events: auto !important; touch-action: none; cursor: grab !important; }
.pen-in { width: 30px; height: 30px; box-sizing: border-box; border-radius: 50%; background: #D4521D; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); display: grid; place-items: center; }
.pen-in svg { width: 14px; height: 14px; stroke: #fff; }
.h-anchor { width: 14px !important; height: 14px !important; margin: -7px 0 0 -7px !important; box-sizing: border-box; border-radius: 50%; background: #fff; border: 3px solid var(--c, #333); box-shadow: 0 1px 3px rgba(0,0,0,.35); cursor: move; }
.h-anchor.end { width: 18px !important; height: 18px !important; margin: -9px 0 0 -9px !important; }
.h-mid { width: 12px !important; height: 12px !important; margin: -6px 0 0 -6px !important; box-sizing: border-box; border-radius: 50%; background: rgba(255,255,255,.85); border: 2px dashed var(--c, #333); cursor: copy; opacity: .8; }
.h-mid:hover { opacity: 1; }
.snap { width: 22px !important; height: 22px !important; margin: -11px 0 0 -11px !important; box-sizing: border-box; border-radius: 50%; border: 2px solid #1D6A86; background: rgba(29,106,134,.15); pointer-events: none !important; }
.trk-label { background: #fff; color: #1A2124; border: 0; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.25); font: 600 12px/1 var(--f-body); padding: 4px 6px; }
.trk-label::before { display: none; }
.pos { width: 16px !important; height: 16px !important; margin: -8px 0 0 -8px !important; box-sizing: border-box; border-radius: 50%; background: var(--c, #333); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--c, #333), 0 2px 6px rgba(0,0,0,.35); pointer-events: none !important; }

@media (max-width: 860px) {
  .brand { width: auto; }
  .tag { display: none; }
}
@media (max-width: 760px) {
  /* iOS zoomer inn på felt med skrift under 16 px. */
  input, select, textarea, .inp, .search input { font-size: 16px; }
  #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 52px minmax(0, 1fr) auto; }
  .side { grid-row: 3; max-height: 40vh; border-right: 0; border-top: 1px solid var(--line); }
  .foot { display: none; }
  .brand b { display: none; }
  .top { gap: 8px; }
  .top .btn .t { display: none; }
  .search { width: auto; flex: 1; }
  .top .sp { display: none; }
  .toolbar { top: 8px; }
  .toolbar kbd, .toolbar .t { display: none; }
  .hint { top: 56px; font-size: 12px; }
  .layers { display: none; }
  .layers.open { display: flex; top: 56px; }
  .layers-toggle { display: inline-flex; position: absolute; z-index: 801; top: 8px; right: max(8px, env(safe-area-inset-right, 0px)); box-shadow: var(--shadow); }
  .busy { top: auto; bottom: 8px; left: 8px; }
  .profile { left: 8px; right: 8px; bottom: 8px; }
  .coach { left: 8px; bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { .toolbar .status i, .busy i { animation: none; } }

/* ─── Pro ─────────────────────────────────────────────────────────────────── */
#pro-head { display: flex; align-items: center; }
.menu-wrap { position: relative; }
#pro-menu-btn .t { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.menu { position: absolute; right: 0; top: 38px; z-index: 1200; min-width: 240px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column; }
.menu button { display: flex; align-items: center; gap: 8px; border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 5px; font-size: 14px; }
.menu button:hover { background: var(--sunken); }
.menu span.i { display: inline-block; width: 16px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.menu-h { font: 12px var(--f-mono); color: var(--muted); padding: 8px 10px 6px; overflow: hidden; text-overflow: ellipsis; }

.pro-sec { background: var(--paper); }
.muted-p { margin: 0; font-size: 13px; color: var(--muted); }
.note { margin: 0; font-size: 13px; padding: 8px 10px; border-radius: var(--r); background: var(--sel-soft); color: var(--sel-ink); }
.note.warn { background: var(--accent-soft); color: var(--ink); }
.ex-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.conn.on i { background: #2B9A5A; }
.conn.connecting i, .conn.off i { background: #D4A21D; animation: pulse 1.4s ease-in-out infinite; }
.presence { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--paper); display: inline-grid; place-items: center; font: 600 10px/1 var(--f-mono); flex: none; }
.avatar.dim { background: var(--sunken); color: var(--muted); }
.inp.area { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.seg.small button { height: 24px; font-size: 12px; padding: 0 8px; }

.logform { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 6px; align-items: center; }
.logform #log-text { grid-column: 2; }
.logform .chk { font-size: 13px; }
.logform .chk svg { width: 14px; height: 14px; }
.logform button { justify-self: end; }
.loglist { list-style: none; margin: 0 -8px; padding: 0; display: flex; flex-direction: column; }
.loglist li { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 7px 8px; border-radius: var(--r); }
.loglist li:hover { background: var(--sunken); }
.loglist .lt { font: 500 13px/1.5 var(--f-mono); font-variant-numeric: tabular-nums; }
.loglist .lx { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.loglist .lx svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; color: var(--accent); }
.loglist .lx em { font: normal 500 11px var(--f-mono); color: var(--muted); }
.loglist .la { display: flex; gap: 2px; opacity: .6; }
.loglist li:hover .la { opacity: 1; }
.loglist li.done .lx, .loglist li.done .lt { color: var(--muted); text-decoration: line-through; }
.loglist li.fired { background: var(--accent-soft); }

.vol { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.vol input { width: 90px; }
.sounds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sound { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); text-align: left; }
.sound svg { width: 20px; height: 20px; margin-bottom: 4px; }
.sound b { font-size: 13px; }
.sound span { font-size: 11px; color: var(--muted); }
.sound:hover { background: var(--sunken); }
.sound.on { border-color: var(--accent); background: var(--accent-soft); }
.sound.on svg { color: var(--accent); }

.alarm-box { position: fixed; z-index: 2100; top: calc(64px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(460px, calc(100% - 32px)); box-sizing: border-box; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 10px; background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.alarm-box .btn { flex: none; }
.alarm-box .btn:not(.primary) { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.4); color: #fff; }
.alarm-box .btn.primary { background: #fff; color: var(--accent); border-color: #fff; }
.alarm-ic svg { width: 28px; height: 28px; animation: pulse 1s ease-in-out infinite; }
.alarm-t { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }

.scrim { position: fixed; inset: 0; z-index: 2000; background: rgba(12,18,20,.45); display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); overflow-y: auto; }
.dialog { width: 520px; max-width: 100%; box-sizing: border-box; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog h2 { margin: 0; font: 700 26px/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.dialog h3 { margin: 6px 0 0; font: 700 14px/1 var(--f-display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dialog p { margin: 0; color: var(--muted); }
.dialog p b { color: var(--ink); }
.dhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dform { display: flex; flex-direction: column; gap: 12px; }
.dform.inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; gap: 8px; }
.dform.inline .field { flex: 1; min-width: 160px; }
.dform.inline .field.narrow { flex: 0 0 130px; min-width: 0; }
.row.end { justify-content: flex-end; }
.err { margin: 0; color: var(--danger) !important; font-size: 13px; }
.planbox { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.planbox > div { background: var(--paper); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.planbox .muted, .planbox small { font-size: 12px; color: var(--muted); }
.planbox b { font: 500 16px var(--f-mono); }
.members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.members li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.members .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.members .who b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.members .who small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.members .role { font-size: 13px; color: var(--muted); }
.inp.sm { height: 30px; width: auto; padding: 0 6px; font-size: 13px; }
@media (max-width: 760px) {
  #pro-menu-btn .t { display: none; }
  .sounds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.h-anchor.paused { background: var(--c, #333); box-shadow: 0 0 0 3px #fff, 0 1px 4px rgba(0,0,0,.4); }
.pause-popup .leaflet-popup-content { margin: 10px 12px; }
.pause-pop { display: flex; align-items: flex-end; gap: 8px; font: 13px var(--f-body); }
.pause-pop label { display: flex; flex-direction: column; gap: 4px; color: #3E4A4F; }
.pause-pop label span { display: flex; align-items: center; gap: 6px; }
.pause-pop input { width: 70px; height: 30px; border: 1px solid #D6DCD7; border-radius: 6px; padding: 0 6px; font: 16px var(--f-mono); }
.plan .danger { color: var(--danger); }
.coord-popup .leaflet-popup-content { margin: 10px 12px; }
.coord-pop { display: flex; flex-direction: column; gap: 10px; font: 13px var(--f-body); color: #1A2124; }
.coord-pop table { border-collapse: collapse; }
.coord-pop th { text-align: left; font-weight: 500; color: #5B686D; padding: 3px 10px 3px 0; white-space: nowrap; font-size: 12px; }
.coord-pop .copy { border: 0; background: none; padding: 2px 4px; margin: -2px -4px; border-radius: 4px; font: 500 13px var(--f-mono); color: #1A2124; cursor: copy; text-align: left; }
.coord-pop .copy:hover { background: #E8ECE8; }
.login-opts { display: flex; flex-direction: column; gap: 8px; }
.login-btn { height: 44px; justify-content: center; font-weight: 500; text-decoration: none; color: var(--ink); }
.login-btn svg { width: 18px; height: 18px; }
a.btn { text-decoration: none; color: var(--ink); }
a.btn[disabled] { pointer-events: none; opacity: .45; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.mail-login summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.mail-login form { margin-top: 10px; }
.linkbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px; border-radius: var(--r); background: var(--sel-soft); }
.linkbox input { flex: 1; min-width: 200px; font: 13px var(--f-mono); }
.linkbox small { width: 100%; color: var(--muted); }
.avatar svg { width: 14px; height: 14px; }

/* Nedtrekkslister: egen pil med luft til kanten, i temaets farge. */
select.inp {
  -webkit-appearance: none; appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select.inp.sm { padding-right: 26px; background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%; }

.namerow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: var(--r); background: var(--paper); }
.namerow > div { display: flex; flex-direction: column; gap: 2px; }
.namerow b { font-weight: 500; font-size: 15px; }

/* Superadmin */
.dialog.wide { width: 860px; }
.planbox.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.adm-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; }
.adm-org { border: 1px solid var(--line); border-radius: var(--r); }
.adm-org summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; }
.adm-org summary .nm { font-weight: 600; }
.adm-org summary .meta { margin-left: auto; font: 12px var(--f-mono); color: var(--muted); }
.adm-org[open] summary { border-bottom: 1px solid var(--line); }
.adm-edit { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 12px; align-items: end; }
.adm-edit .field:first-child { grid-column: span 2; }
.adm-edit .full { grid-column: 1 / -1; }
.adm-edit .row .sp { flex: 1; }
.pill { font: 600 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .05em; padding: 4px 7px; border-radius: 99px; background: var(--sunken); color: var(--muted); }
.pill.lag, .pill.organisasjon { background: var(--sel-soft); color: var(--sel-ink); }
.pill.enterprise { background: var(--ink); color: var(--paper); }
.pill.stengt { background: var(--accent-soft); color: var(--danger); }
@media (max-width: 760px) { .adm-edit { grid-template-columns: 1fr 1fr; } .adm-org summary .meta { margin-left: 0; width: 100%; } }
