/* Corporate Design CR Energiepartner GmbH
   Farben von energiepartner.org: Dunkelgrün #00160E, Lindgrün #D6DF38, Blau #00A2DB, Grau #7F7F7F
   Logoverlauf: Lindgrün über Mint und Türkis zu Blau
   Schriften: Inter (Überschriften), Heebo (Text), lokal eingebunden */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url(fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Heebo'; font-weight: 400; font-display: swap; src: url(fonts/heebo-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Heebo'; font-weight: 500; font-display: swap; src: url(fonts/heebo-latin-500-normal.woff2) format('woff2'); }

:root {
  --cr-dunkel: #00160E;
  --cr-lime: #D6DF38;
  --cr-blau: #00A2DB;
  --cr-grau: #7F7F7F;
  --cr-hellgrau: #E1E1E1;
  --cr-mittelgrau: #C4C4C4;
  --cr-verlauf: linear-gradient(90deg, #D6DF38 0%, #8EDA9B 45%, #3FCFC9 75%, #00A2DB 100%);

  --bg: #F5F6F2;
  --surface: #FFFFFF;
  --ink: var(--cr-dunkel);
  --quiet: #5F6862;
  --line: var(--cr-hellgrau);
  --accent: var(--cr-dunkel);
  --sel: #F3F6C8;
  --good: #149A84;
  --good-soft: #E0F5F0;
  --warn: #B07400;
  --warn-soft: #FCF1D9;
  --bad: #C0392B;
  --radius: 12px;
  --tap: 48px;
  --font-head: 'Inter', system-ui, sans-serif;
  --font-text: 'Heebo', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 16px/1.45 var(--font-text);
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 640px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); min-height: 100vh; }
h1, h2, h3, .btn, .tile .t, .stat b, .field-head .name { font-family: var(--font-head); }

/* Kopfzeile in Dunkelgrün mit Verlaufslinie */
header.bar {
  position: sticky; top: 0; z-index: 5; background: var(--cr-dunkel); color: #fff;
  margin: 0 -16px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  display: flex; align-items: center; gap: 10px;
}
header.bar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: var(--cr-verlauf); }
header.bar h1 { font-size: 18px; font-weight: 600; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
header.bar .sub { display: block; font: 400 13px/1.3 var(--font-text); color: #B9C2BC; }
header.bar .marke { width: 30px; height: auto; flex: none; }
header.bar .chip { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); min-height: 36px; padding: 6px 12px; font-size: 14px; }
button { font: inherit; color: inherit; }
.back { border: 0; background: none; font-size: 28px; line-height: 1; min-width: 36px; min-height: 40px; color: var(--cr-lime); padding: 0; }
.iconbtn { border: 0; background: none; color: var(--quiet); min-width: 40px; min-height: 40px; font-size: 20px; }
header.bar .iconbtn { color: #fff; }
h2 { font: 600 12.5px/1.3 var(--font-head); text-transform: uppercase; letter-spacing: .06em; color: var(--quiet); margin: 24px 0 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: var(--tap); border-radius: var(--radius); border: 1px solid var(--cr-mittelgrau);
  background: var(--surface); color: var(--cr-dunkel); padding: 10px 14px; font-weight: 600; font-size: 15.5px; cursor: pointer; text-align: center;
}
.btn.primary { background: var(--cr-lime); border-color: var(--cr-lime); color: var(--cr-dunkel); }
.btn.primary:active { background: #C3CC2A; }
.btn.warn { background: var(--warn-soft); border-color: var(--warn); color: #5A3C00; }
.btn.dashed { border-style: dashed; font-weight: 500; }
.btn:disabled { opacity: .5; }
.btn + .btn { margin-top: 10px; }
.bottom-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface);
  border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0, 22, 14, .06);
}
.bottom-actions .inner { max-width: 608px; margin: 0 auto; display: flex; gap: 10px; }
.bottom-actions .btn + .btn { margin-top: 0; }
input[type=text], input[type=number], input[type=search], input[type=email], input[type=tel], input[type=password], textarea, select {
  width: 100%; min-height: var(--tap); font: 400 16px/1.4 var(--font-text); color: var(--ink); background: var(--surface);
  border: 1px solid var(--cr-mittelgrau); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--cr-blau); outline-offset: 0; border-color: var(--cr-blau); }
label.lbl { display: block; font-size: 14px; color: var(--quiet); margin-bottom: 6px; }

