/* =====================================================================================
   Fundera – Gestaltung nach Fundoro (Broschüren 2025): Schwarz und Gold, Karte im Hintergrund.
   Standard = Dunkelmodus; Hellmodus mit <html data-theme="hell"> (Umschalter im Personen-Menü).
   Schrift: Hanken Grotesk (Text), Stadtmitte (nur Logo «FUNDERA», aus der Fundoro-Broschüre).
   ===================================================================================== */
@import url('https://unpkg.com/@fontsource-variable/hanken-grotesk@5.3.0/index.css');
@font-face { font-family:'Fundera Titel'; src:url('/design/fundera-titel.otf') format('opentype'); font-weight:400; font-display:swap; }

:root {
  --bg:#08080a; --bg-2:#0e0e11;
  --card:rgba(18,18,21,.88); --card-solid:#141417; --card-2:#1a1a1e;
  --text:#ece6d6; --muted:#9b968a; --line:#2b2a2e; --line-2:#3a383d;
  --input-bg:#0f0f12; --hover:rgba(255,255,255,.045);
  --accent:#c9a227; --accent-2:#e2bf47; --accent-dunkel:#a88a2c; --accent-text:#0b0b0c; --link:#d8b443;
  --accent-weich:rgba(201,162,39,.14); --accent-rand:rgba(201,162,39,.45);
  --ok:#5cb87a; --warn:#e0a92e; --ko:#e46a7f;
  --gut-bg:rgba(92,184,122,.12); --achtung-bg:rgba(224,169,46,.13); --ko-bg:rgba(228,106,127,.13); --info-bg:rgba(255,255,255,.05);
  --gut-rand:rgba(92,184,122,.35); --achtung-rand:rgba(224,169,46,.38); --ko-rand:rgba(228,106,127,.38);
  --schatten:0 1px 2px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.25);
  --karte-farbe:#c9a227; --karte-deckkraft:.11;
  --radius:10px;
  /* Namen aus der ersten Fassung (Fork) als Verweise */
  --gold:var(--accent); --tint:var(--accent-weich); --ok-bg:var(--gut-bg); --warn-bg:var(--achtung-bg);
  color-scheme:dark;
}
html[data-theme="hell"] {
  --bg:#f5f4ef; --bg-2:#ecebe4;
  --card:rgba(255,255,255,.92); --card-solid:#ffffff; --card-2:#f7f6f2;
  --text:#17171a; --muted:#6c6a63; --line:#e3e1d9; --line-2:#d3d0c6;
  --input-bg:#ffffff; --hover:rgba(0,0,0,.035);
  --accent:#c9a227; --accent-2:#d8b13a; --accent-dunkel:#9c7d1c; --accent-text:#0b0b0c; --link:#8a6c10;
  --accent-weich:rgba(201,162,39,.13); --accent-rand:rgba(168,134,31,.45);
  --ok:#2f8f4e; --warn:#b07800; --ko:#c2344f;
  --gut-bg:#eaf5ed; --achtung-bg:#fdf3df; --ko-bg:#fcebee; --info-bg:#f1f1ee;
  --gut-rand:#bfe3c8; --achtung-rand:#f0d79b; --ko-rand:#f1c2cb;
  --schatten:0 1px 2px rgba(0,0,0,.05), 0 6px 18px rgba(0,0,0,.05);
  --karte-farbe:#a88a2c; --karte-deckkraft:.07;
  color-scheme:light;
}

* { box-sizing:border-box; }
[hidden] { display:none !important; }
html { background:var(--bg); }
html, body { margin:0; min-height:100%; font-family:'Hanken Grotesk Variable', 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size:14px; color:var(--text); background:transparent; -webkit-font-smoothing:antialiased; }
/* Karte von Zürich (Fundoro) als ruhiger Hintergrund */
body::before { content:''; position:fixed; inset:0; z-index:-1; pointer-events:none; background-color:var(--karte-farbe); opacity:var(--karte-deckkraft);
  -webkit-mask:url('/design/karte-zuerich.svg') center / cover no-repeat; mask:url('/design/karte-zuerich.svg') center / cover no-repeat; }
body::after { content:''; position:fixed; inset:0; z-index:-1; pointer-events:none; background:radial-gradient(ellipse at 70% 20%, transparent 0%, var(--bg) 85%); opacity:.55; }

