/* ToDos (Präfix td-): Mein Tag, Listenzeilen, Anlege-Dialog, Detail, Kopfband, Reiter, Vorlagen */

.td-sr-label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Seite ---------- */
.td-seite { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.td-kopfzeile { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.td-leer { margin: 16px 0; }

.td-meldung { margin: 0; padding: 8px 12px; border-radius: 6px; font-size: 14px; border: 1px solid #c7e4fb; background: #e8f3ff; color: #235b7e; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.td-meldung-ok { border-color: #bce7c6; background: #e7f7ec; color: #1c5f31; }
.td-meldung-fehler { border-color: #f0b8b8; background: #fdecec; color: #8a1f1f; }
.td-fehler { margin: 0; color: #8a1f1f; font-size: 13px; }
.td-hinweisbox { margin: 4px 0 0; padding: 8px 12px; border-radius: 6px; border: 1px solid #c7e4fb; background: #e8f3ff; color: #235b7e; font-size: 13px; }
.td-hinweis-warn { border-color: #f5d9a8; background: #fdf1da; color: #7a4e05; }

/* ---------- Segmentknöpfe ---------- */
.td-seg { display: inline-flex; flex-wrap: wrap; gap: 0; }
.td-seg-knopf { min-height: 36px; padding: 4px 14px; border: 1px solid #c9d1d4; background: #fff; font: inherit; font-size: 14px; cursor: pointer; margin-left: -1px; }
.td-seg-knopf:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.td-seg-knopf:last-child { border-radius: 0 4px 4px 0; }
.td-seg-knopf:only-child { border-radius: 4px; }
.td-seg-knopf:hover:not(:disabled) { background: var(--km-blau-hell); }
.td-seg-knopf.aktiv { background: var(--km-blau-hell); border-color: var(--km-fokus); font-weight: 600; position: relative; z-index: 1; }
.td-seg-knopf:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--km-fokus); position: relative; z-index: 2; }

/* ---------- Schnelleingabe ---------- */
.td-schnell { display: flex; flex-direction: column; gap: 4px; }
.td-schnell-feld { width: 100%; box-sizing: border-box; min-height: 44px; font-size: 16px; }
.td-schnell-hilfe summary { cursor: pointer; font-size: 12px; color: var(--km-text-gedimmt); }
.td-schnell-hilfe p { margin: 4px 0 0; }

/* ---------- Abschnitte und Liste ---------- */
.td-sektion h2 { margin: 0 0 8px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.td-sektion > .km-klein { margin: 0 0 6px; }
.td-liste { display: flex; flex-direction: column; gap: 6px; }
.td-unterueberschrift { margin: 14px 0 6px; font-size: 14px; color: var(--km-text-gedimmt); }

.td-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 12px; background: #fff; border: 1px solid var(--km-rand); border-left: 5px solid #b4bcc0; border-radius: 6px; min-width: 0; position: relative; }
.td-zeile.td-rot { border-left-color: #d64545; }
.td-zeile.td-orange { border-left-color: #e8923a; }
.td-zeile.td-blau { border-left-color: #3b8fd9; }
.td-zeile.td-grau { border-left-color: #b4bcc0; }
.td-zeile.td-ist-neu { background: #f3f9ff; }
.td-zeile.td-erledigt { opacity: .75; }
.td-zeile.td-kompakt { padding: 4px 10px; }
.td-zeile-haupt { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.td-titelknopf { display: flex; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; font: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; color: inherit; min-height: 28px; }
.td-titelknopf:hover .td-titel { text-decoration: underline; }
.td-titelknopf:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--km-fokus); border-radius: 3px; }
.td-titel { overflow-wrap: anywhere; }
.td-erledigt .td-titel { text-decoration: line-through; }
.td-punkt { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: #1f7fcf; }
.td-meta { display: flex; flex-wrap: wrap; gap: 0 10px; font-size: 12.5px; color: var(--km-text-gedimmt); }
.td-meta-teil + .td-meta-teil::before { content: "·"; margin-right: 10px; }
.td-frist-rot { color: #a01b1b; font-weight: 600; }
.td-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.td-aktionen { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.td-aktionen:empty { display: none; }
.td-zeilenfehler { flex: 1 0 100%; }

/* ---------- Dialoge und Formulare ---------- */
.td-dialog { display: flex; flex-direction: column; gap: 10px; }
.td-dialog label, .td-form label, .td-bearbeiten label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; font-weight: 600; }
.td-dialog-titel { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.td-herkunft { margin: 0; font-size: 13px; color: var(--km-text-gedimmt); }
.td-feld { min-height: 36px; padding: 4px 8px; border: 1px solid #c9d1d4; border-radius: 4px; font: inherit; font-weight: 400; background: #fff; max-width: 100%; box-sizing: border-box; }
.td-feld:focus { outline: none; border-color: var(--km-fokus); box-shadow: 0 0 0 .2rem rgba(31, 127, 207, .25); }
textarea.td-feld { width: 100%; resize: vertical; }
input.td-feld[type="text"], input.td-feld[type="search"] { width: 100%; }
.td-zahl { width: 90px; }
.td-breit { flex: 1 1 260px; }
.td-feldzeile { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.td-feldzeile > label { flex: 0 1 auto; }
.td-feldzeile > .td-feld.td-breit { flex: 1 1 260px; }
.td-gruppe { margin: 0; padding: 8px 12px 12px; border: 1px solid var(--km-rand); border-radius: 6px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.td-gruppe legend { padding: 0 6px; font-size: 13px; font-weight: 600; }
.td-check { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 8px !important; font-weight: 400 !important; min-height: 28px; }
.td-check input { margin-top: 3px; }
.td-checkliste-auswahl { display: flex; flex-direction: column; gap: 2px; }
.td-scroll { max-height: 220px; overflow: auto; border: 1px solid var(--km-rand); border-radius: 4px; padding: 4px 8px; }
.td-praxis-gewaehlt { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.td-wh { display: flex; flex-direction: column; gap: 8px; }
.td-fuss { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.td-fuss-links { justify-content: flex-start; margin-top: 6px; }
.td-fuss-beide { justify-content: space-between; width: 100%; }

/* ---------- Detail ---------- */
.td-detail { display: flex; flex-direction: column; gap: 12px; min-width: 0; border-left: 5px solid #b4bcc0; padding-left: 12px; }
.td-detail.td-rot { border-left-color: #d64545; }
.td-detail.td-orange { border-left-color: #e8923a; }
.td-detail.td-blau { border-left-color: #3b8fd9; }
.td-detail-kopf { display: flex; flex-direction: column; gap: 6px; }
.td-detail-titel { margin: 0; font-size: 22px; font-weight: 500; overflow-wrap: anywhere; }
.td-aktionsleiste { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.td-statusleiste { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.td-box { padding: 10px 12px; border: 1px solid var(--km-rand); border-radius: 6px; background: #fafbfc; display: flex; flex-direction: column; gap: 8px; }
.td-box h3 { margin: 0; font-size: 15px; }
.td-box-warn { border-color: #f5d9a8; background: #fdf8ec; }
.td-felder { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0; font-size: 14px; }
.td-felder dt { color: var(--km-text-gedimmt); }
.td-felder dd { margin: 0; overflow-wrap: anywhere; }
.td-warum summary { cursor: pointer; font-size: 13px; color: var(--km-text-gedimmt); }
.td-warum p { margin: 4px 0 0; font-size: 13px; }
.td-beschreibung { overflow-wrap: anywhere; padding: 8px 12px; background: #fff; border: 1px solid var(--km-rand); border-radius: 6px; }
.td-abschnitt { display: flex; flex-direction: column; gap: 6px; }
.td-abschnitt > h3 { margin: 4px 0 0; font-size: 15px; }
.td-beteiligte, .td-checkpunkte, .td-kommentare, .td-verlauf ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.td-beteiligte li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.td-beteiligt-name { font-weight: 600; }
.td-checkpunkte li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; min-height: 32px; }
.td-check-text { flex: 1 1 200px; overflow-wrap: anywhere; }
.td-check-fertig .td-check-text { text-decoration: line-through; color: var(--km-text-gedimmt); }
.td-check-aktionen { display: inline-flex; gap: 10px; }
.td-link { padding: 0; border: 0; background: transparent; color: var(--km-fokus); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.td-link:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--km-fokus); border-radius: 3px; }
.td-kommentar { padding: 8px 10px; background: #fff; border: 1px solid var(--km-rand); border-radius: 6px; }
.td-kommentar.td-art-rueckfrage { border-left: 4px solid #3b8fd9; }
.td-kommentar.td-art-ablehnung, .td-kommentar.td-art-rueckgabe, .td-kommentar.td-art-fristgefaehrdet { border-left: 4px solid #e8923a; }
.td-kommentar.td-art-kritischbegruendung { border-left: 4px solid #d64545; }
.td-kommentar-kopf { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.td-kommentar-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.td-kommentar-neu { display: flex; flex-direction: column; gap: 6px; }
.td-erinnerung { margin: 0; display: flex; gap: 10px; align-items: center; }
.td-verlauf summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.td-verlauf li { font-size: 13px; }
.td-detail-seite { max-width: 980px; }
.td-detail-seite > p { margin: 0 0 8px; }

/* ---------- Kopfband und Reiter ---------- */
.td-kopfband { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; }
.td-band { padding: 8px 12px; border-radius: 6px; border: 1px solid; font-size: 14px; }
.td-band ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.td-band-rot { background: #fdecec; border-color: #f0b8b8; color: #6f1818; }
.td-band-grau { background: #f3f5f6; border-color: #d3d9dc; color: #2c3332; }
.td-band-titel { font-size: 14px; font-weight: 600; color: inherit; text-align: left; }
.td-reiter { display: flex; flex-direction: column; gap: 8px; }
.td-reiter-kopf { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.td-reiter-kopf h3 { margin: 0; font-size: 17px; }

/* ---------- Vorlagen ---------- */
.td-tabellenrahmen { overflow-x: auto; }
.td-tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.td-tabelle th, .td-tabelle td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--km-rand); vertical-align: top; }
.td-tabelle thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--km-text-gedimmt); }
.td-tabelle-aktionen { display: flex; flex-wrap: wrap; gap: 6px; }
.td-inaktiv { color: var(--km-text-gedimmt); }
.td-wh-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.td-wh-liste li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.td-form { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Telefon ---------- */
@media (max-width: 640px) {
    .td-zeile { padding: 8px; }
    .td-zeile-haupt { flex-basis: 100%; }
    .td-aktionen { margin-left: 0; width: 100%; }
    .td-aktionen .pf-btn { flex: 1 1 auto; min-height: 44px; }
    .td-felder { grid-template-columns: minmax(0, 1fr); }
    .td-felder dt { margin-top: 6px; }
    .td-detail { padding-left: 8px; }
    .td-detail-titel { font-size: 19px; }
    .td-seg-knopf { min-height: 44px; }
    .td-aktionsleiste .pf-btn { min-height: 40px; }
    .td-fuss-beide { flex-direction: column-reverse; }
}

/* ---------- Filter, Ziehen, Ablage ---------- */
.td-filter { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; }
.td-filter label { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.td-filter-kunde { display: flex; flex-direction: column; gap: 2px; min-width: 220px; }
.td-ziehbar { display: flex; flex-direction: column; gap: 2px; cursor: grab; }
.td-ziehbar:active { cursor: grabbing; }
.td-ablage { outline: 2px dashed var(--km-fokus); outline-offset: -2px; background: #f3f9ff; }
.td-zuege { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; padding: 0 2px 4px; }
.td-zug { min-height: 28px; padding: 0 8px; font-size: 12px; }
.td-rueckfrage { display: inline-flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 13px; }

/* ---------- Matrix ---------- */
.td-matrix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.td-matrix-achse { font-size: 13px; font-weight: 600; color: var(--km-text-gedimmt); text-align: center; }
.td-matrix-spalte1 { grid-column: 1; }
.td-matrix-spalte2 { grid-column: 2; }
.td-matrix-feld { padding: 10px; border: 1px solid var(--km-rand); border-radius: 8px; background: #fafbfc; min-width: 0; min-height: 140px; display: flex; flex-direction: column; gap: 6px; }
.td-matrix-feld h2 { margin: 0; font-size: 16px; }
.td-matrix-erklaerung { margin: 0; }
.td-matrix-leer { margin: 0; }
.td-mx-sofort { border-top: 4px solid #d64545; }
.td-mx-einplanen { border-top: 4px solid #3b8fd9; }
.td-mx-kurz { border-top: 4px solid #e8923a; }
.td-mx-irgendwann { border-top: 4px solid #b4bcc0; }

/* ---------- Board ---------- */
.td-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: start; }
.td-board-spalte { padding: 10px; border: 1px solid var(--km-rand); border-radius: 8px; background: #fafbfc; min-width: 0; min-height: 160px; display: flex; flex-direction: column; gap: 6px; }
.td-board-spalte h2 { margin: 0; font-size: 16px; }

/* ---------- Kalender ---------- */
.td-kal-titel { margin: 0; font-size: 17px; font-weight: 600; }
.td-kal-legende { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 12px; background: #fff; }
.td-kal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.td-kal-kopf { text-align: center; font-size: 12px; font-weight: 600; color: var(--km-text-gedimmt); }
.td-kal-tag { min-height: 110px; padding: 4px; border: 1px solid var(--km-rand); border-radius: 6px; background: #fff; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.td-kal-monat .td-kal-tag { min-height: 90px; max-height: 190px; overflow: auto; }
.td-kal-wochenende { background: #f7f8f9; }
.td-kal-fremd { opacity: .55; }
.td-kal-heute { border-color: var(--km-fokus); box-shadow: inset 0 0 0 1px var(--km-fokus); }
.td-kal-tagkopf { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: space-between; }
.td-kal-tagzahl { font-size: 12px; font-weight: 600; }
.td-kal-chip { padding: 3px 5px; border-radius: 4px; border: 1px solid #c9d1d4; background: #f3f5f6; font-size: 12px; display: flex; flex-direction: column; gap: 1px; cursor: grab; min-width: 0; }
.td-kal-chip.td-kal-frist { border: 2px solid #d64545; background: #fff; }
.td-kal-chip.td-kal-plan { border-color: #3b8fd9; background: #eef6fd; }
.td-kal-ueberfaellig { background: #fdecec !important; }
.td-kal-titel-knopf { display: flex; flex-wrap: wrap; gap: 2px 4px; padding: 0; border: 0; background: transparent; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.td-kal-titel-knopf:hover .td-kal-text { text-decoration: underline; }
.td-kal-titel-knopf:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--km-fokus); border-radius: 3px; }
.td-kal-art { font-weight: 700; font-size: 11px; text-transform: uppercase; color: var(--km-text-gedimmt); }
.td-kal-zeit { font-size: 11px; color: var(--km-text-gedimmt); }
.td-kal-text { overflow-wrap: anywhere; font-weight: 600; }
.td-kal-praxis { font-size: 11px; color: var(--km-text-gedimmt); overflow-wrap: anywhere; }
.td-kal-verschieben { font-size: 11px; align-self: flex-start; }
.td-kal-legende.td-kal-frist { border: 2px solid #d64545; }
.td-kal-legende.td-kal-plan { border: 1px solid #3b8fd9; background: #eef6fd; }

/* ---------- Team-Übersicht ---------- */
.td-zahl-spalte { text-align: right; white-space: nowrap; }
.td-person-knopf { font-size: 14px; font-weight: 600; }
.td-zeile-gewaehlt { background: #f3f9ff; }
.td-legende { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.td-qbalken { display: flex; width: 160px; max-width: 100%; height: 12px; border-radius: 3px; overflow: hidden; background: #e8ecee; }
.td-q { display: inline-block; height: 12px; }
.td-legende .td-q { width: auto; height: auto; padding: 0 6px; border-radius: 3px; color: #fff; font-size: 12px; }
.td-q-sofort { background: #d64545; }
.td-q-einplanen { background: #3b8fd9; }
.td-q-kurz { background: #e8923a; }
.td-q-irgendwann { background: #b4bcc0; }
.td-fortschrittsliste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.td-fortschrittsliste li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.td-fortschritt { width: 160px; height: 10px; }
.td-ohne-zeile { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.td-ohne-zeile > :first-child { flex: 1 1 360px; min-width: 0; }
.td-rb-zeile { display: flex; flex-direction: column; gap: 2px; }

@media (max-width: 1100px) {
    .td-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Telefon: Matrix und Board einspaltig, Kalender als Liste je Tag (Tage ohne Einträge entfallen) */
@media (max-width: 760px) {
    .td-matrix, .td-board { grid-template-columns: minmax(0, 1fr); }
    .td-matrix-achse { display: none; }
    .td-kal { display: flex; flex-direction: column; gap: 6px; }
    .td-kal-kopf { display: none; }
    .td-kal-tag { min-height: 0; max-height: none !important; overflow: visible !important; }
    .td-kal-tag.td-kal-leer:not(.td-kal-heute) { display: none; }
    .td-kal-fremd { display: none; }
    .td-zug { min-height: 36px; }
}
