/* ============================================================
   TOTAL VVS — Designsystem
   Tokens, temaer (lys/mørk), typografi, komponentklasser
   ============================================================ */

/* ---------- Tokens: LYST tema (standard) ---------- */
:root {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --accent-text: #ffffff;

  --bg:        #f4f6f9;
  --surface:   #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e9eef4;
  --border:    #e2e8f0;
  --border-strong: #cbd5e1;

  --text:       #0f172a;
  --text-muted: #5a6b80;
  --text-faint: #93a1b3;

  /* Sidebar — alltid mørk */
  --side-bg:    #0f1722;
  --side-bg-2:  #18222f;
  --side-hover: #1c2836;
  --side-active-bg: rgba(37, 99, 235, 0.18);
  --side-text:  #aeb9c7;
  --side-text-active: #ffffff;
  --side-muted: #5e6b7c;
  --side-border: #1e2a38;
  --side-logo:  #ffffff;

  /* Status */
  --ok:    #15803d;
  --ok-bg: #dcfce7;
  --ok-dot:#22c55e;
  --warn:    #b45309;
  --warn-bg: #fef3c7;
  --warn-dot:#f59e0b;
  --idle:    #64748b;
  --idle-bg: #eef2f6;
  --idle-dot:#94a3b8;
  --info:    #1d4ed8;
  --info-bg: #dbeafe;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 14px 40px rgba(15, 23, 42, 0.14);

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
  /* Tallfont for kalkyle/regnskap — tabulære sifre med åpen (uten strek) null */
  --font-num: "IBM Plex Sans", system-ui, -apple-system, sans-serif;

  /* Tetthet (styres av tweaks) */
  --row-h: 44px;
  --pad: 24px;
  --tile-pad: 20px;
  --fs-base: 14.5px;
}

/* ---------- MØRKT tema ---------- */
[data-theme="dark"] {
  --accent-soft: rgba(59, 130, 246, 0.16);

  --bg:        #080b11;
  --surface:   #11161f;
  --surface-2: #161d28;
  --surface-3: #1d2735;
  --border:    #232e3d;
  --border-strong: #324155;

  --text:       #e6edf6;
  --text-muted: #8e9bad;
  --text-faint: #5d6b7d;

  --side-bg:    #06090e;
  --side-bg-2:  #0e151e;
  --side-hover: #141d28;
  --side-active-bg: rgba(59, 130, 246, 0.22);
  --side-text:  #9aa7b8;
  --side-text-active: #ffffff;
  --side-muted: #56657a;
  --side-border: #131c27;

  --ok:    #4ade80;
  --ok-bg: rgba(34, 197, 94, 0.15);
  --warn:    #fbbf24;
  --warn-bg: rgba(245, 158, 11, 0.15);
  --idle:    #93a3b6;
  --idle-bg: rgba(148, 163, 184, 0.13);
  --info:    #60a5fa;
  --info-bg: rgba(59, 130, 246, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.6);
}

/* Tetthet-varianter */
[data-density="compact"] { --row-h: 38px; --pad: 18px; --tile-pad: 15px; --fs-base: 13.5px; }
[data-density="comfy"]   { --row-h: 52px; --pad: 30px; --tile-pad: 26px; --fs-base: 15.5px; }

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.num  { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
button { font-family: inherit; }
::selection { background: var(--accent-soft); }

/* Skjult scrollbar-styling */
.scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }

/* Material Symbols */
.msym {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
  user-select: none;
}
.msym.outlined { font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24; }

/* ============================================================
   App-skall
   ============================================================ */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ----- Sidebar ----- */
.sidebar {
  width: 256px;
  flex-shrink: 0;
  background: var(--side-bg);
  border-right: 1px solid var(--side-border);
  display: flex;
  flex-direction: column;
  color: var(--side-text);
}
.sb-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 16px;
}
.sb-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent);
  display: grid; place-items: center;
  color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37,99,235,0.4);
}
.sb-mark .msym { font-size: 21px; }
.sb-brand-name { color: var(--side-logo); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.sb-brand-sub  { color: var(--side-muted); font-size: 11px; margin-top: 1px; letter-spacing: 0.02em; }

.sb-section { padding: 6px 12px; }
.sb-label {
  color: var(--side-muted); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  padding: 12px 10px 7px;
}
.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 8px;
  color: var(--side-text); cursor: pointer;
  font-size: 13.5px; font-weight: 450;
  border: none; background: none; width: 100%; text-align: left;
  transition: background .12s, color .12s;
}
.sb-item .msym { font-size: 20px; opacity: .82; }
.sb-item:hover { background: var(--side-hover); color: var(--side-text-active); }
.sb-item.active { background: var(--side-active-bg); color: var(--side-text-active); font-weight: 550; }
.sb-item.active .msym { opacity: 1; color: #fff; }
.sb-item .sb-count {
  margin-left: auto; font-size: 11px; color: var(--side-muted);
  background: var(--side-bg-2); padding: 1px 7px; border-radius: 20px;
  font-family: var(--font-mono);
}
.sb-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--side-border); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 8px; }
.sb-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--side-bg-2); display: grid; place-items: center; color: var(--side-text-active); font-size: 12px; font-weight: 600; flex-shrink: 0; }
.sb-user-name { font-size: 12.5px; color: var(--side-text-active); font-weight: 500; }
.sb-user-role { font-size: 11px; color: var(--side-muted); }

/* ----- Hovedflate ----- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }

/* ----- Header ----- */
.header {
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px; height: 58px; flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; min-width: 0; }
.crumb {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 9px; border-radius: 7px; border: none; background: none;
  color: var(--text-muted); font-size: 13px; cursor: pointer; font-weight: 450;
  white-space: nowrap; transition: background .12s, color .12s; font-family: inherit;
}
.crumb .msym { font-size: 17px; }
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.crumb.current:hover { background: none; }
.crumb-sep { color: var(--text-faint); font-size: 16px; margin: 0 -1px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ----- Innholdsflate ----- */
.content { flex: 1; overflow: auto; }
.content-inner { padding: var(--pad); max-width: 1320px; margin: 0 auto; }

.page-head { margin-bottom: 22px; }
.page-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 7px; }
.page-title { font-size: 23px; font-weight: 650; letter-spacing: -0.02em; margin: 0; color: var(--text); }
.page-sub { color: var(--text-muted); font-size: 14px; margin-top: 5px; }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ============================================================
   Knapper
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 550;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s, transform .04s;
  white-space: nowrap; line-height: 1; font-family: inherit;
}
.btn .msym { font-size: 18px; margin: -1px 0; }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(0.5px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm .msym { font-size: 16px; }

/* ============================================================
   Kort
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: visible; /* tbl-wrap håndterer tabell-scroll — card trenger ikke clip */
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px var(--tile-pad); border-bottom: 1px solid var(--border);
}
.card-head-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.card-head-icon .msym { font-size: 19px; }
.card-title { font-size: 14.5px; font-weight: 600; color: var(--text); }
.card-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.card-body { padding: var(--tile-pad); }
.card-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 0; }

