:root { --navy: #16308e; --cyan: #33C3F0; --bg: #f6f8fb; --line: #dde3ec; --text: #1c2333; --muted: #667085;
  --chart-line: #2748b5; --chart-grid: #e6eaf1;
  /* Budget limit = violet (yellow is reserved for solar). --limit text is violet-800 on violet-100 (~7:1). */
  --limit: #5b21b6; --limit-soft: #ede9fe; --limit-line: #c4b5fd; --limit-bar: #8b5cf6; --solar-ink: #8a5300;
  /* EV-from-grid = green (yellow is solar, violet is the budget limit). */
  --ok: #12b76a; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
nav.top { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; background: var(--navy); padding: 8px 16px; }
nav.top a { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 6px; opacity: .85; }
nav.top a.active, nav.top a:hover { background: rgba(255,255,255,.15); opacity: 1; }
nav.top .brand { font-weight: 700; margin-right: 12px; opacity: 1; }
nav.top .logout { margin-left: auto; }

/* Grouped nav: each group is a <details class="navgroup"> with a <summary> and a dropdown .navpanel. */
nav.top .navgroup { position: relative; }
nav.top .navgroup > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  color: #fff; opacity: .85; padding: 6px 10px; border-radius: 6px; user-select: none;
}
nav.top .navgroup > summary::-webkit-details-marker { display: none; }
nav.top .navgroup > summary::marker { content: ""; }
nav.top .navgroup > summary:hover,
nav.top .navgroup > summary.active,
nav.top .navgroup[open] > summary { background: rgba(255,255,255,.15); opacity: 1; }
nav.top .navgroup > summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
nav.top .navgroup .caret { font-size: 10px; line-height: 1; transition: transform .15s ease; }
nav.top .navgroup[open] .caret { transform: rotate(180deg); }
nav.top .navgroup > summary .badge { margin-left: 2px; }

