/* Zählerstand-Web – mobile-first */
:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --text: #1c2420;
  --muted: #5f6b65;
  --line: #dde3df;
  --accent: #1f6f50;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ea;
  --strom: #b7791f;   --strom-soft: #fbf0dc;
  --wasser: #2b6cb0;  --wasser-soft: #e1edf9;
  --solar: #c05621;   --solar-soft: #fde8da;
  --ok: #1f6f50;      --ok-soft: #e3f1ea;
  --error: #b42318;   --error-soft: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 2px 8px rgba(20, 30, 25, .05);
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111614;
    --surface: #1b2220;
    --text: #e7ece9;
    --muted: #9aa7a0;
    --line: #2c3532;
    --accent: #4cb38a;
    --accent-ink: #0d1411;
    --accent-soft: #1d3329;
    --strom: #e3b05a;   --strom-soft: #3a2f1a;
    --wasser: #7fb2e8;  --wasser-soft: #1b2b3d;
    --solar: #f0935c;   --solar-soft: #3c241a;
    --ok: #4cb38a;      --ok-soft: #1d3329;
    --error: #f2877c;   --error-soft: #3d1f1c;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}
body.login { padding-bottom: 0; }

h1 { font-size: 1.6rem; line-height: 1.2; margin: .2em 0 .6em; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 1.4em 0 .5em; }
a { color: var(--accent); }
small { font-size: .85rem; }
.muted { color: var(--muted); margin: 0; }

/* --- Kopfzeile & Navigation --- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; }
.who { color: var(--muted); font-size: .9rem; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .75rem; font-weight: 600;
}
.tabbar svg { width: 24px; height: 24px; fill: currentColor; }
.tabbar a.active { color: var(--accent); }

.page { max-width: 640px; margin: 0 auto; padding: 16px; }

/* --- Startseite --- */
.hero { margin: 4px 0 16px; }
.eyebrow { margin: 0; color: var(--muted); font-size: .9rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.hero h1 { margin: 0 0 12px; font-size: 2rem; }
.progress { display: grid; gap: 6px; color: var(--muted); font-size: .9rem; }
progress {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 10px; border: 0; border-radius: 99px;
  background: var(--line); overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--line); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }

/* --- Karten --- */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.loc-card, .card-link { display: flex; align-items: center; gap: 12px; }
.card-link { color: inherit; text-decoration: none; min-height: 64px; }
.card-link:active { background: var(--accent-soft); }
.loc-main { flex: 1; min-width: 0; }
.loc-main h2 { margin: 0; font-size: 1.05rem; }
.loc-main h2 small { color: var(--muted); font-weight: 500; }
.chev { color: var(--muted); font-size: 1.6rem; line-height: 1; }
.is-inactive { opacity: .6; }

.meters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.chip { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.chip-strom  { color: var(--strom);  background: var(--strom-soft); }
.chip-wasser { color: var(--wasser); background: var(--wasser-soft); }
.chip-solar  { color: var(--solar);  background: var(--solar-soft); }

.status { font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.is-open .status { color: var(--muted); background: var(--bg); border: 1px solid var(--line); }
.is-done .status { color: var(--ok); background: var(--ok-soft); }
.is-done { border-left: 4px solid var(--ok); }

.note { color: var(--muted); font-size: .9rem; text-align: center; margin-top: 20px; }
.empty { text-align: center; padding: 40px 16px; }
.empty p { color: var(--muted); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-head h1 { margin-bottom: .5em; }
.back { display: inline-block; text-decoration: none; font-weight: 600; margin: 4px 0 4px; padding: 6px 0; }

/* --- Formulare --- */
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
input:not([type=checkbox]) {
  width: 100%;
  font: inherit; font-size: 17px;   /* ≥16px verhindert Auto-Zoom auf dem iPhone */
  padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text);
  min-height: 48px;
}
input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
input:disabled { opacity: .7; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 12px; margin: 0; display: grid; gap: 4px; }
legend { font-weight: 600; font-size: .95rem; padding: 0 4px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.check-inline { padding-bottom: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 18px;
  font: inherit; font-weight: 700;
  border-radius: 12px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:active { filter: brightness(.92); }
.btn-ghost { background: transparent; color: var(--error); border-color: var(--line); }
.btn-block { width: 100%; }
.page-head .btn { min-height: 40px; padding: 0 14px; }
.logout { margin-top: 24px; }

.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--error-soft); color: var(--error); }

/* --- Anmeldung --- */
body.login .page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-card form { text-align: left; margin-top: 24px; }
.login-logo { display: block; margin: 0 auto 8px; }
