:root {
  color-scheme: light dark;
  --page: #f3f5f4; --card: #ffffff; --ink: #141a17; --ink-2: #4a544f; --muted: #6b7570;
  --line: #dfe4e1; --axis: #b9c1bd; --field: #ffffff; --accent: #0b6b3a;
  --plan: #0a8f4e; --rest: #a3a9a6; --be: #141a17;
  --note: #fff4d6; --note-ink: #4d3b00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #111513; --card: #1a201d; --ink: #eef2f0; --ink-2: #bcc6c1; --muted: #8d9892;
    --line: #2c3430; --axis: #46504b; --field: #141916; --accent: #4cc486;
    --plan: #12a35c; --rest: #646c68; --be: #eef2f0;
    --note: #3a3010; --note-ink: #ffe9ad;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
:focus-visible { outline: 3px solid #3987e5; outline-offset: 2px; }
.top, main, footer, body > .note { max-width: 1120px; margin-inline: auto; padding-inline: 20px; }
.top { padding-block: 16px; }
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; text-decoration: none; }
.brand span { font-weight: 400; color: var(--ink-2); }

/* Beskedet */
.verdict { border-radius: 16px; padding: clamp(22px, 4vw, 40px); background: #2b3330; color: #fff; }
.verdict[data-status="LADDA"] { background: #0b6b3a; }
.verdict[data-status="VÄNTA"] { background: #f4bb3a; color: #221a00; }
.verdict[data-status="KLAR"] { background: #1c5cab; }
.verdict[data-status="BENSIN"] { background: #2b3330; }
.verdict-when { margin: 0; font-weight: 600; }
.verdict h1 { margin: 2px 0 8px; font-size: clamp(2.4rem, 8vw, 4.6rem); line-height: 1.02; letter-spacing: -0.035em; font-weight: 800; text-wrap: balance; }
.verdict-text { margin: 0; max-width: 60ch; font-size: 1.08rem; }
.duel { display: flex; flex-wrap: wrap; gap: 14px 40px; margin: 22px 0 0; padding-top: 18px; border-top: 1px solid color-mix(in srgb, currentColor 28%, transparent); }
.duel dt { font-size: .9rem; }
.duel dd { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }

.note > span { flex: 1 1 320px; }
.note { margin: 14px 0 0; padding: 12px 16px; border-radius: 10px; background: var(--note); color: var(--note-ink); display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
button { font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid currentColor; background: transparent; color: inherit; cursor: pointer; }
button.link { border: 0; padding: 8px 0; text-decoration: underline; font-weight: 400; color: var(--ink-2); }

.cols { display: grid; gap: 16px; margin-top: 16px; grid-template-columns: minmax(0, 1fr); }
.col-main, .col-side { display: grid; gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr) 360px; } }
/* Mobil: beskedet, dagens uppgifter, planen, sedan resten */
@media (max-width: 899px) {
  .col-main, .col-side { display: contents; }
  .now { order: 1; }
  .col-main > .card { order: 2; }
  .col-side > .card:not(.now) { order: 3; }
  .col-main > #how-card { order: 4; }
}
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; min-width: 0; }
.card h2, .card > summary { margin: 0 0 10px; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.card.more > summary { margin: 0; cursor: pointer; }
.card.more[open] > summary { margin-bottom: 10px; }
.sub { margin: -4px 0 12px; color: var(--ink-2); }
.hint { margin: 2px 0 10px; font-size: .875rem; color: var(--muted); }

/* Formulär */
.f { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; padding: 6px 0; }
.f input:not([type=range], [type=checkbox]), .f select {
  font: inherit; color: inherit; background: var(--field); border: 1px solid var(--axis); border-radius: 8px; padding: 8px 10px; min-height: 42px; width: 100%; min-width: 0;
}
.f > input:not([type=range], [type=checkbox]), .f > select { max-width: 190px; justify-self: end; }
.u { display: flex; align-items: center; gap: 8px; }
.u input { width: 92px !important; text-align: right; font-variant-numeric: tabular-nums; }
.u em { font-style: normal; font-size: .875rem; color: var(--muted); min-width: 4.6em; }
.f input[aria-invalid=true] { border-color: #d03b3b; outline: 2px solid #d03b3b; }
.f.range { grid-template-columns: 1fr auto; }
.f.range input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); min-height: 28px; margin: 0; }
.f.range output { font-weight: 700; font-variant-numeric: tabular-nums; }
.f.check { grid-template-columns: auto 1fr; }
.f.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.err { grid-column: 1 / -1; color: #b42323; font-size: .875rem; }
@media (prefers-color-scheme: dark) { .err { color: #ff8d8d; } }

/* Diagram */
.chart { position: relative; min-height: 240px; }
.chart svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.chart text { font-size: 12px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart text.strong { fill: var(--ink); font-weight: 600; }
.chart .halo { paint-order: stroke; stroke: var(--card); stroke-width: 4px; stroke-linejoin: round; }
.grid { stroke: var(--line); stroke-width: 1; }
.base { stroke: var(--axis); stroke-width: 1; }
.bar { fill: var(--rest); }
.bar.plan { fill: var(--plan); }
.bar.est { opacity: .5; }
.bar.on { filter: brightness(1.18); opacity: 1; }
.be { stroke: var(--be); stroke-width: 2; }
.cursor { stroke: var(--axis); stroke-width: 1; }
.empty { color: var(--muted); padding: 60px 0; text-align: center; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0; margin: 10px 0 14px; font-size: .9rem; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 8px; }
.k { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.k-plan { background: var(--plan); } .k-rest { background: var(--rest); } .k-est { background: var(--rest); opacity: .5; }
.k-line { height: 2px; width: 18px; border-radius: 0; background: var(--be); }
.tip { position: fixed; z-index: 5; pointer-events: none; background: var(--card); color: var(--ink); border: 1px solid var(--axis); border-radius: 10px; padding: 8px 12px; box-shadow: 0 6px 20px rgb(0 0 0 / .18); font-size: .9rem; max-width: 250px; }
.tip b { display: block; font-size: 1.05rem; }
.tip span { display: block; color: var(--ink-2); }

.windows { list-style: none; padding: 0; margin: 0 0 10px; }
.windows li { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.windows b { font-size: 1.1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.windows span { color: var(--ink-2); text-align: right; }
@media (max-width: 520px) { .windows li { grid-template-columns: 1fr; } .windows span { text-align: left; } }
details > summary { cursor: pointer; font-weight: 600; }
.scroll { max-height: 320px; overflow: auto; margin-top: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 7px 8px 7px 0; border-top: 1px solid var(--line); font-weight: 400; }
thead th { border-top: 0; color: var(--ink-2); font-size: .875rem; position: sticky; top: 0; background: var(--card); }
td:not(:first-child), th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total th, tr.total td, tr.best th, tr.best td { font-weight: 700; }
td small, th small { display: block; color: var(--muted); font-weight: 400; }

footer { padding-block: 28px 48px; color: var(--ink-2); font-size: .875rem; }
footer p { margin: 0 0 6px; max-width: 80ch; }
