/* ============================================================
   Neues Design der Team-App (November 2026).
   Wird NUR von pwa/index.html nach style.css geladen und überschreibt
   dort Farben, Schrift, Karten, Knöpfe und Listen. Die Ableser-Seite
   (pwa/a/) lädt diese Datei nicht und bleibt unverändert.
   Zurück zum alten Look: die <link>-Zeile in index.html entfernen.
   ============================================================ */

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/source-sans-3-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/source-sans-3-latin-700-normal.woff2") format("woff2");
}

:root {
  --color-brand: #003f65;
  --color-brand-dark: #002a45;
  --color-brand-soft: #e9eff4;
  --color-bg: #f3f5f7;
  --color-surface: #ffffff;
  --color-border: #e3e8ec;
  --color-divider: #eceff2;
  --color-text: #17212b;
  --color-text-muted: #5c6864;
  --color-danger: #b3312c;
  --color-danger-text: #9e2a26;
  --color-danger-soft: #fbeceb;
  --color-warning: #8a5212;
  --color-warning-soft: #fdf0dc;
  --color-ok: #23633d;
  --color-ok-soft: #e4f2ea;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px rgba(16, 24, 40, 0.04);
  --tab-bar-height: 58px;
  --font: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body { font-family: var(--font); line-height: 1.4; }
input, select, textarea, button { font-family: inherit; }

/* ---- Kopfleiste ---------------------------------------------------- */
.app-header { padding-bottom: 0; }
.app-header-row { min-height: 56px; padding-top: 0; }
.app-title { font-size: 1.06rem; letter-spacing: 0.1px; }
.app-logo-mark { height: 30px; }

/* ---- Tab-Leiste ---------------------------------------------------- */
.tab-bar { background: rgba(255, 255, 255, 0.94); border-top-color: var(--color-border); }
.tab-item span { font-size: 0.75rem; }
.tab-item svg { stroke-width: 2; }

/* ---- Seitenaufbau -------------------------------------------------- */
.app-view { padding-top: 20px; }
.app-view h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.2px; }
.app-view h3 { font-size: 1.1rem; font-weight: 700; }

.seiten-kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
.seiten-kopf h1 { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.3px; margin: 0; }
.seiten-kopf .seiten-sub { font-size: 0.9rem; color: var(--color-text-muted); }

.abschnitt-titel {
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: var(--space-4) 4px var(--space-2) !important;
}