nav.top .navpanel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  display: flex; flex-direction: column; gap: 2px; min-width: 200px; max-width: min(260px, calc(100vw - 24px));
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px;
  box-shadow: 0 14px 36px rgba(15,35,104,.22);
}
nav.top .navpanel a { color: var(--navy); opacity: 1; padding: 8px 12px; border-radius: 6px; white-space: nowrap; }
nav.top .navpanel a:hover, nav.top .navpanel a.active { background: #eef2f8; }
nav.top .navpanel a.active { font-weight: 600; }
main { max-width: 1300px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { margin: 8px 0 16px; font-size: 26px; } h2 { margin: 28px 0 10px; font-size: 18px; }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eef2f8; font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 12px 0; }
.narrow { max-width: 360px; }
form.inline { display: inline; }
form.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
label { display: block; font-size: 13px; color: var(--muted); }
input, select { display: block; width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; margin-top: 4px; }
form.row label { min-width: 160px; flex: 1; }
button, a.button { display: inline-block; background: var(--navy); color: #fff; border: 0; border-radius: 6px; padding: 8px 14px; font: inherit; cursor: pointer; text-decoration: none; line-height: normal; }
button.secondary, a.button.secondary { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
button.danger { background: #fff; color: #b42318; border: 1px solid #f0c0bb; }
button.link { background: none; color: #fff; padding: 6px 10px; }
button.small, a.button.small { padding: 4px 10px; font-size: 13px; }
.flash { background: #e6f7fd; border: 1px solid var(--cyan); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.error { color: #b42318; }
.muted { color: var(--muted); }
.badge { background: var(--cyan); color: #06283d; font-size: 11px; padding: 2px 6px; border-radius: 10px; font-weight: 600; }
.pill { background: #eef2f8; padding: 2px 8px; border-radius: 10px; font-size: 13px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #98a2b3; }
.dot.on { background: #12b76a; }
details summary { cursor: pointer; }
code { background: #eef2f8; padding: 1px 5px; border-radius: 4px; }
table a { color: var(--navy); }
dl.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px 20px; margin: 0; }
dl.facts dt { font-size: 13px; color: var(--muted); }
dl.facts dd { margin: 2px 0 0; }
figure.chart { position: relative; margin: 12px 0; }
figure.chart svg { display: block; width: 100%; height: auto; font-size: 12px; font-variant-numeric: tabular-nums; }
figure.chart figcaption { font-size: 13px; margin-top: 6px; }
.chart .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis text { fill: var(--muted); }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart-line); fill-opacity: .1; stroke: none; }
.chart .limits rect { fill: var(--limit-soft); }
/* Stacked bars (average working day): EV charging in the same green as on the Effekt page, the rest in the chart colour. */
.chart .bars .rest { fill: var(--chart-line); }
.chart .bars .ev { fill: var(--ok); }
.nowrap { white-space: nowrap; }
dl.facts dd.big { font-size: 24px; font-weight: 600; line-height: 1.2; }
.chart .hits rect { fill: transparent; }
.chart .hits rect:hover { fill: var(--chart-line); fill-opacity: .08; }
.chart .hits circle { fill: var(--chart-line); }
/* Hover tooltip (chart-hover.js): crosshair on the SVG plus a small card by the pointer. */
.chart .cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 112px; max-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-size: 12px; line-height: 1.5; color: var(--text); box-shadow: 0 4px 14px rgb(16 24 51 / .18); font-variant-numeric: tabular-nums; transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; }
.chart-tip[hidden] { display: none; }
.chart-tip .t-time { color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.chart-tip .t-kw strong { color: var(--navy); }
.chart-tip .t-limit { color: var(--limit); font-weight: 600; }
.chart-tip .t-solar { color: var(--solar-ink); }
figure.chart svg.narrow { display: none; }
@media (max-width: 600px) { figure.chart svg.wide { display: none; } figure.chart svg.narrow { display: block; } }
details { margin: 12px 0; }
h2.first { margin-top: 0; }
dl.facts .wide { grid-column: 1 / -1; }
.update-status { font-weight: 600; }
.update-log { background: #0f1b3d; color: #e6edf7; padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.45; overflow-x: auto; white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow-y: auto; }
.badge.danger { background: #fde8e6; color: #b42318; }
ul.commits { margin: 0; padding-left: 18px; }
ul.commits li + li { margin-top: 6px; }
p.first { margin-top: 0; }
table.history td:first-child { white-space: nowrap; }
.mail-list textarea { display: block; width: 100%; min-height: 90px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 8px 0; resize: vertical; }
.mail-form > label, .mail-form details { margin-bottom: 14px; }
.mail-form label.check { display: flex; gap: 8px; align-items: center; font-size: 15px; color: var(--text); }
.mail-form label.check input { width: auto; margin: 0; }
.mail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 20px; margin-bottom: 14px; }
.mail-form textarea { display: block; width: 100%; box-sizing: border-box; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; margin-top: 4px; resize: vertical; }
.mail-form .hint { display: block; margin-top: 4px; font-size: 12px; }
table.placeholders { width: auto; margin-top: 8px; }
.sync { font-size: 13px; color: var(--muted); }
.sync.synced { color: #067647; }
.sync.error { color: #b42318; }
form.config-fetch { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
table.config td.val { overflow-wrap: anywhere; max-width: 520px; }
form.config-change { display: flex; gap: 6px; align-items: center; }
form.config-change input { margin: 0; min-width: 0; }
.card.soc.yes { border-left: 4px solid #12b76a; }
.card.soc.no { border-left: 4px solid var(--cyan); }
.card.soc p { margin-bottom: 0; }
.pill.on { background: #dcfae6; color: #085d3a; }
.hint { font-size: 13px; margin-bottom: 0; }
.reset-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.reset-options p { margin: 6px 0 0; font-size: 13px; }
.profile-connector { margin-top: 14px; }
.profile-connector h3 { margin: 0 0 4px; font-size: 15px; }
.profile-connector p { margin: 4px 0; }
table.profiles { max-width: 520px; }
p.warning { background: #fffaeb; border: 1px solid #fedf89; color: #93370d; border-radius: 6px; padding: 10px 12px; }
ul.selftest { list-style: none; margin: 10px 0; padding: 0; max-width: 70ch; }
ul.selftest li { padding: 8px 12px; border-radius: 6px; margin-top: 6px; }
ul.selftest li.ok { background: #ecfdf3; border: 1px solid #abefc6; color: #067647; }
ul.selftest li.warning { background: #fffaeb; border: 1px solid #fedf89; color: #93370d; }
p.verdict { max-width: 70ch; border-radius: 6px; padding: 10px 12px; }
p.verdict.ok { background: #ecfdf3; border: 1px solid #abefc6; color: #067647; }
/* Effekt (grid power) */
p.lead { max-width: 70ch; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 12px 0; }
.grid-cards .card { margin: 0; }
.grid-card h2 { font-size: 14px; color: var(--muted); font-weight: 600; }
.grid-card p { margin: 4px 0 0; }
.grid-card p.big { font-size: 28px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.2; }
.grid-alert { color: #93370d; background: #fffaeb; border-radius: 6px; padding: 4px 8px; font-size: 13px; margin-top: 8px !important; }
table.grid-hours td { white-space: nowrap; }
table.grid-hours tr.ongoing td { background: #f4fbfe; }
table.grid-hours .bar-col { width: 35%; vertical-align: middle; }
table.grid-hours .bar { display: block; position: relative; height: 10px; border-radius: 5px; background: var(--cyan); min-width: 2px; }
table.grid-hours .bar.eon { background: var(--navy); }
/* Green overlay at the base of the grid bar: the EV charging drawn from the grid, to the same scale as the bar. */
table.grid-hours .bar-ev { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--ok); min-width: 2px; box-shadow: 0 0 0 1px rgb(255 255 255 / .35) inset; }
table.grid-hours .grid-legend { margin-top: 8px; }
.grid-legend .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 3px; }
.grid-legend .swatch-ev { margin-left: 14px; background: var(--ok); }
.grid-legend .swatch-grid { background: var(--navy); }
.grid-legend .swatch-chart { background: var(--chart-line); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 600px) { table.grid-hours .bar-col { display: none; } }

/* Load control (Effekt > Effektstyrning) */
p.info { background: #f4fbfe; border: 1px solid #b9e6f8; color: var(--navy); border-radius: 6px; padding: 10px 12px; }
.lc-link { margin: 12px 0; }
.lc-form fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin: 0 0 14px; }
.lc-form legend { font-weight: 600; color: var(--navy); padding: 0 4px; }
.budget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px 12px; }
.budget-grid input { width: 100%; }
.lc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; }
.lc-form .hint { display: block; font-size: 12px; margin-top: 2px; }
.lc-form label.radio { display: flex; gap: 8px; align-items: center; font-size: 15px; color: var(--text); margin: 4px 0; }
.lc-form label.radio input { width: auto; margin: 0; }
.lc-form label.check { display: flex; gap: 8px; align-items: center; font-size: 15px; color: var(--text); margin: 4px 0; }
.lc-form label.check input { width: auto; margin: 0; }
.lc-form label.radio.disabled { color: var(--muted); }
table.lc-table td { white-space: nowrap; }
table.lc-table td.wrap { white-space: normal; }
tr.paused td { background: #fffaeb; }
.pill.send { background: #e0f2fe; color: var(--navy); }
.scroll { overflow-x: auto; }
tr.outlet-names td { background: #fafbfd; padding-top: 6px; }
tr.outlet-names form.row label { flex: 0 1 160px; min-width: 120px; }
tr.outlet-names .hint { display: block; margin-top: 4px; font-size: 12px; }
/* Ansökningar */
.badge.ok { background: #e4f4ea; color: #17703f; }
nav.top .badge { margin-left: 4px; background: var(--cyan); color: #06283d; }
.signup h3 { margin: 0; font-size: 18px; }
.signup-head p { margin: 2px 0 12px; }
.signup dl.facts { margin-bottom: 12px; }
.signup dl.facts dd { white-space: pre-line; }
.approve { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 12px; }
.approve fieldset { border: 0; margin: 0; padding: 0; }
.approve legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 4px; }
.approve .match { margin: 0 0 6px; font-size: 13px; color: #17703f; }
.approve .match.none { color: #8a5300; }
.approve-row { display: flex; gap: 8px; flex-wrap: wrap; max-width: 760px; }
.approve-row label { flex: 1 1 220px; }
.approve label.radio, .reject label.check { display: flex; gap: 8px; align-items: center; font-size: 15px; color: var(--text); margin: 4px 0; }
.approve label.radio input, .reject label.check input { width: auto; margin: 0; }
.approve label.uid { margin-top: 6px; max-width: 420px; }
.approve .hint { display: block; font-size: 12px; margin-top: 4px; }
.approve button { justify-self: start; }
.approve .new-company, .approve label.uid { display: none; }
.approve:has(select option[value="new"]:checked) .new-company { display: block; }
.approve:has(input[value="rfid"]:checked) label.uid { display: block; }
.reject { margin: 12px 0 0; }
.reject summary { color: #b42318; font-size: 14px; }
.reject form { display: grid; gap: 8px; margin-top: 8px; max-width: 560px; }
.reject button { justify-self: start; }
textarea { display: block; width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; margin-top: 4px; }
