/* base.css - shared design system: tokens, type, buttons, fields, cards, chips, dialogs, map, demo bar.
   The brand colour (--brand*) is set from the business's settings at runtime: white label. */
@font-face { font-family: 'Familjen Grotesk'; font-style: normal; font-weight: 500 700; font-display: swap; src: url(../fonts/familjen-grotesk-latin-var.woff2) format('woff2'); }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/schibsted-grotesk-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/schibsted-grotesk-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/schibsted-grotesk-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/schibsted-grotesk-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); }

:root {
  color-scheme: light;
  --bg: #F5F4F0; --surface: #FFFFFF; --surface-2: #F8F7F4; --surface-3: #EFEDE8;
  --ink: #16191A; --ink-2: #3A4042; --ink-3: #5C6467; --muted: #6E7679; --faint: #A1A8AA;
  --line: #E1DFD9; --line-2: #ECEAE5;
  --brand: #1F6F5C; --brand-ink: #FFFFFF; --brand-2: #185A4A; --brand-soft: #E5F2EE; --brand-soft-2: #CDE6DE; --brand-line: #A9D3C6;
  --go: #12805A; --go-soft: #E1F4EA; --go-ink: #0B5E41;
  --warn: #A35F00; --warn-soft: #FCEFD7; --warn-ink: #7A4600;
  --crit: #C0362C; --crit-soft: #FBE4E1; --crit-ink: #922920;
  --info: #2457B8; --info-soft: #E4ECFA; --info-ink: #1A4089;
  --map-land: #F2F1EC; --map-water: #C9DCE5; --map-green: #DFE9D8; --map-road: #FFFFFF; --map-edge: #D3D6CE;
  --map-major: #FFFFFF; --map-major-edge: #BEC4BA; --map-service: #E7E8E2; --map-label: #5E6763; --map-halo: #F2F1EC;
  --shadow-1: 0 1px 2px rgba(22, 25, 26, .06), 0 1px 6px rgba(22, 25, 26, .04);
  --shadow-2: 0 4px 12px rgba(22, 25, 26, .07), 0 18px 44px rgba(22, 25, 26, .10);
  --font-display: "Familjen Grotesk", "Schibsted Grotesk", system-ui, sans-serif;
  --font-ui: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r-s: 8px; --r-m: 12px; --r-l: 18px; --r-xl: 24px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.012em; line-height: 1.15; margin: 0 0 .4em; color: var(--ink); }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 17px; } h4 { font-size: 15px; }
