/* OilChem Betriebsplattform – Designsystem */
:root {
  --kobalt: #0b4da2;
  --kobalt-hell: #1a6fd4;
  --kobalt-matt: #e8f0fb;
  --gruen: #1f7a4d;
  --gruen-matt: #e6f4ec;
  --gelb: #a8730a;
  --gelb-matt: #fdf4e3;
  --rot: #b3261e;
  --rot-matt: #fdeceb;

  --bg: #f6f7f9;
  --flaeche: #ffffff;
  --flaeche-2: #fafbfc;
  --rand: #dfe3e8;
  --rand-stark: #c3c9d1;
  --text: #16191d;
  --text-2: #5b646f;
  --text-3: #8b939d;

  --radius: 8px;
  --radius-s: 5px;
  --schatten: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

:root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    --bg: #15181c; --flaeche: #1c2026; --flaeche-2: #21262d;
    --rand: #2e343c; --rand-stark: #3d444d;
    --text: #e6e9ed; --text-2: #a3abb5; --text-3: #717a85;
    --kobalt-matt: #15283f; --gruen-matt: #14291f; --gelb-matt: #2b2415; --rot-matt: #2e1917;
    --kobalt: #5b9bf0; --gruen: #4caf7d; --gelb: #d8a33c; --rot: #ef6b61;
    --schatten: 0 1px 2px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --bg: #15181c; --flaeche: #1c2026; --flaeche-2: #21262d;
  --rand: #2e343c; --rand-stark: #3d444d;
  --text: #e6e9ed; --text-2: #a3abb5; --text-3: #717a85;
  --kobalt-matt: #15283f; --gruen-matt: #14291f; --gelb-matt: #2b2415; --rot-matt: #2e1917;
  --kobalt: #5b9bf0; --gruen: #4caf7d; --gelb: #d8a33c; --rot: #ef6b61;
  --schatten: 0 1px 2px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans); font-size: 14px; line-height: 1.5;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--kobalt); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────── */
.huelle { display: flex; min-height: 100vh; }
.seitenleiste {
  width: 212px; flex: 0 0 212px; background: var(--flaeche);
  border-right: 1px solid var(--rand); padding: 14px 10px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.marke { display: flex; align-items: center; gap: 9px; padding: 4px 8px 16px; }
.marke .punkt {
  width: 26px; height: 26px; border-radius: 7px; flex: 0 0 26px;
  background: linear-gradient(135deg, var(--kobalt), var(--gruen));
}
.marke b { font-size: 15px; letter-spacing: -.01em; }
.marke span { display: block; font-size: 10.5px; color: var(--text-3); font-weight: 400; }

.nav-gruppe { margin-bottom: 14px; }
.nav-titel {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); padding: 0 8px 5px; font-weight: 600;
}
.nav a {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: var(--radius-s); color: var(--text-2); font-size: 13.5px;
  margin-bottom: 1px;
}
.nav a:hover { background: var(--flaeche-2); color: var(--text); text-decoration: none; }
.nav a.aktiv { background: var(--kobalt-matt); color: var(--kobalt); font-weight: 600; }
.nav a .zahl {
  margin-left: auto; font-size: 11px; background: var(--rot); color: #fff;
  border-radius: 9px; padding: 0 6px; font-weight: 600;
}