/* Felder */
.field { padding: 14px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.field-head .name { flex: 1; font-weight: 600; font-size: 15px; }
.pill { font-size: 12px; border-radius: 999px; padding: 2px 9px; white-space: nowrap; font-weight: 500; }
.pill.nv { background: var(--cr-hellgrau); color: var(--cr-dunkel); }
.pill.nach { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--cr-mittelgrau);
  background: var(--surface); cursor: pointer; font-size: 15px; color: var(--cr-dunkel);
}
.chip.on { background: var(--sel); border: 2px solid var(--cr-dunkel); padding: 7px 13px; font-weight: 500; }
.unitwrap { display: flex; align-items: center; gap: 8px; }
.unitwrap span { color: var(--quiet); min-width: 36px; }
.counter { display: flex; align-items: center; gap: 12px; }
.counter button { width: 48px; height: 48px; border-radius: 10px; border: 1px solid var(--cr-mittelgrau); background: var(--surface); font-size: 22px; color: var(--cr-dunkel); }
.counter output { min-width: 40px; text-align: center; font: 700 20px var(--font-head); }
.hint { font-size: 13px; color: var(--quiet); margin-top: 6px; }
.notice { background: #E6F5FB; border-left: 4px solid var(--cr-blau); border-radius: 8px; padding: 12px 14px; font-size: 14px; }
.notice b { display: block; margin-bottom: 2px; font-family: var(--font-head); }
.error { background: #FBE6E3; color: var(--bad); border-radius: 10px; padding: 10px 12px; font-size: 14px; }

/* Fotoslots */
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.slot {
  position: relative; aspect-ratio: 1 / 1; border-radius: 12px; border: 1.5px dashed var(--cr-mittelgrau);
  background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 6px; cursor: pointer; overflow: hidden; text-align: center;
}
.slot .lab { position: relative; z-index: 1; font-size: 12.5px; line-height: 1.2; background: rgba(255,255,255,.88); border-radius: 6px; padding: 2px 5px; }
.slot .plus { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--quiet); font-size: 13px; padding-bottom: 18px; }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot.done { border: 2px solid var(--good); }
.slot.nach { border: 2px solid var(--warn); background: var(--warn-soft); }
.slot.nv { background: var(--cr-hellgrau); border-style: solid; }
.slot .cnt { position: absolute; top: 6px; right: 6px; z-index: 1; background: var(--good); color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 7px; }
.slot .more { position: absolute; top: 2px; left: 2px; z-index: 1; border: 0; background: rgba(255,255,255,.85); border-radius: 8px; width: 34px; height: 30px; font-size: 18px; line-height: 1; color: var(--cr-dunkel); }
.slot .up { position: absolute; bottom: 6px; right: 6px; z-index: 1; width: 10px; height: 10px; border-radius: 50%; background: var(--warn); }
.slot .up.ok { background: var(--good); }
.kompass { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; align-items: center; }
.kompass .house { grid-column: 2; grid-row: 2; display: flex; justify-content: center; }
.kompass .house svg { width: 70%; height: auto; color: var(--cr-mittelgrau); }

/* Kacheln */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; text-align: left; min-height: 76px; color: var(--cr-dunkel); }
.tile .t { font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; gap: 6px; }
.tile .t small { color: var(--quiet); font: 400 13px var(--font-text); }
.tile .nachw { font-size: 12px; color: var(--warn); margin-top: 4px; min-height: 15px; }
.fortschritt { height: 6px; background: var(--cr-hellgrau); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.fortschritt i { display: block; height: 100%; background: var(--cr-verlauf); background-size: 300px 100%; border-radius: 3px; }
.progress-big { margin: 18px 0 4px; }
.progress-big b { font-family: var(--font-head); font-size: 17px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--quiet); margin-top: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); flex: none; }
.dot.warn { background: var(--warn); }
.dot.off { background: var(--bad); }

/* Listen */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; min-height: 56px; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; color: var(--cr-dunkel); }
.row:last-child { border-bottom: 0; }
.row .main { flex: 1; min-width: 0; }
.row .main b { display: block; font-family: var(--font-head); font-weight: 600; }
.row .main span { display: block; font-size: 13px; color: var(--quiet); overflow: hidden; text-overflow: ellipsis; }
.row.sel { background: var(--sel); box-shadow: inset 4px 0 0 var(--cr-lime); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { border-radius: var(--radius); padding: 12px 8px; text-align: center; border: 1px solid var(--line); background: var(--surface); }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 13px; }
.stat.good { background: var(--good-soft); border-color: var(--good); }
.stat.warn { background: var(--warn-soft); border-color: var(--warn); }
ul.plain { margin: 0; padding: 0 0 0 20px; }
ul.plain li { margin: 4px 0; }
details summary { cursor: pointer; padding: 8px 0; color: var(--cr-blau); font-weight: 500; }

/* Sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 22, 14, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; border-radius: 20px 20px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 88vh; overflow: auto; }
.sheet .grip { width: 44px; height: 4px; border-radius: 2px; background: var(--cr-mittelgrau); margin: 4px auto 12px; }
.sheet h3 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.sheet .thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.sheet .thumbs figure { margin: 0; position: relative; }
.sheet .thumbs img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; }
.sheet .thumbs button { position: absolute; top: 4px; right: 4px; border: 0; border-radius: 8px; background: rgba(0, 22, 14, .7); color: #fff; width: 32px; height: 32px; }
.opt { display: block; width: 100%; text-align: left; min-height: 52px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--cr-mittelgrau); background: var(--surface); margin-top: 8px; cursor: pointer; color: var(--cr-dunkel); }
.opt small { display: block; color: var(--quiet); font-size: 13px; }
.opt.primary { border: 2px solid var(--cr-lime); background: var(--sel); font-weight: 600; font-family: var(--font-head); }
.opt.warn { border-color: var(--warn); background: var(--warn-soft); }
.opt.cancel { border: 0; background: none; text-align: center; color: var(--quiet); }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--cr-dunkel); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; max-width: 90vw; border-bottom: 3px solid var(--cr-lime); }
#toast.show { opacity: 1; }
.center { text-align: center; }
.mt { margin-top: 16px; }

/* Anmeldung */
.login { max-width: 380px; margin: 8vh auto 0; }
.login .logo { display: block; width: 210px; max-width: 70%; margin: 0 auto 28px; }
.login h1 { font: 600 22px var(--font-head); margin: 0 0 4px; text-align: center; }
.login p.claim { color: var(--quiet); margin: 0 0 24px; text-align: center; }
.login label.lbl { margin-top: 14px; }
.login .linie { height: 3px; border-radius: 2px; background: var(--cr-verlauf); margin: 0 auto 24px; width: 80px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--cr-hellgrau); border-top-color: var(--cr-blau); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.fertig-logo { width: 64px; display: block; margin: 8px 0 12px; }
