/* Solar v3 — fælles design (forside og økonomi). Mobil først; PC fra 1024px.
   Farver: valideret serie-palet (sol/batteri/net/salg) mod mørk flade #161b22. */
:root {
  --bg: #0d1117;
  --card: #161b22;
  --card-2: #1c2128;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: #30363d;
  --text: #f0f3f6;
  --text-2: #c9d1d9;
  --muted: #8b949e;
  --sol: #c98500;
  --bat: #199e70;
  --net: #3987e5;
  --salg: #d95926;
  --forbrug: #c3c2b7;
  --dim: #3a414a;
  --sol-wash: rgba(201, 133, 0, 0.2);
  --bat-wash: rgba(25, 158, 112, 0.22);
  --net-wash: rgba(57, 135, 229, 0.14);
  --good-text: #4fd1a5;
  --radius: 24px;
  --radius-sm: 16px;
  --tabbar-h: 80px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.45;
}
a { color: var(--text); }
a:hover { color: #fff; }
h1, h2, p { margin: 0; }
.t-12 { font-size: 12px; }
.t-15 { font-size: 15px; }
.t-20 { font-size: 20px; font-weight: 600; line-height: 1.3; }
.t-hero { font-size: 32px; font-weight: 600; line-height: 1.1; }
.muted { color: var(--muted); }
.soft { color: var(--text-2); }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Ramme ─────────────────────────────────────────────────────────────── */
.app { min-height: 100vh; }
.page { max-width: 1360px; margin: 0 auto; padding: 8px 16px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-direction: column; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.only-desktop { display: none !important; }

/* ── Mobil-header ──────────────────────────────────────────────────────── */
.m-head { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: env(safe-area-inset-top); }
.m-head h1 { font-size: 20px; font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 16px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-live { background: rgba(25, 158, 112, 0.14); color: var(--good-text); }
.pill-live::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: var(--bat); }
.pill-stale { background: rgba(217, 89, 38, 0.16); color: #f08a5d; }
.pill-stale::before { background: var(--salg); }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; background: transparent; }

/* ── Kort ──────────────────────────────────────────────────────────────── */
.card { background: var(--card); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-tight { padding: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; font-weight: 600; }
a.card { text-decoration: none; }
.tile { background: var(--card-2); border-radius: var(--radius-sm); padding: 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile .v { font-size: 20px; font-weight: 600; }
.stat { background: var(--card); border-radius: var(--radius-sm); padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.stat .v { font-size: 24px; font-weight: 600; }
.key { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 4px; flex-shrink: 0; display: inline-block; }
.sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.ln { width: 12px; height: 2px; display: inline-block; }
.c-sol { background: var(--sol); } .c-bat { background: var(--bat); } .c-net { background: var(--net); }
.c-salg { background: var(--salg); } .c-forbrug { background: var(--forbrug); } .c-dim { background: var(--dim); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Meter */
.meter { height: 8px; border-radius: 4px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; }
.meter-sol { background: var(--sol-wash); } .meter-sol > i { background: var(--sol); }
.meter-bat { background: var(--bat-wash); } .meter-bat > i { background: var(--bat); }

/* Segmenteret (høj) bar */
.segbar { height: 28px; display: flex; gap: 2px; }
.segbar > div { border-radius: 4px; display: flex; align-items: center; padding-left: 8px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; min-width: 0; }
.segbar > .c-sol { color: #0b0b0b; }

/* Lister og råd */
.tips { display: flex; flex-direction: column; gap: 8px; }
.tip { min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--card-2); text-decoration: none; }
.tip-net { background: rgba(57, 135, 229, 0.12); }
.tip .ic { width: 32px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ic-net { background: rgba(57, 135, 229, 0.22); color: #79b0f0; }
.ic-bat { background: rgba(25, 158, 112, 0.2); color: var(--good-text); }
.ic-salg { background: rgba(217, 89, 38, 0.2); color: #f08a5d; }
.tip .txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.linklist { background: var(--card); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.linklist a { min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 24px; text-decoration: none; border-bottom: 1px solid var(--line); }
.linklist a:last-child { border-bottom: 0; }
.linklist a span:first-child { flex: 1; }
.rows > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; border-bottom: 1px solid var(--line); }
.rows > div:last-child { border-bottom: 0; }

/* ── Grafer ────────────────────────────────────────────────────────────── */
.bars { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line-strong); }
.bars > div { flex: 1; border-radius: 3px 3px 0 0; background: var(--dim); min-width: 2px; }
.bars > div.hi { background: var(--net); }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.chart-wrap { display: flex; gap: 8px; }
.yaxis { display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; color: var(--muted); text-align: right; flex-shrink: 0; }
.chart-svg { display: block; width: 100%; flex: 1; min-width: 0; }
.cols { display: flex; align-items: flex-end; justify-content: space-around; border-bottom: 1px solid var(--line-strong); }
.col { width: 24px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.col .stack { width: 24px; display: flex; flex-direction: column; gap: 2px; }
.col .stack > i { display: block; width: 24px; }
.col .stack > i:first-child { border-radius: 4px 4px 0 0; }
.hbar { height: 12px; border-radius: 0 4px 4px 0; }
.group { display: flex; align-items: flex-end; gap: 2px; }
.group > div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.group i { display: block; width: 24px; border-radius: 4px 4px 0 0; }

/* Energiflow (PC) */
.flow { display: grid; grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr); gap: 12px 0; align-items: center; }
.flow .hus { grid-row: span 2; height: 100%; justify-content: center; padding: 24px; }
.arrow { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
.arrow i { width: 80px; height: 2px; position: relative; display: block; }
.arrow i::after { content: ""; position: absolute; right: -2px; top: -4px; border-left: 8px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.arrow.off i { height: 1px; background: var(--line-strong); }
.arrow.off i::after { display: none; }

/* Tabeller */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: right; font-size: 12px; font-weight: 400; color: var(--muted); padding: 8px 0 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { text-align: right; padding: 10px 0 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; padding-left: 0; }
.tbl tfoot td { font-weight: 600; border-bottom: 0; }

/* ── Navigation ────────────────────────────────────────────────────────── */
.topnav { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: calc(8px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 12px; }
.tabbar a .tb-ic { width: 56px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; }
.tabbar a[aria-current="page"] { color: var(--text); font-weight: 600; }
.tabbar a[aria-current="page"] .tb-ic { background: var(--sol-wash); color: #e0a530; }

/* Installér-app-banner */

/* ── PC (≥ 1024px) ─────────────────────────────────────────────────────── */
@media (min-width: 1024px) {
  .only-mobile { display: none !important; }
  .only-desktop { display: revert !important; }
  .only-desktop.flexd { display: flex !important; }
  .only-desktop.gridd { display: grid !important; }
  .tabbar { display: none; }
  .topnav { display: block; border-bottom: 1px solid var(--line); }
  .topnav .in { max-width: 1360px; margin: 0 auto; padding: 0 32px; min-height: 64px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; }
  .brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 15px; font-weight: 600; }
  .brand i { width: 32px; height: 32px; border-radius: 8px; background: var(--sol-wash); color: #e0a530; display: flex; align-items: center; justify-content: center; }
  .topnav nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
  .topnav nav a { padding: 10px 14px; border-radius: 8px; text-decoration: none; color: var(--muted); }
  .topnav nav a[aria-current="page"] { background: var(--card-2); color: var(--text); font-weight: 600; }
  .page { padding: 32px; gap: 24px; }
  .row { flex-direction: row; flex-wrap: wrap; gap: 24px; }
  .row > * { flex: 1 1 360px; }
  .row > .w2 { flex: 2 1 560px; }
  .row > .w14 { flex: 1.4 1 560px; }
  .card { border-radius: 16px; }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .t-hero { font-size: 48px; }
  .page-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
  .page-title h1 { font-size: 24px; font-weight: 600; }
}

/* Prisgraf, pile og rækker */
.bars-price { height: 96px; }
.arrow.rev i { transform: rotate(180deg); }
.rows .ic { width: 32px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
@media (min-width: 1024px) {
  .bars-price { height: 160px; gap: 4px; }
  .bars-price > div { max-width: 24px; margin: 0 auto; border-radius: 4px 4px 0 0; }
}
.card.grid-4 { display: grid; }
.bars > .c-net { background: var(--net); } .bars > .c-sol { background: var(--sol); } .bars > .c-bat { background: var(--bat); }
.bars > .c-salg { background: var(--salg); } .bars > .c-dim { background: var(--dim); }
.col > span { white-space: nowrap; }

/* Beregningsgrundlag (dokumentation) */
.docs .bg-section { display: flex; flex-direction: column; gap: 12px; }
.docs .bg-section-title { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 600; }
.docs .bg-section-num { width: 32px; height: 32px; border-radius: 16px; background: var(--sol-wash); color: #e0a530; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; flex-shrink: 0; }
.docs .formula-box { background: var(--card-2); border-radius: 12px; padding: 16px; font-family: ui-monospace, Consolas, "Fira Mono", monospace; font-size: 12px; line-height: 1.7; white-space: pre; overflow-x: auto; color: var(--text); }
.docs .formula-box .comment { color: var(--muted); }
.docs .formula-box .val { color: #e0a530; }
.docs .formula-box .result { color: var(--good-text); font-weight: 600; }
.docs .source-box { display: flex; gap: 12px; align-items: flex-start; background: var(--net-wash); border-radius: 12px; padding: 12px 16px; font-size: 15px; line-height: 1.5; }
.docs .source-box a { color: #79b0f0; }
.docs .src-icon { width: 8px; height: 8px; border-radius: 4px; background: var(--net); margin-top: 8px; flex-shrink: 0; }
.docs .assumption-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; flex-wrap: wrap; }
.docs .assumption-row:last-child { border-bottom: 0; }
.docs .assumption-label { color: var(--muted); }
.docs .assumption-val { font-weight: 600; text-align: right; }
.docs .grid-assumptions { display: grid; grid-template-columns: 1fr; gap: 16px; }
.docs .pill { height: auto; padding: 2px 8px; border-radius: 10px; font-size: 12px; display: inline-flex; vertical-align: middle; margin-left: 6px; }
.docs .pill::before { display: none; }
.docs .pill-live { background: var(--bat-wash); color: var(--good-text); }
.docs .pill-manual { background: var(--sol-wash); color: #e0a530; }
.docs .pill-calc { background: var(--net-wash); color: #79b0f0; }
@media (min-width: 1024px) { .docs .grid-assumptions { grid-template-columns: 1fr 1fr; } .docs .bg-section-title { font-size: 20px; } }

/* ── Energi-ring (forside): hvor strømmen kommer fra + hvor den går hen ───────── */
.ef { gap: 16px; }
.ef-body { display: flex; gap: 24px; align-items: center; flex: 1; }
.ef-ring { display: flex; flex-direction: column; align-items: center; gap: 14px; flex-shrink: 0; }
.ef-box { position: relative; width: 200px; height: 200px; }
.ef-box svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ef-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; }
.ef-kw { font-size: 34px; font-weight: 600; letter-spacing: -1px; line-height: 1.1; }
.ef-socl { font-size: 12px; color: var(--bat); margin-top: 6px; font-weight: 600; }
.ef-bg { fill: none; stroke: var(--card-2); }
.ef-seg { fill: none; stroke-width: 20; transition: stroke-dasharray .8s cubic-bezier(.2,.8,.2,1), stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ef-soc { fill: none; stroke: var(--bat); stroke-width: 6; stroke-linecap: round; transition: stroke-dasharray .8s cubic-bezier(.2,.8,.2,1); animation: ef-glod 3s ease-in-out infinite; }
@keyframes ef-glod { 0%, 100% { filter: drop-shadow(0 0 4px rgba(25,158,112,.25)); } 50% { filter: drop-shadow(0 0 12px rgba(25,158,112,.6)); } }
.ef-leg { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 12px; color: var(--text-2); }
.ef-leg span { display: inline-flex; align-items: center; gap: 6px; }
.ef-list { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ef-row { display: flex; flex-direction: column; gap: 6px; transition: opacity .4s; }
.ef-row.off { opacity: .4; }
.ef-row .axis { color: var(--text-2); font-size: 13px; }
.ef-track { height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; }
.ef-fill { height: 100%; border-radius: 3px; transition: width .7s cubic-bezier(.2,.8,.2,1); }
.ef-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card-2); border-radius: 12px; }
.ef-chip { font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.ef-chip.k-bat { color: #2fbf8a; background: rgba(25,158,112,.16); }
.ef-chip.k-net { color: #6aa8ee; background: rgba(57,135,229,.16); }
.ef-chip.k-salg { color: #ec8558; background: rgba(217,89,38,.16); }
.ef-chip.k-dim { color: var(--text-2); background: rgba(255,255,255,.06); }
@media (max-width: 1023px) {
  .ef-body { flex-direction: column; align-items: stretch; }
  .ef-ring { align-self: center; }
}
@media (prefers-reduced-motion: reduce) { .ef-soc { animation: none; } .ef-seg, .ef-soc, .ef-fill { transition: none; } }

/* ── Kan det betale sig? (investering.php) ─────────────────────────────────────── */
.inv-hero { gap: 14px; }
.inv-hero-tekst { font-size: 20px; line-height: 1.45; margin: 0; }
.inv-svar { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.inv-svar-1 { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius-sm); background: var(--card-2); text-decoration: none; color: var(--text); }
.inv-svar-ik { width: 40px; height: 40px; border-radius: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.inv-svar-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inv-svar-dom { font-size: 18px; font-weight: 700; }
.inv-afsnit { font-size: 15px; font-weight: 600; margin: 8px 0 -4px; color: var(--text-2); }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 16px; }
.inv-grid > div { display: flex; }
.inv-kort { gap: 12px; flex: 1; }
.inv-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.inv-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 4px 9px; border-radius: 999px; }
.inv-sol { background: rgba(201,133,0,.18); color: #e0a530; }
.inv-bat { background: rgba(25,158,112,.18); color: #2fbf8a; }
.inv-vp { background: rgba(217,89,38,.18); color: #f08a5d; }
.inv-elbil { background: rgba(57,135,229,.18); color: #79b0f0; }
.inv-titel { margin: 0; font-size: 18px; font-weight: 600; }
.inv-dom { font-size: 15px; font-weight: 600; }
.inv-dom.inv-god, .inv-svar-dom.inv-god { color: #2fbf8a; background: none; }
.inv-dom.inv-ok, .inv-svar-dom.inv-ok { color: #e0a530; background: none; }
.inv-dom.inv-nej, .inv-svar-dom.inv-nej { color: #f08a5d; background: none; }
.inv-tekst { margin: 0; line-height: 1.5; font-size: 14px; }
.inv-tal { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.inv-tal > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--card-2); }
.inv-tal .strong { font-size: 16px; white-space: nowrap; }
.inv-tid { display: flex; flex-direction: column; gap: 6px; }
.inv-tid p { margin: 2px 0 0; line-height: 1.5; }
.inv-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--card-2); }
.inv-bar i { display: block; height: 100%; }
.inv-betal { background: repeating-linear-gradient(45deg, rgba(201,133,0,.55) 0 6px, rgba(201,133,0,.35) 6px 12px); }
.inv-plus { background: var(--bat); }
.inv-akse { position: relative; height: 16px; font-size: 11px; color: var(--muted); }
.inv-akse span { position: absolute; top: 0; white-space: nowrap; }
.inv-akse .inv-akse-m { transform: translateX(-50%); color: var(--text-2); font-weight: 600; }
.inv-sml { display: flex; flex-direction: column; gap: 8px; }
.inv-sml-l { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.inv-sml-b { height: 8px; border-radius: 4px; background: var(--card-2); overflow: hidden; }
.inv-sml-b i { display: block; height: 100%; border-radius: 4px; }
.inv-kwh { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: auto; padding-top: 4px; }
.inv-kwh span { display: inline-flex; align-items: center; gap: 5px; }
.inv-kwh b { color: var(--text); font-weight: 600; }
.inv-ord-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.inv-ord-grid > div { display: flex; flex-direction: column; gap: 4px; line-height: 1.5; }
.inv-detaljer summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 32px; list-style: none; }
.inv-detaljer summary::-webkit-details-marker { display: none; }
.inv-detaljer summary::after { content: "▾"; color: var(--muted); margin-left: auto; }
.inv-detaljer[open] summary::after { content: "▴"; }
@media (max-width: 520px) { .inv-tal { grid-template-columns: 1fr 1fr; } .inv-tal > div:last-child { grid-column: 1 / -1; } .inv-hero-tekst { font-size: 17px; } }