a { color:var(--link); }
.muted { color:var(--muted); font-size:12px; }
input, select, button, textarea { font:inherit; color:var(--text); padding:7px 10px; border:1px solid var(--line-2); border-radius:8px; background:var(--input-bg); }
input::placeholder, textarea::placeholder { color:var(--muted); opacity:.8; }
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-weich); }
button { cursor:pointer; transition:background .15s, border-color .15s, color .15s; }
button:hover:not(:disabled) { border-color:var(--accent-rand); }
button:disabled { opacity:.5; cursor:default; }
button.primary, a.btn.primary { background:var(--accent); border-color:var(--accent); color:var(--accent-text); font-weight:600; }
button.primary:hover:not(:disabled), a.btn.primary:hover { background:var(--accent-2); border-color:var(--accent-2); }
textarea { width:100%; }
select option { background:var(--card-solid); color:var(--text); }

.card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:16px; margin-bottom:12px; box-shadow:var(--schatten); backdrop-filter:blur(6px); }
.card h2 { font-size:11.5px; text-transform:uppercase; letter-spacing:.09em; margin:0 0 12px; color:var(--muted); font-weight:600; }
table { width:100%; border-collapse:collapse; }
td, th { padding:6px 5px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
th { font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); font-weight:600; }
td.v, th.v { text-align:right; white-space:nowrap; }
.error { color:var(--ko); min-height:1.2em; }
.ok { color:var(--ok); }
.stack { display:flex; flex-direction:column; gap:10px; }
.stack label { display:flex; flex-direction:column; gap:4px; font-size:13px; }
.row { display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; }
.row label { display:flex; flex-direction:column; gap:4px; font-size:13px; }
.btn-link { background:none; border:0; color:var(--link); padding:0; cursor:pointer; text-decoration:underline; }
.badge { display:inline-block; padding:1px 8px; border-radius:10px; font-size:11px; background:var(--info-bg); color:var(--text); border:1px solid var(--line); }
.badge.warn, .badge.live { background:var(--achtung-bg); border-color:var(--achtung-rand); }
.badge.info { background:var(--accent-weich); border-color:var(--accent-rand); }
.badge.grey { background:var(--info-bg); color:var(--muted); }
.badge.db, .badge.ok { background:var(--gut-bg); border-color:var(--gut-rand); }
.badge.err { background:var(--ko-bg); color:var(--ko); border-color:var(--ko-rand); }
tr.click { cursor:pointer; }
tr.click:hover td { background:var(--hover); }
.center { max-width:380px; margin:10vh auto; }
.center input { width:100%; margin-bottom:10px; }
.center button { width:100%; }
.layout { display:grid; grid-template-columns:1fr 380px; height:calc(100% - 58px); }
#map { height:100%; }
aside { overflow:auto; padding:12px; border-left:1px solid var(--line); background:var(--card); }
.page { max-width:900px; margin:22px auto; padding:0 16px; }
@media (max-width:800px) {
  .layout { grid-template-columns:1fr; grid-template-rows:55vh auto; height:auto; }
  #map { height:55vh; }
  aside { border-left:0; }
}

/* ---------- Kopf: Logo, Hauptbereiche, rechts Hilfe und Personen-Menü ---------- */
header { display:flex; align-items:center; padding:0 20px; min-height:58px; flex-wrap:nowrap; gap:28px; background:rgba(8,8,10,.86);
  border-bottom:1px solid var(--line); backdrop-filter:blur(10px); position:sticky; top:0; z-index:500; }
html[data-theme="hell"] header { background:rgba(255,255,255,.9); }
header h1 { margin:0; padding:0; white-space:nowrap; line-height:1; }
header h1, .logo { font-family:'Fundera Titel', 'Hanken Grotesk Variable', sans-serif; font-weight:400; font-size:22px; letter-spacing:.42em; text-transform:uppercase; color:var(--accent); }
html[data-theme="hell"] header h1 { color:var(--accent-dunkel); }
header h1 span { color:inherit; }
header nav { margin-left:0; flex:1; display:flex; align-items:stretch; justify-content:space-between; gap:16px; min-height:58px; }
header nav a { color:var(--text); text-decoration:none; white-space:nowrap; }
.nav-haupt { display:flex; align-items:stretch; gap:2px; }
.nav-haupt a { display:flex; align-items:center; padding:0 13px; color:var(--muted); text-decoration:none; border-bottom:2px solid transparent; font-weight:500; letter-spacing:.01em; }
.nav-haupt a:hover { color:var(--text); }
.nav-haupt a.active { color:var(--text); border-bottom-color:var(--accent); font-weight:600; }
.nav-rechts { display:flex; align-items:center; gap:8px; }
.nav-rund { display:inline-flex; width:34px; height:34px; border-radius:50%; align-items:center; justify-content:center; text-decoration:none;
  border:1px solid var(--line-2); color:var(--text); font-weight:600; font-size:13px; background:transparent; cursor:pointer; list-style:none; }
