/* ============================================================
   LADEPLAN — nat-instrument. Én forpligtet mørk flade.
   Familjen Grotesk (UI) + Spline Sans Mono (tal/tider).
   ============================================================ */

@font-face {
  font-family: 'Familjen Grotesk';
  src: url('/fonts/familjen-grotesk.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Spline Sans Mono';
  src: url('/fonts/spline-sans-mono.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  /* flader */
  --ground: #0B0E14;
  --surface: #131722;
  --raised: #1A2130;
  --line: #232B3D;
  --line-soft: #1C2434;

  /* blæk */
  --ink: #E9EDF5;
  --ink-2: #98A2B8;
  --ink-3: #5C677E;

  /* pris-rampe (sekventiel, stålblå: billig→dyr = dæmpet→lys) */
  --price-1: #2C3A66;
  --price-2: #405490;
  --price-3: #5871B8;
  --price-4: #7B93DC;
  --price-5: #A3B8F2;

  /* accenter */
  --amber: #F5B841;        /* planen / ladning */
  --amber-soft: rgba(245, 184, 65, 0.16);
  --good: #58C29A;
  --warn: #E4695E;

  --radius: 14px;
  --radius-s: 9px;
  --pad: 16px;
  --mono: 'Spline Sans Mono', ui-monospace, monospace;
  --sans: 'Familjen Grotesk', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background:
    radial-gradient(120% 60% at 50% -10%, #121A2E 0%, var(--ground) 55%),
    var(--ground);
  color: var(--ink);
  min-height: 100dvh;
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 560px; margin: 0 auto; padding: 0 var(--pad); }

/* ---------- typografi ---------- */
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.tiny { font-size: 12px; color: var(--ink-3); }

/* ---------- top ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 2px 10px;
}
.wordmark {
  font-family: var(--mono); font-weight: 600; font-size: 15px;
  letter-spacing: 0.34em; color: var(--ink);
  text-transform: uppercase; user-select: none;
}
.wordmark b { color: var(--amber); font-weight: 600; }
.top .sub { font-size: 12px; color: var(--ink-3); letter-spacing: 0.02em; margin-top: 3px; }

/* ---------- kort ---------- */
.card {
  background: linear-gradient(180deg, var(--raised) 0%, var(--surface) 100%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--pad);
  margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.card h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-3); margin-bottom: 12px; font-weight: 600;
}

/* ---------- bilstatus ---------- */
.car-row { display: flex; align-items: center; gap: 18px; }
.soc-wrap { position: relative; width: 92px; height: 92px; flex: none; }
.soc-wrap svg { width: 92px; height: 92px; transform: rotate(-90deg); }
.soc-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--mono); font-size: 24px; font-weight: 600;
}
.soc-num small { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.car-state { flex: 1; min-width: 0; }
.car-state .headline { font-size: 19px; font-weight: 600; margin-bottom: 3px; }
.car-state .detail { font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.car-state .detail .num { color: var(--ink); }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px;
  font-size: 12.5px; color: var(--ink-2);
}
.chip .num { color: var(--ink); }
.chip.amber { border-color: rgba(245, 184, 65, 0.35); color: var(--amber); background: var(--amber-soft); }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }

/* pulserende ladeindikator */
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--amber);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 184, 65, 0.5); }
  50% { box-shadow: 0 0 0 7px rgba(245, 184, 65, 0); }
}

/* ---------- graf ---------- */
.chart-card { padding: var(--pad) 6px 10px; }
.chart-card h2 { padding: 0 10px; display: flex; justify-content: space-between; align-items: baseline; }
.chart-card h2 .now-price { font-family: var(--mono); font-size: 15px; color: var(--ink); letter-spacing: 0; text-transform: none; }
.chart-card h2 .now-price small { color: var(--ink-3); font-size: 11px; }
.chart-wrap { position: relative; touch-action: pan-y; }
.daylabel {
  font-size: 10.5px; color: var(--ink-3); text-transform: uppercase;
  letter-spacing: 0.14em; padding: 8px 10px 3px; font-weight: 600;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  white-space: nowrap;
}
.readout {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink);
  text-transform: none; letter-spacing: 0; font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chart-wrap svg { display: block; width: 100%; height: auto; }
.tooltip {
  position: absolute; top: 4px; pointer-events: none;
  background: #0D111B; border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 7px 10px;
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
  white-space: nowrap; transform: translateX(-50%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  display: none; z-index: 3;
}
.tooltip .t { color: var(--ink-3); }
.legend {
  display: flex; gap: 16px; padding: 8px 10px 2px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--ink-3);
}
.legend i {
  display: inline-block; width: 14px; height: 8px; border-radius: 2px;
  margin-right: 6px; vertical-align: baseline;
}

/* ---------- forslag ---------- */
.banner {
  border: 1px solid rgba(245, 184, 65, 0.4);
  background: linear-gradient(180deg, rgba(245, 184, 65, 0.14), rgba(245, 184, 65, 0.05));
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 12px;
  animation: rise 0.35s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }
.banner .txt { flex: 1; font-size: 14px; line-height: 1.45; }
.banner .txt b { color: var(--amber); }

.ring-wrap { position: relative; width: 132px; height: 132px; margin: 6px auto 14px; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-count {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  font-family: var(--mono); font-size: 26px; font-weight: 600;
}
.ring-count small { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; font-family: var(--sans); }

.presets { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.preset {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 8px 14px; font-size: 13.5px; font-family: var(--mono);
  cursor: pointer; transition: all 0.15s;
}
.preset.on { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }

input[type='time'] {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius-s); padding: 9px 12px; font-family: var(--mono); font-size: 15px;
  color-scheme: dark;
}
input[type='range'] { width: 100%; accent-color: var(--amber); height: 32px; }
input[type='text'], input[type='password'], input[type='number'], input[type='date'], select {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius-s); padding: 11px 12px; font-size: 15px; width: 100%;
  font-family: var(--sans); color-scheme: dark;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid rgba(245, 184, 65, 0.5); outline-offset: 1px; }

/* ---------- knapper ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--raised); color: var(--ink);
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  padding: 13px 18px; cursor: pointer; width: 100%;
  transition: transform 0.1s, filter 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #16130A; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(228, 105, 94, 0.5); color: var(--warn); }
.btn.small { width: auto; padding: 9px 14px; font-size: 13.5px; font-weight: 500; }
.btnrow { display: flex; gap: 10px; margin-top: 12px; }
.btnrow .btn { flex: 1; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* ---------- lister/rækker ---------- */
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 2px; border-bottom: 1px solid var(--line-soft); font-size: 14.5px;
}
.row:last-child { border-bottom: none; }
.row .l { color: var(--ink-2); }
.row .r { text-align: right; }

/* toggle */
.tog { position: relative; width: 46px; height: 27px; flex: none; }
.tog input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 2; }
.tog i {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line);
  transition: background 0.15s;
}
.tog i::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  border-radius: 50%; background: var(--ink-2); transition: all 0.15s;
}
.tog input:checked + i { background: var(--amber); }
.tog input:checked + i::after { left: 22px; background: #16130A; }

/* ---------- statistik-fliser ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.tile {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 13px 8px 11px; text-align: center;
}
.tile .v { font-family: var(--mono); font-size: 19px; font-weight: 600; }
.tile .v.good { color: var(--good); }
.tile .k { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px; }

/* ---------- session-historik ---------- */
.hist { padding: 12px 2px; border-bottom: 1px solid var(--line-soft); }
.hist:last-child { border: none; }
.hist .h1 { display: flex; justify-content: space-between; font-size: 14.5px; margin-bottom: 3px; }
.hist .h2 { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); }
.badge {
  font-size: 10.5px; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.05em;
  border: 1px solid var(--line); color: var(--ink-3); text-transform: uppercase;
}
.badge.good { color: var(--good); border-color: rgba(88, 194, 154, 0.4); }
.badge.warn { color: var(--warn); border-color: rgba(228, 105, 94, 0.4); }
.badge.amber { color: var(--amber); border-color: rgba(245, 184, 65, 0.4); }

/* ---------- bundnavigation ---------- */
nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: rgba(11, 14, 20, 0.86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-soft);
  padding-bottom: env(safe-area-inset-bottom);
}
nav .inner { max-width: 560px; margin: 0 auto; display: flex; }
nav a {
  flex: 1; text-align: center; padding: 10px 0 9px; text-decoration: none;
  color: var(--ink-3); font-size: 10.5px; letter-spacing: 0.02em;
}
nav a svg { display: block; margin: 0 auto 3px; width: 22px; height: 22px; }
nav a.on { color: var(--amber); }

/* ---------- login ---------- */
.login {
  min-height: 88dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px; text-align: center;
}
.login .wordmark { font-size: 19px; }
.login form { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 12px; }
.login .bolt { font-size: 44px; filter: drop-shadow(0 0 18px rgba(245, 184, 65, 0.4)); }

/* ---------- diverse ---------- */
.err { color: var(--warn); font-size: 13.5px; margin-top: 6px; min-height: 1.2em; }
.ok { color: var(--good); font-size: 13.5px; margin-top: 6px; }
.note {
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-s);
  padding: 11px 13px; font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 10px 0;
}
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
details { margin: 8px 0; }
summary { cursor: pointer; color: var(--ink-2); font-size: 13.5px; padding: 6px 0; }
.pricetable { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12.5px; }
.pricetable td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); color: var(--ink-2); }
.pricetable td:last-child { text-align: right; color: var(--ink); }
.pricetable tr.plan td { color: var(--amber); }
.spin {
  width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--amber);
  border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: rise 0.3s ease-out; }
a { color: var(--amber); }
