:root {
  --bg: #f4f7fb;
  --flaeche: #ffffff;
  --text: #22313f;
  --leise: #6b7a89;
  --linie: #e3e9f0;
  --blau: #2f6db5;
  --blau-hell: #e8f0fb;
  --tuerkis: #1b9aaa;
  --tuerkis-hell: #e3f5f7;
  --gelb: #f2b632;
  --gelb-hell: #fff7e1;
  --gruen: #2e9d6a;
  --gruen-hell: #e5f6ee;
  --orange: #d9822b;
  --orange-hell: #fdf0e3;
  --rot: #c8504b;
  --rot-hell: #fbeceb;
  --lila: #8e5cc4;
  --lila-hell: #f2ebfa;
  --schatten: 0 1px 2px rgba(31, 58, 95, .06), 0 4px 16px rgba(31, 58, 95, .06);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: "Nunito", "Segoe UI", system-ui, sans-serif; font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blau); }
.versteckt { display: none !important; }

/* ---------- Kopf ---------- */
header.kopf {
  position: sticky; top: 0; z-index: 20; background: #ffffff;
  border-bottom: 1px solid var(--linie);
}
.kopf-innen { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo .glocke { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #5b9be6, #2f6db5); color: #fff; display: grid; place-items: center; font-size: 18px; }
nav.reiter { display: flex; gap: 2px; margin-left: 6px; flex-wrap: nowrap; }
nav.reiter button {
  border: 0; background: transparent; padding: 8px 11px; white-space: nowrap; border-radius: 10px; cursor: pointer; color: var(--leise); font-weight: 700;
}
nav.reiter button:hover { background: var(--blau-hell); color: var(--blau); }
nav.reiter button.aktiv { background: var(--blau); color: #fff; }
.kopf .suche { margin-left: auto; position: relative; }
.kopf .suche input { border: 1px solid var(--linie); border-radius: 10px; padding: 8px 12px 8px 34px; width: 190px; background: #fff; }
.kopf .suche::before { content: "🔍"; position: absolute; left: 10px; top: 8px; font-size: 14px; opacity: .6; }

main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 90px; }
h2.abschnitt { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--leise); margin: 26px 0 10px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
h2.abschnitt .zahl { background: var(--linie); color: var(--leise); border-radius: 20px; padding: 0 8px; font-size: 12px; }
h2.abschnitt.warn { color: var(--orange); }
h1.seite { font-size: 26px; margin: 4px 0 4px; }
.untertitel { color: var(--leise); margin: 0 0 14px; }

/* ---------- Eingabe ---------- */
.eingabe {
  background: var(--flaeche); border-radius: 18px; box-shadow: var(--schatten); padding: 14px; border: 2px solid transparent; transition: border-color .15s;
}
.eingabe.drueber { border-color: var(--blau); background: var(--blau-hell); }
.eingabe textarea {
  width: 100%; border: 0; resize: vertical; min-height: 64px; font-size: 18px; outline: none; background: transparent;
}
.eingabe .leiste { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.eingabe .hinweis { color: var(--leise); font-size: 13px; margin-left: auto; }
.knopf {
  border: 1px solid var(--linie); background: #fff; border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text);
}
.knopf:hover { border-color: var(--blau); color: var(--blau); }
.knopf.haupt { background: var(--blau); border-color: var(--blau); color: #fff; }
.knopf.haupt:hover { background: #255c9c; color: #fff; }
.knopf.gruen { background: var(--gruen); border-color: var(--gruen); color: #fff; }
.knopf.leise { border-color: transparent; background: transparent; color: var(--leise); }
.knopf.leise:hover { background: var(--blau-hell); color: var(--blau); }
.knopf.klein { padding: 4px 10px; font-size: 14px; }
.knopf.rund { width: 42px; height: 42px; padding: 0; justify-content: center; border-radius: 50%; font-size: 19px; }
.knopf.mikro.an { background: var(--rot); border-color: var(--rot); color: #fff; animation: puls 1.2s infinite; }
@keyframes puls { 50% { box-shadow: 0 0 0 8px rgba(200,80,75,.15); } }
.knopf:disabled { opacity: .5; cursor: default; }
.anhang-liste { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* Vorschlag der KI */
.vorschlag { margin-top: 12px; border-top: 1px dashed var(--linie); padding-top: 12px; }
.arten { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.arten button { border: 1px solid var(--linie); background: #fff; border-radius: 20px; padding: 6px 14px; cursor: pointer; font-weight: 700; }
.arten button.aktiv[data-art="erinnerung"] { background: var(--blau); color: #fff; border-color: var(--blau); }
.arten button.aktiv[data-art="notiz"] { background: var(--gelb); color: #4a3a00; border-color: var(--gelb); }
.arten button.aktiv[data-art="arbeit"] { background: var(--gruen); color: #fff; border-color: var(--gruen); }
.felder { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.feld { display: flex; flex-direction: column; gap: 3px; }
.feld.breit { grid-column: 1 / -1; }
.feld label { font-size: 12px; font-weight: 800; color: var(--leise); text-transform: uppercase; letter-spacing: .03em; }
.feld input, .feld select, .feld textarea { border: 1px solid var(--linie); border-radius: 10px; padding: 8px 10px; background: #fff; width: 100%; }
.feld textarea { min-height: 70px; resize: vertical; }
.ki-hinweis { background: var(--orange-hell); color: #7a4a10; border-radius: 10px; padding: 8px 12px; font-size: 14px; margin-bottom: 10px; }

/* ---------- Karten ---------- */
.liste { display: flex; flex-direction: column; gap: 8px; }
.karte {
  background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 12px 14px 12px 18px; display: flex; gap: 12px; align-items: flex-start;
  position: relative; cursor: pointer; border: 2px solid transparent; transition: transform .08s, border-color .15s;
}
.karte:hover { transform: translateY(-1px); }
.karte::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 5px; border-radius: 0 4px 4px 0; background: var(--farbe, var(--blau)); }
.karte.drueber { border-color: var(--blau); background: var(--blau-hell); }
.karte .datum-box { min-width: 56px; text-align: center; border-radius: 10px; background: var(--hell, var(--blau-hell)); padding: 4px 6px; }
.karte .datum-box .tag { font-size: 20px; font-weight: 800; line-height: 1.1; }
.karte .datum-box .mon { font-size: 12px; color: var(--leise); font-weight: 700; }
.karte .inhalt { flex: 1; min-width: 0; }
.karte .titel { font-weight: 800; font-size: 16px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.karte .meta { color: var(--leise); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; }
.karte .vorschau { color: var(--leise); font-size: 14px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.karte .aktionen { display: flex; gap: 4px; align-items: center; }
.karte.erledigt .titel { text-decoration: line-through; color: var(--leise); }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 20px; padding: 1px 9px; font-size: 13px; font-weight: 700; background: var(--linie); color: var(--leise); }
.chip.blau { background: var(--blau-hell); color: var(--blau); }
.chip.tuerkis { background: var(--tuerkis-hell); color: #11707c; }
.chip.gelb { background: var(--gelb-hell); color: #7a5a00; }
.chip.gruen { background: var(--gruen-hell); color: #1f7a50; }
.chip.orange { background: var(--orange-hell); color: #a35a12; }
.chip.rot { background: var(--rot-hell); color: var(--rot); }
.leer { text-align: center; color: var(--leise); padding: 26px; background: var(--flaeche); border-radius: var(--radius); border: 2px dashed var(--linie); }

.art-erinnerung { --farbe: var(--blau); --hell: var(--blau-hell); }
.art-termin { --farbe: var(--tuerkis); --hell: var(--tuerkis-hell); }
.art-notiz { --farbe: var(--gelb); --hell: var(--gelb-hell); }
.art-arbeit { --farbe: var(--gruen); --hell: var(--gruen-hell); }
.ueberfaellig { --farbe: var(--orange); --hell: var(--orange-hell); }

/* Notizen als Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.kacheln .karte { flex-direction: column; background: #fffdf5; min-height: 120px; }

/* ---------- Detail (Seitenleiste) ---------- */
.schleier { position: fixed; inset: 0; background: rgba(34,49,63,.25); z-index: 40; }
aside.detail {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--flaeche); z-index: 41; box-shadow: -8px 0 30px rgba(31,58,95,.15);
  display: flex; flex-direction: column; animation: rein .18s ease-out;
}
@keyframes rein { from { transform: translateX(40px); opacity: 0; } }
.detail-kopf { padding: 16px 18px 10px; border-bottom: 1px solid var(--linie); display: flex; gap: 10px; align-items: flex-start; }
.detail-kopf .titel-feld { flex: 1; font-size: 21px; font-weight: 800; border: 0; outline: none; width: 100%; background: transparent; }
.detail-inhalt { flex: 1; overflow: auto; padding: 14px 18px 30px; }
.detail-inhalt section { margin-bottom: 18px; }
.detail-inhalt h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--leise); margin: 0 0 8px; }
.outlook-box { background: var(--tuerkis-hell); border-radius: 12px; padding: 10px 12px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ablage {
  display: block; border: 2px dashed #c9d6e5; border-radius: 14px; padding: 18px; text-align: center; color: var(--leise); cursor: pointer; background: #fafcff;
}
.ablage.drueber { border-color: var(--blau); background: var(--blau-hell); color: var(--blau); }
.dateien { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.datei { border: 1px solid var(--linie); border-radius: 12px; padding: 8px 10px; }
.datei .zeile { display: flex; align-items: center; gap: 10px; }
.datei .symbol { font-size: 22px; }
.datei .name { font-weight: 700; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.datei .groesse { color: var(--leise); font-size: 13px; }
.datei audio, .datei video { width: 100%; margin-top: 8px; border-radius: 8px; }
.datei img { max-width: 100%; max-height: 260px; display: block; margin-top: 8px; border-radius: 8px; }
.fortschritt { height: 6px; background: var(--linie); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.fortschritt div { height: 100%; background: var(--blau); width: 0; transition: width .2s; }
.schalter-zeile { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Arbeitszeit ---------- */
.rubrik-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.rubrik-chips button { border: 2px solid var(--linie); background: #fff; border-radius: 20px; padding: 6px 14px; cursor: pointer; font-weight: 800; }
.rubrik-chips button.aktiv { border-color: var(--rf, var(--blau)); background: var(--rf, var(--blau)); color: #fff; }
.summe-box { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 16px; margin-bottom: 14px; }
.summe-box .gross { font-size: 34px; font-weight: 900; color: var(--gruen); line-height: 1; }
.summe-box .monat-wahl { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 18px; }
.tabelle { width: 100%; border-collapse: collapse; background: var(--flaeche); border-radius: var(--radius); overflow: hidden; box-shadow: var(--schatten); }
.tabelle th, .tabelle td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle th { background: #f7fafd; font-size: 12px; text-transform: uppercase; color: var(--leise); letter-spacing: .03em; white-space: nowrap; }
.tabelle td.nowrap { white-space: nowrap; }
.tabelle tr:hover td { background: #fafcff; cursor: pointer; }
.karte-box { background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 16px; margin-bottom: 14px; }

/* ---------- Einstellungen ---------- */
.raster2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.kal-gruppe { margin-bottom: 10px; }
.kal-gruppe .konto { font-weight: 800; margin: 8px 0 4px; }
.kal-zeile { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--linie); font-size: 14px; }
.kal-zeile .n { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.umschalter { position: relative; width: 40px; height: 22px; flex: none; }
.umschalter input { opacity: 0; width: 0; height: 0; }
.umschalter span { position: absolute; inset: 0; background: #cfd8e3; border-radius: 20px; transition: .15s; cursor: pointer; }
.umschalter span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.umschalter input:checked + span { background: var(--gruen); }
.umschalter input:checked + span::after { transform: translateX(18px); }
.protokoll { font-size: 13px; color: var(--leise); max-height: 260px; overflow: auto; }
.protokoll div { padding: 3px 0; border-bottom: 1px dashed var(--linie); }

/* ---------- Anmeldung ---------- */
.anmelde-huelle { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #eef4fc, #f9fbfe 60%, #fff7e8); }
.anmelde-karte { background: #fff; border-radius: 20px; box-shadow: var(--schatten); padding: 30px; width: min(400px, 100%); text-align: center; }
.anmelde-karte .glocke { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px; background: linear-gradient(135deg, #5b9be6, #2f6db5); color: #fff; display: grid; place-items: center; font-size: 32px; }
.anmelde-karte input { width: 100%; border: 1px solid var(--linie); border-radius: 12px; padding: 12px; margin: 14px 0 10px; font-size: 17px; }
.anmelde-karte .knopf { width: 100%; justify-content: center; padding: 12px; }
.anmelde-karte .pw-feld { position: relative; }
.anmelde-karte .pw-feld input { padding-right: 46px; margin: 0 0 10px; }
.pw-auge { position: absolute; right: 8px; top: 7px; border: 0; background: transparent; font-size: 18px; cursor: pointer; padding: 6px; opacity: .6; }
.pw-auge:hover { opacity: 1; }
.anmelde-karte .merken { display: flex; align-items: center; gap: 8px; justify-content: flex-start; margin: 2px 2px 14px; font-size: 15px; cursor: pointer; text-align: left; }
.anmelde-karte .merken input { width: 18px; height: 18px; margin: 0; }
.anmelde-karte .merken small { color: var(--leise); }
.meldung { color: var(--rot); min-height: 22px; font-size: 14px; margin-top: 8px; }
.meldung.ok { color: var(--gruen); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #22313f; color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 60; box-shadow: var(--schatten); max-width: calc(100% - 32px); }

/* ---------- Handy ---------- */
@media (max-width: 980px) { nav.reiter button { padding: 8px 8px; } .kopf .suche input { width: 150px; } }
@media (max-width: 760px) {
  .kopf-innen { flex-wrap: wrap; gap: 8px; }
  .kopf .suche { order: 2; margin-left: auto; }
  .kopf .suche input { width: 150px; }
  nav.reiter {
    position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--linie); margin: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; flex-wrap: nowrap; z-index: 30;
  }
  nav.reiter button { padding: 6px 6px; font-size: 13px; }
  .karte .datum-box { min-width: 48px; }
  .karte .aktionen .knopf.text { display: none; }
  h1.seite { font-size: 22px; }
}
