/* Tema: mørkt er standard i produktionen; lyst kan vælges i Indstillinger. */
:root {
  --bg: #f2f3f5; --surface: #ffffff; --surface-2: #eceef1; --ink: #0d1117; --ink-2: #5b6370;
  --line: #e1e4e8; --accent: #0a6cff; --accent-ink: #ffffff; --icon: #0a6cff; --amber: #f5a524;
  --ok: #157f3b; --ok-bg: #e4f4e9; --warn: #9a5b00; --warn-bg: #fff3dc; --bad: #b42318; --bad-bg: #fde8e6;
  --hero-1: #ffffff; --hero-2: #e7ebf0; --hero-line: rgba(10, 30, 60, .05);
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 18px rgba(0,0,0,.06);
  --iso-P: #1f63c6; --iso-M: #c99a00; --iso-K: #c62828; --iso-N: #2e8b3a; --iso-S: #b4600f; --iso-H: #5f6b7a; --iso-O: #7b4bb3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1c1c1f; --surface-2: #2a2a2e; --ink: #f2f2f4; --ink-2: #9a9aa2;
    --line: #2c2c31; --accent: #1a7cff; --icon: #8cc8ff; --ok: #5fd28a; --ok-bg: #102a1a; --warn: #ffc15e;
    --warn-bg: #2b2110; --bad: #ff8a80; --bad-bg: #2e1513; --hero-1: #1a1b1e; --hero-2: #000000;
    --hero-line: rgba(255,255,255,.035); --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1f; --surface-2: #2a2a2e; --ink: #f2f2f4; --ink-2: #9a9aa2;
  --line: #2c2c31; --accent: #1a7cff; --icon: #8cc8ff; --ok: #5fd28a; --ok-bg: #102a1a; --warn: #ffc15e;
  --warn-bg: #2b2110; --bad: #ff8a80; --bad-bg: #2e1513; --hero-1: #1a1b1e; --hero-2: #000000;
  --hero-line: rgba(255,255,255,.035); --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; }
h2 { font-size: 18px; font-weight: 600; }
small { color: var(--ink-2); }
svg.ln { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

main { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.loading { color: var(--ink-2); text-align: center; padding: 60px 0; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--ink-2); }
.caps { text-transform: uppercase; letter-spacing: .3px; }

/* Undersidehoved: rund tilbage-knap + titel i midten */
.phead {
  position: sticky; top: 0; z-index: 8; display: grid; grid-template-columns: 52px 1fr 52px; align-items: center;
  margin: 0 -16px 8px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg);
}
.phead h1 { text-align: center; font-size: 19px; font-weight: 500; text-transform: uppercase; letter-spacing: .3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round {
  width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--surface); display: grid; place-items: center;
  cursor: pointer; box-shadow: var(--shadow); text-decoration: none;
}
.round svg { width: 22px; height: 22px; }

/* Bundmenu: svævende pille som i Seco-appen */
.nav {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  width: min(calc(100% - 28px), 460px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 40px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px; border-radius: 32px; font-size: 12px; text-decoration: none; color: var(--ink-2); }
.nav svg { width: 25px; height: 25px; }
.nav a.on { color: var(--accent); background: var(--surface-2); font-weight: 600; }

/* Forside */
.hero {
  margin: 0 -16px; padding: calc(28px + env(safe-area-inset-top)) 16px 28px; text-align: center; position: relative;
  background: repeating-linear-gradient(120deg, transparent 0 22px, var(--hero-line) 22px 24px), linear-gradient(180deg, var(--hero-1), var(--hero-2));
}
.logo { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; }
.logo b { background: var(--accent); color: #fff; font-weight: 900; padding: 3px 9px; border-radius: 7px; letter-spacing: .5px; }
.hero h1 { font-size: 34px; font-weight: 600; margin: 44px 0 22px; letter-spacing: -.3px; }
.hero .theme-btn { position: absolute; right: 16px; top: calc(20px + env(safe-area-inset-top)); }
.demo-chip { display: inline-block; margin-top: 10px; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); }
.search { position: relative; }
.search input {
  width: 100%; height: 58px; padding: 0 16px 0 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 18px;
}
.search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--ink-2); }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.qres { text-align: left; margin-top: 12px; }