p { margin: 0 0 .8em; }
a { color: var(--brand); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3.5px; }
.ic.lg { width: 22px; height: 22px; } .ic.sm { width: 15px; height: 15px; vertical-align: -2.5px; }
.mono { font-family: var(--font-data); font-feature-settings: "tnum"; letter-spacing: -.01em; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.strong { font-weight: 700; } .center { text-align: center; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; } .row.gap { gap: 10px; } .row.gap-s { gap: 6px; } .row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; } .row.end { justify-content: flex-end; } .row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; } .stack > * + * { margin-top: 10px; } .stack-s > * + * { margin-top: 6px; } .stack-l > * + * { margin-top: 18px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line-2); margin: 14px 0; }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14.5px; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; }
.btn:hover { background: var(--surface-2); border-color: #d2cfc7; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, .seg button:focus-visible, .tslot:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 2px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-2); }
.btn.soft:hover { background: var(--brand-soft-2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.danger-soft { background: var(--crit-soft); border-color: transparent; color: var(--crit-ink); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.lg { min-height: 52px; font-size: 16px; padding: 0 22px; border-radius: 14px; }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; gap: 6px; }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: 40px; } .btn.sm.icon { width: 32px; }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* ------------------------------------------------------------------ fields */
.field { display: block; }
.field > .lbl, .lbl { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.field .err { font-size: 12.5px; color: var(--crit); margin-top: 5px; }
.inp, select.inp, textarea.inp { width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.inp { min-height: 80px; resize: vertical; line-height: 1.45; }
.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.inp.bad { border-color: var(--crit); }
.inp-wrap { position: relative; } .inp-wrap .ic { position: absolute; left: 13px; top: 13px; color: var(--muted); pointer-events: none; } .inp-wrap .inp { padding-left: 40px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 520px) { .grid2.collapse, .grid3.collapse { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; line-height: 1.4; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
input[type=range] { width: 100%; accent-color: var(--brand); }

/* segmented control */
.seg { display: flex; padding: 3px; gap: 3px; background: var(--surface-3); border-radius: 12px; }
.seg button { flex: 1; border: 0; background: transparent; min-height: 38px; padding: 0 10px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--ink-3); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg.sm button { min-height: 30px; font-size: 12.5px; }
/* switch */
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #CFCCC4; transition: background .15s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 2px; }
/* stepper */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.stepper button { width: 40px; height: 40px; border: 0; background: none; display: grid; place-items: center; color: var(--ink-2); border-radius: 11px; }
.stepper button:hover { background: var(--surface-2); }
.stepper .val { min-width: 64px; text-align: center; font-weight: 700; font-family: var(--font-data); }

/* ------------------------------------------------------------------ surfaces */
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow-1); }
.card.pad { padding: 18px; } .pad { padding: 18px; } .pad-s { padding: 12px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { margin: 0; font-size: 15.5px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.note .ic { margin-top: 1px; }
.note.go { background: var(--go-soft); color: var(--go-ink); } .note.warn { background: var(--warn-soft); color: var(--warn-ink); }
.note.crit { background: var(--crit-soft); color: var(--crit-ink); } .note.info { background: var(--info-soft); color: var(--info-ink); }
.note.brand { background: var(--brand-soft); color: var(--brand-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip .av { margin-left: -6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.badge.go { background: var(--go-soft); color: var(--go-ink); } .badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.crit { background: var(--crit-soft); color: var(--crit-ink); } .badge.info { background: var(--info-soft); color: var(--info-ink); }
.badge.brand { background: var(--brand-soft); color: var(--brand-2); } .badge.dark { background: var(--ink); color: #fff; }
.badge .ic { width: 13px; height: 13px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.av { display: inline-grid; place-items: center; border-radius: 50%; background: var(--av, #888); color: #fff; font-weight: 700; flex: none; letter-spacing: .01em; line-height: 1; box-shadow: 0 0 0 2px var(--surface); }
.stars { display: inline-flex; gap: 1px; color: #E3A008; } .stars .ic { width: 15px; height: 15px; }
.kpi .v { font: 700 26px/1.1 var(--font-display); letter-spacing: -.02em; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .s { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; font-size: 14px; }
.empty .ic { width: 28px; height: 28px; color: var(--faint); display: block; margin: 0 auto 8px; }
.list > .li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-2); }
.list > .li:first-child { border-top: 0; }
.list > .li.click { cursor: pointer; } .list > .li.click:hover { background: var(--surface-2); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr.click { cursor: pointer; } .table tr.click:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 14px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.tabs .cnt { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--surface-3); font-size: 11.5px; margin-left: 4px; }
.tabs button.on .cnt { background: var(--brand-soft); color: var(--brand-2); }
.price-lines { font-size: 14px; }
.price-lines .pl { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }
.price-lines .pl.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 16px; }
.price-lines .pl .mono { white-space: nowrap; }
.price-lines .pl.minus .mono { color: var(--go-ink); }

/* ------------------------------------------------------------------ toasts & dialogs */
#toasts { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 15px; border-radius: 13px; box-shadow: var(--shadow-2); font-size: 14px; line-height: 1.4; opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s; pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; }
.toast.in { opacity: 1; transform: none; }
.toast.go { background: var(--go-ink); } .toast.warn { background: var(--warn-ink); }
.toast .ic { margin-top: 1px; }
.dlg-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.dlg-bg { position: absolute; inset: 0; background: rgba(18, 20, 20, .38); opacity: 0; transition: opacity .2s; }
.dlg { position: relative; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-2); width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; opacity: 0; transform: translateY(10px) scale(.985); transition: opacity .2s, transform .2s; }
.dlg-wrap.wide .dlg { width: min(760px, 100%); }
.dlg-wrap.in .dlg-bg { opacity: 1; } .dlg-wrap.in .dlg { opacity: 1; transform: none; }
.dlg-wrap.side { place-items: stretch end; padding: 0; }
.dlg-wrap.side .dlg { width: min(520px, 100vw); height: 100%; max-height: none; border-radius: 0; transform: translateX(30px); }
.dlg-wrap.side.in .dlg { transform: none; }
.dlg-pad { padding: 22px; } .dlg-pad h3 { font-size: 19px; }
.dlg-head { position: sticky; top: 0; z-index: 2; background: var(--surface); display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.dlg-head h3 { margin: 0; font-size: 17px; }
.dlg-foot { position: sticky; bottom: 0; background: var(--surface); padding: 14px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 600px) {
  .dlg-wrap:not(.side) { place-items: end stretch; padding: 0; }
  .dlg-wrap:not(.side) .dlg { width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; transform: translateY(30px); }
  .dlg-wrap:not(.side).in .dlg { transform: none; }
}

/* ------------------------------------------------------------------ map */
.map-slot { position: relative; overflow: hidden; background: var(--map-land); border-radius: var(--r-m); }
.mapview { position: absolute; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.mapview.dragging { cursor: grabbing; }
.mapview svg.m { width: 100%; height: 100%; display: block; }
.m .land { fill: var(--map-land); } .m .green { fill: var(--map-green); stroke: none; } .m .water { fill: var(--map-water); stroke: none; fill-rule: evenodd; }
.m use.road { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.m .service { stroke: var(--map-service); stroke-width: var(--w-service, .6px); }
.m .minor-c { stroke: var(--map-edge); stroke-width: var(--w-minor-c, 1.6px); } .m .mid-c { stroke: var(--map-edge); stroke-width: var(--w-mid-c, 2.4px); } .m .major-c { stroke: var(--map-major-edge); stroke-width: var(--w-major-c, 3.4px); }
.m .minor { stroke: var(--map-road); stroke-width: var(--w-minor, 1px); } .m .mid { stroke: var(--map-road); stroke-width: var(--w-mid, 1.6px); } .m .major { stroke: var(--map-major); stroke-width: var(--w-major, 2.4px); }
.m .rt { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.m .rt-casing { stroke: var(--surface); }
.m .rt-dash { animation: dash 1.2s linear infinite; }
.m .area { fill: var(--brand); fill-opacity: .06; stroke: var(--brand); stroke-opacity: .35; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.m .place { font: 600 11px var(--font-ui); fill: var(--map-label); paint-order: stroke; stroke: var(--map-halo); stroke-width: 3px; stroke-linejoin: round; text-anchor: middle; letter-spacing: .02em; }
.m .place.big { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.m .mk { cursor: pointer; }
.m .mk-label { font: 700 11px var(--font-ui); fill: var(--ink); }
.m .mk-text { font: 700 10px var(--font-ui); fill: #fff; text-anchor: middle; dominant-baseline: central; }
.m .pulse { animation: pulse 1.8s ease-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes pulse { 0% { opacity: .5; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.9); } }
@keyframes dash { to { stroke-dashoffset: -14; } }
.map-ctrl { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.map-ctrl button { width: 32px; height: 32px; border-radius: 9px; background: var(--surface); box-shadow: var(--shadow-1); border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--ink-2); }
.map-attr { position: absolute; left: 8px; bottom: 6px; font-size: 10px; color: var(--muted); background: color-mix(in srgb, var(--surface) 80%, transparent); padding: 1px 6px; border-radius: 5px; z-index: 2; pointer-events: none; }

/* ------------------------------------------------------------------ demo bar (not part of the product: it runs the demo) */
.demobar { position: fixed; left: 12px; bottom: 12px; z-index: 50; display: flex; align-items: center; gap: 4px; padding: 5px; background: #1B1F20; color: #fff; border-radius: 14px; box-shadow: var(--shadow-2); font-size: 12.5px; max-width: calc(100vw - 24px); }
.demobar .tag { font: 700 10.5px var(--font-ui); letter-spacing: .12em; padding: 0 8px; color: #F7C948; }
.demobar .clock { font-family: var(--font-data); font-weight: 500; padding: 0 8px; border-left: 1px solid #3A4042; }
.demobar button, .demobar a { border: 0; background: transparent; color: #fff; height: 30px; padding: 0 9px; border-radius: 9px; display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12.5px; text-decoration: none; white-space: nowrap; }
.demobar button:hover, .demobar a:hover { background: #2E3436; }
.demobar .ic { width: 15px; height: 15px; }
.demobar.min { padding: 3px; }
.demobar .tag-btn { gap: 2px; padding: 0 6px 0 0; } .demobar .tag-btn .clock { border-left: 0; padding: 0 4px; }
@media (max-width: 760px) { .demobar:not(.min) { flex-wrap: wrap; } .demobar .clock { border-left: 0; } }
@media (max-width: 640px) { .demobar .lbl-s { display: none; } }
@media print { .demobar, #toasts { display: none !important; } }
