/* Journee – Design-System
   Leitidee: Claude × iOS. Papierartige Ruhe, iOS-Klarheit, ein Akzent.
   Umsetzung von docs/design.md. Werte dort ändern, hier nachziehen. */

/* ------------------------------------------------------------------ *
 * 1. Farben
 * ------------------------------------------------------------------ */

:root {
  --bg:            #F4F0E8;  /* Papier-Creme, Seitenhintergrund */
  --surface:       #FCFAF6;  /* Karten */
  --surface-2:     #EDE8DD;  /* eingebettete Flächen, Segmented-Hintergrund */
  --text:          #3D3929;  /* warmes Dunkelgrau, nie #000 */
  --text-muted:    #8A8578;
  --border:        #E0DACC;
  --accent:        #D97757;  /* Terracotta */
  --accent-strong: #C05B3C;  /* Hover/Pressed, Überfällig */
  --accent-soft:   #F6E3DA;  /* Badges, markierte Zeilen */
  --success:       #6B8F5E;  /* nur Erledigt-Häkchen */

  --schatten: 0 1px 3px rgb(0 0 0 / 0.06);

  --radius-karte:  16px;
  --radius-knopf:  12px;
  --radius-badge:  8px;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
             Roboto, sans-serif;
  --font-title: ui-serif, "New York", Georgia, serif;

  --rand: 16px;         /* Seitenrand mobil */
  --spalte-links: 200px;
  --spalte-rechts: 220px;
}

/* Dunkelmodus – der Tagesabschluss ist um 22:00, das ist kein Nebenschauplatz.
   Automatisch nach Systemeinstellung, manuell übersteuerbar. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="hell"]) {
    --bg:            #201E1A;
    --surface:       #2A2723;
    --surface-2:     #33302A;
    --text:          #EDE9DF;
    --text-muted:    #9A948A;
    --border:        #3B372F;
    --accent:        #E08B6D;
    --accent-strong: #EA9E82;
    --accent-soft:   #4A342C;
    --success:       #85A878;
    --schatten:      none;  /* im Dunkeln grenzt --surface gegen --bg ab */
  }
}

:root[data-theme="dunkel"] {
  --bg:            #201E1A;
  --surface:       #2A2723;
  --surface-2:     #33302A;
  --text:          #EDE9DF;
  --text-muted:    #9A948A;
  --border:        #3B372F;
  --accent:        #E08B6D;
  --accent-strong: #EA9E82;
  --accent-soft:   #4A342C;
  --success:       #85A878;
  --schatten:      none;
}

/* ------------------------------------------------------------------ *
 * 2. Grundlagen
 * ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.sekundaer { font-size: 15px; }
.caption   { font-size: 13px; color: var(--text-muted); }
.zahlen    { font-variant-numeric: tabular-nums; }
.gedaempft { color: var(--text-muted); }
.nur-sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* Large Title – Serif, nur für Seitentitel */
.gross-titel {
  font-family: var(--font-title);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.untertitel { color: var(--text-muted); font-size: 15px; }

/* ------------------------------------------------------------------ *
 * 3. Topbar
 * ------------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--rand);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.wortmarke {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.topbar-suche {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-knopf);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 15px;
  cursor: text;
}
.topbar-suche kbd {
  margin-left: auto;
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
}

.icon-knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-knopf);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.icon-knopf:hover { background: var(--surface-2); color: var(--text); }

/* ------------------------------------------------------------------ *
 * 4. Layout
 * ------------------------------------------------------------------ */

.huelle {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--rand) 120px;
}

.seitenleiste, .nebenspalte { display: none; }

.hauptspalte { min-width: 0; padding-top: 16px; }

@media (min-width: 1024px) {
  :root { --rand: 24px; }
  .huelle {
    display: grid;
    grid-template-columns: var(--spalte-links) minmax(0, 1fr) var(--spalte-rechts);
    gap: 24px;
    align-items: start;
    padding-bottom: 48px;
  }
  .seitenleiste, .nebenspalte {
    display: block;
    position: sticky;
    top: 72px;
    padding-top: 16px;
  }
  .huelle.ohne-nebenspalte {
    grid-template-columns: var(--spalte-links) minmax(0, 1fr);
  }
}

/* ------------------------------------------------------------------ *
 * 5. Karten und Listen (iOS-Stil)
 * ------------------------------------------------------------------ */

.karte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-karte);
  box-shadow: var(--schatten);
  margin-bottom: 16px;
  overflow: hidden;
}

