/* Aufgaben und Kalender (aufgaben.js). Größen aus der Schriftskala in app.css, mit Ersatzwert, falls sie fehlt. */

/* ---------- Aufgaben ---------- */

.af-raster { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.af-filterspalte { display: grid; gap: 2px; padding: 10px; position: sticky; top: 20px; }
.af-filter {
  display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px; border: 0; border-radius: 8px;
  background: none; text-align: left; font-size: var(--t-text, 15px); cursor: pointer;
}
.af-filter svg { width: 17px; height: 17px; color: var(--text-2); flex: none; }
.af-filter span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-filter .zahl { font-size: var(--t-neben, 13px); color: var(--text-2); }
.af-filter[aria-current="true"] { background: var(--flaeche); font-weight: 600; }
.af-filter[aria-current="true"] svg { color: var(--text); }
.af-filter:focus-visible, .af-inhalt:focus-visible, .kal-zelle:focus-visible, .af-umschalter button:focus-visible { outline: 2px solid var(--studium); outline-offset: 2px; }
.af-punkt { width: 9px; height: 9px; margin: 0 4px; border-radius: 50%; flex: none; }
.af-abschnitt { font-size: var(--t-klein, 12px); font-weight: 600; color: var(--text-2); padding: 14px 10px 4px; }

.af-schnell { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; }
.af-schnell > svg { width: 17px; height: 17px; color: var(--text-2); flex: none; }
.af-schnell input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: var(--t-text, 15px); }
.af-schnell input::placeholder { color: var(--text-3); }
.af-schnell select { border: 0; background: var(--flaeche); border-radius: 8px; padding: 5px 8px; font-size: var(--t-neben, 13px); }

.af-gruppe { padding: 16px 20px 6px; }
.af-gruppe-kopf { display: flex; align-items: baseline; gap: 8px; font-size: var(--t-text, 15px); }
.af-gruppe-kopf .zahl { color: var(--text-2); font-size: var(--t-neben, 13px); }
.af-gruppe-kopf .knopf { margin-left: auto; }
.af-liste { list-style: none; margin: 4px 0 0; padding: 0; }
.af-zeile { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; }
.af-zeile + .af-zeile { border-top: 1px solid var(--linie); }
.af-zeile .check[aria-checked="true"] { background: var(--af, var(--studium)); border-color: var(--af, var(--studium)); }
.af-inhalt { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
span.af-inhalt { cursor: default; }
.af-titel { font-size: var(--t-text, 15px); overflow-wrap: anywhere; }
.af-unter { font-size: var(--t-neben, 13px); color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.af-wann { font-size: var(--t-neben, 13px); color: var(--text-2); white-space: nowrap; padding-top: 2px; }
.af-zeile.fertig .af-titel { color: var(--text-3); text-decoration: line-through; }
.af-zeile.nachrangig .af-titel { color: var(--text-2); }
.af-dringend { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; font-size: var(--t-mini, 11px); font-weight: 600; color: var(--rot); background: color-mix(in srgb, var(--rot) 13%, transparent); vertical-align: 1px; }
.rot { color: var(--rot); }

.af-geloescht {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: 999px; font-size: var(--t-neben, 13px);
}
.af-geloescht span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-geloescht button { border: 0; background: none; padding: 0; color: var(--studium); font-weight: 600; cursor: pointer; }

/* Formular */
.af-blatt { width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 22px; color: var(--text); overflow: auto; }
.af-blatt::backdrop { background: rgba(0, 0, 0, .32); }
.af-blatt { background: var(--grund); }
.af-blatt form { display: grid; gap: 14px; }
.af-blatt h2 { margin: 0 0 2px; font-size: var(--t-betont, 20px); letter-spacing: -.01em; }
.af-feld { display: grid; gap: 5px; border: 0; margin: 0; padding: 0; min-width: 0; }
.af-feld > span, .af-feld > legend { font-size: var(--t-klein, 12px); font-weight: 600; color: var(--text-2); padding: 0; }
.af-feld > legend { margin-bottom: 5px; }
.af-feld input[type="text"], .af-feld input[type="date"], .af-feld textarea, .af-feld select {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche);
  font: inherit; font-size: var(--t-text, 15px); color: var(--text); resize: vertical;
}
.af-feld input:focus, .af-feld textarea:focus, .af-feld select:focus { outline: 2px solid var(--studium); outline-offset: 0; }
.af-wahl, .af-umschalter { display: flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--flaeche); }
.af-wahl label { flex: 1; }
.af-wahl input { position: absolute; opacity: 0; pointer-events: none; }
.af-wahl span, .af-umschalter button {
  display: grid; place-items: center; min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: none;
  font-size: var(--t-neben, 13px); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.af-wahl input:checked + span, .af-umschalter button[aria-pressed="true"] { background: var(--grund); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); font-weight: 600; }
