/* Public Power Status – Design-System
   Grund #0a0a0a, Flächen #151515, Linien #232323, Akzent #39FF6A, Inter */

:root {
  --bg: #0a0a0a;
  --surface: #151515;
  --surface-2: #1d1d1d;
  --line: #232323;
  --line-2: #2e2e2e;
  --text: #f0f0f0;
  --muted: #8c8c8c;
  --dim: #5a5a5a;
  --green: #39FF6A;
  --green-dim: rgba(57, 255, 106, .14);
  --amber: #ffb020;
  --amber-dim: rgba(255, 176, 32, .14);
  --red: #ff4d5e;
  --red-dim: rgba(255, 77, 94, .14);
  --side-w: 208px;
  --radius: 10px;
  --radius-s: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; }
.login-logo { height: 52px; width: auto; align-self: flex-start; margin-bottom: 6px; }
.login-box h1 { font-size: 22px; font-weight: 600; margin-bottom: 14px; }
.login-box label { color: var(--muted); font-size: 13px; }
.login-box input {
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text);
  border-radius: var(--radius-s); padding: 11px 12px; font: inherit; font-size: 16px;
}
.login-box input:focus { border-color: var(--green); outline: none; }
.login-box button {
  margin-top: 6px; background: var(--green); color: #0a0a0a; font-weight: 600;
  padding: 11px; border-radius: var(--radius-s);
}
.login-box button:disabled { opacity: .4; cursor: default; }
.login-err { color: var(--red); font-size: 13px; }

/* ---------- App-Rahmen ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: var(--side-w); flex: 0 0 auto; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px;
}
.side .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 20px; font-weight: 600; font-size: 15px; }
.side .brand img { height: 30px; width: auto; }
.side a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--radius-s); color: var(--muted); }
.side a svg { width: 18px; height: 18px; flex: 0 0 auto; }
.side a:hover { color: var(--text); background: var(--surface); }
.side a.active { color: var(--text); background: var(--surface-2); }
.side a.active svg { color: var(--green); }
.theme-toggle {
  margin-top: auto; display: flex; align-items: center; gap: 11px; padding: 9px 10px;
  border-radius: var(--radius-s); color: var(--muted); width: 100%; text-align: left;
}
.theme-toggle:hover { color: var(--text); background: var(--surface); }
.theme-toggle svg { width: 18px; height: 18px; flex: 0 0 auto; }
.theme-toggle .i-sun { display: none; }
html[data-theme="light"] .theme-toggle .i-moon { display: none; }
html[data-theme="light"] .theme-toggle .i-sun { display: block; }
.view { flex: 1; min-width: 0; padding: 26px 30px 60px; }

/* ---------- Hell-Theme ---------- */
html[data-theme="light"] {
  --bg: #f4f5f3;
  --surface: #ffffff;
  --surface-2: #eceeeb;
  --line: #e0e2de;
  --line-2: #cfd2cc;
  --text: #17181a;
  --muted: #6b6f6a;
  --dim: #a2a5a0;
  --green: #1f9c47;
  --green-dim: rgba(31, 156, 71, .10);
  --amber: #b6791a;
  --amber-dim: rgba(182, 121, 26, .10);
  --red: #c8303f;
  --red-dim: rgba(200, 48, 63, .10);
}
html[data-theme="light"] .login-box button,
html[data-theme="light"] .btn.primary { color: #fff; }
html[data-theme="light"] .slot span { color: #fff; }
html[data-theme="light"] .slot.empty span, html[data-theme="light"] .slot.lowfill span { color: var(--muted); }

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .side {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; width: auto; height: auto;
    flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line); background: var(--bg); z-index: 10;
  }
  .side .brand, .side .logout { display: none; }
  .side a { flex: 1; flex-direction: column; gap: 4px; padding: 6px 2px; font-size: 11px; }
  .view { padding: 18px 16px 90px; }
}

/* ---------- Seitenkopf ---------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.head .tools { display: flex; align-items: center; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: var(--radius-s);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-size: 13px;
}
.btn:hover { border-color: var(--dim); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--green); color: #0a0a0a; border-color: var(--green); font-weight: 600; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }

/* Refresh-Anzeige: dünne Linie oben, füllt sich bis zum nächsten Abruf */
.refresh { position: relative; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: 20px; }
.refresh i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--green); }

