/*
 * wann — gemeinsames Aussehen fuer Teilnehmer und Verwaltung.
 *
 * Papierton statt Weiss, ein Gruen fuer „ja", ein Bernstein fuer „wenn
 * noetig", ein gedaempftes Rot fuer „nein". Die drei Farben sind die
 * Sprache der ganzen Anwendung; alles andere tritt zurueck.
 */

:root {
  --grund: #f5f2ec;
  --karte: #ffffff;
  --karte-2: #faf8f4;
  --tinte: #1b2226;
  --leise: #5f6b70;
  --blass: #8f989c;
  --linie: #e6e1d7;
  --linie-2: #d8d2c5;
  --gruen: #0f6e5c;
  --gruen-dunkel: #0a5647;
  --gruen-hell: #e2f0eb;
  --gruen-mitte: #bfe0d5;
  --gelb: #c98a12;
  --gelb-hell: #fbf0d6;
  --rot: #b54a3c;
  --rot-hell: #f8e5e1;
  --blau-hell: #e7eef6;
  --schatten: 0 1px 2px rgba(27, 34, 38, .06), 0 6px 24px rgba(27, 34, 38, .06);
  --schatten-hoch: 0 10px 40px rgba(27, 34, 38, .16);
  --rund: 14px;
  --rund-k: 9px;
  --schrift: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #121517;
    --karte: #1b2023;
    --karte-2: #20262a;
    --tinte: #e9ecec;
    --leise: #a3adb0;
    --blass: #7b868a;
    --linie: #2b3337;
    --linie-2: #3a4449;
    --gruen: #3fb596;
    --gruen-dunkel: #62c7ab;
    --gruen-hell: #173a31;
    --gruen-mitte: #1f5a4a;
    --gelb: #e2ab45;
    --gelb-hell: #3a2f16;
    --rot: #e17c6c;
    --rot-hell: #3e2320;
    --blau-hell: #1d2a36;
    --schatten: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--tinte);
  font: 16px/1.55 var(--schrift); -webkit-font-smoothing: antialiased;
}
a { color: var(--gruen); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.25rem); font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .8em; }
small, .klein { font-size: .86rem; }
.leise { color: var(--leise); }
.blass { color: var(--blass); }
.versteckt { display: none !important; }
.nur-leser { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--gruen) 45%, transparent); outline-offset: 2px; border-radius: 6px; }

/* --- Rahmen --------------------------------------------------------- */

.kopfleiste {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 12px max(16px, env(safe-area-inset-left)); padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--grund) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--linie);
}
.marke { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--tinte); font-weight: 750; font-size: 1.15rem; letter-spacing: -.02em; }
.marke svg { width: 28px; height: 28px; }
.marke span.zusatz { font-weight: 500; color: var(--leise); font-size: .95rem; letter-spacing: 0; }
.seite { max-width: 880px; margin: 0 auto; padding: 22px 16px 120px; }
.seite.breit { max-width: 1180px; }

.karte {
  background: var(--karte); border-radius: var(--rund); box-shadow: var(--schatten);
  padding: 22px; margin-bottom: 18px; border: 1px solid color-mix(in srgb, var(--linie) 60%, transparent);
}
.karte.flach { box-shadow: none; }
.karte > h2:first-child { margin-top: 0; }
@media (max-width: 560px) { .karte { padding: 18px 16px; border-radius: 12px; } }

.zeile { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.zeile.zwischen { justify-content: space-between; }
.stapel > * + * { margin-top: 10px; }
.raster-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .raster-2 { grid-template-columns: 1fr; } }

/* --- Knoepfe -------------------------------------------------------- */