.af-wahl input:focus-visible + span { outline: 2px solid var(--studium); }
.af-schnellwahl { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -6px; }
.af-haken { display: flex; align-items: center; gap: 8px; font-size: var(--t-text, 15px); }
.af-haken input { width: 18px; height: 18px; accent-color: var(--studium); }
.af-knoepfe { display: flex; gap: 8px; margin-top: 4px; }
.af-knoepfe > span { flex: 1; }
.af-loeschen { color: var(--rot); }

/* ---------- Kalender ---------- */

.kal-legende { display: flex; gap: 14px; margin: -12px 0 14px; font-size: var(--t-klein, 12px); color: var(--text-2); }
.kal-legende span { display: flex; align-items: center; gap: 6px; }
.kal-punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.kal-ring { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--text-2); flex: none; }

.kal-woche { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: start; }
.kal-tag { padding: 12px 12px 6px; border-radius: var(--r-kachel); min-height: 220px; }
.kal-tag.heute { border-color: var(--studium); box-shadow: 0 0 0 1px var(--studium), var(--glas-schatten); }
.kal-tagkopf { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; font-size: var(--t-text, 15px); }
.kal-tagkopf .knopf { margin-left: auto; align-self: center; min-height: 28px; padding: 0 8px; }
.kal-wt { font-size: var(--t-klein, 12px); color: var(--text-2); }
.kal-nr { font-size: var(--t-betont, 20px); font-weight: 600; }
.kal-tag.heute .kal-nr { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 999px; background: var(--studium); color: #fff; }
.kal-woche .af-zeile { gap: 8px; padding: 8px 0; }
.kal-woche .check { width: 18px; height: 18px; }
.kal-woche .check svg { width: 10px; height: 10px; }
.kal-woche .af-titel { font-size: var(--t-neben, 13px); }
.kal-woche .af-unter { font-size: var(--t-klein, 12px); }
.kal-woche .af-wann { display: none; }
.kal-marke { flex: none; width: 24px; display: grid; place-items: center; padding-top: 7px; }
.kal-woche .kal-marke { width: 18px; padding-top: 5px; }

.kal-monat { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.kal-raster { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.kal-kopf { font-size: var(--t-mini, 11px); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); padding: 0 9px 2px; }
.kal-zelle {
  display: grid; align-content: start; gap: 3px; min-height: 104px; padding: 7px 8px; border: 1.5px solid transparent;
  border-radius: var(--r-kachel); background: var(--kachel); text-align: left; cursor: pointer; overflow: hidden;
}
.kal-zelle b { font-size: var(--t-neben, 13px); font-weight: 500; width: 24px; height: 24px; display: grid; place-items: center; margin: -2px 0 1px -4px; border-radius: 50%; }
.kal-zelle.heute b { background: var(--studium); color: #fff; font-weight: 700; }
.kal-zelle.fremd { background: color-mix(in srgb, var(--kachel) 40%, transparent); color: var(--text-2); }
.kal-zelle[aria-current="date"] { border-color: var(--text-2); }
.kal-chip { display: flex; align-items: center; gap: 5px; font-size: var(--t-mini, 11px); min-width: 0; }
.kal-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kal-mehr { font-size: var(--t-mini, 11px); color: var(--text-2); }
.kal-punkte { display: none; gap: 3px; }
.kal-seite { position: sticky; top: 20px; }

@media (max-width: 1100px) {
  .kal-woche { grid-template-columns: 1fr; }
  .kal-tag { min-height: 0; }
  .kal-woche .af-titel { font-size: var(--t-text, 15px); }
  .kal-woche .af-wann { display: block; }
  .kal-monat { grid-template-columns: 1fr; }
  .kal-seite { position: static; }
}
@media (max-width: 900px) {
  .af-raster { grid-template-columns: 1fr; }
  /* Filter als Zeile zum Wischen; die Abschnittstitel entfallen, die Reihenfolge bleibt. */
  .af-filterspalte { position: static; display: flex; gap: 6px; padding: 6px; overflow-x: auto; border-radius: 999px; scrollbar-width: none; }
  .af-filterspalte::-webkit-scrollbar { display: none; }
  .af-abschnitt { display: none; }
  .af-filter { flex: none; border-radius: 999px; padding: 0 12px; }
  .af-filter span:first-of-type { flex: none; }
  .kopf-knoepfe { flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 600px) {
  .kal-zelle { min-height: 58px; padding: 5px; justify-items: center; }
  .kal-zelle b { margin: 0; }
  .kal-chip, .kal-mehr { display: none; }
  .kal-punkte { display: flex; }
  .kal-kopf { text-align: center; padding: 0; }
  .kopf:has(.af-umschalter) { flex-direction: column; align-items: stretch; }
  .kopf:has(.af-umschalter) .kopf-knoepfe { flex-wrap: nowrap; justify-content: flex-start; }
  .kopf:has(.af-umschalter) .af-umschalter { margin-right: auto; }
  .kopf:has(.af-umschalter) .knopf { padding: 0 12px; }
}