/* ---------- Kennzahlen ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.stat .v small { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 5px; }

/* ---------- Stationskarten ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 14px; position: relative;
  border-left: 3px solid var(--line-2);
}
.card[data-state="ok"]      { border-left-color: var(--green); }
.card[data-state="refill"]  { border-left-color: var(--amber); }
.card[data-state="empty"]   { border-left-color: var(--amber); }
.card[data-state="offline"] { border-left-color: var(--red); }
.card[data-state="error"]   { border-left-color: var(--red); }
.card .top { display: flex; align-items: flex-start; gap: 10px; }
.card .who { flex: 1; min-width: 0; cursor: pointer; }
.card .who h2 { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .who .id { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card .who:hover h2 { color: var(--green); }
.restart { width: 32px; height: 32px; border-radius: var(--radius-s); color: var(--muted); display: grid; place-items: center; border: 1px solid transparent; }
.restart:hover { color: var(--text); border-color: var(--line-2); background: var(--surface-2); }
.restart svg { width: 16px; height: 16px; }
.restart.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Status-Zeile */
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: 0 0 auto; }
.status.on .dot { background: var(--green); box-shadow: 0 0 0 0 rgba(57,255,106,.6); animation: pulse 2.4s ease-out infinite; }
.status.warn .dot { background: var(--amber); }
.status.off .dot { background: var(--red); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(57,255,106,.55); } 70% { box-shadow: 0 0 0 7px rgba(57,255,106,0); } 100% { box-shadow: 0 0 0 0 rgba(57,255,106,0); } }
.status .sep { color: var(--dim); }
.status .warntext { color: var(--amber); }

/* Ladestand-Leiste: das eine bewusst auffällige Element */
.slots { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.slot { height: 34px; border-radius: 4px; background: var(--surface-2); position: relative; overflow: hidden; border: 1px solid var(--line-2); }
.slot i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--green); transition: height .5s ease; }
.slot.mid i { background: var(--amber); }
.slot.low i { background: var(--red); }
.slot.empty { border-style: dashed; }
.slot span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10.5px; font-weight: 600; color: #0a0a0a; mix-blend-mode: normal; }
.slot.empty span, .slot.lowfill span { color: var(--muted); }
.slot.changed { animation: glow .9s ease-out; }
@keyframes glow { 0% { box-shadow: 0 0 0 2px var(--green); } 100% { box-shadow: 0 0 0 0 rgba(57,255,106,0); } }

/* Meta-Zeile */
.meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.meta b { color: var(--text); font-weight: 500; }
.meta .bad { color: var(--red); }
.meta .sig { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 10px; margin-right: 5px; vertical-align: -1px; }
.meta .sig i { width: 3px; background: var(--dim); border-radius: 1px; }
.meta .sig i.on { background: var(--green); }
.meta .sig i:nth-child(1){height:3px}.meta .sig i:nth-child(2){height:5px}.meta .sig i:nth-child(3){height:7px}.meta .sig i:nth-child(4){height:10px}

/* ---------- Allgemein ---------- */
.empty { color: var(--muted); padding: 40px 0; text-align: center; }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); min-height: 180px; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius-s); font-size: 13px; z-index: 20; max-width: calc(100% - 32px);
}
.toast.ok { border-color: var(--green); }
.toast.err { border-color: var(--red); }
@media (max-width: 760px) { .toast { bottom: 86px; } }
.placeholder { background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 40px 20px; color: var(--muted); text-align: center; }

/* ---------- Geräte / Detail / Tabellen ---------- */
.back { color: var(--muted); font-size: 12.5px; display: inline-block; margin-bottom: 6px; }
.back:hover { color: var(--text); }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr[data-go] { cursor: pointer; }
.tbl tbody tr[data-go]:hover { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl .empty { text-align: center; color: var(--muted); padding: 26px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; background: var(--surface-2); color: var(--muted); }
.chip.on { background: var(--green-dim); color: var(--green); }
.chip.off { background: var(--red-dim); color: var(--red); }

.card2 { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card2 h2 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.card2 .sub { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.card2-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card2-head h2 { margin: 0; }
.inline-edit { display: flex; gap: 8px; align-items: center; }
.inline-edit input[type="date"] {
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text);
  border-radius: var(--radius-s); padding: 7px 10px; font: inherit; font-size: 13px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }
.spark { width: 100%; height: 90px; display: block; }
.barchart { width: 100%; height: 200px; display: block; }
.barchart rect { transition: opacity .15s; }
.barchart rect:hover { opacity: .75; }

/* ---------- Umsatz v2 ---------- */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filter-row select.btn { cursor: pointer; }
.chart-wrap, .heatmap-wrap { position: relative; }
.revsvg { width: 100%; height: 220px; display: block; }
.revsvg .grid-line { stroke: var(--line); stroke-width: 1; }
.revsvg .axis-label { fill: var(--muted); font-size: 9px; font-family: Inter, sans-serif; }
.revsvg .rbar { fill: var(--green); transition: opacity .1s; cursor: pointer; }
.revsvg .rbar:hover { opacity: .7; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface-2); border: 1px solid var(--line-2);
  padding: 7px 10px; border-radius: var(--radius-s); font-size: 12px; white-space: nowrap; z-index: 5;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.heatmap { border-collapse: collapse; font-size: 10px; width: 100%; table-layout: fixed; }
.heatmap th { color: var(--muted); font-weight: 400; text-align: center; padding: 2px 0; }
.heatmap th:first-child { width: 28px; }
.hm-cell { position: relative; height: 20px; border: 1px solid var(--bg); background: var(--surface-2); cursor: pointer; }
.hm-fill { position: absolute; inset: 0; background: var(--green); }
.heatmap-wrap { overflow-x: auto; }
@media (max-width: 760px) { .heatmap { font-size: 8px; } .hm-cell { height: 16px; } }
