:root { --bg:#eef1f4; --panel:#ffffff; --ink:#1c2430; --mut:#5b6675; --line:#d4dae2; --acc:#1f6fd1; --warn:#c8641a; }
@media (prefers-color-scheme: dark) { :root { --bg:#12161c; --panel:#1a2029; --ink:#e6eaf0; --mut:#9aa6b5; --line:#2b3441; --acc:#6aa8ff; --warn:#f09b5a; } }
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--ink); font:14px/1.45 system-ui,-apple-system,Segoe UI,sans-serif; height:100vh; display:flex; flex-direction:column; }
header { padding:10px 16px; background:var(--panel); border-bottom:1px solid var(--line); display:flex; gap:14px; align-items:baseline; }
header span { color:var(--mut); }
main { flex:1; display:flex; min-height:0; }
#stage { flex:1; position:relative; min-width:0; }
#stage canvas { display:block; width:100%; height:100%; }
#labels { position:absolute; inset:0; pointer-events:none; overflow:hidden; }
.lbl { position:absolute; transform:translate(-50%,-50%); padding:1px 6px; border-radius:4px; font-size:12px; background:var(--panel); border:1px solid var(--line); white-space:nowrap; }
#splitter { flex:none; width:7px; margin:0 -3px 0 -4px; position:relative; z-index:5; cursor:col-resize; touch-action:none; background:transparent; }
#splitter::after { content:""; position:absolute; top:50%; left:2px; width:3px; height:44px; margin-top:-22px; border-radius:2px; background:var(--line); }
#splitter:hover::after, #splitter:focus-visible::after, #splitter.drag::after { background:var(--acc); }
#splitter:focus-visible { outline:2px solid var(--acc); outline-offset:-2px; }
body.dragging { cursor:col-resize; user-select:none; }
body.dragging #stage canvas { pointer-events:none; }
#panel { width:400px; flex:none; display:flex; flex-direction:column; min-height:0; background:var(--panel); border-left:1px solid var(--line); }
.panes { flex:1; min-height:0; overflow:auto; padding:14px 16px; }
.tabs { display:grid; grid-template-columns:repeat(5, 1fr); border-bottom:1px solid var(--line); flex:none; }
.tabs button { border:0; border-bottom:3px solid transparent; border-radius:0; background:transparent; font-weight:600; padding:12px 4px 9px; min-height:44px; color:var(--ink); }
.tabs button:hover { border-bottom-color:var(--line); }
.tabs button[aria-selected=true] { border-bottom-color:var(--acc); }
.tabs button:focus-visible { outline:2px solid var(--acc); outline-offset:-2px; }
[hidden] { display:none !important; }
#panel h2 { font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--mut); margin:14px 0 6px; }
#panel section > h2:first-child { margin-top:0; }
#panel h3 { font-size:13px; margin:14px 0 4px; }
label { display:block; margin:4px 0; }
.views { display:flex; gap:6px; margin:8px 0; flex-wrap:wrap; }
button { font:inherit; padding:4px 10px; border:1px solid var(--line); background:var(--bg); color:var(--ink); border-radius:6px; cursor:pointer; }
button:hover { border-color:var(--acc); }
table { width:100%; border-collapse:collapse; font-size:13px; }
th, td { text-align:left; padding:4px 6px 4px 0; border-bottom:1px solid var(--line); vertical-align:top; }
th { color:var(--mut); font-weight:500; font-size:11px; }
td.n { text-align:right; font-variant-numeric:tabular-nums; }
td.n .badge { display:inline-block; margin-top:2px; }
.badge { font-size:10px; padding:0 5px; border-radius:8px; border:1px solid var(--line); color:var(--mut); white-space:nowrap; }
.badge.official-copy { border-color:var(--acc); color:var(--acc); }
.badge.stated { border-color:var(--warn); color:var(--warn); }
.dev { color:var(--warn); font-size:12px; }
.hint { color:var(--mut); font-size:12px; }
ul { padding-left:18px; margin:4px 0; font-size:12px; color:var(--mut); }
@media (max-width: 800px) { #splitter { display:none; } main { flex-direction:column; } #panel { width:auto !important; width:auto; max-height:55vh; border-left:0; border-top:1px solid var(--line); } }

.proto { margin-left:auto; color:var(--warn); font-size:12px; }
.okk { color:#1a9a55; }
input[type=range] { width:100%; }
a { color:var(--acc); }

select { font:inherit; max-width:100%; }
.tree { list-style:none; padding-left:6px; margin:4px 0 8px; }
.tree li { cursor:pointer; padding:2px 4px; border-radius:4px; font-size:13px; color:var(--ink); }
.tree li:hover { background:var(--bg); }
.tree li.unplaced { color:var(--mut); }
details > summary { cursor:pointer; padding:3px 0; }

.scene { display:block; width:100%; text-align:left; margin:6px 0; padding:8px 10px; border-radius:8px; }
.scene strong { display:block; }
.scene span { color:var(--mut); font-size:12px; }
.scene[aria-pressed=true] { border-color:var(--acc); box-shadow:inset 3px 0 0 var(--acc); }
.scene .n { display:inline-block; min-width:1.4em; color:var(--acc); font-variant-numeric:tabular-nums; }

.colorrow { display:flex; align-items:center; gap:8px; margin:6px 0; }
.colorlabel { width:56px; font-size:13px; }
.swatches { display:flex; gap:6px; flex-wrap:wrap; }
.sw { width:34px; height:34px; min-height:34px; padding:0; border:2px solid var(--line); border-radius:6px; position:relative; overflow:hidden; cursor:pointer; background-clip:padding-box; }
.sw[aria-pressed=true] { outline:3px solid var(--acc); outline-offset:1px; }
.sw:focus-visible, .sw.free:focus-within { outline:3px solid var(--acc); outline-offset:1px; }
.sw.free { display:inline-block; margin:0; }
.sw.free input { position:absolute; inset:-6px; width:46px; height:46px; border:0; padding:0; cursor:pointer; opacity:1; }
.sw .tag { position:absolute; left:0; right:0; bottom:0; font-size:9px; line-height:11px; text-align:center; color:#fff; background:rgba(0,0,0,.45); pointer-events:none; }

label.inl { display:inline-block; margin:2px 10px 2px 0; }
.hidegrp { margin:2px 0 6px 18px; }
details.grp { border-top:1px solid var(--line); padding:6px 0 4px; }
details.grp > summary { font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--mut); font-weight:600; cursor:pointer; padding:6px 0; list-style:none; display:flex; align-items:center; gap:6px; min-height:32px; }
details.grp > summary::-webkit-details-marker { display:none; }
details.grp > summary::before { content:'▸'; display:inline-block; width:12px; transition:transform .12s; }
details.grp[open] > summary::before { transform:rotate(90deg); }
details.grp > summary:focus-visible { outline:2px solid var(--acc); outline-offset:2px; }
.grpbar { margin:2px 0 6px; }

/* Prova: sikte, text och hjälprad ovanpå vyn */
.tryset { border:1px solid var(--line); border-radius:6px; margin:10px 0; padding:6px 10px 8px; }
.tryset legend { font-size:12px; color:var(--mut); padding:0 4px; }
.tryset label { display:block; margin:4px 0; }
#walk-hud { position:absolute; inset:0; pointer-events:none; }
#walk-hud[hidden] { display:none; }
#walk-hud .xhair { position:absolute; left:50%; top:50%; width:8px; height:8px; margin:-4px 0 0 -4px; border-radius:50%; background:rgba(255,255,255,.85); box-shadow:0 0 0 1.5px rgba(20,24,30,.75); }
#walk-hud .prompt { position:absolute; left:50%; top:50%; transform:translate(-50%, 26px); text-align:center; padding:8px 14px; border-radius:8px; background:rgba(20,24,30,.82); color:#fff; min-width:200px; }
#walk-hud .prompt[hidden] { display:none; }
#walk-hud .pn { font-size:13px; opacity:.85; }
#walk-hud .pk { font-size:16px; font-weight:700; margin:2px 0; }
#walk-hud .pv { font-size:13px; color:#ffb877; }
#walk-hud .touchui[hidden], #walk-hud .stick[hidden] { display:none; }
#walk-hud .stick { position:absolute; width:112px; height:112px; margin:-56px 0 0 -56px; border-radius:50%; background:rgba(255,255,255,.18); box-shadow:0 0 0 2px rgba(255,255,255,.6); }
#walk-hud .stick .knob { position:absolute; left:50%; top:50%; width:44px; height:44px; margin:-22px 0 0 -22px; border-radius:50%; background:rgba(255,255,255,.75); box-shadow:0 0 0 1.5px rgba(20,24,30,.6); }
#walk-hud.touch .walkhint { left:10px; right:auto; transform:none; bottom:12px; max-width:calc(100% - 140px); white-space:normal; }
#walk-hud .tbtns { position:absolute; right:12px; bottom:12px; display:flex; flex-direction:column; gap:10px; align-items:flex-end; pointer-events:auto; }
#walk-hud .tbtns button { min-width:96px; min-height:48px; padding:10px 16px; border:0; border-radius:24px; background:rgba(20,24,30,.78); color:#fff; font-size:15px; font-weight:600; touch-action:none; }
#walk-hud .tbtns button.on { background:#ff7a00; }
#walk-hud .walkhint { position:absolute; left:50%; bottom:10px; transform:translateX(-50%); padding:4px 10px; border-radius:6px; background:rgba(20,24,30,.7); color:#fff; font-size:12px; white-space:nowrap; max-width:96%; overflow:hidden; text-overflow:ellipsis; }

/* Delar: kortet för den valda delen ligger kvar överst medan listan under rullar, så att inget hoppar när man väljer */
#sec-card { position:sticky; top:-14px; z-index:2; background:var(--panel); padding-top:14px; margin-top:-14px; border-top:0; border-bottom:1px solid var(--line); }
#sec-card #card { max-height:36vh; overflow:auto; }

#bal-live, #cost-live { position:sticky; top:-14px; z-index:2; background:var(--panel); padding-top:14px; margin-top:-14px; border-top:0; border-bottom:1px solid var(--line); }
#bal-live-body, #cost-live-body { max-height:38vh; overflow:auto; }
table.live td { padding:3px 6px 3px 0; }
details.grp > summary .sv { margin-left:auto; text-transform:none; letter-spacing:0; font-weight:500; color:var(--ink); font-size:12px; }
.dl { font-size:11px; font-weight:600; white-space:nowrap; }
.dl-ok { color:#1a9a55; } .dl-bad { color:var(--warn); }
.sheetplans { display:flex; flex-wrap:wrap; gap:10px; margin:8px 0; }
.sheetplan { margin:0; flex:1 1 220px; max-width:320px; color:var(--mut); }
.sheetplan svg { width:100%; height:auto; display:block; }

/* Mått & status (ADR-185). Färgen är aldrig ensam bärare: varje nivå har text och antal i förklaringen. */
.statbar { display:flex; height:14px; border:1px solid var(--line); border-radius:4px; overflow:hidden; margin:4px 0 8px; }
.statbar span { display:block; height:100%; }
.statleg { list-style:none; padding:0; margin:4px 0; font-size:13px; color:var(--ink); }
.statleg li { margin:4px 0; }
.statdot, .stdot { display:inline-block; width:10px; height:10px; border-radius:2px; border:1px solid var(--mut); margin-right:4px; vertical-align:baseline; }
.stg-stated, .stg-datasheet, .stm-maker, .stm-inkerb, .stm-volume { background:var(--acc); }
.stg-derived, .stm-calculated { background:color-mix(in srgb, var(--acc) 55%, var(--warn)); }
.stg-listing, .stm-listing { background:color-mix(in srgb, var(--acc) 30%, var(--warn)); }
.stg-estimated, .stm-typical, .stm-assumed { background:var(--warn); }
.stg-placeholder, .stm-missing { background:transparent; }

/* Roller (ADR-186) */
.persona { display:inline-flex; border:1px solid var(--line); border-radius:6px; overflow:hidden; }
.pbtn { display:inline-flex; align-items:center; gap:6px; border:0; border-radius:0; padding:2px 10px 2px 4px; background:transparent; color:var(--ink); }
.pbtn[aria-pressed=true] { background:var(--acc); color:#fff; }
.pbtn:focus-visible { outline:2px solid var(--acc); outline-offset:-2px; }
/* Processnavigering (ADR-252), i rubriken sedan ADR-256 */
.pbtn { padding:3px 10px; }
header { flex-wrap:wrap; row-gap:6px; align-items:center; }
header .phases { display:inline-flex; gap:2px; }
header .phases button { border:0; border-radius:6px; padding:5px 12px; background:transparent; color:var(--ink); font-weight:600; }
header .phases button[aria-pressed=true] { background:var(--acc); color:#fff; }
header .phases button:focus-visible { outline:2px solid var(--acc); outline-offset:1px; }
.model-bar { font-size:12px; }
.mb-row { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.mb-link { border:0; background:transparent; color:var(--acc); text-decoration:underline; padding:2px; }
header .namebar { flex:1 1 260px; min-width:0; display:flex; align-items:center; gap:12px; }
header #vehicle-name { flex:0 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mb-note-bar { padding:6px 16px; background:rgba(224,160,48,.22); border-bottom:1px solid var(--line); font-size:13px; display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.mb-note-bar[hidden] { display:none; }
.mb-note-bar > span { flex:1 1 320px; }
@media (max-width: 600px) { header #vehicle-name { display:none; } header .proto { font-size:11px; } .mb-row { gap:4px; } .mb-row > .hint { display:none; } header .phases button { padding:5px 9px; } }
.dim { opacity:.45; cursor:not-allowed; }
.tabs [role=tab].dim { text-decoration:line-through dotted; }
.pchoice { flex-direction:row !important; align-items:center !important; gap:12px; }
.pchoice img { border-radius:10px; object-fit:cover; flex:none; background:#fff; }
.pchoice .ptxt { display:flex; flex-direction:column; gap:2px; }

/* Visa-läget: mått, meddelande och lista över dolda delar (ADR-190) */
#dim-tip { position:absolute; z-index:5; pointer-events:none; max-width:250px; padding:6px 9px; border-radius:6px; background:var(--panel); color:var(--ink); border:1px solid var(--line); font-size:12px; box-shadow:0 2px 8px rgba(0,0,0,.25); }
#visa-toast { position:absolute; z-index:5; left:50%; bottom:16px; transform:translateX(-50%); max-width:80%; padding:7px 12px; border-radius:8px; background:var(--panel); color:var(--ink); border:1px solid var(--line); font-size:13px; box-shadow:0 2px 8px rgba(0,0,0,.25); pointer-events:none; }
#hidden-dialog { border:1px solid var(--line); border-radius:10px; background:var(--panel); color:var(--ink); width:min(440px, 90vw); max-height:70vh; padding:16px; }
#hidden-dialog::backdrop { background:rgba(0,0,0,.45); }
#hidden-dialog h2 { margin:0 0 6px; font-size:18px; text-transform:none; letter-spacing:0; color:var(--ink); }
#hidden-list { max-height:40vh; overflow:auto; }
ul.hid { list-style:none; padding:0; margin:4px 0; }
ul.hid button { width:100%; text-align:left; margin:2px 0; min-height:36px; }
.tk { font-size:12px; color:var(--mut); margin-top:2px; }
kbd { font:11px ui-monospace,monospace; padding:0 5px; border:1px solid var(--line); border-bottom-width:2px; border-radius:4px; background:var(--bg); color:var(--ink); }

label.variant { display:block; padding:10px 0; border-top:1px solid var(--line); }

/* Telefon (ADR-224): rubriken bryts i rader, rollväxlaren får plats och reglagen blir minst 36 px höga */
@media (max-width: 600px) {
  header { flex-wrap:wrap; row-gap:6px; align-items:center; padding:8px 12px; }
  header .proto { flex-basis:100%; }
  #vehicle-name { flex:1 1 auto; min-width:0; }
  .pbtn { min-height:36px; }
  #panel button, #panel select, #panel summary, #panel input[type=checkbox], #panel input[type=range] { min-height:36px; }
  #panel input[type=checkbox] { min-width:24px; }
}

/* Förhandsvisning i fliken Fordon (ADR-243) */
.pv-bar { display:flex; flex-wrap:wrap; gap:8px 14px; margin:6px 0; }
.pv-bar select { max-width:100%; }
.pv-stage { height:340px; border:1px solid var(--line); border-radius:6px; background:var(--bg); overflow:hidden; position:relative; }
.pv-stage canvas { display:block; }

/* Lagerbyggaren (ADR-244) */
.lyr-bar { display:flex; flex-wrap:wrap; gap:8px 14px; margin:6px 0; }
.lyr { display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:6px 0; border-top:1px solid var(--line); }
.lyr-n { width:34px; font-size:11px; color:var(--mut); text-transform:uppercase; }
.lyr select { max-width:100%; } .lyr input[type=number] { width:4.5em; }
.lyr button, .lyr-actions button { padding:2px 8px; }
.lyr-actions { display:flex; flex-wrap:wrap; gap:8px; margin:8px 0; }
.lyr-add { margin:6px 0; }

/* Planera (ADR-245) */
.pl-bar { display:flex; flex-wrap:wrap; gap:8px 14px; margin:6px 0; }
.pl-row { border-top:1px solid var(--line); }
.pl-row.open { background:color-mix(in srgb, var(--acc) 8%, transparent); }
.pl-pick { display:block; width:100%; text-align:left; border:0; background:transparent; padding:8px 4px; color:var(--ink); }
.pl-edit { padding:4px 4px 10px; display:grid; gap:6px; }
.pl-place, .pl-nudge, .pl-snap { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.pl-place input[type=number], .pl-edit input[type=number] { width:5.5em; }
.pl-nudge button, .pl-snap button { padding:2px 10px; min-width:32px; }
.pl-add, .pl-saved, .pl-veh { margin:6px 0; }

/* Presentationsläge (ADR-257): på smal skärm bara Scener, Visa och Prova */
body.presentation #phase-bar, body.presentation #model-bar, body.presentation #model-note { display:none; }
.pl-locked { opacity:.4; pointer-events:none; }

/* Biblioteksgalleri (ADR-259) */
.lib-filter { display:flex; gap:6px; margin:6px 0; } .lib-filter input { flex:1; min-width:0; }
.lib-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(92px,1fr)); gap:6px; max-height:324px; overflow-y:auto; padding-right:4px; } /* tre rader synliga, resten rullas: förhandsvisningen och Placera-knapparna syns direkt under */
.lib-card { display:flex; flex-direction:column; align-items:center; gap:2px; padding:4px; font-size:11px; text-align:center; border:1px solid var(--line); border-radius:6px; background:transparent; color:var(--ink); }
.lib-card img { width:80px; height:60px; object-fit:contain; } .lib-card.on { border-color:var(--acc); box-shadow:0 0 0 2px var(--acc); }
.lib-detail { margin-top:8px; } .lib-detail img { width:100%; max-width:320px; height:auto; display:block; } .lib-detail h3 { margin:6px 0 2px; }

/* Skiktens funktioner: värme, fukt, ljud (ADR-263) */
.fn { display:inline-flex; gap:3px; } .fn span { font-size:10px; padding:1px 5px; border-radius:8px; background:var(--line); color:var(--ink); }
.fn .fn-thermal { background:#f2c9a8; color:#3a2a1a; } .fn .fn-moisture { background:#b8d8f2; color:#1a2a3a; } .fn .fn-sound { background:#d4c8f0; color:#2a2040; }
.fn-sum { font-size:12px; margin:6px 0; display:grid; gap:2px; }

.gloss dt { font-weight:600; margin-top:8px; } .gloss dd { margin:2px 0 0 0; font-size:12px; } abbr[title] { text-decoration:underline dotted; cursor:help; }

/* Materialvalet (ADR-266) */
.mat-btn { text-align:left; max-width:100%; white-space:normal; }
.picker { border:1px solid var(--line); border-radius:8px; padding:8px; margin:6px 0; background:var(--panel); }
.picker-head { display:flex; gap:8px; align-items:baseline; flex-wrap:wrap; } .picker-head [data-picker-close] { margin-left:auto; }
.pg-h { font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--mut); margin:10px 0 4px; }
.po { border:1px solid var(--line); border-radius:6px; padding:6px 8px; margin:0 0 6px; } .po.cur { border-color:var(--acc); } .po.off { opacity:.6; }
.po-top { display:flex; gap:6px; align-items:center; flex-wrap:wrap; } .po-name { font-weight:600; text-align:left; border:0; background:transparent; color:var(--acc); padding:0; text-decoration:underline; cursor:pointer; } .po-name[disabled] { color:var(--mut); text-decoration:none; cursor:not-allowed; }
.tag { font-size:11px; padding:1px 7px; border-radius:8px; background:rgba(40,120,220,.15); }
.po-plain { font-size:13px; margin:3px 0; } .po-why { font-size:12px; color:#a33; }
.ecs { display:flex; flex-wrap:wrap; gap:4px; } .ec { font-size:12px; padding:1px 8px; border-radius:8px; } .ec.g { background:rgba(40,160,80,.18); } .ec.b { background:rgba(210,60,60,.16); } .ec.n { background:var(--line); }
.po-tech { font-size:12px; margin-top:4px; } .po-tech table td { padding:1px 6px 1px 0; vertical-align:top; }

.save-bar { display:inline-flex; align-items:center; gap:8px; }
.save-bar[hidden] { display:none; }
.save-bar button { border:1px solid var(--acc); background:var(--acc); color:#fff; border-radius:6px; padding:4px 14px; font-weight:600; }
.save-bar button:focus-visible { outline:2px solid var(--acc); outline-offset:2px; }
.save-bar #save-state { font-size:12px; white-space:nowrap; }
.save-bar.dirty #save-state { color:#b45309; font-weight:600; }
@media (max-width:600px) { .save-bar { display:none; } }

.iss { background:none; border:0; padding:2px 0; text-align:left; font:inherit; color:inherit; cursor:pointer; text-decoration:underline dotted; }
.iss:hover { background:rgba(229,36,43,.08); }
.grp-sym { opacity:.7; }
.pl-tr { border-collapse:collapse; width:100%; margin:6px 0; font-size:.85em; }
.pl-tr th, .pl-tr td { text-align:left; padding:4px 6px; border-bottom:1px solid var(--line, #8884); vertical-align:top; }

/* Belagt och obelagt (ADR-373) */
.vf-notice { margin:6px 0 10px; border:1px solid #d9a21b; background:rgba(217,162,27,.10); border-radius:6px; padding:6px 10px; font-size:13px; }
.vf-notice > summary { cursor:pointer; list-style:none; }
.vf-notice > summary::-webkit-details-marker { display:none; }
.vf-notice > summary .sv { color:var(--mut); text-decoration:underline; margin-left:4px; }
.vf-missing { border-color:#e5242b; background:rgba(229,36,43,.10); }
.vf-row { border-top:1px solid var(--line, #8884); padding:6px 0; }
.vf-mark { display:inline-block; width:1.3em; text-align:center; font-weight:700; }
.vf-unverified .vf-mark { color:#e5242b; } .vf-calculated .vf-mark { color:#b57b00; } .vf-proven .vf-mark { color:#2f7d32; }
.vf-lvl { font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--mut); margin-left:4px; }
@media print { .vf-notice { border:1px solid #000; background:none; } .vf-notice[open] { display:block; } }

/* Sidfot med upphovsrätt och villkor (Joakim 2026-11-23) */
#site-footer { flex:none; padding:4px 12px; border-top:1px solid var(--line, #8884); font-size:11px; color:var(--mut); background:var(--bg); }
#site-footer a { color:inherit; margin-left:8px; }
body.presentation #site-footer { font-size:10px; }

/* Konto (ADR-375) */
.account-bar { font-size:12px; display:inline-flex; gap:8px; align-items:center; margin-left:auto; padding:0 8px; }
.account-bar a, .account-bar .linklike { color:inherit; }
.linklike { background:none; border:0; padding:0; font:inherit; text-decoration:underline; cursor:pointer; }
