/* ===== Grundwasser-Portal – Look angelehnt an Sencrop ===== */
:root {
  --green: #1c7c54;
  --green-dark: #155d40;
  --blue: #2f3e9e;
  --blue-grad: linear-gradient(160deg, #3949ab 0%, #283593 60%, #1a237e 100%);
  --bg: #eef1f4;
  --card: #ffffff;
  --text: #2b3440;
  --muted: #7a8694;
  --warn-bg: #fff7df;
  --warn-border: #f0b429;
  --danger: #d64545;
  --radius: 14px;
  --shadow: 0 1px 4px rgba(20, 30, 50, .08);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 76px; background: #fff; border-right: 1px solid #e3e7eb;
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 0; gap: 6px; position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { margin-bottom: 14px; }
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 64px; padding: 8px 0; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-size: 10.5px;
}
.nav-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: #f1f5f3; color: var(--green); }
.nav-item.active { color: var(--green); background: #e7f2ec; font-weight: 600; }
.sidebar .spacer { flex: 1; }
.logout-form { margin: 0; }
.nav-button { border: none; background: none; cursor: pointer; font-family: inherit; }

/* ---------- Inhalt ---------- */
.content { flex: 1; min-width: 0; }
.page { padding: 24px 28px; max-width: 1300px; margin: 0 auto; }
.page h1 { font-size: 22px; margin: 0 0 18px; }

/* ---------- Hero (Startseite) ---------- */
.hero {
  background: var(--blue-grad); color: #fff; padding: 28px 28px 36px;
  border-radius: 0 0 24px 24px;
}
.hero .station-name { text-align: center; font-size: 15px; opacity: .9; margin-bottom: 4px; }
.hero .big {
  display: flex; justify-content: center; align-items: baseline; gap: 26px; margin: 10px 0 4px;
}
.hero .big .value { font-size: 44px; font-weight: 700; }
.hero .big .unit { font-size: 20px; opacity: .85; }
.hero .sub { text-align: center; font-size: 13px; opacity: .8; }
.hero .pills { display: flex; justify-content: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hero .pill {
  background: rgba(255,255,255,.14); border-radius: 12px; padding: 10px 16px;
  text-align: center; min-width: 86px;
}
.hero .pill .v { font-size: 18px; font-weight: 600; }
.hero .pill .l { font-size: 11px; opacity: .8; }

/* ---------- Karten/Grids ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px;
}
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card .meta { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.kv .k { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.kv .v { font-size: 19px; font-weight: 650; }
.kv .v small { font-size: 12px; font-weight: 400; color: var(--muted); }
.card .actions { display: flex; gap: 10px; margin-top: 14px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge.ok { background: #e2f3e9; color: var(--green-dark); }
.badge.offline { background: #fdeaea; color: var(--danger); }
.badge.warn { background: var(--warn-bg); color: #92600a; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; border: none; cursor: pointer; text-decoration: none;
  border-radius: 999px; padding: 8px 18px; font-size: 13.5px; font-weight: 600;
  background: #eef1f4; color: var(--text); font-family: inherit;
}
.btn:hover { background: #e2e7ec; }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.outline { background: #fff; border: 1px solid #d7dde3; }
.btn.small { padding: 5px 13px; font-size: 12.5px; }
.btn.active { background: var(--green); color: #fff; }

.seg { display: inline-flex; background: #fff; border: 1px solid #e0e5ea; border-radius: 999px; padding: 3px; gap: 2px; }
.seg .btn { background: transparent; }
.seg .btn.active { background: var(--green); color: #fff; }

/* ---------- Historie ---------- */
.history-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.chart-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.chart-wrap { position: relative; height: 380px; }
.metric-pills { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
.metric-pill {
  border: 1px solid #e0e5ea; border-radius: 12px; padding: 8px 16px; background: #fff;
  cursor: pointer; font-size: 13px; font-family: inherit;
}
.metric-pill.active { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); font-weight: 600; }
.metric-pill .mval { display: block; font-size: 17px; font-weight: 700; }

/* ---------- Meldungen ---------- */
.alert-row {
  display: flex; align-items: center; gap: 14px; background: var(--warn-bg);
  border: 1px solid #f5dfa1; border-radius: 12px; padding: 14px 18px; margin-bottom: 10px;
  color: #5d4708; text-decoration: none;
}
.alert-row.danger { background: #fdeaea; border-color: #f3c1c1; color: #7c2222; }
.alert-row .icon { font-size: 20px; }
.alert-row b { display: block; font-size: 14px; }
.alert-row span { font-size: 12.5px; }
.empty { color: var(--muted); padding: 40px; text-align: center; }

/* ---------- Tabellen / Formulare ---------- */
table.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 11px 14px; font-size: 13.5px; border-bottom: 1px solid #eef1f4; }
table.list th { background: #f7f9fa; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
table.list tr:last-child td { border-bottom: none; }
code.token { background: #f1f3f5; padding: 2px 7px; border-radius: 6px; font-size: 12px; }

.form-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; max-width: 560px; }
.form-card label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 4px; }
.form-card input, .form-card select, .form-card textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d7dde3; border-radius: 9px; font-size: 14px; font-family: inherit;
}
.form-row { display: flex; gap: 12px; }
.form-row > div { flex: 1; }

/* ---------- Login ---------- */
.login-bg { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--blue-grad); }
.login-card { background: #fff; border-radius: 18px; padding: 36px 40px; width: 360px; box-shadow: 0 10px 40px rgba(0,0,20,.3); }
.login-card h1 { font-size: 20px; margin: 0 0 18px; text-align: center; }
.login-card .err { color: var(--danger); font-size: 13px; margin-top: 10px; text-align: center; }

/* ---------- Gleichenplan ---------- */
.ct-label {
  background: rgba(255,255,255,.85); border: none; box-shadow: none;
  font: 600 10.5px "Segoe UI", sans-serif; color: #1c2b3a;
  padding: 0 3px; border-radius: 4px;
}
.ct-label::before { display: none; }

/* ---------- Karte ---------- */
.map-full { height: calc(100vh - 0px); width: 100%; }
.leaflet-popup-content { font-size: 13px; }
.leaflet-popup-content b { font-size: 14px; }

@media (max-width: 760px) {
  .sidebar { width: 60px; }
  .page { padding: 16px; }
}
