:root {
  --tief: #0b6e99;
  --tief-dunkel: #075173;
  --tuerkis: #14b8a6;
  --himmel: #38bdf8;
  --warm: #ea580c;
  --kalt: #2563eb;
  --rot: #dc2626;
  --gruen: #15803d;
  --text: #12313f;
  --gedaempft: #5b7684;
  --linie: #d7e6ee;
  --flaeche: #ffffff;
  --grund: #eef6fa;
  --radius: 14px;
  --schatten: 0 1px 2px rgba(11, 110, 153, 0.06), 0 6px 18px rgba(11, 110, 153, 0.07);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--grund);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--tief); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.6em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 0.95rem; color: var(--gedaempft); margin-top: 1em; }

small { color: var(--gedaempft); }

/* Kopfzeile */

.topbar {
  background: linear-gradient(120deg, #e0f4fb 0%, #ffffff 55%, #e2f8f4 100%);
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--tief), var(--himmel), var(--tuerkis)) 1;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.marke {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.marke-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #cdeaf5;
}

.marke-text { display: flex; flex-direction: column; line-height: 1.15; }
.marke-text strong { font-size: 1.05rem; color: var(--tief-dunkel); }
.marke-text small { font-size: 0.8rem; }

.nav-schalter { display: none; }
.burger { display: none; }

.hauptnav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.hauptnav a {
  text-decoration: none;
  color: var(--text);
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 500;
}