.karte-kopf {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 16px 10px;
}
.karte-kopf h2 {
  font-size: 17px;
  font-weight: 600;
}
.karte-kopf .caption { margin-left: auto; }

.karte-inhalt { padding: 0 16px 16px; }
.karte-inhalt-oben { padding: 16px; }

/* Liste mit Trennlinien zwischen den Zeilen */
.liste > li + li { border-top: 1px solid var(--border); }

.zeile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  min-height: 48px;
}
.zeile.klickbar:hover { background: var(--surface-2); }
.zeile-haupt { flex: 1; min-width: 0; }
.zeile-titel {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.zeile-rechts {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.chevron { color: var(--text-muted); flex-shrink: 0; }

.leer {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
}

/* ------------------------------------------------------------------ *
 * 6. Aufgabenzeile
 * ------------------------------------------------------------------ */

.hakerl {
  appearance: none;
  -webkit-appearance: none;
  width: 22px; height: 22px;
  flex-shrink: 0;
  border: 1.75px solid var(--border);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: border-color .15s, background .15s;
}
.hakerl:hover { border-color: var(--success); }
.hakerl:checked {
  background: var(--success);
  border-color: var(--success);
}
.hakerl:checked::after {
  content: "";
  position: absolute;
  left: 7px; top: 3px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.erledigt .zeile-titel {
  text-decoration: line-through;
  color: var(--text-muted);
}

.aufgabe-ueberfaellig .zeile-titel { color: var(--accent-strong); }

/* ------------------------------------------------------------------ *
 * 7. Badges
 * ------------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-badge);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-muted);
}
.badge-ueberfaellig { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.badge-akzent      { background: var(--accent-soft); color: var(--accent-strong); }
.badge-phase       { background: var(--surface-2); color: var(--text-muted); }

/* ------------------------------------------------------------------ *
 * 8. Knöpfe
 * ------------------------------------------------------------------ */

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-knopf);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.knopf:hover  { background: var(--accent-strong); }
.knopf:active { transform: translateY(0.5px); }
.knopf[disabled] { opacity: .5; cursor: not-allowed; }

.knopf-umriss {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.knopf-umriss:hover { background: var(--accent-soft); color: var(--accent-strong); }

.knopf-still {
  background: var(--surface-2);
  color: var(--text);
}
.knopf-still:hover { background: var(--border); }

.knopf-klein { height: 32px; padding: 0 12px; font-size: 13px; }

/* ------------------------------------------------------------------ *
 * 9. Segmented Control
 * ------------------------------------------------------------------ */

.segmente {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-2);
  border-radius: var(--radius-knopf);
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 16px;
}
.segmente::-webkit-scrollbar { display: none; }
.segment {
  flex: 1;
  min-width: max-content;
  padding: 6px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 15px;
  text-align: center;
  cursor: pointer;
}
.segment[aria-current="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--schatten);
}

/* ------------------------------------------------------------------ *
 * 10. Formulare
 * ------------------------------------------------------------------ */

.feld { margin-bottom: 14px; }
.feld > label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.feld-hinweis { font-size: 13px; color: var(--text-muted); margin-top: 5px; }

input[type="text"], input[type="password"], input[type="date"],
input[type="time"], input[type="number"], input[type="url"],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-knopf);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--text-muted); }

.feld-reihe { display: flex; gap: 12px; flex-wrap: wrap; }
.feld-reihe > .feld { flex: 1; min-width: 140px; }

/* iOS-Schalter */
.schalter { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.schalter input { position: absolute; opacity: 0; pointer-events: none; }
.schalter-spur {
  width: 50px; height: 30px;
  flex-shrink: 0;
  border-radius: 15px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
  transition: background .2s;
}
.schalter-spur::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / .2);
  transition: transform .2s;
}
.schalter input:checked + .schalter-spur {
  background: var(--accent);
  border-color: var(--accent);
}
.schalter input:checked + .schalter-spur::after { transform: translateX(20px); }

/* ------------------------------------------------------------------ *
 * 11. Capture-Leiste
 * ------------------------------------------------------------------ */

.capture {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 25;
  padding: 10px var(--rand) calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
}
.capture form { display: flex; gap: 8px; max-width: 1400px; margin: 0 auto; }
.capture input { flex: 1; }
.capture .knopf { width: 44px; padding: 0; }