/* ---- Karten und Listen -------------------------------------------- */
.card, .list, .stat-box {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.list-item { border-bottom-color: var(--color-divider); }
.list-item-title { font-size: 1rem; }
.list-item-sub { font-size: 0.875rem; }
.list-item-nav:active, .list-item:active { background: rgba(0, 63, 101, 0.05); }

/* ---- Eingabefelder ------------------------------------------------- */
.field label { font-size: 0.875rem; }
.field input, .field select, .field textarea {
  min-height: 48px;
  border-color: var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(0, 63, 101, 0.15);
}

/* ---- Knöpfe: Haupt (gefüllt), Neben (hell), Gefahr (rot) ----------- */
.btn {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 1rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn:hover { background: var(--color-brand-dark); }
.btn-block { display: flex; width: 100%; }
.btn-secondary, .btn-secondary:hover { background: var(--color-brand-soft); color: var(--color-brand); border: none; }
.btn-secondary:hover { background: #dce6ee; }
.btn-danger, .btn-danger:hover { background: var(--color-danger); }
.btn-danger-ruhig, .btn-danger-ruhig:hover {
  background: var(--color-surface);
  color: var(--color-danger);
  border: 1px solid #f0cdcb;
}
.btn-quadrat { width: 44px; padding: 0; flex: 0 0 auto; }
.btn-text, .btn-text:hover {
  background: none;
  color: var(--color-brand);
  padding: 0 4px;
  min-height: 44px;
}
.btn:focus-visible, .tab-item:focus-visible, .list-item:focus-visible, .zz-zeile:focus-visible {
  outline: 3px solid rgba(0, 63, 101, 0.35);
  outline-offset: 2px;
}

/* "← Zurück" als deutlicher Knopf statt Textlink */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  background: var(--color-brand-soft);
  font-size: 0.95rem;
}

/* ---- Status-Pillen ------------------------------------------------- */
.tag { padding: 3px 10px; font-size: 0.75rem; }
.tag-complete { background: var(--color-ok-soft); color: var(--color-ok); }
.tag-missing { background: var(--color-danger-soft); color: var(--color-danger-text); }
.tag-pending { background: var(--color-warning-soft); color: var(--color-warning); }
.tag-photo, .tag-rolle-admin { background: #e3eef8; color: #1d4f7a; }
.tag-nophoto { background: var(--color-divider); color: #4a5551; }

.hint { color: var(--color-text-muted); font-size: 0.875rem; }
.empty-state { font-size: 0.95rem; }
.toast { border-radius: var(--radius); }

/* ---- Kennzahlen ---------------------------------------------------- */
.stat-box .value { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stat-box .label { font-size: 0.8rem; }

/* ============================================================
   Übersicht
   ============================================================ */

/* Suchfeld mit Lupe – öffnet die Auswahlliste */
.suchfeld {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  margin-bottom: var(--space-3);
  border: none;
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  color: var(--color-text-muted);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
}
.suchfeld svg { flex: 0 0 auto; }

/* Kopfkarte der gewählten Liegenschaft */
.lg-karte { padding: 14px var(--space-3); display: flex; flex-direction: column; gap: 10px; }
.lg-kopf { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.lg-label { font-size: 0.75rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.6px; }
.lg-name { font-size: 1.25rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.lg-adresse { font-size: 0.875rem; color: var(--color-text-muted); }
.lg-stand { display: flex; justify-content: space-between; font-size: 0.875rem; }
.lg-stand span:first-child { color: var(--color-text-muted); }
.lg-stand span:last-child { font-weight: 600; }
.fortschritt { height: 6px; background: #e6ebef; border-radius: 999px; overflow: hidden; }
.fortschritt > div { height: 100%; background: var(--color-brand); border-radius: 999px; transition: width 0.3s; }
.fortschritt.ist-fertig > div { background: var(--color-ok); }
.lg-aktionen { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.lg-aktionen .btn { flex: 1 1 auto; font-size: 0.95rem; }

/* Kompakte Zählerzeile: Symbol | Typ, Nummer, Status | Ablesen? | ⋯ */
.zz-zeile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 10px 6px 10px var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  position: relative;
}
.zz-zeile:last-child { border-bottom: none; }
.zz-symbol {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.zz-symbol svg { width: 18px; height: 18px; }
.zz-strom { background: var(--color-warning-soft); color: #8a5212; }
.zz-wasser { background: #e3eef8; color: #1d5c8f; }
.zz-fernwaerme { background: #fbe6e4; color: var(--color-danger-text); }
.zz-gas { background: var(--color-divider); color: #4a5551; }
.zz-text { flex: 1; min-width: 0; text-decoration: none; color: inherit; padding: 4px 0; }
.zz-titel { font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }
.zz-titel small { font-weight: 400; font-size: 0.875rem; color: var(--color-text-muted); }
.zz-status { font-size: 0.875rem; color: var(--color-text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.zz-status .ok { color: var(--color-ok); font-weight: 600; }
.zz-status .fehlt { color: var(--color-danger-text); font-weight: 600; }
.zz-status .wert { color: var(--color-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.zz-status .tag { font-size: 0.7rem; padding: 1px 7px; }
.zz-standort { font-size: 0.8rem; color: var(--color-text-muted); overflow-wrap: anywhere; }
.zz-ablesen { flex: 0 0 auto; padding: 0 14px; font-size: 0.95rem; }
.zz-mehr {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius);
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
}
.zz-mehr:hover, .zz-mehr[aria-expanded="true"] { background: var(--color-brand-soft); color: var(--color-brand); }

/* Aufklappmenü der ⋯-Taste */
.zz-menue {
  position: absolute;
  right: 8px;
  top: calc(100% - 6px);
  z-index: 15;
  min-width: 200px;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.18);
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.zz-menue a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 1rem;
}
.zz-menue a:hover, .zz-menue a:focus-visible { background: var(--color-brand-soft); outline: none; }
.zz-gruppe .list { overflow: visible; }

.uebersicht-fuss { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-4); }
.uebersicht-fuss .btn-row .btn { flex: 1; }

/* Zuständigkeiten etwas ruhiger */
.zust-karte h3 { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--color-text-muted); }

/* ============================================================
   Auswahlliste (Bottom Sheet) für Liegenschaften
   ============================================================ */
.sheet-hintergrund {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 20, 30, 0.45);
  animation: sheet-blende 0.2s ease-out;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 51;
  max-width: 640px;
  margin: 0 auto;
  height: calc(100% - 48px - env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: 20px 20px 0 0;
  overflow-x: hidden;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
  padding-bottom: env(safe-area-inset-bottom);
  animation: sheet-hoch 0.25s ease-out;
}
@keyframes sheet-hoch { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheet-blende { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-hintergrund { animation: none; } }

.sheet-griff { width: 40px; height: 5px; border-radius: 999px; background: #d3d9de; margin: 8px auto 0; }
.sheet-kopf { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 0 var(--space-3); }
.sheet-kopf h2 { margin: 0; font-size: 1.25rem; }
.sheet-suche { padding: var(--space-2) var(--space-3) 12px; }
.sheet-suche label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--color-bg);
  border: 2px solid transparent;
}
.sheet-suche label:focus-within { border-color: var(--color-brand); }
.sheet-suche input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 16px; color: var(--color-text); -webkit-appearance: none; appearance: none; }
.sheet-liste { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 var(--space-3) var(--space-3); overscroll-behavior: contain; }
.sheet-liste .abschnitt-titel { margin-top: 12px !important; margin-left: 0 !important; }
.lg-zeile {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  margin: 0 -12px;
  width: calc(100% + 24px);
  border: none;
  border-bottom: 1px solid var(--color-divider);
  background: none;
  text-align: left;
  font-size: 1rem;
  color: inherit;
  cursor: pointer;
  border-radius: 0;
}
.lg-zeile:hover { background: rgba(0, 63, 101, 0.04); }
.lg-zeile.ist-aktiv { background: var(--color-brand-soft); border-radius: var(--radius); border-bottom-color: transparent; }
.lg-zeile-text { flex: 1; min-width: 0; }
.lg-zeile-name { font-weight: 600; overflow-wrap: anywhere; }
.lg-zeile-sub { font-size: 0.875rem; color: var(--color-text-muted); overflow-wrap: anywhere; }
.lg-zeile-sub .ok { color: var(--color-ok); font-weight: 600; }
.lg-zeile-sub .fehlt { color: var(--color-danger-text); font-weight: 600; }
.lg-zeile svg { flex: 0 0 auto; color: var(--color-brand); }
body.sheet-offen { overflow: hidden; }

/* ============================================================
   Team-Seite
   ============================================================ */
.team-karte { padding: 0; overflow: hidden; }
.team-karte .hint { padding: var(--space-3); margin: 0; }
.team-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-divider);
}
.team-kopf { display: flex; align-items: center; gap: 12px; min-width: 0; }
.team-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: var(--color-divider);
  color: #4a5551;
}
.team-avatar.rolle-admin { background: #e3eef8; color: #1d5c8f; }
.team-avatar.rolle-superadmin { background: var(--color-brand); color: #fff; }
.team-item .team-name { font-size: 1.05rem; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.team-name .tag { margin-left: 0; vertical-align: baseline; font-size: 0.72rem; }
.team-item .team-sub { font-size: 0.875rem; }
.team-item .team-status { font-size: 0.8rem; margin-top: 0; }
.team-item .team-status .tag { font-size: 0.75rem; }
.team-aktionen { flex-direction: row; max-width: none; gap: var(--space-2); }
.team-aktionen .btn { padding: 0 14px; font-size: 0.95rem; min-height: 44px; }
.team-aktionen .btn-secondary { flex: 1; }
.team-geloescht { border-top: 1px solid var(--color-divider); }
.team-geloescht summary { margin: 0; padding: 0 var(--space-3); min-height: 48px; display: flex; align-items: center; }
.team-geloescht .team-item:last-child { border-bottom: none; }
.team-item:last-child { border-bottom: none; }
.team-liste-wrap > .team-item:last-of-type { border-bottom: none; }

/* iPhone/iPad vergrößert die Seite beim Antippen eines Eingabefelds, wenn
   dessen Schrift kleiner als 16 px ist (style.css setzt auf schmalen
   Bildschirmen 15 px Grundschrift). Deshalb alle Felder fest auf 16 px. */
input, select, textarea { font-size: 16px !important; }