.hauptnav a:hover { background: rgba(56, 189, 248, 0.15); }
.hauptnav a.aktiv { background: var(--tief); color: #fff; }

.nav-trenner { width: 1px; height: 22px; background: var(--linie); margin: 0 6px; }
.nav-user { color: var(--gedaempft) !important; }
.hauptnav a.nav-user.aktiv { color: #fff !important; }
.nav-logout { color: var(--gedaempft) !important; }

.sensorwahl {
  max-width: 1180px;
  margin: 14px auto 0;
  padding: 0 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sensorwahl a {
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--linie);
  color: var(--text);
  font-size: 0.9rem;
}

.sensorwahl a.aktiv { background: var(--tuerkis); border-color: var(--tuerkis); color: #fff; }

/* Seite */

.seite {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  flex: 1;
}

.fuss {
  text-align: center;
  color: var(--gedaempft);
  font-size: 0.85rem;
  padding: 18px 16px 24px;
}

.fuss a { color: var(--gedaempft); }

.seitenkopf { margin: 4px 0 16px; }
.seitenkopf h1 { margin-bottom: 2px; color: var(--tief-dunkel); }
.sub { color: var(--gedaempft); margin: 0; }

.karte {
  background: var(--flaeche);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.karte.schmal { max-width: 620px; }

.karte-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.karte-kopf h2 { margin: 0; }

.karte.leer { text-align: center; padding: 48px 20px; }
.leer { color: var(--gedaempft); }

.hinweis { color: var(--gedaempft); font-size: 0.88rem; margin: 10px 0 0; }

.kalt { color: var(--kalt); }
.warm { color: var(--warm); }
.warnung { color: var(--rot); font-weight: 600; }

/* Kacheln */

.kacheln {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.kachel {
  background: var(--flaeche);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 4px solid var(--himmel);
}

.kachel:nth-child(3) { border-top-color: var(--tuerkis); }
.kachel:nth-child(4) { border-top-color: #a78bfa; }

.kachel.gross {
  background: linear-gradient(140deg, var(--tief) 0%, #0e8fbf 55%, var(--tuerkis) 100%);
  color: #fff;
  border-top: 0;
}

.kachel-titel {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gedaempft);
  font-weight: 600;
}

.kachel.gross .kachel-titel { color: rgba(255, 255, 255, 0.85); }

.kachel-wert {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kachel-wert small { font-size: 1.1rem; font-weight: 500; margin-left: 4px; color: inherit; opacity: 0.85; }
.kachel-wert.klein { font-size: 1.35rem; font-weight: 650; }

.kachel-fuss { font-size: 0.85rem; color: var(--gedaempft); }
.kachel.gross .kachel-fuss { color: rgba(255, 255, 255, 0.85); }

/* Diagramme */

.diagramm { width: 100%; height: 300px; }
.diagramm.hoch { height: 420px; }

.zahlenreihe {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--linie);
}

.zahlenreihe div { display: flex; flex-direction: column; }
.zahlenreihe span { font-size: 0.8rem; color: var(--gedaempft); }
.zahlenreihe strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }

/* Formulare */

.filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 14px;
}

.formular .feld { margin-bottom: 14px; }
.formular .zeile { display: flex; gap: 14px; }
.formular .zeile .feld { flex: 1; }

.feld { display: flex; flex-direction: column; gap: 4px; }
.feld label, legend { font-size: 0.82rem; font-weight: 600; color: var(--gedaempft); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"], select {
  font: inherit;
  color: var(--text);
  padding: 8px 10px;
  border: 1px solid #c3d8e3;
  border-radius: 9px;
  background: #fff;
  min-height: 40px;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--himmel);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { padding: 0; margin-bottom: 6px; }

.wahl { display: block; padding: 8px 0; cursor: pointer; }
.wahl small { display: block; margin-left: 24px; }

.jahre { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.jahre legend { width: 100%; }

.chip-wahl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #c3d8e3;
  background: #fff;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.chip-wahl:has(input:checked) { background: #e0f4fb; border-color: var(--tief); color: var(--tief-dunkel); font-weight: 600; }

.schnellwahl { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }

.chip {
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 999px;
  background: #e8f5fa;
  color: var(--tief-dunkel);
  font-size: 0.88rem;
  font-weight: 500;
}

.chip:hover { background: #d3edf7; }
.chip.aktiv { background: var(--tuerkis); color: #fff; }

/* Knöpfe */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  padding: 9px 18px;
  min-height: 40px;
  border-radius: 10px;
  border: 0;
  background: linear-gradient(135deg, var(--tief), #0e8fbf);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.klein { padding: 5px 12px; min-height: 32px; font-size: 0.88rem; }
.btn.hell { background: #e8f5fa; color: var(--tief-dunkel); }
.btn.gefahr { background: var(--rot); }
.btn.breit { width: 100%; }

/* Meldungen */

.meldung { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.meldung.ok { background: #dcfce7; color: var(--gruen); }
.meldung.fehler { background: #fee2e2; color: #991b1b; }

/* Tabellen */

.tabelle-rahmen { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.tabelle { width: 100%; border-collapse: collapse; font-size: 0.92rem; }

.tabelle th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gedaempft);
  padding: 8px 10px;
  border-bottom: 2px solid var(--linie);
  white-space: nowrap;
}

.tabelle td { padding: 9px 10px; border-bottom: 1px solid #e8f0f4; vertical-align: middle; }
.tabelle tbody tr:hover { background: #f5fafc; }
.tabelle .zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle tr.inaktiv td { color: var(--gedaempft); }

.tabelle.monate td.zahl strong { display: block; }
.tabelle.monate td.zahl small { font-size: 0.78rem; }
.tabelle.monate tr.gewaehlt { background: #e6f7f4; }
.leer-zelle { color: #b6c8d1; }

.marke-klein {
  display: inline-block;
  font-size: 0.72rem;
  padding: 1px 8px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 600;
}

.aktionen { text-align: right; }
.aktionen details { display: inline-block; position: relative; }
.aktionen summary { list-style: none; }
.aktionen summary::-webkit-details-marker { display: none; }

.aktionen-box {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(18, 49, 63, 0.18);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 250px;
  text-align: left;
}

.inline { display: flex; gap: 6px; align-items: center; }
.inline input { flex: 1; min-width: 0; min-height: 32px; padding: 5px 8px; }

.mobil-nur { display: none; }

/* Anmeldung */

.login-body {
  background: linear-gradient(160deg, #0b6e99 0%, #0e8fbf 45%, #14b8a6 100%);
}

.login-seite {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.login-box {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 28px 26px 20px;
  box-shadow: 0 20px 50px rgba(7, 81, 115, 0.35);
}

.login-box .marke { margin-bottom: 4px; }
.login-box .sub { margin-bottom: 18px; }
.login-box .feld { margin-bottom: 14px; }
.login-box .btn { margin-top: 6px; }
.login-fuss { text-align: center; color: var(--gedaempft); font-size: 0.82rem; margin: 18px 0 0; }
.login-fuss a { color: var(--gedaempft); }

/* Handy */

@media (max-width: 900px) {
  .kacheln { grid-template-columns: 1fr 1fr; }
  .kachel.gross { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    margin-left: auto;
    width: 42px;
    height: 42px;
    padding: 0 9px;
    border-radius: 10px;
    cursor: pointer;
  }

  .burger span { display: block; height: 3px; border-radius: 2px; background: var(--tief); }

  .hauptnav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 12px 14px;
    background: #fff;
    box-shadow: 0 12px 24px rgba(18, 49, 63, 0.15);
  }

  .nav-schalter:checked ~ .hauptnav { display: flex; }
  .hauptnav a { padding: 11px 14px; border-radius: 10px; }
  .nav-trenner { width: auto; height: 1px; margin: 6px 0; }

  .seite { padding-top: 16px; }
  .karte { padding: 14px; }
  h1 { font-size: 1.35rem; }

  .kachel-wert { font-size: 2.2rem; }
  .kachel-wert.klein { font-size: 1.15rem; }

  .diagramm { height: 260px; }
  .diagramm.hoch { height: 340px; }

  .zahlenreihe { grid-template-columns: 1fr 1fr; }

  .filter .feld { flex: 1 1 140px; }
  .schnellwahl { margin-left: 0; width: 100%; }

  .formular .zeile { flex-direction: column; gap: 0; }

  .mobil-weg { display: none; }
  .mobil-nur { display: block; font-size: 0.8rem; }

  .aktionen-box { min-width: 220px; }
}