@media (min-width: 1024px) {
  .capture {
    position: static;
    padding: 0;
    background: none;
    backdrop-filter: none;
    border-top: none;
    margin-top: 16px;
  }
}

/* ------------------------------------------------------------------ *
 * 12. Sheet (mobil von unten) / Modal (Desktop)
 * ------------------------------------------------------------------ */

.sheet-hintergrund {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgb(0 0 0 / .35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-karte) var(--radius-karte) 0 0;
  padding: 20px var(--rand) calc(20px + env(safe-area-inset-bottom));
  animation: sheet-hoch .22s ease-out;
}
@keyframes sheet-hoch { from { transform: translateY(100%); } }

.sheet-kopf {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}
.sheet-kopf h2 { font-size: 20px; font-weight: 600; }
.sheet-kopf .icon-knopf { margin-left: auto; }

@media (min-width: 768px) {
  .sheet-hintergrund { align-items: center; padding: 24px; }
  .sheet {
    max-width: 560px;
    border-radius: var(--radius-karte);
    animation: modal-auf .18s ease-out;
  }
  @keyframes modal-auf { from { opacity: 0; transform: scale(.97); } }
}

@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
}

/* ------------------------------------------------------------------ *
 * 13. Suchpalette (Strg+K)
 * ------------------------------------------------------------------ */

.palette-hintergrund {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgb(0 0 0 / .35);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}
.palette {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-karte);
  box-shadow: 0 12px 40px rgb(0 0 0 / .18);
  overflow: hidden;
}
.palette input {
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  height: 52px;
  font-size: 17px;
  background: transparent;
}
.palette input:focus-visible { outline: none; }
.palette-treffer { max-height: 50vh; overflow-y: auto; }
.palette-treffer .zeile { cursor: pointer; }
.palette-treffer .zeile[aria-selected="true"] { background: var(--accent-soft); }

/* ------------------------------------------------------------------ *
 * 14. Seitenleiste
 * ------------------------------------------------------------------ */

