:root {
  --bg: #f5f5f3; --karte: #fff; --text: #1d1d1f; --leise: #6b6b70; --linie: #e2e2e0;
  --akzent: #2457c5; --akzent-hell: #e8eefb; --fehler: #b3261e; --ok: #1e7b34; --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161618; --karte: #222226; --text: #ececee; --leise: #9a9aa0; --linie: #34343a;
          --akzent: #7aa2ff; --akzent-hell: #263252; --fehler: #ff8a80; --ok: #7bd88f; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--akzent); }
main { max-width: 900px; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.4rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
       padding: .6rem 1rem; background: var(--karte); border-bottom: 1px solid var(--linie); }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.top nav { display: flex; gap: 1rem; align-items: center; }
.top nav a { text-decoration: none; color: var(--leise); }
.top nav a.aktiv { color: var(--text); font-weight: 600; }
.top form { margin: 0; }

.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.schmal { max-width: 380px; margin: 3rem auto; }

form label { display: block; margin-bottom: .8rem; }
input:not([type=radio]):not([type=checkbox]), select {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .6rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--linie); border-radius: 6px; }
fieldset { border: 1px solid var(--linie); border-radius: 6px; margin: 0 0 .8rem; padding: .6rem .8rem; }
fieldset[hidden] { display: none; }
label.wahl { display: flex; gap: .5rem; align-items: center; margin-bottom: .3rem; }

button, .knopf { display: inline-block; padding: .55rem 1rem; font: inherit; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--akzent); background: var(--akzent); color: #fff; text-decoration: none; }
button.zweit, .knopf.zweit { background: transparent; color: var(--akzent); }
button.gefahr { background: transparent; color: var(--fehler); border-color: var(--fehler); }
button.link { background: none; border: none; padding: 0; color: var(--leise); }

.aktionen { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 1rem; }
.aktionen form { margin: 0; }
.leise { color: var(--leise); }
.klein { font-size: .9rem; }
.fehler { color: var(--fehler); }
.ok { color: var(--ok); }
.hinweis { color: var(--leise); }
.tag { display: inline-block; font-size: .8rem; padding: 0 .4rem; border-radius: 4px; background: var(--akzent-hell); color: var(--akzent); }
code { background: var(--akzent-hell); padding: .1rem .3rem; border-radius: 4px; }