.inhalt { flex: 1; min-width: 0; padding: 20px 24px 60px; }
.kopf { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.kopf h1 { font-size: 20px; margin: 0 0 2px; letter-spacing: -.015em; }
.kopf p { margin: 0; color: var(--text-2); font-size: 13px; }
.kopf .rechts { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Karten ─────────────────────────────────────────── */
.karte {
  background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: var(--radius); box-shadow: var(--schatten); margin-bottom: 16px;
}
.karte > h2 {
  font-size: 13px; margin: 0; padding: 11px 14px; border-bottom: 1px solid var(--rand);
  font-weight: 600; letter-spacing: -.005em; display: flex; align-items: center; gap: 8px;
}
.karte > h2 .rechts { margin-left: auto; font-weight: 400; color: var(--text-2); font-size: 12px; }
.karte-inhalt { padding: 14px; }

.kacheln { display: grid; gap: 12px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kachel {
  background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--schatten);
  position: relative; overflow: hidden;
}
.kachel .label { font-size: 11.5px; color: var(--text-2); margin-bottom: 5px;
  display: flex; align-items: center; gap: 6px; }
.kachel .wert { font-size: 22px; font-weight: 650; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; }
.kachel .unter { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.kachel.gruen { border-left: 3px solid var(--gruen); }
.kachel.gelb  { border-left: 3px solid var(--gelb); }
.kachel.rot   { border-left: 3px solid var(--rot); }
.kachel.blau  { border-left: 3px solid var(--kobalt); }
.wert.pos { color: var(--gruen); } .wert.neg { color: var(--rot); }

/* ── Tabellen ───────────────────────────────────────── */
.tabelle-huelle { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th {
  text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-2); padding: 8px 10px;
  border-bottom: 1px solid var(--rand); background: var(--flaeche-2);
  position: sticky; top: 0; white-space: nowrap; z-index: 1;
}
table.t td { padding: 7px 10px; border-bottom: 1px solid var(--rand); vertical-align: top; }
table.t tbody tr:hover { background: var(--flaeche-2); }
table.t tr.summe td { font-weight: 650; background: var(--flaeche-2); border-top: 2px solid var(--rand-stark); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; }
.klein { font-size: 11.5px; color: var(--text-2); }
.gedimmt { color: var(--text-3); }
.abschnitt td { background: var(--kobalt-matt); font-weight: 600; font-size: 12px; }

/* ── Marken / Badges ────────────────────────────────── */
.marke-b {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px;
  font-weight: 600; padding: 2px 7px; border-radius: 20px; white-space: nowrap;
  border: 1px solid transparent;
}
.m-gruen { background: var(--gruen-matt); color: var(--gruen); }
.m-gelb  { background: var(--gelb-matt);  color: var(--gelb); }
.m-rot   { background: var(--rot-matt);   color: var(--rot); }
.m-blau  { background: var(--kobalt-matt); color: var(--kobalt); }
.m-grau  { background: var(--flaeche-2); color: var(--text-2); border-color: var(--rand); }

/* ── Formulare ──────────────────────────────────────── */
input, select, textarea, button { font-family: inherit; font-size: 13px; }
input[type=text], input[type=date], input[type=number], input[type=email],
input[type=password], input[type=search], select, textarea {
  padding: 6px 9px; border: 1px solid var(--rand-stark); border-radius: var(--radius-s);
  background: var(--flaeche); color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--kobalt); outline-offset: -1px; border-color: var(--kobalt);
}
textarea { min-height: 160px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
label.feld { display: block; margin-bottom: 10px; }
label.feld > span { display: block; font-size: 11.5px; color: var(--text-2); margin-bottom: 3px; }

.filter {
  display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap;
  padding: 11px 14px; border-bottom: 1px solid var(--rand); background: var(--flaeche-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.filter .f { min-width: 125px; }
.filter .f.w { min-width: 210px; }
.filter .f > span { display: block; font-size: 10.5px; color: var(--text-2);
  margin-bottom: 2px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px;
  border-radius: var(--radius-s); border: 1px solid var(--rand-stark);
  background: var(--flaeche); color: var(--text); cursor: pointer; font-weight: 500;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--flaeche-2); text-decoration: none; }
.btn-haupt { background: var(--kobalt); border-color: var(--kobalt); color: #fff; }
.btn-haupt:hover { background: var(--kobalt-hell); border-color: var(--kobalt-hell); }
.btn-gefahr { background: var(--rot); border-color: var(--rot); color: #fff; }
.btn-klein { padding: 3px 8px; font-size: 12px; }

/* ── Hinweise ───────────────────────────────────────── */
.hinweis { padding: 10px 13px; border-radius: var(--radius-s); margin-bottom: 12px;
  font-size: 13px; border: 1px solid; display: flex; gap: 9px; align-items: flex-start; }
.h-info { background: var(--kobalt-matt); border-color: var(--kobalt); color: var(--text); }
.h-ok   { background: var(--gruen-matt);  border-color: var(--gruen); color: var(--text); }
.h-warn { background: var(--gelb-matt);   border-color: var(--gelb);  color: var(--text); }
.h-fehler{background: var(--rot-matt);    border-color: var(--rot);   color: var(--text); }

.leer { text-align: center; padding: 40px 20px; color: var(--text-3); }
.leer b { display: block; color: var(--text-2); margin-bottom: 4px; font-size: 14px; }

/* ── Diagramme (reines SVG/CSS) ─────────────────────── */
/* .s braucht volle Höhe, sonst haben die Prozentwerte der Säulen keinen Bezug */
.balken { display: flex; align-items: stretch; gap: 3px; height: 110px; padding-top: 6px; }
.balken .s { flex: 1; height: 100%; display: flex; flex-direction: column;
  justify-content: flex-end; gap: 1px; min-width: 6px; }
.balken .b { background: var(--kobalt); border-radius: 2px 2px 0 0; min-height: 1px; }
.balken .b.g { background: var(--gruen); }
.balken .b.r { background: var(--rot); }
.achse { display: flex; gap: 3px; font-size: 9.5px; color: var(--text-3); margin-top: 4px; }
.achse span { flex: 1; text-align: center; min-width: 6px; overflow: hidden; }

.fortschritt { height: 6px; background: var(--rand); border-radius: 3px; overflow: hidden; }
.fortschritt > i { display: block; height: 100%; background: var(--kobalt); }
.fortschritt.g > i { background: var(--gruen); }
.fortschritt.r > i { background: var(--rot); }

/* ── Sonstiges ──────────────────────────────────────── */
.reihe { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.zweispaltig { display: grid; gap: 16px; grid-template-columns: 1.6fr 1fr; align-items: start; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 13px; }
.dl dt { color: var(--text-2); } .dl dd { margin: 0; font-variant-numeric: tabular-nums; }
.blaettern { display: flex; gap: 6px; align-items: center; padding: 10px 14px;
  border-top: 1px solid var(--rand); font-size: 12.5px; color: var(--text-2); }
.blaettern .rechts { margin-left: auto; display: flex; gap: 6px; }

@media (max-width: 900px) {
  .huelle { flex-direction: column; }
  .seitenleiste { width: 100%; height: auto; position: static; flex: none;
    border-right: 0; border-bottom: 1px solid var(--rand); }
  .nav { display: flex; flex-wrap: wrap; gap: 3px; }
  .nav-gruppe { margin-bottom: 6px; } .nav-titel { display: none; }
  .inhalt { padding: 14px; }
  .zweispaltig { grid-template-columns: 1fr; }
}
@media print {
  .seitenleiste, .filter, .btn, .blaettern { display: none !important; }
  .inhalt { padding: 0; } body { background: #fff; }
  .karte { break-inside: avoid; box-shadow: none; }
}