.nav-rund:hover, .nav-rund.active { border-color:var(--accent); }
.nav-ich { background:var(--accent); color:var(--accent-text); border-color:var(--accent); letter-spacing:.03em; }
.nav-mehr { position:relative; }
.nav-mehr summary::-webkit-details-marker { display:none; }
.nav-mehr > div { position:absolute; right:0; top:44px; background:var(--card-solid); border:1px solid var(--line); border-radius:12px; padding:6px 0; min-width:240px; z-index:1000; box-shadow:0 14px 40px rgba(0,0,0,.35); }
.nav-mehr > div a { display:block; padding:9px 16px; color:var(--text); text-decoration:none; }
.nav-mehr > div a:hover { background:var(--hover); }
.nav-mehr > div a.active { font-weight:600; color:var(--accent); }
.nav-wer { padding:8px 16px 10px; border-bottom:1px solid var(--line); margin-bottom:4px; }
.nav-wer b { display:block; } .nav-wer span { color:var(--muted); font-size:12px; }
.nav-titel { padding:10px 16px 2px; font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
.nav-trenn { border-top:1px solid var(--line); margin:4px 0; }
.nav-thema { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 16px; color:var(--text); }
.nav-thema .seg { width:auto; }
#logout { color:var(--ko) !important; }
.seitenkopf { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin:4px 0 14px; }
.seitenkopf h2 { margin:0; font-size:22px; font-weight:600; }
.seitenkopf .muted { font-size:13px; }
.nav-verw { display:flex; align-items:stretch; }
.nav-verw > summary { display:flex; align-items:center; padding:0 13px; color:var(--muted); cursor:pointer; list-style:none; font-weight:500; border-bottom:2px solid transparent; }
.nav-verw > summary::after { content:''; width:7px; height:7px; margin-left:8px; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:rotate(45deg) translateY(-2px); }
.nav-verw > summary:hover { color:var(--text); }
.nav-verw > summary.active { color:var(--text); border-bottom-color:var(--accent); font-weight:600; }
.nav-verw > div { left:0; right:auto; top:58px; min-width:300px; }
.nav-haupt .nav-verw > div a { display:block; padding:10px 16px; border-bottom:0; color:var(--text); }
.nav-eintrag b { display:block; font-weight:600; }
.nav-eintrag span { display:block; font-size:12px; color:var(--muted); margin-top:1px; }
.nav-hilfeknopf { display:inline-flex; align-items:center; gap:7px; border:1px solid var(--line-2); background:transparent; border-radius:18px; height:34px; padding:0 13px 0 8px; font-weight:500; color:var(--text); }
.nav-hilfeknopf span { display:inline-flex; width:20px; height:20px; border-radius:50%; border:1.5px solid var(--accent); color:var(--accent); font-weight:700; font-size:11px; align-items:center; justify-content:center; }
.nav-hilfeknopf:hover { border-color:var(--accent); }
#hilfePanel .hp-hinter { position:fixed; inset:0; background:rgba(0,0,0,.45); opacity:0; pointer-events:none; transition:opacity .2s; z-index:4000; }
#hilfePanel .hp-fenster { position:fixed; top:0; right:0; bottom:0; width:min(440px, 100%); background:var(--card-solid); box-shadow:-10px 0 40px rgba(0,0,0,.35);
  transform:translateX(100%); transition:transform .25s ease; z-index:4001; display:flex; flex-direction:column; border-left:1px solid var(--line); }