/* ============================================================
   Ikon-grid (drill-down)
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 14px;
}
.tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--tile-pad);
  cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 13px;
  transition: border-color .14s, box-shadow .14s, transform .08s, background .14s;
  font-family: inherit; color: inherit;
  min-height: 132px;
}
.tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tile:active { transform: translateY(0); }
.tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tile-ico {
  width: 46px; height: 46px; border-radius: 11px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
}
.tile-ico .msym { font-size: 27px; }
.tile-num { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); font-weight: 500; letter-spacing: 0.02em; }
.tile-name { font-size: 14.5px; font-weight: 600; color: var(--text); line-height: 1.3; letter-spacing: -0.01em; }
.tile-meta { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.tile-meta-txt { font-size: 12px; color: var(--text-muted); }
.tile-chev { position: absolute; right: 16px; bottom: 16px; color: var(--text-faint); opacity: 0; transition: opacity .14s, transform .14s; }
.tile:hover .tile-chev { opacity: 1; transform: translateX(2px); }
.tile-chev .msym { font-size: 20px; }

/* Fase-fargevarianter på ikon */
.tile-ico.c-blue   { background: rgba(37,99,235,0.11);  color: #2563eb; }
.tile-ico.c-violet { background: rgba(124,58,237,0.11); color: #7c3aed; }
.tile-ico.c-amber  { background: rgba(217,119,6,0.12);  color: #d97706; }
.tile-ico.c-green  { background: rgba(21,128,61,0.12);  color: #15803d; }
.tile-ico.c-teal   { background: rgba(13,148,136,0.12); color: #0d9488; }
.tile-ico.c-rose   { background: rgba(225,29,72,0.11);  color: #e11d48; }
.tile-ico.c-slate  { background: rgba(71,85,105,0.13);  color: #475569; }
.tile-ico.c-cyan   { background: rgba(8,145,178,0.12);  color: #0891b2; }
[data-theme="dark"] .tile-ico.c-blue   { background: rgba(59,130,246,0.16);  color: #60a5fa; }
[data-theme="dark"] .tile-ico.c-violet { background: rgba(139,92,246,0.16);  color: #a78bfa; }
[data-theme="dark"] .tile-ico.c-amber  { background: rgba(245,158,11,0.16);  color: #fbbf24; }
[data-theme="dark"] .tile-ico.c-green  { background: rgba(34,197,94,0.16);   color: #4ade80; }
[data-theme="dark"] .tile-ico.c-teal   { background: rgba(20,184,166,0.16);  color: #2dd4bf; }
[data-theme="dark"] .tile-ico.c-rose   { background: rgba(244,63,94,0.16);   color: #fb7185; }
[data-theme="dark"] .tile-ico.c-slate  { background: rgba(148,163,184,0.16); color: #cbd5e1; }
[data-theme="dark"] .tile-ico.c-cyan   { background: rgba(6,182,212,0.16);   color: #22d3ee; }

/* ============================================================
   Statusbadge & prikk
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; line-height: 1.4;
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.badge.ok   { background: var(--ok-bg);   color: var(--ok); }
.badge.ok   .dot { background: var(--ok-dot); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.warn .dot { background: var(--warn-dot); }
.badge.idle { background: var(--idle-bg); color: var(--idle); }
.badge.idle .dot { background: var(--idle-dot); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.info .dot { background: var(--info); }

/* Progresslinje */
.prog { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.prog-fill { height: 100%; border-radius: 6px; background: var(--accent); transition: width .4s ease; }
.prog-fill.ok { background: var(--ok-dot); }

/* ============================================================
   Sjekkliste
   ============================================================ */
.checklist { display: flex; flex-direction: column; }
.check {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 4px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}
.check:last-child { border-bottom: none; }
.check:hover { background: var(--surface-2); }
.check-box {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center; margin-top: 1px;
  transition: background .12s, border-color .12s;
}
.check-box .msym { font-size: 15px; color: #fff; opacity: 0; transform: scale(.5); transition: opacity .12s, transform .12s; }
.check.done .check-box { background: var(--ok-dot); border-color: var(--ok-dot); }
.check.done .check-box .msym { opacity: 1; transform: scale(1); }
.check-txt { font-size: 13.5px; color: var(--text); line-height: 1.45; }
.check.done .check-txt { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--text-faint); }
.check-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.check-tag { margin-left: auto; flex-shrink: 0; }

/* ============================================================
   Tabell
   ============================================================ */
.tbl-wrap { width: 100%; overflow-x: auto; min-width: 0; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl-kalk { min-width: 0; width: 100%; table-layout: auto; }
.tbl thead th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); position: sticky; top: 0; white-space: nowrap;
}
.tbl tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .t-right { text-align: right; }
.tbl .t-num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
/* Tall med utregnings-forklaring ved hover */
.num-tip { cursor: help; }
.num-tip:hover { text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.tbl-group-row td {
  background: var(--surface-3); font-weight: 650; font-size: 12px;
  letter-spacing: 0.02em; color: var(--text); padding: 9px 12px;
  text-transform: uppercase;
}
.tbl-group-row .g-count { color: var(--text-muted); font-weight: 500; text-transform: none; font-family: var(--font-mono); }
.tbl tfoot td { padding: 13px 12px; border-top: 2px solid var(--border-strong); font-weight: 650; background: var(--surface-2); }

/* Kalkyle — gruppert header + grønn total-kolonne (som regnearket) */
.tbl thead .th-grp .grp-h {
  text-align: center; border-bottom: 1px solid var(--border);
  background: var(--surface-3); color: var(--text-muted);
}
.tbl thead .th-sub th { top: 36px; background: var(--surface-2); }
.tbl .cell-total { background: var(--ok-bg); }
.tbl thead th.cell-total { color: var(--ok); }
.tbl tbody tr:hover td.cell-total { background: var(--ok-bg); }
.tbl-group-row td.cell-total,
.tbl tfoot td.cell-total { background: var(--ok-bg); color: var(--ok); }

/* Inline pris-input */
.cell-input {
  width: 100%; max-width: 110px; text-align: right;
  border: 1px solid transparent; background: transparent;
  padding: 5px 8px; border-radius: 6px; font-family: var(--font-num);
  font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  transition: border-color .12s, background .12s;
}
.cell-input:hover { border-color: var(--border); background: var(--surface); }
.cell-input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.cell-input::placeholder { color: var(--text-faint); }

/* Tid (t)-kolonne: skrivebeskyttet avlesning (redigeres via kalkulator-popup).
   Alltid bred nok til å vise hele timetallet — aldri avkuttet. */
.tid-readout {
  font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  text-align: right; padding: 4px 2px; min-width: 40px;
}

/* Responsiv kalkyletabell: mindre skrift + trangere cellepadding gir plass til
   alle 12 kolonner (inkl. Status) uten avkutting på normale skjermer;
   tbl-wrap scroller ved behov på smalere skjermer. */
.tbl-kalk { font-size: 11px; }
.tbl-kalk thead th, .tbl-kalk tbody td { padding-left: 4px; padding-right: 4px; }
.tbl-kalk .t-num { font-size: 10.5px; }
.tbl-kalk .tid-readout { font-size: 12px; }
.tbl-kalk .mini-select { font-size: 10.5px; padding: 4px 19px 4px 6px; max-width: 100%; }
.tbl-kalk .info-col { max-width: 78px; overflow: hidden; text-overflow: ellipsis; }
.tbl-kalk th:last-child, .tbl-kalk td:last-child { padding-left: 3px; padding-right: 4px; }
/* Stram inn produktnr-lenken under enhetspris så Materiell-gruppen ikke blåser opp bredden */
.tbl-kalk .col-mat a { font-size: 9.5px; }

/* Kalkyle radhøyde-varianter (Standard / Kompakt / Tett / Ekstra tett) — reduserer kun
   vertikal luft, ikke funksjon. Gjelder alle rader i tabellen. */
.kdens-kompakt tbody td { padding-top: 6px; padding-bottom: 6px; }
.kdens-tett    tbody td { padding-top: 4px; padding-bottom: 4px; }
.kdens-ekstra  tbody td { padding-top: 2px; padding-bottom: 2px; }
.kdens-tett   .mini-select { padding-top: 3px; padding-bottom: 3px; }
.kdens-ekstra .mini-select { padding-top: 2px; padding-bottom: 2px; }
.kdens-tett   .tbl-group-row td,
.kdens-ekstra .tbl-group-row td { padding-top: 5px; padding-bottom: 5px; }

/* Antall-kolonne: blyant skjules til rad-hover for å unngå støy over mange rader */
.antall-edit-btn { opacity: 0 !important; transition: opacity .12s; }
tr:hover .antall-edit-btn { opacity: 0.45 !important; }
.antall-edit-btn:hover { opacity: 1 !important; }
.antall-cell .cell-input { text-align: right; }

/* Montasjetid-kalkulator-knapp i Tid-kolonnen */
.mont-calc-btn { opacity: 0.5; transition: opacity .12s; }
tr:hover .mont-calc-btn { opacity: 0.9; }
.mont-calc-btn:hover { opacity: 1 !important; }

/* «Flytt til overskrift»-knapp i kalkylerad */
.flytt-btn { opacity: 0; transition: opacity .12s; }
tr:hover .flytt-btn { opacity: 0.6; }
.flytt-btn:hover { opacity: 1 !important; }

/* «Fortsett der du slapp»-banner på Oversikt */
.resume-banner {
  display: flex; align-items: center; gap: 14px; width: 100%;
  margin: 0 0 18px; padding: 14px 18px; cursor: pointer; text-align: left;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 14px;
  background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface) 70%);
  transition: border-color .14s, box-shadow .14s, transform .06s;
}
.resume-banner:hover { border-color: var(--accent); box-shadow: 0 4px 18px color-mix(in srgb, var(--accent) 18%, transparent); }
.resume-banner:active { transform: translateY(1px); }
.resume-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
.resume-ico .msym { font-size: 23px; }
.resume-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.resume-lbl {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent);
}
.resume-where { font-size: 14.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-cta {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  font-size: 13.5px; font-weight: 600; color: var(--accent);
  padding: 8px 14px; border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.resume-banner:hover .resume-cta { background: var(--accent); color: #fff; }
.resume-cta .msym { font-size: 17px; }

/* «Husk backup»-påminnelse på Oversikt */
.backup-reminder {
  display: flex; align-items: center; gap: 13px; width: 100%;
  margin: 0 0 16px; padding: 13px 16px;
  border: 1px solid color-mix(in srgb, #f59e0b 40%, var(--border));
  border-radius: 14px;
  background: linear-gradient(100deg, color-mix(in srgb, #f59e0b 12%, var(--surface)), var(--surface) 72%);
}
.backup-reminder .br-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  background: color-mix(in srgb, #f59e0b 18%, transparent); color: #b45309;
}
.backup-reminder .br-ico .msym { font-size: 22px; }
.backup-reminder .br-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.backup-reminder .br-lbl { font-size: 14px; font-weight: 650; color: var(--text); }
.backup-reminder .br-sub { font-size: 12.5px; color: var(--text-muted); }
.backup-reminder .br-cta {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: #fff;
  background: #d97706; border: none; padding: 9px 15px; border-radius: 9px; transition: background .13s;
}
.backup-reminder .br-cta:hover { background: #b45309; }
.backup-reminder .br-x {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 30px; height: 30px; border: none; background: none; cursor: pointer;
  color: var(--text-faint); border-radius: 8px; transition: background .12s, color .12s;
}
.backup-reminder .br-x:hover { background: color-mix(in srgb, #f59e0b 14%, transparent); color: var(--text); }
/* select-pille */
.mini-select {
  font-family: inherit; font-size: 12px; font-weight: 550;
  border: 1px solid var(--border); border-radius: 7px;
  padding: 5px 26px 5px 9px; color: var(--text); background: var(--surface);
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%2393a1b3' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center;
  transition: border-color .12s, box-shadow .12s;
}
.mini-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ============================================================
   Diverse
   ============================================================ */
.info-banner {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--border); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
}
.info-cell { background: var(--surface); padding: 13px 16px; }
.info-cell-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 5px; }
.info-cell-val { font-size: 14px; font-weight: 550; color: var(--text); }
.info-cell-val .msym { font-size: 16px; vertical-align: -3px; margin-right: 4px; color: var(--text-muted); }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center; color: var(--text-muted);
}
.empty .msym { font-size: 44px; color: var(--text-faint); margin-bottom: 12px; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.empty-sub { font-size: 13px; max-width: 320px; line-height: 1.5; }

.docrow {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}
.docrow:last-child { border-bottom: none; }
.docrow:hover { background: var(--surface-2); }
.docrow .doc-ico { width: 34px; height: 34px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-muted); flex-shrink: 0; }
.docrow .doc-ico .msym { font-size: 19px; }
.doc-name { font-size: 13.5px; font-weight: 500; color: var(--text); }
.doc-meta { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); }
.docrow .doc-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi-label .msym { font-size: 17px; color: var(--text-faint); }
.kpi-val { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin-top: 7px; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; color: var(--text); }
.kpi-val .unit { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.kpi-sub { font-size: 12px; color: var(--text-faint); margin-top: 3px; }

.section-label { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); margin: 4px 0 13px; display: flex; align-items: center; gap: 8px; }
.section-label .msym { font-size: 17px; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; }
.tag-pill { display:inline-flex; align-items:center; gap:6px; padding: 3px 9px; border-radius: 6px; font-size: 11.5px; font-weight: 550; background: var(--surface-3); color: var(--text-muted); }

textarea.note-area, input.text-field {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; font-family: inherit; font-size: 13.5px; color: var(--text);
  background: var(--surface); resize: vertical; transition: border-color .12s, box-shadow .12s;
}
textarea.note-area:focus, input.text-field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Toast for "Åpne i Explorer" */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--side-bg); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow-lg); z-index: 9000;
  display: flex; align-items: center; gap: 10px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; border: 1px solid var(--side-border);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .msym { font-size: 18px; color: var(--accent); }
.toast .mono-path { font-family: var(--font-mono); font-size: 12px; color: #aeb9c7; }

/* Animasjon ved skjermbytte */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
/* forwards (ikke both) — ingen backwards-fill under delay. JS-fallback h\u00e5ndterer throttlede milj\u00f8er */
.fade-in { animation: fadeUp .35s ease forwards; }

.divider { height: 1px; background: var(--border); margin: 18px 0; border: none; }

.content-inner-wrap { display: contents; }

/* Segmentkontroll */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg-btn { border: none; background: none; padding: 6px 13px; border-radius: 6px; font-size: 12.5px; font-weight: 550; color: var(--text-muted); cursor: pointer; font-family: inherit; transition: background .12s, color .12s; }
.seg-btn.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Filterlinje + søk */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; }
.search { display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 11px; background: var(--surface); min-width: 200px; }
.search input { border: none; background: none; outline: none; font-family: inherit; font-size: 13px; color: var(--text); width: 100%; }
.search input::placeholder { color: var(--text-faint); }

/* Snarvei-kort på prosjektside */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; margin-bottom: 24px; }
.quick-card { display: flex; align-items: center; gap: 13px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; text-align: left; font-family: inherit; box-shadow: var(--shadow-sm); transition: border-color .14s, box-shadow .14s, transform .08s; }
.quick-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.quick-title { font-size: 14px; font-weight: 600; color: var(--text); }
.quick-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* ============================================================
   KANBAN
   ============================================================ */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.kan-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 200px; transition: background .15s, border-color .15s; }
.kan-col.drop { border-color: var(--accent); background: var(--accent-soft); }
.kan-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 11px; }
.kan-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--idle-dot); }
.kan-dot[data-col="pagar"] { background: var(--warn-dot); }
.kan-dot[data-col="venter"] { background: #a78bfa; }
.kan-dot[data-col="ferdig"] { background: var(--ok-dot); }
.kan-title { font-size: 13px; font-weight: 600; color: var(--text); }
.kan-count { margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); padding: 1px 8px; border-radius: 20px; }
.kan-list { display: flex; flex-direction: column; gap: 9px; min-height: 40px; }
.kan-empty { text-align: center; font-size: 12px; color: var(--text-faint); padding: 18px 0; }

.task { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 12px; cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow .12s, transform .06s; }
.task:hover { box-shadow: var(--shadow-md); }
.task:active { cursor: grabbing; }
.task-top { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.task-prio { width: 7px; height: 7px; border-radius: 50%; }
.task-prio-lbl { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.task-frist { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }
.task-title { font-size: 13.5px; font-weight: 550; color: var(--text); line-height: 1.35; margin-bottom: 7px; }
.task-fase { font-size: 11.5px; color: var(--text-faint); margin-bottom: 10px; }
.task-foot { display: flex; align-items: center; gap: 8px; }
.task-proj { font-size: 11.5px; font-weight: 600; }
.task-sjekk { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }
.task-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--text-muted); }

/* Import mengdeliste */
.import-drop {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-bottom: 16px;
  user-select: none;
}
.import-drop:hover, .import-drop.over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.import-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  color: var(--warn);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.import-help {
  background: var(--bg-alt);
  border-radius: 10px;
  padding: 14px 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* Sticky thead i kalkyle-tabell — tbl-wrap er scroll-container med max-height */
.tbl-kalk thead tr.th-grp th { position: sticky; top: 0; z-index: 12; background: var(--surface); box-shadow: 0 1px 0 var(--border); }
.tbl-kalk thead tr.th-sub th  { position: sticky; top: 37px; z-index: 11; background: var(--surface); box-shadow: 0 1px 0 var(--border); }
/* Montasje- og materiell-kolonner */
td.col-mont, th.col-mont { background: color-mix(in srgb, var(--accent) 4%, transparent); }
td.col-mat,  th.col-mat  { background: color-mix(in srgb, #22c55e 4%, transparent); }
th.col-mont, th.col-mat  { font-style: italic; }
/* Gruppe-header collapsible */
.tbl-group-row td { cursor: pointer; user-select: none; }
.tbl-group-row:hover td { background: var(--surface-2); }
.group-chevron { transition: transform .18s; font-size: 16px; color: var(--text-muted); }
.group-chevron.closed { transform: rotate(-90deg); }
.komp-edit-btn { opacity: 0; transition: opacity .12s; color: var(--text-faint) !important; }
.tbl-kalk tbody tr:hover .komp-edit-btn { opacity: 1; }
/* Info-kolonne */
.info-col { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* Slett-knapp per rad — vises tydelig kun ved hover */
.tbl-kalk tbody tr:not(.tbl-group-row):not(.import-section-hdr tr) .row-del-btn {
  opacity: 0.55;
  color: var(--text-faint);
  transition: opacity .12s, color .12s;
}
.tbl-kalk tbody tr:hover .row-del-btn { opacity: 1; }
.row-del-btn:hover { color: #dc2626 !important; }

/* «?»-notat-hint: vises ved hover på raden, nativt tooltip viser teksten */
.notat-hint {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--text-faint); color: var(--text-faint);
  font-size: 10px; font-weight: 700; line-height: 1;
  margin-left: 6px; cursor: help; vertical-align: baseline;
  flex-shrink: 0; user-select: none;
  opacity: 0; transition: opacity .12s;
}
.tbl-kalk tbody tr:hover .notat-hint { opacity: 0.6; }
.notat-hint:hover { opacity: 1; background: color-mix(in srgb, var(--text-faint) 14%, transparent); }
/* Armert (steg 2) — rød, fylt, pulserer for å be om bekreftelse */
.row-del-confirm {
  background: #dc2626 !important;
  border: 1px solid #dc2626 !important;
  border-radius: 6px;
  animation: delArmPulse .9s ease-in-out infinite alternate;
}
.row-del-confirm:hover { background: #b91c1c !important; border-color: #b91c1c !important; }
@keyframes delArmPulse {
  from { box-shadow: 0 0 0 0 rgba(220,38,38,.40); }
  to   { box-shadow: 0 0 0 5px rgba(220,38,38,0); }
}
.import-section-hdr td {
  background: var(--bg-alt);
  border-top: 2px solid var(--border);
  padding: 8px 14px;
  font-size: 13px;
}

/* ============================================================
   OPSJONER — seksjon, skuff, kalkulator, rad-merker
   ============================================================ */
.opt-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px 2px 5px; border-radius: 6px; font-size: 10px; font-weight: 650; background: color-mix(in srgb, var(--opt, #7c3aed) 14%, transparent); color: var(--opt, #7c3aed); white-space: nowrap; cursor: pointer; border: none; }
.opt-pill .msym { font-size: 12px; }
.retning-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 650; font-family: var(--font-mono); padding: 1px 7px 1px 4px; border-radius: 5px; border: none; cursor: pointer; }
.retning-tag.tillegg { color: var(--ok); background: var(--ok-bg); }
.retning-tag.fradrag { color: #dc2626; background: rgba(220,38,38,0.12); }
.retning-tag .msym { font-size: 14px; }

.mini-switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--text-muted); user-select: none; flex-shrink: 0; }
.mini-switch .track { width: 34px; height: 19px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .16s; flex-shrink: 0; }
.mini-switch .knob { position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .16s; }
.mini-switch.on .track { background: var(--opt, var(--accent)); }
.mini-switch.on .knob { left: 17px; }
.mini-switch.on { color: var(--opt, var(--accent)); }

.opt-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.opt-li { border-top: 1px solid var(--border); }
.opt-li:first-child { border-top: none; }
.opt-li-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; }
.opt-li-mark { width: 7px; height: 34px; border-radius: 4px; background: var(--opt); flex-shrink: 0; }
.opt-navn-input { border: 1px solid transparent; background: transparent; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--text); padding: 3px 7px; border-radius: 6px; min-width: 60px; flex: 1; max-width: 280px; }
.opt-navn-input:hover { border-color: var(--border); }
.opt-navn-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.opt-navn-input::placeholder { color: var(--text-faint); font-weight: 400; font-style: italic; }
.opt-li-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; display: flex; align-items: center; gap: 9px; padding-left: 7px; }
.opt-li-sum { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; font-weight: 700; font-size: 15.5px; white-space: nowrap; flex-shrink: 0; }
.opt-li-sum.neg { color: #dc2626; }
.opt-chev { transition: transform .18s; color: var(--text-muted); }
.opt-li.open .opt-chev { transform: rotate(90deg); }
.opt-drawer { padding: 2px 16px 16px 37px; background: var(--surface-2); }
.opt-sub-row td { border-top: 1px dashed var(--opt); background: color-mix(in srgb, var(--opt) 6%, transparent); }
.opt-tekster { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
@media (max-width: 880px) { .opt-tekster { grid-template-columns: 1fr; } }
.opt-tekst-lbl { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 8px; }

.calc-box { margin: 16px 0 2px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: 14px 18px; }
.calc-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13px; }
.calc-line .lbl { color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.calc-line .val { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; font-weight: 600; }
.calc-line.tot { border-top: 2px solid var(--border-strong); margin-top: 6px; padding-top: 12px; font-size: 15px; font-weight: 700; }
.calc-line.tot .lbl { color: var(--text); }
.calc-line.tot .val { color: var(--ok); font-size: 18px; }

.opt-scope-banner { display: flex; align-items: center; gap: 11px; padding: 11px 16px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--opt, var(--accent)) 9%, var(--surface-2)); }
.opt-row-mark > td:first-child { box-shadow: inset 4px 0 0 var(--opt); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(8,11,17,0.5); backdrop-filter: blur(2px); z-index: 8000; display: grid; place-items: center; padding: 24px; animation: fadeUp .15s ease; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 540px; box-shadow: var(--shadow-lg); max-height: 86vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ============================================================
   GANTT / TIDSLINJE
   ============================================================ */
.gantt { display: flex; }
.gantt-left { flex-shrink: 0; width: 230px; border-right: 1px solid var(--border); background: var(--surface); z-index: 3; }
.gantt-left-head { display: flex; align-items: flex-end; padding: 0 14px 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.gantt-rowlbl { display: flex; align-items: center; gap: 9px; padding: 0 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.gantt-rowlbl:hover { background: var(--surface-2); }
.gantt-rowlbl.sel { background: var(--accent-soft); }
.gantt-rowlbl-txt { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crit-dot { width: 7px; height: 7px; border-radius: 50%; background: #dc2626; flex-shrink: 0; }
.res-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }

.gantt-right { flex: 1; overflow-x: auto; }
.tl-header { border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.tl-months { display: flex; height: 26px; }
.tl-month { border-right: 1px solid var(--border); display: flex; align-items: center; padding: 0 8px; font-size: 11.5px; font-weight: 600; color: var(--text); text-transform: capitalize; white-space: nowrap; overflow: hidden; }
.tl-year { color: var(--text-faint); font-weight: 400; }
.tl-weeks { display: flex; height: 22px; }
.tl-week { border-right: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 9.5px; color: var(--text-faint); font-family: var(--font-mono); }
.gantt-body { background: var(--surface); }
.tl-gridline { position: absolute; top: 0; width: 1px; background: var(--border); opacity: 0.5; }
.tl-gridline.month { opacity: 1; background: var(--border-strong); }
.tl-today { position: absolute; top: 0; width: 2px; background: var(--accent); z-index: 4; }
.tl-today-lbl { position: absolute; top: -1px; left: 3px; font-size: 9px; font-weight: 700; color: #fff; background: var(--accent); padding: 1px 5px; border-radius: 0 4px 4px 0; white-space: nowrap; }

.gbar { position: absolute; height: 24px; border-radius: 6px; background: #93a8c9; display: flex; align-items: center; padding: 0 8px; overflow: hidden; cursor: pointer; z-index: 2; box-shadow: var(--shadow-sm); transition: filter .12s, outline .1s; }
.gbar.crit { background: #1e3a8a; }
[data-theme="dark"] .gbar { background: #3b4d6b; }
[data-theme="dark"] .gbar.crit { background: #1d4ed8; }
.gbar:hover { filter: brightness(1.08); }
.gbar.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.gbar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,0.28); border-radius: 6px 0 0 6px; }
.gbar-lbl { position: relative; font-size: 11.5px; font-weight: 600; color: #fff; white-space: nowrap; z-index: 1; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.gbar-prog { position: relative; margin-left: auto; font-size: 10px; font-family: var(--font-mono); color: rgba(255,255,255,0.85); z-index: 1; }
.gbar-check { position: relative; margin-left: auto; font-size: 15px; color: #fff; z-index: 1; }
.gantt-arrows { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 1; }

.gantt-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; font-size: 12px; color: var(--text-muted); }
.gantt-legend span { display: inline-flex; align-items: center; gap: 7px; }
.lg-swatch { width: 16px; height: 11px; border-radius: 3px; }
.lg-swatch.crit { background: #1e3a8a; }
.lg-swatch.norm { background: #93a8c9; }
[data-theme="dark"] .lg-swatch.crit { background: #1d4ed8; }
[data-theme="dark"] .lg-swatch.norm { background: #3b4d6b; }
.lg-line { width: 16px; height: 11px; border-radius: 3px; background: linear-gradient(90deg, rgba(150,170,200,0.5) 60%, transparent 60%); border: 1px solid var(--border-strong); }
.lg-arrow { color: var(--text-faint); }

/* Ressurs-søyler + belegg */
.rbar { position: absolute; height: 24px; border-radius: 6px; display: flex; align-items: center; padding: 0 9px; overflow: hidden; box-shadow: var(--shadow-sm); }
.rbar-lbl { font-size: 11px; font-weight: 550; color: #fff; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.belegg-cell { position: absolute; border-radius: 4px; background: transparent; }
.belegg-cell.full { background: var(--accent-soft); border: 1px solid var(--accent); }
.belegg-cell.over { background: rgba(220,38,38,0.18); border: 1px solid #dc2626; display: grid; place-items: center; }
.belegg-txt { font-size: 9px; font-weight: 700; color: #dc2626; font-family: var(--font-mono); }

@media (max-width: 1100px) {
  .kanban { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   INNSTILLINGER
   ============================================================ */
.set-layout { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 22px; align-items: start; }
.set-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.set-nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px; border: none; background: none; color: var(--text-muted); font-family: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; text-align: left; transition: background .12s, color .12s; }
.set-nav-item .msym { font-size: 19px; }
.set-nav-item:hover { background: var(--surface-2); color: var(--text); }
.set-nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.set-grid { display: flex; flex-direction: column; gap: 2px; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: none; }
.set-row-lbl { font-size: 13.5px; color: var(--text); font-weight: 500; flex: 1; }
.set-row-val { margin-left: auto; font-size: 13px; color: var(--text-muted); background: var(--surface-2); padding: 3px 10px; border-radius: 6px; min-width: 64px; text-align: right; }
.kr-input { display: inline-flex; align-items: center; gap: 6px; }
.kr-input .cell-input { border-color: var(--border); background: var(--surface); }
.kr-suffix { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); }

/* av/på-bryter */
.switch { width: 38px; height: 22px; border-radius: 20px; background: var(--border-strong); border: none; cursor: pointer; padding: 0; position: relative; transition: background .15s; flex-shrink: 0; }
.switch.on { background: var(--accent); }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.switch.on .switch-knob { transform: translateX(16px); }

.info-note { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 9px; background: var(--accent-soft); color: var(--text); font-size: 12.5px; line-height: 1.5; }
.info-note .msym { font-size: 18px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }

.std-block { border: 1px solid var(--border); border-radius: 9px; padding: 12px 13px; background: var(--surface-2); }
.std-block-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.std-block-head .text-field { background: transparent; flex: 1; }
.std-block .note-area { background: var(--surface); }

/* ============================================================
   TILBUDSBREV
   ============================================================ */
.brev { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 42px 46px; min-height: 520px; }
.brev-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 34px; }
.brev-logo { font-size: 17px; font-weight: 700; color: var(--accent); letter-spacing: -0.01em; }
.brev-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.brev-mottaker { margin-bottom: 26px; font-size: 13.5px; }
.brev-tittel { font-size: 19px; font-weight: 650; margin: 0 0 4px; color: var(--text); letter-spacing: -0.01em; }
.brev-sub { font-size: 12.5px; color: var(--text-muted); margin-bottom: 22px; font-family: var(--font-mono); }
.brev-body { display: flex; flex-direction: column; gap: 13px; }
.brev-p { margin: 0; font-size: 13.5px; line-height: 1.65; color: var(--text); white-space: pre-wrap; }
.brev-sig { margin: 18px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--text); white-space: pre-wrap; border-top: 1px solid var(--border); padding-top: 18px; }

/* Opsjoner i tilbudsbrev */
.brev-opsjoner { margin-top: 26px; border-top: 2px solid var(--border-strong); padding-top: 18px; }
.brev-h3 { font-size: 15px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.brev-sum-tab { width: 100%; border-collapse: collapse; margin: 10px 0 20px; font-size: 13.5px; }
.brev-sum-tab td { padding: 8px 0; border-bottom: 1px solid var(--border); }
.brev-sum-tab td:last-child { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; font-weight: 600; white-space: nowrap; }
.brev-sum-tab tr:first-child td { font-weight: 650; }
.brev-retning { color: var(--text-faint); font-size: 11.5px; }
.brev-opt-blk { margin: 14px 0; padding-left: 14px; border-left: 3px solid var(--border-strong); }
.brev-opt-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-weight: 650; font-size: 13.5px; margin-bottom: 6px; }
.brev-opt-h span:last-child { font-family: var(--font-mono); white-space: nowrap; }
.brev-opt-txt { display: flex; flex-direction: column; gap: 8px; }

.brev-pick { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--border); cursor: pointer; transition: background .1s, border-color .1s; }
.brev-pick:hover { background: var(--surface-2); }
.brev-pick.on { border-color: var(--accent); background: var(--accent-soft); }
.brev-pick .check-box { border-color: var(--border-strong); }
.brev-pick.on .check-box { background: var(--ok-dot); border-color: var(--ok-dot); }
.brev-pick.on .check-box .msym { opacity: 1; transform: scale(1); }

@media (max-width: 900px) { .set-layout { grid-template-columns: 1fr; } }

/* ============================================================
   OVERSIKT / DASHBORD
   ============================================================ */
.dash-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.mcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.mcard-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 550; color: var(--text-muted); }
.mcard-top .msym { font-size: 18px; color: var(--text-faint); }
.mcard-val { font-size: 27px; font-weight: 650; letter-spacing: -0.02em; margin-top: 9px; font-family: var(--font-mono); color: var(--text); }
.mcard-foot { display: flex; align-items: center; gap: 9px; margin-top: 9px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 650; font-family: var(--font-mono); padding: 2px 7px 2px 5px; border-radius: 6px; }
.delta .msym { font-size: 15px; }
.delta.up { color: var(--ok); background: var(--ok-bg); }
.delta.down { color: #dc2626; background: rgba(220,38,38,0.12); }
.delta.flat { color: var(--idle); background: var(--idle-bg); }
.mcard-sub { font-size: 11.5px; color: var(--text-faint); }

.dash-grid { display: grid; grid-template-columns: 1.75fr 1fr; gap: 16px; align-items: start; }

/* trendgraf */
.chart-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cmp-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 550; color: var(--text-muted); white-space: nowrap; }
.chart-wrap { width: 100%; }
.trend-svg { width: 100%; height: auto; display: block; overflow: visible; }
.trend-svg .grid-line { stroke: var(--border); stroke-width: 1; }
.trend-svg .axis-lbl { font-size: 11px; fill: var(--text-faint); font-family: var(--font-mono); }
.trend-svg .split-line { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 4; }
.trend-svg .split-lbl { font-size: 10px; fill: var(--text-faint); font-family: var(--font-mono); }
.trend-svg .cmp-line { stroke: var(--text-faint); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: 0.7; }
.trend-svg .hover-line { stroke: var(--text-muted); stroke-width: 1; opacity: 0.5; }
.trend-svg .tip-box { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; filter: drop-shadow(0 4px 10px rgba(15,23,42,0.12)); }
.trend-svg .tip-mnd { font-size: 11px; fill: var(--text-muted); font-weight: 600; }
.trend-svg .tip-val { font-size: 14px; font-weight: 700; font-family: var(--font-mono); }
.trend-svg .tip-cmp { font-size: 11px; fill: var(--text-faint); font-family: var(--font-mono); }

/* donut */
.donut-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-svg { width: 180px; height: 180px; flex-shrink: 0; }
.donut-svg .donut-total { font-size: 20px; font-weight: 700; font-family: var(--font-mono); fill: var(--text); }
.donut-svg .donut-cap { font-size: 9.5px; fill: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.donut-legend { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 11px; }
.leg-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; }
.leg-dot { width: 11px; height: 11px; border-radius: 3px; }
.leg-navn { font-size: 13px; font-weight: 500; color: var(--text); }
.leg-pct { font-size: 12.5px; font-weight: 650; color: var(--text-muted); font-family: var(--font-mono); }
.leg-val { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); min-width: 70px; text-align: right; }

@media (max-width: 1080px) {
  .dash-cards { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .dash-cards { grid-template-columns: 1fr; } }

/* ============================================================
   OVERSIKT — KOMMANDOSENTER (fane "Oversikt")
   ============================================================ */
.seg-lg .seg-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; font-size: 13px; }
.seg-lg .seg-btn .msym { font-size: 17px; }

.ov2 { display: flex; flex-direction: column; gap: 16px; }

/* lenkeknapp */
.lnk-btn { display: inline-flex; align-items: center; gap: 4px; border: none; background: none; cursor: pointer; font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--accent); padding: 4px 6px; border-radius: 6px; transition: background .12s; }
.lnk-btn:hover { background: var(--info-bg); }
.lnk-btn .msym { font-size: 15px; }

/* --- KPI-stripe --- */
.kstripe { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.kstripe-cell { background: var(--surface); padding: 13px 15px; display: flex; flex-direction: column; gap: 5px; }
.kstripe-top { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 550; color: var(--text-muted); }
.kstripe-top .msym { font-size: 16px; color: var(--text-faint); }
.kstripe-val { font-size: 21px; font-weight: 650; letter-spacing: -0.02em; font-family: var(--font-mono); color: var(--text); line-height: 1.05; }
.kstripe-foot { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-height: 18px; }
.kstripe-sub { font-size: 10.5px; color: var(--text-faint); }
.kstripe .delta { font-size: 11px; padding: 1px 6px 1px 4px; }
.kstripe .delta .msym { font-size: 13px; }

/* --- Haster nå --- */
.haster { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px 16px; }
.haster-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; color: var(--text); margin-bottom: 11px; }
.haster-head .msym { font-size: 18px; color: #d97706; }
.haster-count { font-size: 11px; font-weight: 700; font-family: var(--font-mono); color: var(--warn); background: var(--warn-bg); border-radius: 999px; padding: 1px 8px; }
.haster-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px; }
.haster-chip { flex: 0 0 auto; min-width: 230px; max-width: 290px; display: flex; align-items: flex-start; gap: 10px; text-align: left; cursor: pointer; font-family: inherit; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--idle); border-radius: var(--radius-sm); padding: 10px 12px; transition: box-shadow .12s, transform .12s; }
.haster-chip:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.haster-chip.rod { border-left-color: #dc2626; }
.haster-chip.gul { border-left-color: var(--warn-dot); }
.haster-chip.bla { border-left-color: var(--accent); }
.haster-ico { flex-shrink: 0; width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-3); }
.haster-ico .msym { font-size: 17px; color: var(--text-muted); }
.haster-chip.rod .haster-ico { background: rgba(220,38,38,0.1); } .haster-chip.rod .haster-ico .msym { color: #dc2626; }
.haster-chip.gul .haster-ico { background: var(--warn-bg); } .haster-chip.gul .haster-ico .msym { color: var(--warn); }
.haster-chip.bla .haster-ico { background: var(--info-bg); } .haster-chip.bla .haster-ico .msym { color: var(--accent); }
.haster-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.haster-kicker { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.haster-txt { font-size: 12.5px; font-weight: 550; color: var(--text); line-height: 1.3; }
.haster-proj { font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Fakturaplan --- */
.fp-total { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.fp-total-val { font-size: 17px; font-weight: 700; font-family: var(--font-mono); color: var(--text); }
.fp-total-lbl { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.fp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fp-col { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.fp-col.now { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.fp-col-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.fp-col-mnd { font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-muted); display: inline-flex; align-items: center; gap: 7px; }
.fp-now { font-size: 9.5px; font-weight: 700; text-transform: uppercase; color: #fff; background: var(--accent); border-radius: 999px; padding: 1px 7px; letter-spacing: 0.03em; }
.fp-col-sum { font-size: 12.5px; font-weight: 700; font-family: var(--font-mono); color: var(--text); }
.fp-items { display: flex; flex-direction: column; gap: 6px; padding: 10px; min-height: 60px; }
.fp-empty { font-size: 11.5px; color: var(--text-faint); text-align: center; padding: 16px 0; }
.fp-item { display: flex; align-items: stretch; gap: 9px; text-align: left; cursor: pointer; font-family: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px 8px 8px; transition: box-shadow .12s; }
.fp-item:hover { box-shadow: var(--shadow-sm); }
.fp-bar { width: 3px; border-radius: 2px; background: var(--pc, var(--accent)); flex-shrink: 0; }
.fp-item-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.fp-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.fp-item-proj { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-item-kr { font-size: 12px; font-weight: 700; font-family: var(--font-mono); color: var(--text); white-space: nowrap; }
.fp-item-sub { font-size: 10.5px; color: var(--text-faint); font-family: var(--font-mono); }

/* --- Hovedrad: kort-grid + oppgave-rail --- */
.ov2-main { display: grid; grid-template-columns: 1.62fr 1fr; gap: 16px; align-items: start; }
.ov2-section-lbl { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 11px; }
.ov2-section-lbl .msym { font-size: 16px; color: var(--text-faint); }
.ov2-section-n { font-size: 11px; font-weight: 700; font-family: var(--font-mono); color: var(--text-muted); background: var(--surface-3); border-radius: 999px; padding: 1px 8px; }
.ov2-rail { position: sticky; top: 16px; }

.pk-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }

/* --- Prosjektkort --- */
.pk { position: relative; text-align: left; cursor: pointer; font-family: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 15px 16px 13px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; transition: box-shadow .14s, transform .14s, border-color .14s; }
.pk:hover { box-shadow: 0 6px 18px rgba(15,23,42,0.10); transform: translateY(-2px); border-color: var(--border-strong); }
.pk-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--pc, var(--accent)); }
.pk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pk-head-l { min-width: 0; }
.pk-nr { font-size: 10.5px; font-weight: 600; font-family: var(--font-mono); color: var(--pc, var(--accent)); letter-spacing: 0.02em; }
.pk-navn { font-size: 15.5px; font-weight: 650; color: var(--text); letter-spacing: -0.01em; margin-top: 1px; }
.pk-kunde { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-muted); margin-top: 3px; flex-wrap: wrap; }
.pk-kunde .msym { font-size: 14px; color: var(--text-faint); }
.pk-kunde .pk-dot { color: var(--text-faint); }
.pk .badge { white-space: nowrap; flex-shrink: 0; }

.pk-prog { display: flex; align-items: center; gap: 10px; }
.pk-prog-track { flex: 1; height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.pk-prog-fill { display: block; height: 100%; background: var(--pc, var(--accent)); border-radius: 3px; }
.pk-prog-pct { font-size: 12px; font-weight: 700; font-family: var(--font-mono); color: var(--text-muted); min-width: 34px; text-align: right; }

.pk-econ { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.pk-econ-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pk-econ-lbl { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-faint); }
.pk-econ-val { font-size: 14.5px; font-weight: 700; font-family: var(--font-mono); color: var(--text); }
.pk-econ-val.rod { color: #dc2626; }
.pk-econ-val.ok { color: var(--ok); } .pk-econ-val.warn { color: var(--warn); }
.pk-econ-sub { font-size: 10.5px; color: var(--text-faint); font-family: var(--font-mono); }
.pk-mini { height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; margin-top: 3px; }
.pk-mini-fill { display: block; height: 100%; background: var(--text-muted); border-radius: 2px; }
.pk-mini-fill.rod { background: #dc2626; }

.pk-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pk-stat { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pk-stat-lbl { display: flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--text-faint); white-space: nowrap; }
.pk-stat-lbl .msym { font-size: 13px; }
.pk-stat-val { font-size: 13px; font-weight: 600; color: var(--text); font-family: var(--font-mono); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pk-stat-val.rod { color: #dc2626; }
.pk-flag { font-size: 9.5px; font-weight: 700; font-family: var(--font-sans); color: #dc2626; background: rgba(220,38,38,0.1); border-radius: 4px; padding: 1px 5px; }

.pk-faktura { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--surface-2); margin: 0 -16px -13px; padding: 10px 16px; border-top: 1px solid var(--border); }
.pk-faktura-cell { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ico lbl" "ico val"; column-gap: 8px; align-items: center; }
.pk-faktura-cell .msym { grid-area: ico; font-size: 16px; color: var(--text-faint); }
.pk-faktura-lbl { grid-area: lbl; font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.03em; }
.pk-faktura-val { grid-area: val; font-size: 11.5px; font-weight: 600; font-family: var(--font-mono); color: var(--text); }

/* --- Samlet oppgaveliste --- */
.ol-list { display: flex; flex-direction: column; max-height: 640px; overflow-y: auto; }
.ol-row { display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer; font-family: inherit; background: none; border: none; border-bottom: 1px solid var(--border); padding: 11px 16px; transition: background .12s; }
.ol-row:last-child { border-bottom: none; }
.ol-row:hover { background: var(--surface-2); }
.ol-frist { flex: 0 0 64px; display: flex; flex-direction: column; gap: 1px; padding-left: 8px; border-left: 3px solid var(--idle); }
.ol-frist.rod { border-left-color: #dc2626; } .ol-frist.gul { border-left-color: var(--warn-dot); }
.ol-frist-dm { font-size: 12px; font-weight: 700; font-family: var(--font-mono); color: var(--text); }
.ol-frist-rel { font-size: 10px; color: var(--text-faint); }
.ol-frist.rod .ol-frist-rel { color: #dc2626; font-weight: 600; } .ol-frist.gul .ol-frist-rel { color: var(--warn); }
.ol-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ol-tittel { font-size: 12.5px; font-weight: 550; color: var(--text); line-height: 1.3; }
.ol-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ol-proj { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.ol-projdot { width: 7px; height: 7px; border-radius: 50%; background: var(--pc, var(--accent)); }
.ol-ansv { font-size: 11px; color: var(--text-faint); }
.ol-prio { flex-shrink: 0; font-size: 10px; font-weight: 700; border-radius: 5px; padding: 2px 7px; text-transform: uppercase; letter-spacing: 0.02em; }
.ol-prio.warn { color: var(--warn); background: var(--warn-bg); }
.ol-prio.info { color: var(--info); background: var(--info-bg); }
.ol-prio.idle { color: var(--idle); background: var(--idle-bg); }
.ol-empty { font-size: 12.5px; color: var(--text-faint); text-align: center; padding: 28px 0; }

/* --- Økonomi-fane toolbar --- */
.ok-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.ok-toolbar-lbl { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.ok-toolbar-lbl .msym { font-size: 17px; color: var(--text-faint); }

@media (max-width: 1180px) {
  .ov2-main { grid-template-columns: 1fr; }
  .ov2-rail { position: static; }
  .kstripe { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 880px) {
  .pk-grid { grid-template-columns: 1fr; }
  .fp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kstripe { grid-template-columns: repeat(2, 1fr); }
  .pk-stats { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   KALKYLE-MODULEN
   ============================================================ */
/* status-banner (pipeline) */
.kstat-banner { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kstat-cell { display: flex; align-items: center; gap: 13px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; text-align: left; transition: border-color .12s, box-shadow .12s, transform .12s; }
.kstat-cell:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kstat-cell.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kstat-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.kstat-ico .msym { font-size: 22px; }
.kstat-n { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
.kstat-lbl { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }
.tone-ok   { background: var(--ok-bg);   color: var(--ok); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tone-idle { background: var(--idle-bg); color: var(--idle); }
.tone-info { background: var(--info-bg); color: var(--info); }

/* tekniske forutsetninger */
.kfacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.kfact { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.kfact-ico { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted); flex-shrink: 0; }
.kfact-ico .msym { font-size: 19px; }
.kfact-ico.warn { background: var(--warn-bg); color: var(--warn); }
.kfact-lbl { font-size: 11.5px; color: var(--text-faint); font-weight: 500; }
.kfact-val { font-size: 13.5px; font-weight: 600; color: var(--text); }

/* livssyklus-bar */
.klife { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 22px; }
.klife-track { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 280px; }
.klife-node { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 550; color: var(--text-faint); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.klife-node .msym { font-size: 16px; }
.klife-node.done { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.klife-node.on { border-color: transparent; }
.klife-line { height: 2px; flex: 1; min-width: 16px; background: var(--border); border-radius: 2px; }
.klife-line.done { background: var(--ok-dot); }
.klife-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* skjema-grid (veiviser + modaler) */
.kform { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.kform-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kform-hint { font-size: 11.5px; color: var(--text-faint); }

/* modal-footer */
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }

/* veiviser-stepper */
.kwiz-steps { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.kwiz-step { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 550; color: var(--text-faint); }
.kwiz-step.on { color: var(--text); }
.kwiz-step.done { color: var(--ok); }
.kwiz-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-muted); font-family: var(--font-mono); }
.kwiz-step.on .kwiz-num { background: var(--accent); color: #fff; }
.kwiz-step.done .kwiz-num { background: var(--ok-bg); color: var(--ok); }
.kwiz-step:not(:last-child)::after { content: ""; width: 18px; height: 1px; background: var(--border-strong); margin-left: 2px; }

/* garanti-valg */
.kgar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kgar { display: flex; flex-direction: column; gap: 6px; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; text-align: left; transition: border-color .12s, box-shadow .12s; }
.kgar:hover { border-color: var(--border-strong); }
.kgar.on { border-color: var(--accent); background: var(--accent-soft); }
.kgar-top { display: flex; align-items: center; justify-content: space-between; }

/* multi-select TE */
.kmulti { position: relative; }
.kmulti-btn { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-family: inherit; font-size: 13px; }
.kmulti-btn:focus, .kmulti-btn:hover { border-color: var(--border-strong); }
.kmulti-panel { position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; right: 0; max-height: 240px; overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.kmulti-opt { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 7px; cursor: pointer; }
.kmulti-opt:hover { background: var(--surface-2); }
.kmulti-opt .check-box { border-color: var(--border-strong); }
.kmulti-opt.on .check-box { background: var(--ok-dot); border-color: var(--ok-dot); }
.kmulti-opt.on .check-box .msym { opacity: 1; transform: scale(1); }

/* warn-blokk (veiviser / erfaring) */
.kwarn { display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px; border-radius: 10px; background: var(--warn-bg); }
.kwarn > .msym { font-size: 19px; color: var(--warn); flex-shrink: 0; margin-top: 1px; }

@media (max-width: 720px) {
  .kstat-banner { grid-template-columns: 1fr 1fr; }
  .kform { grid-template-columns: 1fr; }
  .kgar-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   TEGNING-MODULEN
   ============================================================ */
/* forside-thumbnails */
.tg-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 14px var(--tile-pad) var(--tile-pad); }
.tg-thumb { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; text-align: left; transition: border-color .12s, box-shadow .12s, transform .12s; }
.tg-thumb:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tg-thumb-prev { height: 92px; background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 9px, var(--surface-3) 9px, var(--surface-3) 18px); display: grid; place-items: center; border-bottom: 1px solid var(--border); }
.tg-thumb-body { padding: 11px 13px; display: flex; flex-direction: column; gap: 7px; }
.tg-thumb-meta { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }
.tg-thumb-stats { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); }
.tg-thumb-stats span { display: inline-flex; align-items: center; gap: 4px; }

/* editor-skall */
.tg-editor { height: 100%; display: flex; flex-direction: column; background: var(--bg); }
.tg-topbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap; }
.tg-floors { display: inline-flex; gap: 4px; }
.tg-floor { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); font-size: 12px; font-weight: 550; padding: 5px 11px; border-radius: 7px; cursor: pointer; font-family: inherit; }
.tg-floor.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tg-title { font-weight: 650; font-size: 14.5px; }
.tg-etasje { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.tg-etasje-sel { padding: 5px 26px 5px 9px; font-size: 12.5px; font-weight: 600; }
.tg-etasje select:disabled { opacity: .55; cursor: not-allowed; }
.tg-frakt-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; color: #b45309; background: #fef3c7; padding: 3px 8px; border-radius: 6px; }
.tg-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 5px; }
.tg-divider { width: 1px; height: 22px; background: var(--border); margin: 0 3px; }

.tg-body { flex: 1; min-height: 0; display: flex; }
/* venstre rail */
.tg-rail { width: 232px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.tg-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 10px; border-bottom: 1px solid var(--border); }
.tg-tool { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid transparent; background: var(--surface-2); border-radius: 8px; cursor: pointer; color: var(--text-muted); }
.tg-tool:hover { background: var(--surface-3); color: var(--text); }
.tg-tool.on { background: var(--accent); color: #fff; }
.tg-tool .msym { font-size: 20px; }
.tg-rail-scroll { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 16px; }
.tg-opt { display: flex; flex-direction: column; gap: 8px; }
.tg-opt-lbl { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tg-opt-row { display: flex; align-items: center; gap: 8px; }
.tg-opt-row .tg-opt-lbl { flex: 1; }
.tg-sys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.tg-sys { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); font-size: 11.5px; font-weight: 500; cursor: pointer; color: var(--text); font-family: inherit; }
.tg-sys.on { border-color: var(--accent); background: var(--accent-soft); }
.tg-sys-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.tg-sym-grid { display: flex; flex-direction: column; gap: 3px; }
.tg-sym-btn { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid transparent; border-radius: 7px; background: var(--surface-2); cursor: grab; font-size: 12.5px; font-family: inherit; color: var(--text); text-align: left; }
.tg-sym-btn:hover { background: var(--surface-3); }
.tg-sym-btn.on { border-color: var(--accent); background: var(--accent-soft); }
.tg-sym-name { flex: 1; }
.tg-sym-ic { width: 26px; height: 20px; flex-shrink: 0; display: grid; place-items: center; }
.tg-sym-ic svg { overflow: visible; }

/* lerret */
.tg-canvas { flex: 1; position: relative; overflow: hidden; background: #eef2f6; min-width: 0; }
.tg-canvas-wrap, .tg-svg { width: 100%; height: 100%; display: block; }
.tg-svg { touch-action: none; user-select: none; }
.tg-hint { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); background: rgba(15,23,34,0.9); color: #fff; font-size: 12px; padding: 7px 14px; border-radius: 999px; pointer-events: none; }
.tg-legend { position: absolute; top: 14px; right: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow-md); padding: 8px 10px; min-width: 150px; font-size: 12px; }
.tg-legend-head { display: flex; align-items: center; justify-content: space-between; font-weight: 650; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 6px; }
.tg-legend-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.tg-legend-show { position: absolute; top: 14px; right: 14px; }
.tg-legend-wide { max-width: 326px; max-height: 62vh; overflow: auto; }
.tg-legend-grid { display: flex; flex-direction: column; gap: 1px; }
.tg-legend-grow { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 8px; padding: 3px 2px; font-size: 11.5px; }
.tg-legend-grow.warn { color: var(--warn); }
.tg-legend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-legend-qty { color: var(--text-muted); font-size: 11px; white-space: nowrap; }

/* hjelpe-tooltip (?) */
.help-dot { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--border); color: var(--text-faint); font-size: 10px; font-weight: 700; cursor: help; position: relative; vertical-align: middle; font-family: var(--font-sans); }
.help-dot:hover { border-color: var(--accent); color: var(--accent); }
.help-tip { position: absolute; bottom: 135%; left: 50%; transform: translateX(-50%); width: 244px; background: #0f172a; color: #e2e8f0; padding: 10px 12px; border-radius: 9px; font-size: 11.5px; font-weight: 400; line-height: 1.5; box-shadow: var(--shadow-md); z-index: 60; text-transform: none; letter-spacing: 0; text-align: left; pointer-events: none; opacity: 0; transition: opacity .12s; }
.help-dot:hover .help-tip { opacity: 1; }
.help-tip b { color: #fff; font-weight: 650; }
.help-tip .tip-formula { font-family: var(--font-mono); background: rgba(255,255,255,0.12); padding: 1px 5px; border-radius: 4px; font-size: 10.5px; }
.help-tip .tip-bom { display: flex; align-items: center; gap: 5px; margin-top: 6px; color: #86efac; font-size: 10.5px; }
.help-tip .tip-bom.no { color: #fca5a5; }
.tg-varlist { display: flex; flex-direction: column; gap: 7px; }
.tg-var { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); cursor: pointer; text-align: left; transition: border-color .12s, background .12s; }
.tg-var:hover { border-color: var(--accent); background: var(--accent-soft); }
.tg-var-ic { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); flex-shrink: 0; }
.tg-var-name { font-weight: 600; font-size: 13.5px; }
.tg-var-desc { font-size: 11.5px; color: var(--text-muted); }

/* høyre panel */
.tg-side { width: 300px; flex-shrink: 0; background: var(--bg); border-left: 1px solid var(--border); overflow: auto; padding: 14px; }
.tg-mini-note { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); background: var(--surface-2); padding: 7px 9px; border-radius: 7px; }
.tg-mini-note.warn { background: var(--warn-bg); color: var(--warn); }
.tbl tr.row-warn td { background: var(--warn-bg); }

@media (max-width: 1100px) { .tg-side { display: none; } }

/* ============================================================
   AI-CHAT-MODUL
   ============================================================ */
/* ----- Header-launcher ----- */
.ai-launch-wrap { position: relative; display: inline-flex; }
.ai-launch.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.ai-launch.on .msym { color: var(--accent); }
.ai-launch.locked { opacity: 0.5; cursor: not-allowed; }
.ai-launch.locked .msym { font-size: 17px; }

/* upsell-popover */
.ai-popover {
  position: absolute; top: calc(100% + 9px); right: 0; width: 282px; z-index: 9500;
  background: var(--side-bg); color: #e9eef4; border: 1px solid var(--side-border);
  border-radius: 11px; padding: 13px 15px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 7px;
  opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .14s, transform .14s;
}
.ai-launch-wrap:hover .ai-popover { opacity: 1; transform: none; }
.ai-popover::before { content: ""; position: absolute; top: -5px; right: 13px; width: 10px; height: 10px; background: var(--side-bg); border-left: 1px solid var(--side-border); border-top: 1px solid var(--side-border); transform: rotate(45deg); }
.ai-popover-head { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; color: #fff; }
.ai-popover-head .msym { font-size: 16px; color: var(--warn-dot); }
.ai-popover-body { font-size: 12px; line-height: 1.5; color: #aeb9c7; }
.ai-popover-cta { font-size: 12px; font-weight: 600; color: #fff; background: var(--accent); padding: 6px 10px; border-radius: 7px; text-align: center; margin-top: 2px; }

/* ----- Flyout ----- */
.ai-flyout {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 7500;
  width: clamp(360px, 31vw, 444px);
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .26s cubic-bezier(.32,.72,.32,1);
}
.ai-flyout.open { transform: none; }

.ai-head { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ai-head-id { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.ai-avatar { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: #fff; flex-shrink: 0; box-shadow: 0 2px 8px var(--accent-soft); }
.ai-avatar .msym { font-size: 20px; }
.ai-title { font-size: 14.5px; font-weight: 650; color: var(--text); letter-spacing: -0.01em; }
.ai-sub { font-size: 11.5px; color: var(--text-muted); }
.ai-head-actions { display: flex; align-items: center; gap: 5px; }
.ai-head-actions .btn-icon { position: relative; width: 32px; height: 32px; padding: 6px; }
.ai-log-badge { position: absolute; top: -3px; right: -3px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; font-family: var(--font-mono); }

/* live web-pill */
.ai-web-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--ok); background: var(--ok-bg); padding: 4px 9px; border-radius: 20px; white-space: nowrap; }
.ai-web-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok-dot); box-shadow: 0 0 0 0 rgba(34,197,94,0.5); animation: aiGlow 1.8s ease-in-out infinite; }
@keyframes aiGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.55); } 50% { box-shadow: 0 0 0 5px rgba(34,197,94,0); } }

/* kontekst-badge */
.ai-ctx { padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 9px; flex-shrink: 0; }
.ai-ctx-row { display: flex; align-items: baseline; gap: 9px; }
.ai-ctx-lbl { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); flex-shrink: 0; padding-top: 2px; }
.ai-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 1px; font-size: 11.5px; min-width: 0; }
.ai-crumb { color: var(--text-muted); white-space: nowrap; }
.ai-crumb.cur { color: var(--accent); font-weight: 600; }
.ai-crumb-sep { font-size: 14px; color: var(--text-faint); }
.ai-ctx-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ai-scope-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 550; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); padding: 3px 9px; border-radius: 20px; }
.ai-scope-chip .msym { font-size: 14px; }
.ai-scope-chip.read { color: var(--accent); border-color: transparent; background: var(--accent-soft); }
.ai-scope-chip.ovr { cursor: pointer; color: #7c3aed; background: rgba(124,58,237,0.10); border-color: transparent; font-family: var(--font-mono); }
.ai-scope-chip.ovr:hover { background: rgba(124,58,237,0.18); }

/* kilde-peek */
.ai-peek { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--accent-soft); color: var(--accent); font-size: 12px; border-bottom: 1px solid var(--border); animation: fadeUp .2s ease; }
.ai-peek .msym { font-size: 16px; }

/* meldinger */
.ai-msgs { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 14px; }
.ai-msg { display: flex; gap: 9px; max-width: 100%; }
.ai-msg.user { justify-content: flex-end; }
.ai-msg-ava { width: 26px; height: 26px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; margin-top: 2px; }
.ai-msg-ava .msym { font-size: 16px; }
.ai-bubble { font-size: 13.5px; line-height: 1.55; color: var(--text); white-space: pre-wrap; border-radius: 13px; padding: 10px 13px; max-width: 84%; }
.ai-msg.ai .ai-bubble { background: var(--surface-2); border-bottom-left-radius: 4px; }
.ai-msg.user .ai-bubble { background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.ai-sysmsg { display: flex; align-items: center; gap: 8px; align-self: center; font-size: 11.5px; color: var(--ok); background: var(--ok-bg); padding: 6px 12px; border-radius: 20px; }
.ai-sysmsg .msym { font-size: 15px; }

/* sitat-chip */
.ai-cite { display: inline-flex; align-items: center; gap: 4px; vertical-align: baseline; margin: 0 1px; padding: 1px 6px 1px 5px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 11.5px; color: var(--text-muted); font-family: var(--mono, monospace); cursor: pointer; }
.ai-cite:hover { background: var(--accent-soft); border-color: var(--accent); }
.ai-cite .msym { font-size: 13px; }

/* forslag-chips */
.ai-suggestions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.ai-suggestions-lbl { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.ai-suggestions-lbl .msym { font-size: 14px; color: var(--text-faint); }
.ai-suggest-chip { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 20px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background 0.12s, transform 0.1s; }
.ai-suggest-chip:hover { background: var(--accent); color: var(--accent-text); transform: translateY(-1px); }d: var(--surface); color: var(--accent); font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; cursor: pointer; transition: background .12s, border-color .12s; }
.ai-cite:hover { background: var(--accent-soft); border-color: var(--accent); }
.ai-cite .msym { font-size: 13px; }

/* typing */
.ai-typing { display: inline-flex; align-items: center; gap: 4px; padding: 13px 14px; }
.ai-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); animation: aiBlink 1.2s infinite ease-in-out; }
.ai-typing span:nth-child(2) { animation-delay: .18s; }
.ai-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes aiBlink { 0%,80%,100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* loggbar */
.ai-logbar { padding: 0 14px 8px; flex-shrink: 0; }
.ai-logbtn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 9px; border-radius: 9px; border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text-muted); font-family: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer; transition: border-color .12s, color .12s, background .12s; }
.ai-logbtn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ai-logbtn .msym { font-size: 17px; }

/* hurtighandlinger */
.ai-quick { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 14px; border-top: 1px solid var(--border); flex-shrink: 0; }
.ai-pill { font-size: 12px; font-weight: 500; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 6px 12px; cursor: pointer; font-family: inherit; transition: background .12s, border-color .12s, color .12s; }
.ai-pill:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ai-pill:disabled { opacity: .5; cursor: default; }

/* input */
.ai-input { display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--border); flex-shrink: 0; }
.ai-input textarea { flex: 1; resize: none; border: 1px solid var(--border-strong); border-radius: 11px; padding: 10px 12px; font-family: inherit; font-size: 13.5px; line-height: 1.4; color: var(--text); background: var(--surface); max-height: 120px; transition: border-color .12s, box-shadow .12s; }
.ai-input textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ai-input textarea::placeholder { color: var(--text-faint); }
.ai-send { width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px; border: none; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background .12s, opacity .12s; }
.ai-send:hover:not(:disabled) { background: var(--accent-hover); }
.ai-send:disabled { opacity: .4; cursor: default; }
.ai-send .msym { font-size: 20px; }

/* logg-modal */
.ai-log-preview { border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.ai-log-preview-lbl { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); padding: 9px 12px; border-bottom: 1px solid var(--border); }
.ai-log-preview-lbl .msym { font-size: 15px; }
.ai-log-preview pre, .ai-log-entry pre { margin: 0; padding: 12px; font-size: 12px; line-height: 1.6; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.ai-log-entry { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.ai-log-entry-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.ai-log-entry-head .msym { font-size: 17px; color: var(--ok); }

/* admin */
.ai-mod-ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted); flex-shrink: 0; }
.ai-mod-ic .msym { font-size: 18px; }
.set-row-lbl .tag-pill .msym { vertical-align: -2px; }
.ai-scope-opt { display: flex; align-items: flex-start; gap: 13px; padding: 14px 15px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; font-family: inherit; transition: border-color .12s, box-shadow .12s; }
.ai-scope-opt:hover { border-color: var(--border-strong); }
.ai-scope-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ai-scope-opt-ic { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted); flex-shrink: 0; }
.ai-scope-opt-ic.web { background: var(--ok-bg); color: var(--ok); }
.ai-scope-opt-t { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text); }
.ai-scope-opt-s { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.45; }
.ai-scope-opt .ai-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); flex-shrink: 0; margin-top: 2px; transition: border-color .12s; position: relative; }
.ai-scope-opt.on .ai-radio { border-color: var(--accent); }
.ai-scope-opt.on .ai-radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.tag-pill.warn-pill { background: var(--warn-bg); color: var(--warn); }
.ai-upsell-demo { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ai-upsell-text { display: flex; align-items: flex-start; gap: 9px; flex: 1; min-width: 220px; font-size: 12.5px; line-height: 1.5; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.ai-upsell-text .msym { font-size: 17px; color: var(--warn-dot); flex-shrink: 0; margin-top: 1px; }

@media (max-width: 560px) { .ai-flyout { width: 100vw; } }

/* ============================================================
   Smart Search / Command Palette
   ============================================================ */

/* Launcher bar — permanent i header-actions */
.ss-launcher {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  color: var(--text-faint);
  font-size: 13px;
  font-family: var(--font-sans);
  transition: border-color .12s, background .12s, color .12s;
  min-width: 196px;
  user-select: none;
}
.ss-launcher:hover { border-color: var(--border-strong); color: var(--text-muted); background: var(--surface); }
.ss-launcher:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ss-launcher .ss-launcher-ico { font-size: 17px; flex-shrink: 0; }
.ss-launcher-txt { flex: 1; }
.ss-launcher-kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-faint);
  letter-spacing: .02em;
  flex-shrink: 0;
}

/* Full-screen backdrop */
.ss-overlay {
  position: fixed;
  inset: 0;
  z-index: 9800;
  background: rgba(8, 14, 26, 0.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(56px, 11vh, 130px);
  animation: ss-fade .11s ease;
}
@keyframes ss-fade { from { opacity: 0; } to { opacity: 1; } }

/* Panel */
.ss-panel {
  width: 640px;
  max-width: calc(100vw - 40px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(37,99,235,.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ss-drop .13s cubic-bezier(.16,1,.3,1);
}
@keyframes ss-drop {
  from { opacity: 0; transform: translateY(-10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)      scale(1);  }
}

/* Input row */
.ss-input-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  min-height: 54px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ss-ico { font-size: 20px; color: var(--text-faint); flex-shrink: 0; }
.ss-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text);
  outline: none;
  min-width: 0;
}
.ss-input::placeholder { color: var(--text-faint); }
.ss-clear {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: none;
  background: var(--surface-3);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background .1s;
}
.ss-clear:hover { background: var(--border-strong); }
.ss-clear .msym { font-size: 15px; }
.ss-kbd-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  color: var(--text-faint);
  flex-shrink: 0;
  letter-spacing: .02em;
}

/* Scope badge */
.ss-scope-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s;
  white-space: nowrap;
  max-width: 220px;
}
.ss-scope-badge span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-scope-badge:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.ss-scope-badge .msym { font-size: 14px; }
.ss-scope-x { opacity: .55; transition: opacity .1s; }
.ss-scope-badge:hover .ss-scope-x { opacity: 1; }

/* Results body */
.ss-body {
  max-height: 376px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Result group */
.ss-group { padding: 4px 0 6px; }
.ss-group + .ss-group { border-top: 1px solid var(--border); }
.ss-group-lbl {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px 5px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.ss-group-lbl .msym { font-size: 13px; }

/* Result item */
.ss-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 7px 14px;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: background .07s;
}
.ss-item:hover  { background: var(--surface-2); }
.ss-item.active { background: var(--accent-soft); }
.ss-item-ic {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: background .07s, color .07s, border-color .07s;
}
.ss-item.active .ss-item-ic {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}
.ss-item-ic .msym { font-size: 16px; }
.ss-item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.ss-item-lbl {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ss-item-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ss-item-enter {
  font-size: 16px;
  color: var(--accent);
  flex-shrink: 0;
  opacity: .65;
}

/* Empty / hint state */
.ss-hint-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 34px 20px;
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}
.ss-hint-state .msym { font-size: 32px; opacity: .4; }
.ss-hint-state kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  vertical-align: middle;
  color: var(--text-muted);
}

/* Footer hint bar */
.ss-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--text-faint);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.ss-footer kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  color: var(--text-muted);
  vertical-align: middle;
  letter-spacing: .01em;
}
.ss-foot-sep { opacity: .35; user-select: none; }

/* Dark theme refinements */
[data-theme="dark"] .ss-overlay { background: rgba(0, 0, 0, 0.68); }

/* ============================================================
   Aktivitetslogg — Activity Log
   ============================================================ */

/* Timeline row */
.act-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  transition: background 0.12s;
  position: relative;
}
.act-row:hover { background: var(--surface-2); }
.act-row + .act-row { border-top: 1px solid var(--border); }

/* Vertical connector line between rows */
.act-timeline-line {
  position: absolute;
  left: 34px;
  top: 50px;
  bottom: -14px;
  width: 1px;
  background: var(--border);
  pointer-events: none;
}

/* Circular icon */
.act-icon {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Text content */
.act-body   { flex: 1; min-width: 0; }
.act-head   { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.act-actor  { font-size: 13px; font-weight: 600; color: var(--text); }
.act-time   { font-size: 12px; color: var(--text-faint); }
.act-proj   {
  font-size: 11.5px; color: var(--text-muted);
  background: var(--surface-2); padding: 1px 8px;
  border-radius: 20px; white-space: nowrap;
}
.act-desc   { font-size: 13.5px; color: var(--text); line-height: 1.45; }

/* Filter pill row */
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all 0.12s;
  font-family: var(--font-sans);
  white-space: nowrap;
}
.filter-pill:hover  { border-color: var(--accent); color: var(--accent); }
.filter-pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   WORKFLOW ENGINE
   ============================================================ */

/* ---- Template list ---- */
.wf-tpl-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.wf-tpl-card {
  display: flex; align-items: center; gap: 16px;
  padding: 15px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; text-align: left; width: 100%;
  font-family: inherit; color: inherit;
  transition: border-color .14s, box-shadow .14s, transform .08s;
}
.wf-tpl-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.wf-tpl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wf-tpl-navn { font-size: 14.5px; font-weight: 600; color: var(--text); }
.wf-tpl-beskr { font-size: 13px; color: var(--text-muted); line-height: 1.4; }

/* ---- Run cards ---- */
.wf-runs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.wf-run-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: border-color .14s, box-shadow .14s;
}
.wf-run-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.wf-run-top { display: flex; align-items: center; gap: 11px; }

/* ============================================================
   RUNNER SHELL
   ============================================================ */
.wf-runner { display: flex; flex-direction: column; }

.wf-runner-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.wf-runner-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 14px; color: var(--text);
}

/* ---- Stepper ---- */
.wf-stepper {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 18px 24px 14px; overflow-x: auto;
  position: sticky; top: 52px; z-index: 9;
}
.wf-stepper-track { display: flex; align-items: flex-start; min-width: min-content; }

.wf-connector {
  height: 2px; min-width: 20px; flex: 1;
  background: var(--border); border-radius: 2px;
  margin-top: 15px; transition: background .35s;
}
.wf-connector.wf-done { background: var(--ok-dot); }

.wf-step-node {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  min-width: 80px; max-width: 100px;
  padding: 0; border: none; background: none;
  font-family: inherit;
}
.wf-step-bubble {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); border: 2px solid var(--border);
  color: var(--text-faint); flex-shrink: 0;
  transition: background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.wf-step-node.wf-complete .wf-step-bubble { background: var(--ok-bg); border-color: var(--ok-dot); color: var(--ok); }
.wf-step-node.wf-active  .wf-step-bubble { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.wf-step-node.wf-skipped .wf-step-bubble { background: var(--surface-2); border-color: var(--border); color: var(--text-faint); opacity: .65; }
.wf-step-node.wf-locked  .wf-step-bubble { background: var(--surface-2); border-color: var(--border); color: var(--text-faint); opacity: .4; }
.wf-step-node.wf-optional .wf-step-bubble { border-style: dashed; border-color: var(--border-strong); color: var(--text-muted); }

.wf-step-num { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.wf-step-label {
  font-size: 11.5px; font-weight: 550; color: var(--text-muted);
  text-align: center; line-height: 1.3;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.wf-step-node.wf-active   .wf-step-label { color: var(--accent); font-weight: 600; }
.wf-step-node.wf-complete .wf-step-label { color: var(--ok); }
.wf-step-node.wf-locked   .wf-step-label { color: var(--text-faint); }
.wf-optional-tag { font-size: 10px; color: var(--text-faint); font-weight: 400; }
.wf-locked-tag   { font-size: 10px; color: var(--text-faint); font-weight: 400; font-style: italic; }

/* ---- Runner body: 2-kolonne ---- */
.wf-runner-body {
  display: grid; grid-template-columns: 1fr 284px;
  min-height: 520px;
}
.wf-step-area {
  display: flex; flex-direction: column; gap: 22px;
  padding: 28px 32px;
}

/* Steg-header */
.wf-step-hd { display: flex; align-items: flex-start; gap: 14px; }
.wf-step-eyebrow {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-faint);
}
.wf-step-title { font-size: 20px; font-weight: 650; letter-spacing: -.02em; color: var(--text); }
.wf-step-desc  { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-top: 3px; }

/* Felt */
.wf-fields { display: flex; flex-direction: column; gap: 20px; }
.wf-field  { display: flex; flex-direction: column; gap: 8px; }
.wf-field-lbl { font-size: 13px; font-weight: 550; color: var(--text); }
.wf-req { color: var(--accent); margin-left: 3px; }

/* Boolean */
.wf-bool-row { display: flex; gap: 8px; }
.wf-bool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 13px; font-weight: 550;
  cursor: pointer; transition: all .12s; font-family: inherit;
}
.wf-bool-btn:hover { border-color: var(--border-strong); color: var(--text); }
.wf-bool-btn.wf-bool-yes { border-color: var(--ok-dot); background: var(--ok-bg); color: var(--ok); }
.wf-bool-btn.wf-bool-no  { border-color: #dc2626; background: rgba(220,38,38,.08); color: #dc2626; }

/* Select row + source chip */
.wf-select-row  { display: flex; align-items: center; gap: 10px; }
.wf-source-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; color: var(--text-faint);
  background: var(--surface-3); padding: 3px 8px; border-radius: 5px;
  font-family: var(--font-mono); white-space: nowrap;
}

/* Hopp-over dialog */
.wf-skip-dialog {
  border: 1.5px solid var(--warn-dot); border-radius: var(--radius);
  background: var(--warn-bg); padding: 16px 18px;
  animation: fadeUp .15s ease;
}
.wf-skip-head { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }

/* Footer-nav */
.wf-footer {
  display: flex; align-items: center; gap: 8px;
  padding-top: 18px; border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ---- Logikk-panel (høyre kolonne) ---- */
.wf-logic-panel {
  border-left: 1px solid var(--border);
  background: var(--surface-2);
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.wf-logic-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-muted);
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.wf-rule-card {
  display: flex; gap: 9px; padding: 10px 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; transition: border-color .15s, background .15s;
}
.wf-rule-card.triggered { border-color: var(--ok-dot); background: var(--ok-bg); }
.wf-rule-indicator { flex-shrink: 0; padding-top: 1px; }
.wf-rule-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.wf-rule-name { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.3; }
.wf-rule-blocks { display: flex; flex-direction: column; gap: 3px; margin-top: 3px; }
.wf-rule-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 11px; }
.wf-kw {
  font-size: 9.5px; font-weight: 700; padding: 1px 5px;
  border-radius: 3px; letter-spacing: .03em;
}
.wf-kw-if   { background: var(--info-bg); color: var(--info); }
.wf-kw-then { background: var(--accent-soft); color: var(--accent); }
.wf-rule-token { color: var(--text); background: var(--surface-3); padding: 0 4px; border-radius: 3px; font-size: 11px; }
.wf-rule-op     { color: var(--text-faint); font-size: 11px; }
.wf-rule-action { color: var(--text-muted); font-size: 11px; }

/* ---- Oppsummering / dokument ---- */
.wf-summary      { display: flex; flex-direction: column; gap: 22px; }
.wf-summary-hero { display: flex; align-items: center; gap: 16px; }
.wf-doc-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.wf-doc-card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12.5px; font-weight: 550; color: var(--text-muted);
}
.wf-doc-pre {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.75;
  padding: 16px; margin: 0; color: var(--text);
  white-space: pre-wrap; max-height: 400px; overflow-y: auto;
}

@media (max-width: 900px) {
  .wf-runner-body { grid-template-columns: 1fr; }
  .wf-logic-panel { display: none; }
  .wf-step-area   { padding: 18px; }
}

/* ============================================================
   WORKFLOW BUILDER
   ============================================================ */
.wf-builder      { display: flex; flex-direction: column; }
.wf-builder-body {
  display: flex; flex-direction: column; gap: 24px;
  padding: 28px 32px; max-width: 900px;
}

/* Steg-kort */
.bl-step-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.bl-step-card-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.bl-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; font-family: var(--font-mono);
  flex-shrink: 0; margin-top: 8px;
}
.bl-step-props {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.bl-fields-section { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }

/* Felt-rad */
.bl-field-row { display: flex; align-items: center; gap: 8px; }

/* Ikonvelger */
.bl-icon-btn {
  border-radius: 7px; border: 1.5px solid var(--border);
  background: var(--surface); cursor: pointer;
  display: grid; place-items: center;
  color: var(--text-muted); transition: all .12s;
}
.bl-icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.bl-icon-btn.on    { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Obligatorisk-knapp (stjerne) */
.bl-req-btn {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 7px; border: 1.5px solid var(--border);
  background: var(--surface); cursor: pointer;
  display: grid; place-items: center; color: var(--text-faint);
  transition: all .12s;
}
.bl-req-btn.on { border-color: var(--warn-dot); background: var(--warn-bg); color: var(--warn); }

/* Toggle-label */
.bl-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }

/* Regelkort */
.bl-rule-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.bl-rule-head    { display: flex; align-items: center; gap: 10px; }
.bl-rule-section {
  display: flex; flex-direction: column; gap: 7px;
  padding-left: 12px; border-left: 2px solid var(--border);
}
.bl-cond-row  { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.bl-then-row  { flex-direction: row !important; align-items: center; flex-wrap: wrap; gap: 8px; }