.sect-title { font-size: 20px; font-weight: 600; margin: 26px 0 12px; }
.cats { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.catcard {
  flex: none; width: 44%; min-width: 156px; max-width: 220px; aspect-ratio: 4 / 5; scroll-snap-align: start; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; padding: 16px; display: flex; flex-direction: column; justify-content: flex-end;
  position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.catcard .art { position: absolute; inset: 10px 10px 40% 10px; display: grid; place-items: center; color: var(--icon); opacity: .95; }
.catcard .art svg { width: 100%; height: 100%; }
.catcard .mini { width: 34px; height: 34px; color: var(--icon); margin-bottom: 10px; }
.catcard b { font-size: 20px; font-weight: 500; }

/* Kategori-fliser */
.gtiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gtile {
  aspect-ratio: 3 / 4; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 14px; text-align: center; box-shadow: var(--shadow);
}
.gtile svg { width: 70%; max-width: 130px; height: auto; color: var(--icon); }
.gtile b { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; font-size: 15px; font-weight: 500; text-transform: uppercase; letter-spacing: .3px; line-height: 1.25; }
.gtile small { margin-top: -10px; }

/* Rækker med billede + VERSALTEKST + pil */
.rows { border-top: 1px solid var(--line); }
.rowitem {
  display: grid; grid-template-columns: 72px 1fr 20px; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line);
  text-decoration: none; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; cursor: pointer;
}
.rowitem .thumb { width: 72px; height: 72px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; }
.rowitem .thumb svg { width: 46px; height: 46px; }
.rowitem .t1 { display: block; font-size: 16px; font-weight: 500; text-transform: uppercase; letter-spacing: .2px; line-height: 1.3; }
.rowitem .t2 { display: block; font-size: 13px; color: var(--ink-2); margin-top: 3px; font-variant-numeric: tabular-nums; }
.rowitem .t2 b { color: var(--ink); }
.rowitem .chev { color: var(--ink-2); font-size: 26px; line-height: 1; }
.rowitem .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rowitem .quick { grid-column: 2 / -1; font-size: 14px; background: var(--ok-bg); color: var(--ok); padding: 8px 10px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.rowitem .quick b { color: inherit; }
.rowitem .why { grid-column: 2 / -1; font-size: 13px; color: var(--ink-2); margin: 0; padding-left: 18px; }
.rowitem .why .bad { color: var(--warn); }

/* Værktøjer-liste (ikon + titel + forklaring) */
.ulist { margin-top: 8px; }
.uitem {
  display: grid; grid-template-columns: 64px 1fr; gap: 18px; align-items: center; padding: 22px 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
.uitem svg { width: 56px; height: 56px; color: var(--ink); }
.uitem b { display: block; font-size: 20px; font-weight: 500; }
.uitem span span { display: block; color: var(--ink-2); font-size: 16px; margin-top: 4px; }

/* Indstillinger */
.slist { border-top: 1px solid var(--line); }
.sitem { display: grid; grid-template-columns: 34px 1fr auto; gap: 16px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.sitem svg { width: 28px; height: 28px; color: var(--icon); }
.sitem b { font-weight: 500; font-size: 18px; display: block; }
.sitem small { display: block; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.seg button { min-height: 46px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button svg { width: 18px; height: 18px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.2); }

/* Kort, knapper, felter */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.card h2 { margin-bottom: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; cursor: pointer; font-weight: 600; font-size: 16px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent { background: var(--amber); border-color: var(--amber); color: #1d1300; }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn.on { border-color: var(--amber); background: var(--warn-bg); }
.btn svg { width: 22px; height: 22px; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btns .wide { grid-column: 1 / -1; }

input[type="text"], select, textarea, .fi input {
  width: 100%; min-height: 52px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 17px;
}
.card input[type="text"], .card select, .card textarea, .card .fi input { background: var(--surface-2); }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 1px; }
label.lbl { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag { display: inline-flex; align-items: center; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.iso { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 5px; color: #fff; font-size: 12px; font-weight: 800; }
.iso-P { background: var(--iso-P); } .iso-M { background: var(--iso-M); } .iso-K { background: var(--iso-K); }
.iso-N { background: var(--iso-N); } .iso-S { background: var(--iso-S); } .iso-H { background: var(--iso-H); } .iso-O { background: var(--iso-O); }
.iso.lg { min-width: 46px; height: 46px; font-size: 22px; border-radius: 10px; }

.tool-ico { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool-ico .hl { stroke: var(--amber); }

/* Beregner */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fld { display: flex; flex-direction: column; gap: 4px; }
.fl { font-weight: 700; font-size: 15px; }
.fl small { font-weight: 400; }
.fi { position: relative; }
.fi input { padding-right: 70px; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fi em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 13px; color: var(--ink-2); pointer-events: none; }
.fh { font-size: 12px; color: var(--ok); min-height: 16px; }
.fld.warn input { border-color: var(--amber); background: var(--warn-bg); }
.fld.warn .fh { color: var(--warn); font-weight: 600; }

.result { background: var(--accent); color: #fff; border-radius: 18px; padding: 16px; position: sticky; top: calc(70px + env(safe-area-inset-top)); z-index: 5; box-shadow: 0 8px 24px rgba(10,108,255,.3); }
.big { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big div { display: flex; flex-direction: column; }
.big small { color: rgba(255,255,255,.8); font-size: 13px; }
.big b { font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.big span { font-size: 13px; color: rgba(255,255,255,.8); }
.res-src { margin-top: 10px; font-size: 12px; color: rgba(255,255,255,.85); }

details.more summary { cursor: pointer; font-weight: 600; padding: 4px 0; list-style: none; color: var(--accent); }
details.more[open] summary { margin-bottom: 10px; }
details.more summary::before { content: '▸ '; }
details.more[open] summary::before { content: '▾ '; }
table.t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.t th, table.t td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 15px; }
table.t th { color: var(--ink-2); font-weight: 500; }
table.t td.num { text-align: right; font-weight: 600; white-space: nowrap; }
.formulas { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--ink-2); margin: 10px 0 0; padding-left: 18px; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.cmp th, table.cmp td { min-width: 120px; }
table.cmp th:first-child { min-width: 96px; position: sticky; left: 0; background: var(--surface); }

.msg { padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.warn { background: var(--warn-bg); color: var(--warn); }
.msg.bad { background: var(--bad-bg); color: var(--bad); }
.msg.info { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }

.prod-head { display: grid; grid-template-columns: 84px 1fr; gap: 16px; align-items: center; }
.prod-head .ico { width: 84px; height: 84px; border-radius: 14px; background: var(--surface); display: grid; place-items: center; border: 1px solid var(--line); }
.prod-head .ico svg { width: 56px; height: 56px; }
.prod-head h2 { font-size: 20px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-variant-numeric: tabular-nums; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

.scanbox { position: relative; aspect-ratio: 3 / 4; max-height: 60vh; width: 100%; border-radius: 18px; overflow: hidden; background: #000; }
.scanbox video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanbox .frame { position: absolute; inset: 22% 14%; border: 3px solid var(--accent); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0,0,0,.4); }
.scanbox .frame::after { content: ''; position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: var(--accent); animation: sweep 1.8s ease-in-out infinite; }
@keyframes sweep { 0%, 100% { transform: translateY(-60px); } 50% { transform: translateY(60px); } }
.scanbox .start { position: absolute; inset: 0; display: grid; place-items: center; }
.scanbox.live .start { display: none; }
.scanbox:not(.live) .frame { display: none; }

.tabs2 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 14px; }
.tabs2 button { min-height: 42px; border: 0; background: none; border-radius: 10px; font-weight: 600; cursor: pointer; color: var(--ink-2); font-size: 14px; }
.tabs2 button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.2); }

.empty { text-align: center; color: var(--ink-2); padding: 30px 8px; }
.empty svg { width: 44px; height: 44px; }

@media (max-width: 380px) {
  .big b { font-size: 28px; }
  .hero h1 { font-size: 28px; }
}
@media (min-width: 640px) {
  .fields { grid-template-columns: repeat(3, 1fr); }
  .gtiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.qres:empty { display: none; }
.qres { border-top: 0; }

/* Scanner i fuld skærm */
body.noscroll { overflow: hidden; }
.scanner { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; overflow: hidden; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.scanner::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.1) 30%, rgba(0,0,0,.1) 65%, rgba(0,0,0,.6)); pointer-events: none; z-index: 1; }
.scanner > *:not(video) { z-index: 2; }
.sc-top { position: absolute; left: 24px; right: 24px; top: calc(70px + env(safe-area-inset-top)); margin: 0; text-align: center; font-size: 20px; line-height: 1.35; }
.sc-frame { position: absolute; left: 7%; right: 7%; top: 50%; transform: translateY(-58%); aspect-ratio: 1; border: 2px solid rgba(255,255,255,.85); border-radius: 14px; }
.sc-cross { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; transform: translate(-50%, -50%); }
.sc-cross::before, .sc-cross::after { content: ''; position: absolute; background: #fff; border-radius: 3px; box-shadow: 0 0 6px rgba(0,0,0,.5); }
.sc-cross::before { left: 0; right: 0; top: 50%; height: 5px; margin-top: -2.5px; }
.sc-cross::after { top: 0; bottom: 0; left: 50%; width: 5px; margin-left: -2.5px; }
.scanner.hit .sc-frame { border-color: #4ade80; box-shadow: 0 0 0 4px rgba(74,222,128,.4); }
.sc-ctrl { position: absolute; left: 0; right: 0; bottom: calc(130px + env(safe-area-inset-bottom)); display: flex; justify-content: center; align-items: center; gap: 18px; }
.sc-zoom { display: flex; gap: 4px; padding: 5px; border-radius: 40px; background: rgba(255,255,255,.35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.sc-zoom button { width: 62px; height: 52px; border: 0; border-radius: 30px; background: none; color: #fff; font-size: 18px; font-weight: 600; cursor: pointer; }
.sc-zoom button.on { background: #000; }
.sc-torch { width: 62px; height: 62px; border: 0; border-radius: 14px; background: #000; color: #8cc8ff; display: grid; place-items: center; cursor: pointer; }
.sc-torch svg { width: 30px; height: 30px; }
.sc-torch.on { background: #fff; color: #0a6cff; }
.sc-close { position: absolute; left: 24px; right: 24px; bottom: calc(30px + env(safe-area-inset-bottom)); height: 62px; border-radius: 12px; border: 1.5px solid rgba(255,255,255,.8); background: rgba(0,0,0,.15); color: #fff; font-size: 20px; cursor: pointer; }
.sc-sheet { position: absolute; left: 16px; right: 16px; bottom: calc(110px + env(safe-area-inset-bottom)); background: #1c1c1f; border-radius: 16px; padding: 16px; display: grid; gap: 10px; z-index: 3 !important; }
.sc-sheet b { font-size: 18px; color: #ff8a80; }
.sc-sheet span { color: #c8c8cc; font-size: 15px; }
.sc-sheet .btn { background: #2a2a2e; border-color: #3a3a3f; color: #fff; }
.sc-sheet .btn.primary { background: var(--accent); border-color: var(--accent); }
.sc-torch[hidden], .sc-sheet[hidden] { display: none; }

/* Rigtige produktbilleder fra KJV (hvid baggrund som i kataloget) */
.rowitem .thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; border-radius: 9px; padding: 4px; }
.rowitem .thumb:has(img) { background: #fff; }
.prod-img { background: #fff; border-radius: 16px; border: 1px solid var(--line); display: grid; place-items: center; height: 230px; padding: 12px; }
.prod-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.catcard .art.photo { inset: 0 0 38% 0; background: #fff; }
.catcard .art.photo img { width: 100%; height: 100%; object-fit: contain; padding: 14px; }
.catcard small { color: var(--ink-2); margin-top: 2px; }
.btn.sm svg { width: 18px; height: 18px; }
.rowitem .thumb { overflow: hidden; }
.rowitem .thumb img { display: block; max-width: 72px; max-height: 72px; }
.catcard .art.photo { display: block; overflow: hidden; border-radius: 16px 16px 0 0; }
.catcard .art.photo img { display: block; }
.catcard .art.photo + .mini { display: none; }

/* Strategier og materialeguide */
svg.diag { width: 100%; max-width: 260px; height: auto; color: var(--icon); display: block; margin: 0 auto; }
svg.diag .hl { stroke: var(--amber); }
svg.diag text { fill: var(--ink-2); stroke: none; font-size: 7px; }
.vrow { display: grid; grid-template-columns: 1fr; gap: 4px; }
.vrow b { font-size: 14px; font-variant-numeric: tabular-nums; }
.vbar { position: relative; height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.vbar i { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--amber)); }
.mat.flash { outline: 3px solid var(--amber); }

/* Galleri */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gcard { display: flex; flex-direction: column; gap: 8px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.gcard .gimg { aspect-ratio: 1; background: #fff; border-radius: 10px; display: grid; place-items: center; overflow: hidden; }
.gcard .gimg img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.gcard b { font-size: 13px; font-weight: 600; line-height: 1.25; }
a.chip { display: inline-flex; align-items: center; text-decoration: none; }
@media (min-width: 640px) { .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* AI-assistent: flydende boble + chat */
.ai-bubble { position: fixed; z-index: 60; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(10,108,255,.45); touch-action: none; cursor: grab; transition: left .25s, top .25s, transform .15s; }
.ai-bubble svg { width: 28px; height: 28px; }
.ai-bubble.dragging { transition: none; transform: scale(1.1); cursor: grabbing; }
.ai-panel { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.ai-panel header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 18px; }
.ai-x { border: 0; background: var(--surface); color: var(--ink); border-radius: 999px; min-width: 40px; height: 40px; margin-left: 8px; font-size: 15px; padding: 0 12px; cursor: pointer; }
.ai-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; line-height: 1.45; font-size: 16px; word-wrap: break-word; }
.ai-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.ai-msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.ai-msg.thinking { color: var(--ink-2); font-style: italic; }
.ai-msg img { display: block; width: 120px; border-radius: 10px; margin-bottom: 6px; }
.ai-msg ul { margin: 4px 0; padding-left: 18px; }
.ai-msg a.sku { color: var(--accent); font-weight: 700; }
.ai-hello { color: var(--ink-2); text-align: center; padding: 24px 8px 8px; }
.ai-hello b { color: var(--ink); font-size: 18px; }
.ai-sug { display: grid; gap: 8px; }
.ai-sug button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; font-size: 15px; cursor: pointer; }
.ai-img { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.ai-img img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.ai-img button { margin-left: auto; border: 0; background: none; color: var(--ink-2); font-size: 18px; }
.ai-form { display: grid; grid-template-columns: 48px 1fr 48px; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.ai-form input[type=text] { min-height: 48px; border-radius: 24px; background: var(--surface-2); border: 1px solid var(--line); padding: 0 16px; font-size: 16px; width: 100%; }
.ai-cam, #aiSend { width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; }
.ai-cam { background: var(--surface-2); color: var(--ink); }
#aiSend { background: var(--accent); color: #fff; }
.ai-cam svg, #aiSend svg { width: 24px; height: 24px; }
.ai-panel[hidden], .ai-img[hidden] { display: none; }
.prod-img { overflow: hidden; } .prod-img img { display: block; max-height: 206px; width: auto; }
.btns3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .btns3 .btn { min-height: 48px; font-size: 14px; padding: 0 6px; }
.user-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #7b4bb3; color: #fff; letter-spacing: .2px; }
input[type="date"] { width: 100%; min-height: 52px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 17px; color: var(--ink); }

/* Visuelle fræsestrategier */
.strat-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.strat-tabs button { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; }
.strat-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.strat-draw { background: var(--surface-2); border-radius: 14px; padding: 6px; }
.strat-svg { width: 100%; height: auto; display: block; }
.strat-svg .wp-t { fill: #c9ced6; stroke: #7b8594; stroke-width: .8; }
.strat-svg .wp-f { fill: #a9b0bb; stroke: #7b8594; stroke-width: .8; }
.strat-svg .wp-r { fill: #8e96a3; stroke: #7b8594; stroke-width: .8; }
.strat-svg .bg { fill: var(--surface-2); stroke: none; }
.strat-svg .cut-floor { fill: #e9ecf0; stroke: #7b8594; stroke-width: .8; }
.strat-svg .cut-wall { fill: #b5bcc6; stroke: #7b8594; stroke-width: .8; }
.strat-svg .cut-wall2 { fill: #9ea6b1; stroke: #7b8594; stroke-width: .8; }
.strat-svg .tool { fill: #5a6372; stroke: #2e3440; stroke-width: .8; }
.strat-svg .tool-top { fill: #8a94a5; stroke: #2e3440; stroke-width: .8; }
.strat-svg .engage { fill: rgba(245,165,36,.75); stroke: #f5a524; stroke-width: 1.4; }
.strat-svg .helix { fill: none; stroke: #f5a524; stroke-width: 1.4; stroke-dasharray: 4 3; }
.strat-svg .dim { stroke: #1a7cff; stroke-width: 1.3; }
.strat-svg .dim.ap { stroke: #e5484d; } .strat-svg .dim.ae { stroke: #2e8b3a; }
.strat-svg .ah { fill: currentColor; } .strat-svg marker path { fill: #1a7cff; }
.strat-svg .feed { stroke: #f5a524; stroke-width: 2.4; } .strat-svg .fa { fill: #f5a524; }
.strat-svg .lbl { font: 700 9.5px system-ui, sans-serif; fill: var(--ink); paint-order: stroke; stroke: var(--surface-2); stroke-width: 3px; }
.strat-svg .lbl.dc { fill: #1a7cff; } .strat-svg .lbl.ap { fill: #e5484d; } .strat-svg .lbl.ae { fill: #2e8b3a; } .strat-svg .lbl.feed-l, .strat-svg .lbl.acc { fill: #c77d00; }
.strat-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; }
.lg::before { content: ''; display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.lg.dc::before { background: #1a7cff; } .lg.ap::before { background: #e5484d; } .lg.ae::before { background: #2e8b3a; } .lg.vf::before { background: #f5a524; }
.strat-vals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sv { background: var(--surface-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.sv small { color: var(--ink-2); font-weight: 600; } .sv b { font-size: 20px; font-variant-numeric: tabular-nums; }
.src { font-size: 11px; line-height: 1.3; padding: 2px 6px; border-radius: 6px; align-self: flex-start; }
.src a { color: inherit; }
.src-k { background: #e4effd; color: #0a4fb8; } .src-m { background: #e4f4e9; color: #157f3b; } .src-c { background: #eceef1; color: #4a5568; }
.src-u { background: #efe7f8; color: #6b3fa0; } .src-n { background: #fde8e6; color: #b42318; }
:root[data-theme="dark"] .src-k, :root:not([data-theme="light"]) .src-k { }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .src { filter: brightness(.9); } }
@media (min-width: 640px) { .strat-vals { grid-template-columns: repeat(3, 1fr); } .strat-tabs { grid-template-columns: repeat(7, 1fr); } }
.na { color: var(--ink-2); font-weight: 400; font-style: italic; }

/* Redaktør */
.editbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.editbar .btn { border-style: dashed; border-color: var(--accent); color: var(--accent); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.imgpick { display: grid; grid-template-columns: 112px 1fr; gap: 12px; align-items: center; }
.imgprev { width: 112px; height: 112px; border-radius: 14px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; font-size: 13px; text-align: center; }
.imgprev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.imgpick .btn { width: 100%; }
.cuthead, .cutrow { display: grid; grid-template-columns: 54px 1fr 1fr 58px 1fr 40px; gap: 6px; align-items: center; }
.cuthead { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.cutrow + .cutrow { margin-top: 6px; }
.cutrow input, .cutrow select { min-width: 0; width: 100%; padding: 8px 6px; min-height: 40px; }
.cutrow .btn { padding: 0; min-height: 40px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; min-height: 36px; margin-right: 8px; }
.chk input { width: 20px; height: 20px; accent-color: var(--accent); }
.aico { width: 26px; text-align: center; font-size: 20px; flex: none; }
.rowitem > .btn { white-space: nowrap; }
.rows.log .rowitem { grid-template-columns: 1fr auto; }
.rows.log .t1 { text-transform: none; font-size: 15px; }
.rows.ed .rowitem { grid-template-columns: 48px 1fr auto; }
.rows.ed .thumb { width: 48px; height: 48px; }
.rows.ed .t1 { text-transform: none; }
.fields.two { grid-template-columns: 1fr 1fr; }

/* Platform: netværksstatus, besked, login, admin */
.netbar { position: sticky; top: 0; z-index: 50; background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 600; text-align: center; padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); }
.toast { position: fixed; left: 50%; bottom: 110px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--bg, #fff); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; transition: .25s; z-index: 80; max-width: calc(100vw - 32px); text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.gbtn { gap: 10px; background: #fff; color: #1f1f1f; border-color: #dadce0; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
input[type="password"], .stack > input[type="search"] { width: 100%; min-height: 52px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 17px; }
.role-chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.role-chip.r-ADMIN { background: var(--accent); color: #fff; }
.role-chip.r-SUPER_ADMIN { background: #7b4bb3; color: #fff; }
.off { color: var(--bad); font-weight: 600; }
.alist .rowitem { grid-template-columns: 28px 1fr; gap: 10px; }
.alist .pick { width: 22px; height: 22px; accent-color: var(--accent); }
.aitem { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.aitem .thumb { width: 56px; height: 56px; border-radius: 10px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.aitem .thumb img, .subrow .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.aitem .t1 { text-transform: none; }
.bulk { position: sticky; top: 8px; z-index: 5; display: grid; gap: 8px; }
.bulk select { min-height: 38px; font-size: 14px; padding: 4px 8px; }
.cattree { display: grid; gap: 6px; }
.subrow { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.subrow .thumb { width: 40px; height: 40px; border-radius: 8px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.filerow { display: grid; grid-template-columns: 1fr auto 40px; gap: 8px; align-items: center; }
.filerow input { min-height: 40px; font-size: 15px; }
.chks { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 6px; }
.audit { display: grid; gap: 10px; }
.aud { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; font-size: 14px; color: var(--ink); }
.aud-h { color: var(--ink-2); font-size: 13px; }
.aud-c { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.aud-c s { color: var(--bad); }
.aud .btn { justify-self: start; margin-top: 4px; }
.tablewrap { overflow-x: auto; }
.itab { border-collapse: collapse; font-size: 13px; width: 100%; }
.itab th, .itab td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.res-src.depth { margin-top: 6px; opacity: .95; }
.res-src.depth.on { font-weight: 700; }
.res-src.depth.warn { background: var(--warn-bg); color: var(--warn); padding: 6px 8px; border-radius: 8px; font-weight: 700; }
.dh { font-size: 12px; color: var(--ink-2); }
.dtab { width: 100%; border-collapse: collapse; font-size: 14px; }
.dtab th { text-align: left; font-size: 12px; color: var(--ink-2); padding: 4px; }
.dtab td { padding: 3px; }
.dtab input { width: 100%; min-height: 40px; padding: 6px 8px; font-size: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }

/* 3D-visning af STEP-emner */
.v3tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.v3tabs button { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 700; padding: 10px 4px; border-radius: 10px; cursor: pointer; min-height: 44px; }
.v3tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.v3d { position: relative; scroll-margin-top: 80px; height: min(64vh, 580px); min-height: 320px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); touch-action: none; }
.v3d canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.v3status { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--ink-2); background: var(--surface-2); font-weight: 600; }
.v3status[hidden] { display: none; }
.v3views, .v3opts { position: absolute; display: flex; gap: 4px; padding: 4px; border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); }
.v3views { top: 8px; left: 8px; right: 8px; justify-content: center; }
.v3opts { bottom: 8px; right: 8px; }
.v3tag { position: absolute; top: 58px; left: 8px; right: 8px; border: 0; text-align: left; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer;
  padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-left: 4px solid var(--accent); }
.v3tag span { color: var(--accent); font-weight: 600; white-space: nowrap; }
.v3tag[hidden] { display: none; }
.v3views button, .v3opts button { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 9px; cursor: pointer; min-height: 36px; }
.v3views button:active, .v3opts button:active { background: var(--surface-2); }
.v3opts button { font-size: 13px; padding: 6px 10px; color: var(--ink-2); }
.v3opts button.on { color: var(--accent); background: var(--surface-2); }
.v3card, .v3sel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.v3head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.v3head b { overflow-wrap: anywhere; }
.v3dims { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.v3dims span { display: inline-flex; align-items: center; gap: 6px; }
.ax { font-style: normal; font-size: 12px; font-weight: 800; color: #fff; border-radius: 6px; padding: 2px 6px; }
.ax.x { background: #e5484d; } .ax.y { background: #30a46c; } .ax.z { background: #3e8ef7; }
.v3found ul, .v3sel ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.v3sel > b { font-size: 18px; }
.linkbtn { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.v3title { font-size: 18px; }
.v3chips { display: flex; gap: 6px; flex-wrap: wrap; }
.v3chips .chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink); }
.v3chips .warnchip { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.v3ops { display: grid; gap: 10px; }
.v3opshead { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.v3strat { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.v3strat button { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.v3strat button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.v3strat button:disabled { opacity: .35; cursor: default; }
.v3list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.v3list li { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.v3list li.open { border-color: var(--accent); }
.v3op { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: var(--surface); color: var(--ink); font: inherit; padding: 10px 12px; cursor: pointer; }
.v3n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 13px; font-weight: 700; }
.v3list li.open .v3n { background: var(--accent); color: #fff; }
.v3body { display: grid; gap: 2px; min-width: 0; }
.v3body > .muted { font-size: 13px; overflow-wrap: anywhere; }
.v3sum { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 3px; }
.v3badge { font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
.v3badge.g-plan { background: #e7f0ff; color: #0a4fbf; } .v3badge.g-side { background: #e6f6ec; color: #13703a; } .v3badge.g-slot { background: #fff1e0; color: #8a4b00; }
.v3badge.g-pocket { background: #f1e9ff; color: #5b2fa6; } .v3badge.g-ramp { background: #ffe9ec; color: #a3172e; } .v3badge.g-helix { background: #e3f7f7; color: #0d6b6b; }
.v3badge.g-hsm { background: #fdf3d6; color: #7a5a00; } .v3badge.g-hul { background: #eceef1; color: #3d4450; } .v3badge.g-drej { background: #e8ecf7; color: #2d3f73; }
.v3miss { color: var(--warn); }
.v3detail { padding: 4px 12px 12px; display: grid; gap: 8px; background: var(--surface); }
.v3side { font-size: 13px; font-weight: 600; color: var(--accent); }
.v3tab { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.v3tab th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 5px 0; width: 38%; border-bottom: 1px solid var(--line); }
.v3tab td { text-align: right; font-weight: 700; padding: 5px 0; border-bottom: 1px solid var(--line); }
.v3src { font-size: 12px; color: var(--ink-2); margin: 0; overflow-wrap: anywhere; }
.v3svg { background: var(--surface-2); border-radius: 10px; padding: 6px; }
.v3svg svg { display: block; width: 100%; height: auto; max-height: 220px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .v3badge { background: var(--surface-2); color: var(--ink); } }
:root[data-theme="dark"] .v3badge { background: var(--surface-2); color: var(--ink); }
.v3ctl { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }
.v3ctl label { display: grid; gap: 4px; min-width: 0; }
.v3ctl label > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.v3ctl select, .v3ctl input { width: 100%; min-width: 0; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; padding: 0 10px; }
.v3chk { font-size: 14px; font-weight: 600; padding: 8px 10px; border-radius: 10px; }
.v3chk.ok { background: var(--ok-bg); color: var(--ok); }
.v3chk.warn { background: var(--warn-bg); color: var(--warn); }
.v3chk.info { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); }
.v3chk.bad { background: var(--bad-bg); color: var(--bad); }
.v3bad { color: var(--bad); }
.v3info { color: var(--accent); }
