:root {
  --bg: #0f1d24; --bg2: #152a33; --bg3: #1c3742; --rand: #29505e; --text: #eaf6f8; --leise: #9fbac3;
  --akzent: #3fd5f0; --gold: #ffd447; --offen: #ff9d3c; --ok: #5cc98a; --rot: #ff6b6b;
  --radius: 14px; --nav: 64px; --kopf: 54px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--akzent); }
.versteckt { display: none !important; }

/* Kopf und Navigation */
#kopf { height: var(--kopf); display: flex; align-items: center; gap: 12px; padding: 0 14px; background: var(--bg2); border-bottom: 1px solid var(--rand); position: relative; z-index: 20; }
#kopf .logo { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .3px; white-space: nowrap; }
#kopf .logo img { width: 28px; height: 28px; }
#kopf .logo span { color: var(--akzent); }
#nav { display: flex; gap: 4px; margin-left: 12px; }
#nav button { background: none; border: 0; padding: 8px 12px; border-radius: 10px; color: var(--leise); font-weight: 600; display: flex; gap: 6px; align-items: center; }
#nav button.aktiv { background: var(--bg3); color: var(--text); }
#nav button svg { width: 20px; height: 20px; }
#kopf .rechts { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--leise); font-size: 13px; }
#speicher { font-size: 13px; color: var(--leise); }
#speicher.fehler { color: var(--rot); }
.knopf { background: var(--bg3); border: 1px solid var(--rand); border-radius: 10px; padding: 8px 12px; }
.knopf.primaer { background: var(--akzent); color: #06222a; border-color: var(--akzent); font-weight: 700; }

main { position: absolute; top: var(--kopf); left: 0; right: 0; bottom: 0; }
.ansicht { position: absolute; inset: 0; }

/* Zoom-Fläche */
.flaeche { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; background:
  radial-gradient(circle at 1px 1px, #ffffff10 1px, transparent 0) 0 0 / 24px 24px, var(--bg); }
.flaeche.zieht { cursor: grabbing; }
.welt { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.zoomknoepfe { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.zoomknoepfe button { width: 44px; height: 44px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--rand); font-size: 20px; }
.hinweis-ecke { position: absolute; left: 14px; bottom: 14px; font-size: 12px; color: var(--leise); background: #0f1d24cc; padding: 6px 10px; border-radius: 10px; z-index: 5; pointer-events: none; }

/* Zeitachse */
.achse { position: absolute; left: 0; right: 0; top: 0; height: 34px; background: #0f1d24e8; border-bottom: 1px solid var(--rand); z-index: 4; pointer-events: none; overflow: hidden; }
.achse .tick { position: absolute; top: 0; height: 34px; border-left: 1px solid var(--rand); padding: 9px 0 0 5px; font-size: 12px; color: var(--leise); white-space: nowrap; }
.achse .tick.gross { color: var(--text); font-weight: 700; border-left-color: var(--akzent); }
.spuren-namen { position: absolute; left: 0; top: 34px; bottom: 0; width: 0; z-index: 3; pointer-events: none; }
.spur-name { position: absolute; left: 8px; font-size: 12px; font-weight: 700; color: var(--leise); background: #0f1d24d9; padding: 3px 8px; border-radius: 8px; white-space: nowrap; transform: translateY(-50%); border: 1px solid var(--rand); }
.spur-band { position: absolute; left: -3000px; width: 25000px; border-top: 1px solid #ffffff12; }
.spur-band:nth-child(even) { background: #ffffff05; }
.heute { position: absolute; top: 0; width: 0; border-left: 2px dashed var(--gold); z-index: 2; pointer-events: none; }
.heute span { position: absolute; top: 40px; left: 6px; color: var(--gold); font-size: 13px; font-weight: 700; white-space: nowrap; }

.el { position: absolute; border-radius: 10px; background: var(--bg2); border: 1.5px solid var(--rand); overflow: hidden; color: var(--text); font-size: 13px; line-height: 1.25; cursor: pointer; transition: box-shadow .15s; }
.el:hover { box-shadow: 0 0 0 3px #3fd5f055; }
.el.g-idee { border-style: dashed; opacity: .72; background: #152a33aa; }
.el.g-fest { border-width: 2.5px; }
.el .t { padding: 6px 8px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.el .farbe { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
.el.chip .t { padding-left: 11px; -webkit-line-clamp: 1; white-space: nowrap; text-overflow: ellipsis; display: block; }
.el.video img { display: block; width: 100%; aspect-ratio: 16/9; background: var(--bg3); }
.el.video .t { font-weight: 700; }
.el .punkt { position: absolute; right: 6px; top: 6px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--bg); z-index: 1; }
.el .punkt:not(.offen):not(.eingearbeitet):not(.erledigt), .akarte .punkt:not(.offen):not(.eingearbeitet):not(.erledigt) { display: none; }
.punkt.offen { background: var(--offen); } .punkt.eingearbeitet, .punkt.erledigt { background: var(--ok); }
.balken { position: absolute; border-radius: 12px; color: #fff; font-weight: 800; overflow: visible; cursor: pointer; }
.balken.jahr { background: linear-gradient(90deg, #2a5463, #1c3742); border: 1.5px solid #3c6b7a; }
.balken.jahr.g-idee { background: repeating-linear-gradient(135deg, #1c3742, #1c3742 14px, #20404c 14px, #20404c 28px); }
.balken.staffel { opacity: .92; }
.balken { overflow: hidden; }
.balken .lbl { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: 14px; text-shadow: 0 1px 3px #0009; }

/* Detailstufen der Zeitachse */
.tl-mittel .el .t, .tl-fern .el .t, .tl-fern .el.video img, .tl-mittel .el .farbe, .tl-fern .el .farbe, .tl-fern .el .punkt { display: none; }
.tl-mittel .el.chip, .tl-fern .el { background: var(--f); border-color: #0f1d24; border-radius: 5px; border-width: 1px; }
.tl-mittel .el.chip.g-idee, .tl-fern .el.g-idee { opacity: .45; }
.tl-mittel .el .punkt { width: 8px; height: 8px; right: 1px; top: 1px; border-width: 1px; }
.tl-mittel .el.video img { aspect-ratio: auto; height: 100%; object-fit: cover; }
.el .nr { display: none; position: absolute; left: 4px; bottom: 3px; font-size: 11px; font-weight: 800; background: #0f1d24cc; padding: 0 5px; border-radius: 6px; }
.tl-mittel .el.video .nr { display: block; }

/* Baum */
.knoten { position: absolute; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: var(--bg2); border: 1.5px solid var(--rand); font-size: 14px; cursor: pointer; white-space: nowrap; }
.knoten.g-idee { border-style: dashed; opacity: .78; }
.knoten img { width: 64px; height: 36px; border-radius: 6px; }
.knoten .auf { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--rand); background: var(--bg3); display: grid; place-items: center; font-weight: 800; flex: none; }
.knoten .art { font-size: 11px; color: var(--leise); text-transform: uppercase; letter-spacing: .5px; }
.knoten .punkt { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.knoten.wurzel { font-size: 20px; font-weight: 800; background: var(--bg3); }
.kanten { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }

/* Tabelle und Listen */
.leiste { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--rand); background: var(--bg2); align-items: center; }
.leiste input, .leiste select { background: var(--bg); border: 1px solid var(--rand); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.leiste input[type=search] { flex: 1 1 180px; }
.leiste .zahl { color: var(--leise); font-size: 13px; margin-left: auto; }
.liste { position: absolute; top: 62px; left: 0; right: 0; bottom: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid #ffffff10; vertical-align: top; }
th { position: sticky; top: 0; background: var(--bg2); color: var(--leise); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; z-index: 1; }
tbody tr { cursor: pointer; } tbody tr:hover { background: var(--bg2); }
td .bem { color: var(--leise); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marke { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--bg3); color: var(--leise); margin: 1px 2px 1px 0; white-space: nowrap; }
.marke.fest { background: #1f4d3a; color: #9ff0c4; } .marke.idee { background: #3a3a46; color: #c9c9d6; } .marke.geplant { background: #1e3f52; color: #a8e2f5; }

/* Assets */
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; padding: 14px; }
.akarte { background: var(--bg2); border: 1px solid var(--rand); border-radius: var(--radius); overflow: hidden; cursor: pointer; position: relative; }
.akarte .bild { aspect-ratio: 16/10; background: var(--bg3) center/contain no-repeat; display: grid; place-items: center; }
.akarte .bild img { max-width: 100%; max-height: 100%; }
.akarte .info { padding: 8px 10px; font-size: 13px; }
.akarte .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.akarte .info small { color: var(--leise); }
.play { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--akzent); color: #06222a; font-size: 22px; font-weight: 900; }
.akarte .punkt { position: absolute; right: 8px; top: 8px; width: 12px; height: 12px; border-radius: 50%; }

/* Detailpanel */
#panel { position: fixed; z-index: 30; background: var(--bg2); border-left: 1px solid var(--rand); top: var(--kopf); right: 0; bottom: 0; width: min(440px, 100%); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .22s ease; }
#panel.offen { transform: none; }
#panel .kopfzeile { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--rand); }
#panel .kopfzeile b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#panel .inhalt { overflow: auto; padding: 14px; -webkit-overflow-scrolling: touch; }
.schliessen { width: 40px; height: 40px; border-radius: 10px; background: var(--bg3); border: 1px solid var(--rand); font-size: 20px; }
.detail h2 { margin: 6px 0 8px; font-size: 21px; line-height: 1.2; }
.detail .vorschau { width: 100%; border-radius: 12px; background: var(--bg3); display: block; }
.detail dl, .fb-karte dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; margin: 12px 0; }
.detail dt, .fb-karte dt { color: var(--leise); }
.detail dd, .fb-karte dd { margin: 0; }
.detail .beschr { font-size: 15px; line-height: 1.45; }
.kind { display: block; text-align: left; width: 100%; background: var(--bg3); border: 1px solid var(--rand); border-radius: 10px; padding: 8px 10px; margin: 4px 0; font-size: 14px; }

/* Feedback-Editor */
.warum { background: #3fd5f014; border: 1px solid #3fd5f044; border-radius: 12px; padding: 10px 12px; margin: 12px 0 8px; font-size: 14px; line-height: 1.45; }
.warum b { color: var(--akzent); display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.anregung { background: #ffd44712; border: 1px solid #ffd44740; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.45; margin-bottom: 10px; }
.anregung b { color: var(--gold); display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.reaktionen { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.reaktionen button { border: 1px solid var(--rand); background: var(--bg3); border-radius: 99px; padding: 8px 13px; font-size: 14px; }
.reaktionen button.an { background: var(--akzent); color: #06222a; border-color: var(--akzent); font-weight: 700; }
.editor textarea { width: 100%; min-height: 130px; background: var(--bg); border: 1.5px solid var(--rand); border-radius: 12px; padding: 12px; font-size: 16px; line-height: 1.45; resize: vertical; }
.editor textarea:focus { outline: none; border-color: var(--akzent); }
.editor .zustand { font-size: 13px; color: var(--leise); margin-top: 4px; min-height: 18px; }
.antwort { background: #5cc98a18; border: 1px solid #5cc98a55; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }

/* Feedback-Modus */
#feedback { display: flex; flex-direction: column; }
#feedback .leiste { flex: none; }
.fb-buehne { flex: 1; overflow: auto; padding: 14px; display: flex; justify-content: center; -webkit-overflow-scrolling: touch; }
.fb-karte { width: min(680px, 100%); }
.fb-karte .fortschritt { height: 6px; background: var(--bg3); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.fb-karte .fortschritt i { display: block; height: 100%; background: var(--akzent); }
.fb-karte .medium { border-radius: 16px; overflow: hidden; background: var(--bg3); display: grid; place-items: center; min-height: 180px; touch-action: pan-y; }
.fb-karte .medium img, .fb-karte .medium video { width: 100%; display: block; max-height: 58vh; object-fit: contain; }
.fb-karte .medium.audio { padding: 28px 14px; gap: 14px; }
.fb-karte .medium.audio audio { width: 100%; }
.fb-karte h2 { font-size: 22px; margin: 14px 0 4px; line-height: 1.2; }
.fb-karte .meta { color: var(--leise); font-size: 14px; }
.fb-steuer { flex: none; display: flex; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rand); background: var(--bg2); }
.fb-steuer button { flex: 1; padding: 13px; border-radius: 12px; border: 1px solid var(--rand); background: var(--bg3); font-weight: 700; font-size: 16px; }
.fb-steuer button.weiter { background: var(--akzent); color: #06222a; border-color: var(--akzent); }

/* Anmeldung */
#login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); padding: 20px; }
#login form { width: min(360px, 100%); background: var(--bg2); border: 1px solid var(--rand); border-radius: 18px; padding: 24px; display: grid; gap: 14px; text-align: center; }
#login img { width: 72px; margin: 0 auto; }
#login input { background: var(--bg); border: 1.5px solid var(--rand); border-radius: 12px; padding: 13px; font-size: 16px; }
#login .fehler { color: var(--rot); min-height: 20px; font-size: 14px; }

/* Handy */
@media (max-width: 820px) {
  :root { --kopf: 50px; }
  #nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav) + env(safe-area-inset-bottom)); margin: 0; padding: 6px 4px env(safe-area-inset-bottom); background: var(--bg2); border-top: 1px solid var(--rand); justify-content: space-around; z-index: 25; }
  #nav button { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; flex: 1; }
  main { bottom: calc(var(--nav) + env(safe-area-inset-bottom)); }
  #kopf .rechts .wer { display: none; }
  #panel { top: auto; height: 88vh; height: 88dvh; width: 100%; border-left: 0; border-top: 1px solid var(--rand); border-radius: 18px 18px 0 0; transform: translateY(105%); bottom: 0; }
  #panel.offen { transform: none; }
  table thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tbody tr { border-bottom: 1px solid var(--rand); padding: 8px 4px; }
  td { border: 0; padding: 2px 10px; }
  td.datum { color: var(--leise); font-size: 12px; }
  td.titel { font-weight: 700; font-size: 15px; }
  .raster { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 10px; }
  .hinweis-ecke { display: none; }
  .zoomknoepfe { bottom: 10px; right: 10px; }
}