#hilfePanel.offen .hp-hinter { opacity:1; pointer-events:auto; }
#hilfePanel.offen .hp-fenster { transform:none; }
.hp-kopf { display:flex; justify-content:space-between; align-items:center; padding:14px 18px; border-bottom:1px solid var(--line); }
.hp-kopf b { font-size:15px; }
.hp-zu { border:0; background:none; font-size:16px; }
.hp-inhalt { padding:6px 18px 18px; overflow:auto; flex:1; line-height:1.6; font-size:14px; }
.hp-inhalt h3 { font-size:16px; margin:14px 0 8px; }
.hp-inhalt ul, .hp-inhalt ol { padding-left:20px; }
.hp-inhalt li { margin-bottom:6px; }
.hp-fuss { padding:12px 18px; border-top:1px solid var(--line); }
.nav-burger { display:none !important; width:38px; height:34px; padding:0; align-items:center; justify-content:center; }
.nav-admin > summary { list-style:none; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; border:1px solid var(--line-2); border-radius:9px; color:var(--muted); }
.nav-admin > summary:hover, .nav-admin > summary.active, .nav-admin[open] > summary { color:var(--accent); border-color:var(--accent); }
.nav-admin > summary svg.ico { width:17px; height:17px; }
.nav-admin > div { min-width:300px; }
@media (max-width:900px) {
  header { flex-wrap:wrap; gap:8px; padding:0 12px; }
  header nav { flex-wrap:wrap; }
  .nav-burger { display:inline-flex !important; }
  .nav-hilfeknopf { padding:0 8px; font-size:0; gap:0; }
  .nav-haupt { display:none; order:2; flex-basis:100%; }
  header nav.offen .nav-haupt { display:flex; flex-direction:column; }
  header nav.offen .nav-haupt a { padding:12px 4px; border-bottom:1px solid var(--line); }
  .nav-verw > div { position:static; }
  .nav-rechts { margin-left:auto; }
  .page { margin:12px auto; padding:0 10px; }
  .card { padding:12px; }
}

/* ---------- Register ---------- */
.tabs { display:flex; gap:4px; flex-wrap:wrap; background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:0 8px; margin-bottom:12px; box-shadow:var(--schatten); }
.tabs button { border:0; border-bottom:2px solid transparent; border-radius:0; background:none; padding:12px 12px; color:var(--muted); font-weight:500; }
.tabs button:hover:not(:disabled) { color:var(--text); border-color:transparent; border-bottom-color:var(--line-2); }
.tabs button.on { color:var(--text); border-bottom-color:var(--accent); font-weight:600; }
.card .tabs { border:0; border-bottom:1px solid var(--line); border-radius:0; padding:0; background:none; box-shadow:none; }

/* ---------- Hilfe, Info, leer ---------- */
.hilfebox { background:var(--accent-weich); border:1px solid var(--accent-rand); border-radius:var(--radius); padding:9px 13px; margin-bottom:12px; font-size:13px; }
.hilfebox summary { cursor:pointer; font-weight:600; }
.hilfebox div { margin-top:6px; line-height:1.55; }
.hilfebox ol, .hilfebox ul { margin:4px 0; padding-left:20px; }
.i-info { display:inline-flex; width:15px; height:15px; border-radius:50%; border:1px solid var(--muted); color:var(--muted); font:italic 600 10px Georgia, serif;
  align-items:center; justify-content:center; cursor:help; vertical-align:middle; margin-left:3px; }
.i-info:hover, .i-info:focus { background:var(--accent); color:var(--accent-text); border-color:var(--accent); }
.leer { text-align:center; padding:24px; color:var(--muted); }
.leer b { display:block; color:var(--text); margin-bottom:4px; }

