/* Zentrale – nur Dark Mode. Orange nur für Handlung, Zähler und „aktiv“. */
:root {
  --bg: #0b0b0c;
  --flaeche: #141416;
  --flaeche2: #1c1c1f;
  --flaeche3: #26262a;
  --linie: rgba(255, 255, 255, 0.07);
  --linie2: rgba(255, 255, 255, 0.12);
  --text: #f4f4f5;
  --text2: #a1a1aa;
  --text3: #71717a;
  --orange: #e4610a;
  --orange-druck: #c8540a;
  --orange-schein: rgba(228, 97, 10, 0.14);
  --gruen: #34c759;
  --rot: #ff453a;
  --gelb: #ffd60a;
  --radius: 16px;
  --radius-k: 11px;
  --oben: env(safe-area-inset-top, 0px);
  --unten: env(safe-area-inset-bottom, 0px);
  --leiste: 64px;
  --breite: 680px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--text); }
[hidden] { display: none !important; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Grundrahmen */
.app { min-height: 100dvh; display: flex; flex-direction: column; max-width: var(--breite); margin: 0 auto; }
.kopf {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--oben) + 10px) 20px 10px;
  background: rgba(11, 11, 12, 0.82);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.kopf.mit-linie { border-bottom-color: var(--linie); }
.kopf-zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.kopf h1 { margin: 0; font-size: 28px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
.inhalt { flex: 1; padding: 6px 16px calc(var(--leiste) + var(--unten) + 28px); }

/* ---------- Zustandsstreifen */
.zustand {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; font-size: 13px; color: var(--text2);
}
.zustand .stueck { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.punkt { width: 8px; height: 8px; border-radius: 50%; background: var(--text3); flex: none; }
.punkt.gruen { background: var(--gruen); box-shadow: 0 0 0 3px rgba(52, 199, 89, .15); }
.punkt.rot { background: var(--rot); box-shadow: 0 0 0 3px rgba(255, 69, 58, .15); }
.punkt.gelb { background: var(--gelb); }
.zustand .trenner { width: 3px; height: 3px; border-radius: 50%; background: var(--text3); }
.mit-claude {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--flaeche2); border: 1px solid var(--linie2);
  font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none;
}
.mit-claude:active { transform: scale(.97); }
.mit-claude svg { width: 14px; height: 14px; }

/* ---------- Abschnitte und Karten */
.abschnitt { margin-top: 22px; }
.abschnitt:first-child { margin-top: 10px; }
.abschnitt-kopf { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 8px; }
.abschnitt-kopf h2 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text3); }
.abschnitt-kopf .zahl { color: var(--text3); font-size: 13px; }
.abschnitt-kopf button { font-size: 14px; color: var(--text2); padding: 6px 4px; }
.liste { display: flex; flex-direction: column; gap: 8px; }