.knopf {
  appearance: none; border: 1px solid var(--linie-2); background: var(--karte); color: var(--tinte);
  font: 600 .95rem/1 var(--schrift); padding: 11px 16px; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; min-height: 42px;
  transition: background .15s, border-color .15s, transform .05s;
}
.knopf:hover { border-color: var(--leise); }
.knopf:active { transform: translateY(1px); }
.knopf[disabled] { opacity: .5; cursor: default; }
.knopf.haupt { background: var(--gruen); border-color: var(--gruen); color: #fff; }
.knopf.haupt:hover { background: var(--gruen-dunkel); border-color: var(--gruen-dunkel); }
.knopf.gefahr { color: var(--rot); }
.knopf.gefahr:hover { border-color: var(--rot); }
.knopf.leer { border-color: transparent; background: transparent; }
.knopf.leer:hover { background: var(--karte-2); }
.knopf.klein { padding: 7px 11px; min-height: 34px; font-size: .86rem; border-radius: 8px; }
.knopf.gross { padding: 15px 22px; font-size: 1.05rem; border-radius: 12px; min-height: 52px; }
.knopf.voll { width: 100%; justify-content: center; }
.knopf svg { width: 18px; height: 18px; flex: none; }

/* --- Formulare ------------------------------------------------------ */

label.feld { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 14px; }
label.feld > span.hinweis { font-weight: 400; color: var(--leise); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=search], textarea, select {
  display: block; width: 100%; margin-top: 6px; font: 16px/1.4 var(--schrift); color: var(--tinte);
  background: var(--karte); border: 1px solid var(--linie-2); border-radius: 10px; padding: 11px 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gruen); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gruen) 20%, transparent); }