.leiste-titel {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 10px;
  margin: 18px 0 6px;
}
.leiste-eintrag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 15px;
  color: var(--text);
}
.leiste-eintrag:hover { background: var(--surface-2); }
.leiste-eintrag[aria-current="page"] {
  background: var(--surface-2);
  font-weight: 600;
}
.leiste-eintrag .zaehler {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.bereichspunkt {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ------------------------------------------------------------------ *
 * 15. Fortschritts- und Kapazitätsanzeige
 * ------------------------------------------------------------------ */

.kapazitaet-balken {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 8px 0 4px;
}
.kapazitaet-balken > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.block-zeile {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 0;
}
.block-zeile .zahlen { margin-left: auto; }

/* ------------------------------------------------------------------ *
 * 16. Meldungen
 * ------------------------------------------------------------------ */

.meldung {
  padding: 12px 16px;
  border-radius: var(--radius-knopf);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  margin-bottom: 16px;
}
.meldung-warnung {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* Tabelle (Projektübersicht) */
.tabelle-huelle { overflow-x: auto; }
table.uebersicht {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
table.uebersicht th {
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.uebersicht td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.uebersicht tr:last-child td { border-bottom: none; }
table.uebersicht tbody tr:hover { background: var(--surface-2); }

/* HTMX: Anzeige während laufender Anfragen */
.htmx-request { opacity: .6; }

/* ------------------------------------------------------------------ *
 * 17. Kalenderansicht (Woche und Monat)
 *
 * Die Wochenansicht ist ein CSS-Grid: erste Spalte Uhrzeiten, danach
 * sieben Tagesspalten. Termine und Rasterbloecke werden innerhalb der
 * Tagesspalte absolut positioniert; die Prozentwerte rechnet der Dienst
 * (app/services/kalenderansicht.py), damit im Template nichts gerechnet
 * werden muss.
 * ------------------------------------------------------------------ */

.kal-steuerung {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.kal-blaettern {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.kal-karte { overflow-x: auto; }

/* --- Woche --- */

.kal-woche {
  display: grid;
  grid-template-columns: 44px repeat(7, minmax(96px, 1fr));
  min-width: 760px;
}

.kal-kopfzelle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 10px 4px 8px;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  text-align: center;
}
.kal-kopfzelle:first-child { border-left: none; }
.kal-wochentag { font-size: 13px; color: var(--text-muted); }
.kal-tagzahl { font-size: 20px; font-weight: 600; line-height: 1.1; }

.kal-kopfzelle.ist-heute .kal-tagzahl {
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
}

.kal-oberzelle {
  min-height: 30px;
  padding: 4px;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kal-oberzelle:first-child {
  border-left: none;
  justify-content: center;
  font-size: 11px;
}

.kal-chip {
  display: block;
  font-size: 11px;
  line-height: 1.3;
  padding: 2px 5px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kal-chip-akzent { background: var(--accent-soft); color: var(--accent-strong); }
.kal-mini { font-size: 11px; padding: 1px 5px; }

/* Zeitraster: eine Zeile je Stunde, feste Hoehe */
.kal-gitter {
  position: relative;
  border-left: 1px solid var(--border);
}
.kal-zeitspalte.kal-gitter { border-left: none; }
.kal-stunde {
  height: 44px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.kal-zeitspalte .kal-stunde > span {
  position: absolute;
  top: -7px;
  right: 6px;
  background: var(--surface);
  padding: 0 2px;
}

.kal-tagspalte.ist-wochenende,
.kal-kopfzelle.ist-wochenende,
.kal-monat-zelle.ist-wochenende { background: var(--surface-2); }
.kal-tagspalte.ist-heute { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }

/* Wochenraster-Block als Hintergrundband */
.kal-block {
  position: absolute;
  left: 2px; right: 2px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--block-farbe, var(--accent)) 12%, transparent);
  border-left: 2px solid color-mix(in srgb, var(--block-farbe, var(--accent)) 45%, transparent);
  pointer-events: none;
  overflow: hidden;
}
.kal-block-titel {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 4px;
  display: block;
}

/* Termin */
.kal-termin {
  position: absolute;
  border-radius: 6px;
  padding: 2px 5px;
  overflow: hidden;
  background: color-mix(in srgb, var(--termin-farbe, var(--accent)) 22%, var(--surface));
  border-left: 3px solid var(--termin-farbe, var(--accent));
  font-size: 11px;
  line-height: 1.25;
  cursor: default;
}
/* Zeit und Titel laufen im Textfluss, nicht untereinander: ein
   30-Minuten-Termin ist nur ~22 px hoch und haette bei zwei festen
   Zeilen den Titel abgeschnitten. So bleibt bei flachen Kaesten
   "09:00 Bau..." stehen, bei hohen umbricht der Titel von selbst. */
.kal-termin-zeit { color: var(--text-muted); margin-right: 3px; }
.kal-termin-titel { font-weight: 600; }

.kal-fusszelle {
  padding: 6px 4px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 40px;
}
.kal-fusszelle:first-child { border-left: none; font-size: 11px; }

.kal-aufgabe {
  font-size: 11px;
  line-height: 1.3;
  padding: 2px 5px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kal-aufgabe:hover { background: var(--border); }
.kal-aufgabe.erledigt { text-decoration: line-through; color: var(--text-muted); }

/* --- Monat --- */

.kal-monat {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  min-width: 780px;
}
.kal-monat-kopf {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.kal-monat-zelle {
  min-height: 104px;
  padding: 5px 6px 7px;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
}
.kal-monat-zelle:nth-child(7n + 1) { border-left: none; }
.kal-monat-zelle:hover { background: var(--surface-2); }
.kal-monat-zelle.ist-fremd { opacity: .45; }
.kal-monat-zelle.ist-heute { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }

.kal-monat-zeile {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}
.kal-monat-zahl { font-size: 15px; font-weight: 600; }
.kal-monat-zelle.ist-heute .kal-monat-zahl { color: var(--accent-strong); }
.kal-monat-kapazitaet, .kal-monat-ausnahme { margin-left: auto; }

.kal-monat-termin {
  font-size: 11px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kal-monat-aufgaben { margin-top: auto; }

/* ------------------------------------------------------------------ *
 * 18. Anhaenge an Notizen
 * ------------------------------------------------------------------ */

.anhaenge {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.anhang {
  border: 1px solid var(--border);
  border-radius: var(--radius-knopf);
  background: var(--surface-2);
  overflow: hidden;
  max-width: 200px;
}

.anhang img {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  background: var(--surface);
}

.anhang-datei {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 8px;
  font-size: 13px;
  max-width: 200px;
}

.anhang-fuss {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-top: 1px solid var(--border);
}
.anhang-fuss > span:first-child { margin-right: auto; }

/* Dateiauswahl im Sheet */
input[type="file"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-knopf);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}
input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 5px 12px;
  border: none;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