.karte {
  display: block; width: 100%; text-align: left;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 14px 16px; position: relative;
  transition: transform .12s ease, background .15s;
}
.karte:active { transform: scale(.985); background: var(--flaeche2); }
.karte-oben { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text3); margin-bottom: 4px; }
.karte-oben .quelle { color: var(--text2); font-weight: 500; }
.karte-oben .zeit { margin-left: auto; white-space: nowrap; }
.karte h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; letter-spacing: -0.005em; }
.karte p { margin: 4px 0 0; color: var(--text2); font-size: 14.5px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.karte.neu::before {
  content: ""; position: absolute; left: 6px; top: 22px; width: 6px; height: 6px; border-radius: 50%; background: var(--orange);
}
.karte.wartet { border-color: rgba(228, 97, 10, .35); background: linear-gradient(180deg, rgba(228, 97, 10, .07), rgba(228, 97, 10, 0) 70%), var(--flaeche); }
.karte .marken { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.marke { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--flaeche3); color: var(--text2); font-size: 12px; font-weight: 500; }
.marke.orange { background: var(--orange-schein); color: #ff9a55; }
.marke.rot { background: rgba(255, 69, 58, .14); color: #ff7b73; }
.art-zeichen { width: 18px; height: 18px; flex: none; color: var(--text3); }
.karte.wartet .art-zeichen { color: #ff9a55; }

/* laufende Aufträge */
.laeuft { display: flex; gap: 12px; align-items: flex-start; }
.puls { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--orange); flex: none; animation: puls 1.6s ease-in-out infinite; }
.laeuft .text { min-width: 0; }
.laeuft .fort { color: var(--text2); font-size: 14px; margin-top: 3px; }
@keyframes puls { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }

/* leer */
.leer { text-align: center; color: var(--text3); padding: 44px 24px; font-size: 15px; }
.leer strong { display: block; color: var(--text2); font-size: 17px; margin-bottom: 6px; font-weight: 600; }

/* Platzhalter beim Laden */
.platzhalter { height: 78px; border-radius: var(--radius); background: linear-gradient(90deg, var(--flaeche) 0%, var(--flaeche2) 50%, var(--flaeche) 100%);
  background-size: 200% 100%; animation: glanz 1.3s linear infinite; }
@keyframes glanz { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Knöpfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: 13px;
  background: var(--flaeche2); border: 1px solid var(--linie2);
  font-weight: 600; font-size: 16px; color: var(--text);
  transition: transform .12s, background .15s, opacity .15s;
}
.knopf:active { transform: scale(.97); }
.knopf.haupt { background: var(--orange); border-color: var(--orange); color: #fff; }
.knopf.haupt:active { background: var(--orange-druck); }
.knopf.leise { background: none; border-color: transparent; color: var(--text2); }
.knopf.gefahr { color: #ff7b73; }
.knopf.breit { width: 100%; }
.knopf.klein { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.knopf[disabled] { opacity: .45; pointer-events: none; }
.knopf svg { width: 18px; height: 18px; }
.knopfreihe { display: flex; gap: 10px; }
.knopfreihe > .knopf { flex: 1; }

/* ---------- Untere Leiste */
.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 0 8px var(--unten);
  background: rgba(11, 11, 12, 0.9);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--linie);
}
.leiste-innen { max-width: var(--breite); margin: 0 auto; height: var(--leiste); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
.reiter { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--text3); height: 100%; justify-content: center; position: relative; }
.reiter svg { width: 24px; height: 24px; }
.reiter.aktiv { color: var(--text); }
.reiter.aktiv svg { color: var(--orange); }
.reiter .zaehler {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.plus {
  justify-self: center; width: 54px; height: 54px; border-radius: 18px; background: var(--orange); color: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 20px rgba(228, 97, 10, .35);
  transition: transform .12s, background .15s;
}
.plus:active { transform: scale(.93); background: var(--orange-druck); }
.plus svg { width: 26px; height: 26px; }

/* ---------- Ebene: Blätter und Seiten */
.ebene { position: fixed; inset: 0; z-index: 50; }
.ebene .dunkel { position: absolute; inset: 0; z-index: 5; background: rgba(0, 0, 0, .55); animation: einblenden .2s ease; }
@keyframes einblenden { from { opacity: 0; } }
.blatt {
  position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; max-width: var(--breite); margin: 0 auto;
  background: var(--flaeche); border-radius: 22px 22px 0 0; border: 1px solid var(--linie2); border-bottom: 0;
  padding: 10px 18px calc(var(--unten) + 18px);
  max-height: calc(100dvh - var(--oben) - 24px); overflow-y: auto;
  animation: hoch .28s cubic-bezier(.2, .9, .25, 1);
}
@keyframes hoch { from { transform: translateY(100%); } }
.griff { width: 38px; height: 5px; border-radius: 3px; background: var(--flaeche3); margin: 0 auto 12px; }
.blatt h2 { margin: 0 0 12px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.seite {
  position: absolute; inset: 0; z-index: 1; isolation: isolate; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: rein .26s cubic-bezier(.2, .9, .25, 1);
}
@keyframes rein { from { transform: translateX(28px); opacity: 0; } }
.seite-kopf {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px;
  padding: calc(var(--oben) + 8px) 12px 8px; background: rgba(11, 11, 12, .88);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-bottom: 1px solid var(--linie);
}
.seite-kopf .zurueck { display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 0 8px; color: var(--text); font-size: 16px; }
.seite-kopf .zurueck svg { width: 22px; height: 22px; }
.seite-kopf .mitte { flex: 1; text-align: center; font-size: 13px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seite-kopf .platz { width: 72px; }
.seite-inhalt { max-width: var(--breite); margin: 0 auto; padding: 18px 20px calc(var(--unten) + 120px); }
.seite-inhalt h1 { margin: 6px 0 10px; font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; }
.meta { color: var(--text3); font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Freigabe-Kasten */
.aktion {
  margin: 18px 0 14px; padding: 14px 16px; border-radius: var(--radius-k);
  background: var(--flaeche); border: 1px solid rgba(228, 97, 10, .35);
}
.aktion .titel { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: #ff9a55; margin-bottom: 6px; }
.aktion .wortlaut { white-space: pre-wrap; font-size: 15.5px; }
.entscheidung {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 12px 16px calc(var(--unten) + 12px);
  background: linear-gradient(180deg, rgba(11, 11, 12, 0), rgba(11, 11, 12, .95) 30%);
}
.entscheidung-innen { max-width: var(--breite); margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.status-zeile { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--radius-k); background: var(--flaeche); color: var(--text2); font-size: 14.5px; margin: 14px 0; }

/* Faden */
.faden { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.blase { padding: 12px 14px; border-radius: 16px; max-width: 92%; }
.blase.ich { align-self: flex-end; background: var(--flaeche3); border-bottom-right-radius: 6px; }
.blase.claude { align-self: stretch; max-width: 100%; background: none; padding: 0; }
.status-zeile .puls { margin-top: 0; }
.blase .wer { font-size: 12px; color: var(--text3); margin-bottom: 4px; }
.trennlinie { height: 1px; background: var(--linie); margin: 6px 0; }

/* Markdown */
.md { font-size: 16px; line-height: 1.55; word-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3 { font-size: 17px; margin: 18px 0 8px; font-weight: 700; }
.md ul, .md ol { padding-left: 22px; margin: 0 0 12px; }
.md li { margin: 3px 0; }
.md a { color: #ff9a55; text-decoration: none; word-break: break-word; }
.md code { font: 14px ui-monospace, "SF Mono", Menlo, monospace; background: var(--flaeche2); padding: 2px 5px; border-radius: 5px; }
.md pre { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 12px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 12px; padding-left: 12px; border-left: 3px solid var(--flaeche3); color: var(--text2); }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border-bottom: 1px solid var(--linie); padding: 6px 8px; text-align: left; }
.md img { max-width: 100%; border-radius: 10px; }
.md hr { border: 0; border-top: 1px solid var(--linie); margin: 16px 0; }

/* Anhänge */
.anhaenge { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.anhang-bild { width: 100%; border-radius: 12px; display: block; background: var(--flaeche); }
.anhang-datei { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-k); background: var(--flaeche); border: 1px solid var(--linie); text-decoration: none; }
.anhang-datei svg { width: 20px; height: 20px; color: var(--text2); flex: none; }
audio { width: 100%; height: 40px; }

/* ---------- Formulare */
.feld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.feld label { font-size: 13px; color: var(--text2); font-weight: 500; }
.eingabe, .textfeld {
  width: 100%; background: var(--flaeche2); border: 1px solid var(--linie2); border-radius: 12px;
  padding: 13px 14px; font-size: 17px; outline: none; transition: border-color .15s;
}
.eingabe:focus, .textfeld:focus { border-color: rgba(228, 97, 10, .6); }
.textfeld { min-height: 110px; resize: none; line-height: 1.45; }
.fehler { color: #ff7b73; font-size: 14px; margin: 4px 0 12px; }
.klein-text { font-size: 13px; color: var(--text3); }

/* Einwurf-Blatt */
.werkzeuge { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.werkzeug { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--flaeche2); color: var(--text2); border: 1px solid var(--linie); }
.werkzeug svg { width: 21px; height: 21px; }
.werkzeug:active { transform: scale(.94); }
.werkzeug.aufnahme { background: rgba(255, 69, 58, .16); color: #ff7b73; border-color: rgba(255, 69, 58, .35); }
.werkzeuge .senden { margin-left: auto; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 34px; padding: 0 6px 0 12px; border-radius: 999px; background: var(--flaeche2); border: 1px solid var(--linie2); font-size: 13.5px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.chip button { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--text3); }
.chip button svg { width: 14px; height: 14px; }
.aufnahme-zeile { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 69, 58, .1); color: #ff9c95; font-size: 15px; }
.aufnahme-zeile .rot-punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--rot); animation: puls 1.2s infinite; }
.aufnahme-zeile .zeit { font-variant-numeric: tabular-nums; }
.aufnahme-zeile button { margin-left: auto; font-weight: 600; color: var(--text); }

/* Aufgaben */
.aufgabe { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }
.haken { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--text3); display: grid; place-items: center; color: transparent; transition: all .15s; }
.haken svg { width: 15px; height: 15px; }
.aufgabe.fertig .haken { background: var(--orange); border-color: var(--orange); color: #fff; }
.aufgabe.fertig .a-titel { color: var(--text3); text-decoration: line-through; }
.aufgabe .a-titel { font-size: 16px; font-weight: 500; }
.aufgabe .a-faellig { font-size: 13px; color: var(--text3); margin-top: 2px; }
.aufgabe .a-faellig.ueber { color: #ff7b73; }

/* Ich */
.gruppe { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
.zeile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 52px; }
.zeile + .zeile { border-top: 1px solid var(--linie); }
.zeile .z-text { flex: 1; min-width: 0; }
.zeile .z-titel { font-size: 16px; }
.zeile .z-info { font-size: 13px; color: var(--text3); margin-top: 1px; }
.zeile input[type="time"] { background: var(--flaeche2); border: 1px solid var(--linie2); border-radius: 9px; padding: 6px 8px; font-size: 15px; }
.schalter { position: relative; width: 51px; height: 31px; flex: none; }
.schalter input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.schalter span { position: absolute; inset: 0; border-radius: 16px; background: var(--flaeche3); transition: background .2s; pointer-events: none; }
.schalter span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
.schalter input:checked + span { background: var(--orange); }
.schalter input:checked + span::after { transform: translateX(20px); }
.token-kasten { font: 13px ui-monospace, "SF Mono", Menlo, monospace; word-break: break-all; background: var(--flaeche2); border: 1px solid var(--linie2); border-radius: 10px; padding: 12px; margin: 10px 0; user-select: all; -webkit-user-select: all; }
.schritte { margin: 10px 0 0; padding-left: 20px; color: var(--text2); font-size: 14.5px; }
.schritte li { margin: 6px 0; }

/* Anmeldung */
.anmeldung { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--oben) + 24px) 24px calc(var(--unten) + 24px); max-width: 420px; margin: 0 auto; width: 100%; }
.anmeldung h1 { font-size: 30px; margin: 22px 0 6px; letter-spacing: -0.02em; }
.anmeldung .unterzeile { color: var(--text2); margin: 0 0 26px; }
.qr { background: #fff; border-radius: 14px; padding: 12px; width: 196px; height: 196px; margin: 6px auto 14px; display: block; }
.code-eingabe { text-align: center; letter-spacing: .4em; font-size: 26px; font-variant-numeric: tabular-nums; }

/* Logo */
.logo-z { position: relative; width: 64px; height: 64px; border-radius: 18px; background: #000; border: 1px solid var(--linie2);
  display: grid; place-items: center; font-weight: 800; font-size: 34px; letter-spacing: -0.04em; color: #fff; }
.logo-z span { position: absolute; right: 13px; bottom: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.start-laden { min-height: 100dvh; display: grid; place-items: center; }

/* Hinweis (Toast) */
.hinweis {
  position: fixed; left: 50%; bottom: calc(var(--leiste) + var(--unten) + 16px); transform: translateX(-50%); z-index: 80;
  max-width: calc(100% - 32px); display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 14px; background: var(--flaeche3); border: 1px solid var(--linie2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45); font-size: 15px; animation: toast .22s ease;
}
.hinweis button { color: #ff9a55; font-weight: 600; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } }

/* Breiter Bildschirm */
@media (min-width: 900px) {
  .app { border-left: 1px solid var(--linie); border-right: 1px solid var(--linie); }
  .kopf h1 { font-size: 30px; }
  .blatt { bottom: auto; top: 12vh; border-radius: 22px; border-bottom: 1px solid var(--linie2); padding-bottom: 20px; animation: einblenden .2s ease; }
  .seite { left: 50%; width: min(760px, 100%); transform: translateX(-50%); border-left: 1px solid var(--linie); border-right: 1px solid var(--linie); animation: einblenden .2s ease; }
  .entscheidung { left: 50%; width: min(760px, 100%); transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