/* ---------- Ampel und Prüfpunkte ---------- */
.ampel { display:inline-block; width:12px; height:12px; border-radius:50%; vertical-align:middle; border:1px solid rgba(0,0,0,.2); }
.ampel.gross { width:18px; height:18px; }
.ampel-gruen { background:#3fae5f; } .ampel-gelb { background:#e7b416; } .ampel-rot { background:#d9506b; } .ampel-leer { background:transparent; border:1px dashed var(--muted); }
.krit { display:grid; grid-template-columns:22px 1fr auto; gap:2px 8px; padding:9px 10px; border-bottom:1px solid var(--line); font-size:13px; border-radius:8px; align-items:start; }
.krit.k-ok { background:var(--gut-bg); } .krit.k-auflage { background:var(--achtung-bg); } .krit.k-ko { background:var(--ko-bg); } .krit.k-unbekannt { background:var(--info-bg); }
.krit + .krit { margin-top:3px; }
.krit .t { font-weight:600; grid-column:2; }
.krit .x { grid-column:2; color:var(--muted); }
.krit .q { grid-column:3; grid-row:1 / span 2; align-self:center; display:flex; gap:6px; justify-content:flex-end; }
.krit::before { grid-row:1 / span 2; }
.k-ok::before { content:'✓'; color:var(--ok); font-weight:700; } .k-auflage::before { content:'!'; color:var(--warn); font-weight:800; padding-left:4px; }
.k-ko::before { content:'×'; color:var(--ko); font-weight:800; font-size:16px; line-height:1; } .k-unbekannt::before { content:'?'; color:var(--muted); font-weight:700; padding-left:3px; }

/* ---------- Kacheln ---------- */
.kacheln { display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); gap:10px; margin-bottom:12px; }
.kachel { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:12px; text-decoration:none; color:var(--text); display:block; }
.kachel:hover { border-color:var(--accent-rand); }
.kachel .zahl { font-size:26px; font-weight:500; line-height:1.1; }
.kachel .was { color:var(--muted); font-size:12px; margin-top:2px; }
.mikro { margin-top:6px; }
.mikro.hoert { background:var(--ko); color:#fff; border-color:var(--ko); }

/* ---------- Umschalter, Knopf als Link, Popup ---------- */
.seg { display:inline-grid; grid-auto-flow:column; grid-auto-columns:1fr; gap:3px; padding:3px; background:var(--input-bg); border:1px solid var(--line-2); border-radius:10px; }
.seg button { height:30px; border:0; border-radius:7px; background:transparent; padding:0 12px; font-size:13px; font-weight:500; color:var(--muted); white-space:nowrap; }
.seg button:hover:not(:disabled) { color:var(--text); background:var(--hover); }
.seg button.on { background:var(--accent); color:var(--accent-text); font-weight:600; }
a.btn { display:inline-flex; align-items:center; gap:7px; height:34px; padding:0 13px; border-radius:8px; text-decoration:none; border:1px solid var(--line-2); background:var(--input-bg); color:var(--text); font-weight:500; }
a.btn:hover { border-color:var(--accent-rand); }
.popup-hinter { position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:3000; display:flex; align-items:flex-start; justify-content:center; overflow:auto; padding:30px 10px; }
.popup { background:var(--card-solid); border:1px solid var(--line); border-radius:14px; padding:18px 20px; width:100%; box-shadow:0 20px 60px rgba(0,0,0,.45); }
.popup h2 { font-size:16px; }

/* ---------- Linien-Icons (window.ICON in nav.js) ---------- */
svg.ico { width:18px; height:18px; flex:0 0 auto; vertical-align:-3px; stroke:currentColor; fill:none; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.ico-feld { display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px; border-radius:10px; background:var(--accent-weich); color:var(--accent); flex:0 0 auto; }
.ico-feld svg.ico { width:19px; height:19px; }
button svg.ico, a.btn svg.ico { width:16px; height:16px; }
button:has(svg.ico), a.btn:has(svg.ico) { display:inline-flex; align-items:center; gap:7px; }
/* Darstellung Dunkel/Hell im Personen-Menü */
.nav-modus { display:grid; grid-template-columns:1fr 1fr; gap:3px; margin:4px 12px 8px; padding:3px; background:var(--input-bg); border:1px solid var(--line-2); border-radius:10px; }
.nav-modus button { height:30px; border:0; border-radius:7px; background:transparent; font-size:13px; font-weight:500; color:var(--muted); padding:0; }
.nav-modus button.on { background:var(--accent); color:var(--accent-text); font-weight:600; }

/* ---------- Leaflet im Dunkelmodus ---------- */
html:not([data-theme="hell"]) .basis-karte { filter:invert(1) grayscale(1) brightness(.78) contrast(.92); }
.leaflet-container { background:var(--bg-2); font:inherit; }
.leaflet-bar a, .leaflet-control-zoom a { background:var(--card-solid) !important; color:var(--text) !important; border-color:var(--line) !important; }
.leaflet-control-attribution { background:rgba(0,0,0,.55) !important; color:#bbb !important; }
html[data-theme="hell"] .leaflet-control-attribution { background:rgba(255,255,255,.8) !important; color:#555 !important; }
.leaflet-control-attribution a { color:inherit !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background:var(--card-solid); color:var(--text); }

@media print { header, .noprint { display:none !important; } body { background:#fff; color:#111; } body::before, body::after { display:none; } }