textarea { min-height: 90px; resize: vertical; }
.honig { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.schalter { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--linie); cursor: pointer; }
.schalter:first-child { border-top: 0; }
.schalter input { appearance: none; flex: none; width: 44px; height: 26px; border-radius: 26px; background: var(--linie-2); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.schalter input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.schalter input:checked { background: var(--gruen); }
.schalter input:checked::after { transform: translateX(18px); }
.schalter b { display: block; font-weight: 600; }
.schalter span { color: var(--leise); font-size: .88rem; }

.segmente { display: inline-flex; background: var(--karte-2); border: 1px solid var(--linie); border-radius: 11px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.segmente button { appearance: none; border: 0; background: transparent; font: 600 .9rem/1 var(--schrift); color: var(--leise); padding: 9px 13px; border-radius: 8px; cursor: pointer; }
.segmente button[aria-pressed=true] { background: var(--karte); color: var(--tinte); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px; background: var(--karte-2); border: 1px solid var(--linie); font-size: .88rem; color: var(--leise); white-space: nowrap; }
.chip svg { width: 15px; height: 15px; }
.chip.gruen { background: var(--gruen-hell); border-color: transparent; color: var(--gruen-dunkel); }
.chip.gelb { background: var(--gelb-hell); border-color: transparent; color: var(--gelb); }
.chip.rot { background: var(--rot-hell); border-color: transparent; color: var(--rot); }
.chip button { appearance: none; border: 0; background: none; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0 0 2px; }

.plakette { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .76rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.plakette.offen { background: var(--gruen-hell); color: var(--gruen-dunkel); }
.plakette.entschieden { background: var(--blau-hell); color: #2d5b86; }
.plakette.abgesagt, .plakette.geschlossen { background: var(--karte-2); color: var(--leise); }
.plakette.favorit { background: var(--gelb-hell); color: var(--gelb); }

/* --- Antworten: ja, wenn noetig, nein ------------------------------- */

.antwort { display: inline-flex; border-radius: 11px; overflow: hidden; border: 1px solid var(--linie-2); background: var(--karte); flex: none; }
.antwort button {
  appearance: none; border: 0; background: transparent; width: 48px; height: 44px; cursor: pointer;
  display: grid; place-items: center; color: var(--blass); transition: background .12s, color .12s;
}
.antwort button + button { border-left: 1px solid var(--linie); }
.antwort button svg { width: 20px; height: 20px; }
.antwort button[data-wert=ja][aria-pressed=true] { background: var(--gruen); color: #fff; }
.antwort button[data-wert=vielleicht][aria-pressed=true] { background: var(--gelb); color: #fff; }
.antwort button[data-wert=nein][aria-pressed=true] { background: var(--rot); color: #fff; }
.antwort button:hover:not([aria-pressed=true]) { background: var(--karte-2); color: var(--tinte); }
.antwort[aria-disabled=true] { opacity: .45; pointer-events: none; }

.punkt { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; font-size: .8rem; }
.punkt svg { width: 15px; height: 15px; }
.punkt.ja { background: var(--gruen); color: #fff; }
.punkt.vielleicht { background: var(--gelb); color: #fff; }
.punkt.nein { background: var(--rot-hell); color: var(--rot); }
.punkt.leer { background: var(--karte-2); color: var(--blass); }

/* --- Optionen je Tag --------------------------------------------------- */

.tag-kopf { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 8px; }
.tag-kopf:first-child { margin-top: 4px; }
.tag-kopf .tag-zahl { font-size: 1.5rem; font-weight: 750; letter-spacing: -.03em; }
.tag-kopf .tag-name { font-weight: 650; }
.tag-kopf .tag-monat { color: var(--leise); }

.option {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px;
  background: var(--karte-2); border: 1px solid var(--linie); margin-bottom: 8px; transition: border-color .15s, background .15s;
}
.option.ist-ja { border-color: color-mix(in srgb, var(--gruen) 50%, transparent); background: color-mix(in srgb, var(--gruen-hell) 55%, var(--karte)); }
.option.ist-vielleicht { border-color: color-mix(in srgb, var(--gelb) 50%, transparent); background: color-mix(in srgb, var(--gelb-hell) 60%, var(--karte)); }
.option .zeit { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.option .info { flex: 1; min-width: 0; }
.option .stand { font-size: .84rem; color: var(--leise); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.option .balken { height: 5px; border-radius: 5px; background: var(--linie); overflow: hidden; display: flex; margin-top: 7px; max-width: 220px; }
.option .balken i { display: block; height: 100%; }
.option .balken i.ja { background: var(--gruen); }
.option .balken i.vielleicht { background: var(--gelb); }
.option.gestrichen { opacity: .65; background: transparent; border-style: dashed; }
.option.gestrichen .zeit { text-decoration: line-through; }
.option.favorit { box-shadow: inset 3px 0 0 var(--gelb); }
.option.fest { border-color: var(--gruen); background: var(--gruen-hell); }
.option.wahl { cursor: pointer; }
.option.wahl input { width: 22px; height: 22px; accent-color: var(--gruen); flex: none; }
@media (max-width: 420px) { .antwort button { width: 42px; } .option { gap: 10px; padding: 10px 11px; } }

/* --- Die Matrix ------------------------------------------------------ */

.matrix-huelle { overflow-x: auto; margin: 0 -22px; padding: 0 22px; -webkit-overflow-scrolling: touch; }
table.matrix { border-collapse: separate; border-spacing: 0; font-size: .9rem; min-width: 100%; }
.matrix th, .matrix td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--linie); white-space: nowrap; }
.matrix th:first-child, .matrix td:first-child { text-align: left; position: sticky; left: 0; background: var(--karte); z-index: 1; padding-left: 0; padding-right: 14px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.matrix thead th { font-weight: 600; font-size: .8rem; color: var(--leise); vertical-align: bottom; }
.matrix thead th .t { display: block; color: var(--tinte); font-size: .92rem; font-weight: 700; }
.matrix tfoot td { font-weight: 700; border-bottom: 0; }
.matrix .spalte-fav { background: color-mix(in srgb, var(--gelb-hell) 60%, transparent); }
.matrix .spalte-fest { background: var(--gruen-hell); }
.matrix .spalte-weg { opacity: .45; }
.matrix tr.ich td { background: color-mix(in srgb, var(--gruen-hell) 45%, transparent); }
.matrix tr.ich td:first-child { background: var(--gruen-hell); }

/* --- Termin steht ------------------------------------------------------ */

.termin-fest {
  background: linear-gradient(135deg, var(--gruen) 0%, #13866f 100%); color: #fff; border: 0;
}
.termin-fest h2 { color: #fff; font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.termin-fest .wann-gross { font-size: clamp(1.35rem, 4vw, 1.8rem); font-weight: 750; letter-spacing: -.02em; line-height: 1.25; }
.termin-fest .knopf { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.35); color: #fff; }
.termin-fest .knopf:hover { background: rgba(255,255,255,.24); border-color: #fff; }
.termin-fest .knopf.haupt { background: #fff; color: var(--gruen-dunkel); border-color: #fff; }
.termin-fest a { color: #fff; }

/* --- Kopf einer Abstimmung --------------------------------------------- */

.einladender { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; color: var(--leise); font-size: .92rem; }
.bild { width: 40px; height: 40px; border-radius: 50%; background: var(--gruen); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .95rem; flex: none; }
.beschreibung { white-space: pre-wrap; color: var(--tinte); }

/* --- Leiste unten (Telefon) ------------------------------------------- */

.leiste-unten {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--karte) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--linie); box-shadow: 0 -8px 30px rgba(0,0,0,.06);
}
.leiste-unten .innen { max-width: 880px; margin: 0 auto; display: flex; gap: 12px; align-items: center; justify-content: space-between; }

/* --- Meldungen --------------------------------------------------------- */

.hinweis-kasten { border-radius: 12px; padding: 13px 15px; background: var(--blau-hell); margin: 12px 0; font-size: .94rem; }
.hinweis-kasten.gut { background: var(--gruen-hell); }
.hinweis-kasten.warn { background: var(--gelb-hell); }
.hinweis-kasten.schlecht { background: var(--rot-hell); }
#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--tinte); color: var(--grund); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: .93rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100% - 32px); box-shadow: var(--schatten-hoch);
}
#toast.sichtbar { opacity: 1; transform: translateX(-50%) translateY(0); }

.leerstand { text-align: center; padding: 40px 20px; color: var(--leise); }
.leerstand svg { width: 54px; height: 54px; color: var(--linie-2); margin-bottom: 10px; }

/* --- Kommentare -------------------------------------------------------- */

.kommentar { display: flex; gap: 11px; padding: 12px 0; border-top: 1px solid var(--linie); }
.kommentar:first-child { border-top: 0; }
.kommentar .bild { width: 34px; height: 34px; font-size: .8rem; background: var(--leise); }
.kommentar.ralph .bild { background: var(--gruen); }
.kommentar .kopf { font-size: .88rem; }
.kommentar .kopf b { margin-right: 6px; }
.kommentar .text { white-space: pre-wrap; margin-top: 2px; }

/* --- Dialog ------------------------------------------------------------ */

dialog { border: 0; border-radius: 16px; padding: 0; max-width: min(560px, calc(100% - 24px)); width: 100%; background: var(--karte); color: var(--tinte); box-shadow: var(--schatten-hoch); }
dialog::backdrop { background: rgba(15, 20, 22, .45); backdrop-filter: blur(2px); }
dialog .innen { padding: 22px; max-height: 80vh; overflow: auto; }
dialog .fuss { padding: 14px 22px; border-top: 1px solid var(--linie); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.fuss-seite { text-align: center; color: var(--blass); font-size: .84rem; padding: 30px 16px 40px; }
.fuss-seite a { color: var(--leise); }

.lade { display: inline-block; width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: dreh .7s linear infinite; vertical-align: -3px; }
@keyframes dreh { to { transform: rotate(360deg); } }
.skelett { background: linear-gradient(90deg, var(--karte-2), var(--linie), var(--karte-2)); background-size: 200% 100%; animation: schimmer 1.2s infinite; border-radius: 8px; height: 18px; margin: 8px 0; }
@keyframes schimmer { to { background-position: -200% 0; } }

@media print {
  .kopfleiste, .leiste-unten, .knopf, #toast { display: none !important; }
  body { background: #fff; }
  .karte { box-shadow: none; border: 1px solid #ccc; }
}