.filter { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter select { width: auto; flex: 0 0 auto; margin: 0; }
.filter input { flex: 1 1 200px; margin: 0; }

.mails { list-style: none; padding: 0; margin: 0; background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); }
.mails li + li { border-top: 1px solid var(--linie); }
.mails a { display: grid; grid-template-columns: 1fr auto; gap: .1rem .8rem; padding: .7rem 1rem; color: inherit; text-decoration: none; }
.mails a:hover { background: var(--akzent-hell); }
.von { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeit { color: var(--leise); font-size: .9rem; }
.betreff { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { grid-column: 1 / -1; color: var(--leise); font-size: .85rem; }
.seiten { display: flex; justify-content: space-between; margin: 1rem 0; }

.kontokopf { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; align-items: baseline; }
.ordner { margin: .5rem 0; }

.kopf { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; margin: 0 0 1rem; }
.kopf dt { color: var(--leise); }
.kopf dd { margin: 0; overflow-wrap: anywhere; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 0; border-top: 1px solid var(--linie); padding-top: 1rem; }

textarea { display: block; width: 100%; margin-top: .25rem; padding: .55rem .6rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--linie); border-radius: 6px; resize: vertical; }
.abstand { margin-top: 1.5rem; }
.rechts { display: flex; justify-content: flex-end; margin: 0 0 .5rem; }
button.klein { padding: .3rem .7rem; font-size: .9rem; }

.reiter { display: flex; gap: 1.2rem; margin-bottom: .8rem; border-bottom: 1px solid var(--linie); }
.reiter a { padding: .4rem 0; text-decoration: none; color: var(--leise); border-bottom: 2px solid transparent; }
.reiter a.aktiv { color: var(--text); font-weight: 600; border-color: var(--akzent); }

.mails a { grid-template-columns: 2.6rem 1fr auto; }
.mails .score { grid-row: 1 / span 4; align-self: start; }
.mails .betreff, .mails .meta, .mails .zusammenfassung { grid-column: 2 / -1; }
.zusammenfassung { color: var(--text); font-size: .93rem; opacity: .85; }
.score { display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem;
  border-radius: 50%; font-weight: 700; font-size: .9rem; background: var(--linie); color: var(--text); }
.score.hoch { background: #c62828; color: #fff; }
.score.mittel { background: #f9a825; color: #1d1d1f; }
.score.niedrig { background: var(--linie); color: var(--leise); }
.score.offen { background: transparent; border: 1px dashed var(--linie); color: var(--leise); }
.score.gross { width: 3.2rem; height: 3.2rem; font-size: 1.2rem; flex: 0 0 auto; }
.bewertung { display: flex; gap: 1rem; align-items: flex-start; padding: .8rem; margin-bottom: .5rem;
  background: var(--akzent-hell); border-radius: var(--radius); }
.bewertung p { margin: 0 0 .3rem; }
.tag.warn { background: #fde7e7; color: #b3261e; }
@media (prefers-color-scheme: dark) { .tag.warn { background: #4a1f1f; color: #ffb4ab; } }

/* Stufen 1–5 */
.score.s5 { background: #c62828; color: #fff; }
.score.s4 { background: #ef6c00; color: #fff; }
.score.s3 { background: #f9a825; color: #1d1d1f; }
.score.s2 { background: var(--linie); color: var(--text); }
.score.s1 { background: var(--linie); color: var(--leise); }
.stufen { display: flex; gap: .35rem; flex-wrap: wrap; margin: .3rem 0; }
.stufen .stufe { min-width: 2.4rem; padding: .35rem .5rem; border-radius: 6px; border: 1px solid var(--linie);
  background: var(--karte); color: var(--text); cursor: pointer; text-align: center; font: inherit; }
.stufen .stufe.gewaehlt, .wahlstufen .stufe:has(input:checked) { outline: 3px solid var(--akzent); }
.stufen .stufe.s5 { border-color: #c62828; } .stufen .stufe.s4 { border-color: #ef6c00; } .stufen .stufe.s3 { border-color: #f9a825; }
.wahlstufen .stufe { display: flex; flex-direction: column; align-items: center; gap: .1rem; flex: 1 1 4rem; }
.wahlstufen input { position: absolute; opacity: 0; pointer-events: none; }
.wahlstufen small { font-size: .72rem; color: var(--leise); }

/* Abhaken und Themen */
.mails li { display: flex; align-items: stretch; }
.mails li > a { flex: 1; min-width: 0; }
.abhaken { display: flex; align-items: center; padding-left: .6rem; margin: 0; }
.haken { width: 1.8rem; height: 1.8rem; padding: 0; border-radius: 50%; border: 2px solid var(--linie);
  background: transparent; color: transparent; font-weight: 700; line-height: 1; }
.haken:hover { color: var(--leise); }
.haken.an { background: var(--ok); border-color: var(--ok); color: #fff; }
.erledigt .betreff, .erledigt .von, .erledigt h1 { text-decoration: line-through; opacity: .6; }
.anzahl { display: inline-block; min-width: 1.4rem; padding: 0 .35rem; margin-left: .3rem; border-radius: 999px;
  background: var(--akzent); color: #fff; font-size: .78rem; text-align: center; font-weight: 600; }
.titelzeile { display: flex; align-items: center; gap: .5rem; }
.titelzeile .abhaken { padding: 0; }
.zeilenaktion { display: flex; align-items: center; padding: 0 .6rem; }
.zeilenaktion .stufe { min-width: 1.9rem; padding: .2rem .3rem; font-size: .85rem; }
@media (max-width: 640px) { .mails li { flex-wrap: wrap; } .zeilenaktion { width: 100%; padding: 0 1rem .6rem 3rem; } }
.deine { padding: .6rem 0; border-top: 1px solid var(--linie); margin-top: .5rem; }
.deine details { margin-top: .4rem; }

.banner { background: var(--akzent-hell); padding: .7rem 1rem; border-radius: var(--radius); }
.banner a { font-weight: 600; text-decoration: none; }
.punkt { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: #c62828; vertical-align: middle; }
.vorformatiert { white-space: pre-wrap; }
.zahlen { display: flex; flex-wrap: wrap; gap: 1rem; margin: .5rem 0 1rem; }
.zahlen div { display: flex; flex-direction: column; min-width: 5rem; }
.zahlen strong { font-size: 1.5rem; }
.zahlen span { color: var(--leise); font-size: .85rem; }
.rueckblick-mail { padding: .8rem 0; border-top: 1px solid var(--linie); }
.rueckblick-mail p { margin: 0 0 .4rem; }
.frage { margin-top: .5rem; font-weight: 600; }
.frage textarea { font-weight: normal; }
.liste a { grid-template-columns: 1fr auto; }
details summary { cursor: pointer; color: var(--akzent); }

/* Deine Bewertung (1–5) neben der KI-Bewertung (0–100) */
.du { display: inline-block; font-size: .8rem; padding: 0 .45rem; border-radius: 4px; font-weight: 600;
  border: 1px solid var(--linie); color: var(--text); }
.du.s5 { border-color: #c62828; color: #c62828; } .du.s4 { border-color: #ef6c00; color: #ef6c00; }
.du.s3 { border-color: #c79100; color: #c79100; }
@media (prefers-color-scheme: dark) { .du.s5 { color: #ff8a80; } .du.s4 { color: #ffb74d; } .du.s3 { color: #ffd54f; } }
.score { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* Kommentar und Frist an der Mail */
.kommentarform textarea { margin: .3rem 0 .4rem; }
.kommentarform .stufe { display: flex; flex-direction: column; align-items: center; flex: 1 1 3.6rem; }
.kommentarform .stufe small { font-size: .7rem; color: var(--leise); }
.kommentar { margin: .2rem 0 .4rem; padding: .4rem .6rem; border-left: 3px solid var(--akzent); background: var(--akzent-hell); border-radius: 4px; }
.frist { padding: .6rem 0; border-top: 1px solid var(--linie); }
.frist p { margin: 0 0 .4rem; }
.fristform { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.fristform input[type=date] { width: auto; margin: 0; }

/* Kalender */
.monatsnav { display: flex; gap: 1rem; align-items: center; margin: .5rem 0 .8rem; }
.monatsnav a { text-decoration: none; font-size: 1.1rem; }
.kalender { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
.wochentage, .woche { display: grid; grid-template-columns: repeat(7, 1fr); }
.wochentage span { padding: .4rem; font-size: .8rem; color: var(--leise); text-align: center; border-bottom: 1px solid var(--linie); }
.tag-zelle { min-height: 5.5rem; padding: .25rem; border-right: 1px solid var(--linie); border-bottom: 1px solid var(--linie); overflow: hidden; }
.woche .tag-zelle:last-child { border-right: none; }
.tag-zelle.fremd { background: var(--bg); color: var(--leise); }
.tag-zelle.heute .datum { background: var(--akzent); color: #fff; border-radius: 50%; padding: 0 .35rem; }
.datum { font-size: .8rem; }
.eintrag { display: block; margin-top: .2rem; padding: .1rem .3rem; font-size: .75rem; border-radius: 3px; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--linie); color: var(--text); }
.eintrag.s5 { background: #c62828; color: #fff; } .eintrag.s4 { background: #ef6c00; color: #fff; } .eintrag.s3 { background: #f9a825; color: #1d1d1f; }
.eintrag.erledigt { text-decoration: line-through; opacity: .5; }
.kalenderliste { display: none; }
.kalenderliste .score { width: auto; min-width: 3.2rem; border-radius: 6px; padding: 0 .3rem; }
@media (max-width: 640px) { .kalender { display: none; } .kalenderliste { display: block; } }
.abolink { font-family: ui-monospace, monospace; font-size: .85rem; }
.ueberfaellig { border-color: #c62828; }
