/* Stempeluhr – Aufgaben & Notizen (Board). Ergänzt app.css und nutzt deren Farben und Bausteine
   (.seg, .btn, .card, .check, .field, .pill, .sync, dialog/.dlg). Farbe nur für Bedeutung:
   rot = fällig/überfällig, orange = heute fällig. Ab 900px stehen die Spalten nebeneinander, darunter eine Spalte mit Umschalter.
   Anhänge im Dialog: graue Liste wie .preview, Fortschritt als schmaler schwarzer Balken, blaue Ablagefläche beim Ziehen. */
.bd { display: grid; gap: 16px; min-width: 0; }
.bd:focus { outline: none; }
.bd-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- Kopfzeile: Filter, Status, Erledigte, Neuer Eintrag ---------- */
.bd-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.seg.bd-filter { grid-template-columns: repeat(4, 1fr); max-width: none; }
.bd-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px 16px; flex-wrap: wrap; margin-left: auto; }
.bd-tools .sync { margin-right: 0; }
@media (max-width: 560px) {
  .seg.bd-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1 1 100%; }
  .bd-tools { flex: 1 1 100%; justify-content: space-between; margin-left: 0; }
  .bd-tools .sync { order: 3; flex-basis: 100%; }
}

.bd-msg { padding: 28px 24px; display: grid; gap: 12px; justify-items: center; text-align: center; color: var(--muted); }
.bd-msg p { margin: 0; max-width: 60ch; }

/* Spaltenwahl (nur schmal) */
.seg.bd-pick { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); max-width: none; }
.bd-pick button { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.bd-pn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-pc { flex: none; font-size: 12.5px; font-variant-numeric: tabular-nums; opacity: .8; }
@media (max-width: 400px) { .bd-pick button { gap: 4px; padding-inline: 6px; font-size: 13.5px; } }
@media (min-width: 900px) { .seg.bd-pick { display: none; } }

/* ---------- Spalten ---------- */
.bd-cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .bd-cols { grid-template-columns: repeat(var(--bd-n, 3), minmax(0, 1fr)); gap: 20px; } }
@media (max-width: 899.98px) { .bd-col:not(.is-sel) { display: none; } }
.bd-col { padding: 20px; display: grid; gap: 14px; align-content: start; grid-template-columns: minmax(0, 1fr); }
@media (max-width: 480px) { .bd-col { padding: 16px; } }
.bd-col-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bd-col-head h2 { margin: 0; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font: 700 22px/1.2 var(--f-display); letter-spacing: -.015em; overflow-wrap: anywhere; }
.bd-col-head .pill { font-family: var(--f-body); letter-spacing: 0; line-height: 1.5; }
.bd-count { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bd-add { margin-left: auto; flex: none; }

/* Schnell-Eingabe: 16px, damit iOS beim Antippen nicht zoomt */
.bd-quick { margin: 0; }
.bd-quick input { width: 100%; min-width: 0; min-height: 44px; padding: 9px 14px; border: 1px solid var(--rule); border-radius: var(--r-field); background: var(--surface); font-size: 16px; }
.bd-quick input:focus { border-color: var(--focus); outline: 3px solid rgb(0 113 227 / .2); outline-offset: 0; }
.bd-quick input[aria-busy="true"] { background: var(--surface-2); }

/* ---------- Gruppen und Einträge ---------- */
.bd-list { display: grid; gap: 14px; min-width: 0; align-content: start; }

/* Feste, gleiche Spaltenhöhe: Kopf und Eingabe stehen, nur die Liste scrollt – so bleibt „Demnächst fällig“ darunter im Blick.
   Höhe nach Bildschirm: Rest nach Kopfzeile, Filter und dem Feld darunter (mind. 340, höchstens 640 px). */
.bd { --bd-col-h: clamp(340px, calc(100vh - 430px), 640px); }
@media (min-width: 900px) {
  .bd-cols { align-items: stretch; }
  .bd-col { height: var(--bd-col-h); grid-template-rows: auto auto minmax(0, 1fr); align-content: stretch; }
}
@media (max-width: 899.98px) { .bd-col.is-sel { max-height: 70vh; max-height: 70dvh; grid-template-rows: auto auto minmax(0, 1fr); } }
.bd-list, .bd-soon-list { min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; }
.bd-list { padding-inline: 8px; margin-inline: -8px; }   /* Platz für den Hover-Hintergrund der Einträge (margin -8px) */
.bd-soon-list { max-height: clamp(220px, 34vh, 420px); padding: 2px; margin: -2px; }
.fade-b { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); }
.fade-t { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px); mask-image: linear-gradient(to bottom, transparent, #000 28px); }
.fade-t.fade-b { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 36px), transparent); }
.bd-group { min-width: 0; }
.bd-gh { margin: 0 0 2px; display: flex; align-items: center; gap: 6px; font: 600 12.5px/1.2 var(--f-body); color: var(--muted); }
.bd-gc { font-weight: 500; font-variant-numeric: tabular-nums; }
.bd-more { margin-top: 6px; }
.bd-items { list-style: none; margin: 0; padding: 0; }
.bd-item { display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 12px; align-items: start; padding-inline: 8px; margin-inline: -8px; border-radius: 12px; cursor: pointer; }
.bd-item:hover { background: var(--surface-2); }
.bd-main { min-width: 0; padding-block: 9px 10px; }
.bd-item + .bd-item .bd-main { border-top: 1px solid var(--rule-soft); }
.bd-lead { width: 24px; height: 24px; margin-top: 8px; }
.bd-ico { display: grid; place-items: center; color: var(--muted); }

/* Runde Abhak-Box: echtes Kontrollkästchen liegt unsichtbar darüber (Tastatur, Vorlesen), Trefferfläche 36px */
.bd-tick { position: relative; display: grid; place-items: center; cursor: pointer; }
.bd-tick input { position: absolute; top: -6px; left: -6px; width: calc(100% + 12px); height: calc(100% + 12px); margin: 0; opacity: 0; cursor: pointer; }
.bd-box { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--faint); background: var(--surface); color: transparent; display: grid; place-items: center; transition: background-color .15s, border-color .15s; }
.bd-box svg { display: block; }
.bd-tick:hover .bd-box { border-color: var(--muted); }
.bd-tick input:checked + .bd-box { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.bd-tick input:focus-visible + .bd-box { outline: 2px solid var(--focus); outline-offset: 2px; }

.bd-title { appearance: none; display: block; width: 100%; margin: 0; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--ink); font: 500 15px/1.35 var(--f-body); text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.bd-bell { display: inline-block; margin-right: 5px; vertical-align: -1px; color: var(--muted); }
.bd-bell svg { display: block; }
.bd-item.is-done .bd-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
/* Text: Zeilenumbrüche bleiben, höchstens 3 Zeilen */
.bd-body { margin: 2px 0 0; font-size: 14px; line-height: 1.4; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.bd-meta { margin: 3px 0 0; display: flex; flex-wrap: wrap; column-gap: 6px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.bd-meta > span + span::before { content: "·"; content: "·" / ""; margin-right: 6px; }
.bd-due { font-variant-numeric: tabular-nums; }
.bd-due.is-over { color: var(--minus); font-weight: 600; }
.bd-due.is-today { color: var(--vac); font-weight: 600; }

.bd-empty { padding: 22px 8px 10px; display: grid; gap: 4px; justify-items: center; text-align: center; color: var(--muted); font-size: 14px; }
.bd-empty b { color: var(--ink); font-weight: 600; font-size: 15px; }

/* ---------- Dialog ---------- */
.seg.bd-kind { grid-template-columns: repeat(3, 1fr); max-width: none; }
.bd-dlg textarea { min-height: 112px; resize: vertical; line-height: 1.45; }
.bd-when-wrap { display: grid; gap: 10px; }
.bd-when { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; }
@media (max-width: 400px) { .bd-when { grid-template-columns: minmax(0, 1fr); } }
.bd-conflict { display: grid; gap: 10px; justify-items: start; padding: 12px 14px; border-radius: var(--r-tile); background: var(--minus-soft); }
.bd-conflict p { margin: 0; color: var(--minus); font-size: 13.5px; font-weight: 500; }
.bd-conflict .btn { background: var(--surface); }
.bd-conflict .btn:hover { background: var(--surface-3); }

/* ---------- Anhänge ---------- */
/* Büroklammer mit Anzahl in der Meta-Zeile der Liste */
.bd-clip > span[aria-hidden] { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.bd-clip svg { display: block; }

/* Der Dialog scrollt im Formular: so bedeckt die Ablagefläche immer genau den sichtbaren Dialog */
.bd-dlg { overflow: hidden; }
.bd-dlg > form { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
.bd-files { display: grid; gap: 8px; min-width: 0; }
.bd-files-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.bd-files-head h4 { margin: 0; font: 500 13px/1.3 var(--f-body); color: var(--muted); }
.bd-fc { font-variant-numeric: tabular-nums; }
.bd-flist { list-style: none; margin: 0; padding: 0; border-radius: var(--r-tile); background: var(--surface-2); min-width: 0; }
.bd-file { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; column-gap: 10px; align-items: center; min-height: 52px; padding: 6px 6px 6px 12px; }
.bd-file + .bd-file { border-top: 1px solid var(--rule-soft); }
.bd-fico { display: grid; place-items: center; color: var(--muted); }
.bd-fico svg { display: block; }
.bd-fmain { min-width: 0; display: grid; gap: 2px; padding-block: 4px; }
.bd-fname { font-size: 14.5px; font-weight: 500; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
a.bd-fname { justify-self: stretch; text-decoration: none; border-radius: 4px; padding-block: 10px; margin-block: -10px; }   /* Tippfläche ~40 px über die ganze Breite */
a.bd-fname:hover { text-decoration: underline; text-underline-offset: 3px; }
.bd-fmeta { font-size: 12.5px; line-height: 1.35; color: var(--muted); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.bd-ferr { color: var(--minus); font-weight: 500; }
.bd-file[data-s="removed"] .bd-fname { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.bd-facts { display: flex; align-items: center; gap: 4px; }
.bd-fx svg { display: block; }
.bd-fx[aria-busy="true"] { opacity: .45; cursor: progress; }
.bd-fagain { padding-inline: 14px; font-size: 13px; background: var(--surface); }
.bd-fagain:hover { background: var(--surface-3); }
.bd-file .btn.ghost:hover { background: var(--surface-3); }
/* Fortschritt: schmaler schwarzer Balken auf grauer Spur */
.bd-file progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 6px; margin: 4px 0 2px; border: 0; border-radius: 980px; background: var(--surface-3); color: var(--ink); overflow: hidden; }
.bd-file progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 980px; }
.bd-file progress::-webkit-progress-value { background: var(--ink); border-radius: 980px; transition: width .2s; }
.bd-file progress::-moz-progress-bar { background: var(--ink); border-radius: 980px; }
@media (max-width: 400px) {
  /* Fehlerzeile: Knöpfe unter die Meldung, damit sie Platz hat */
  .bd-file[data-s="error"] .bd-facts { grid-column: 2 / -1; justify-content: flex-end; }
}

/* Ablagefläche beim Darüberziehen von Dateien */
.bd-drop { position: absolute; inset: 0; z-index: 3; display: grid; padding: 12px; background: rgb(255 255 255 / .94); border-radius: inherit; }
.bd-drop > div { pointer-events: none; display: grid; align-content: center; justify-items: center; gap: 6px; padding: 16px; border: 2px dashed var(--focus); border-radius: 16px; background: rgb(0 113 227 / .04); text-align: center; }
.bd-drop svg { color: var(--focus); }
.bd-drop b { font: 600 18px/1.25 var(--f-display); color: var(--ink); }
.bd-drop span { font-size: 13.5px; color: var(--muted); }

/* ---------- Demnächst fällig: großes Feld unter den Spalten ----------
   Rand = 3px Innenabstand des äußeren Elements; offen: rot leuchtende Linie läuft im Kreis, alles erledigt: ruhiger grüner Rahmen */
@property --bd-spin { syntax: '<angle>'; inherits: true; initial-value: 0deg; }
.bd-soon { position: relative; isolation: isolate; padding: 3px; border-radius: calc(var(--r-card) + 3px); background: var(--rule-soft); }
.bd-soon::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: inherit; filter: blur(14px); opacity: 0; transition: opacity .3s; pointer-events: none; }
.bd-soon-in { background: var(--surface); border-radius: var(--r-card); padding: 24px 26px 26px; display: grid; gap: 18px; min-height: 170px; align-content: start; }
@media (max-width: 480px) { .bd-soon-in { padding: 18px 16px 20px; } }
.bd-soon-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.bd-soon-ico { width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--ink); color: #FFFFFF; }
.bd-soon-tt { min-width: 0; flex: 1 1 180px; }   /* Basis statt Inhaltsbreite: Titel bleibt neben dem Symbol, der Status bricht schmal darunter um */
.bd-soon-tt h2 { margin: 0; font: 700 24px/1.15 var(--f-display); letter-spacing: -.02em; }
.bd-soon-tt h2:focus { outline: none; }
.bd-soon-tt p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.bd-soon-state { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 980px; font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.bd-soon-state::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
@media (max-width: 560px) { .bd-soon-head { flex-wrap: wrap; row-gap: 10px; } .bd-soon-state { margin-left: 60px; } .bd-soon-tt h2 { font-size: 21px; } }

/* Offen: Leuchtspur läuft um den Rand */
.bd-soon.is-alert { background: conic-gradient(from var(--bd-spin), rgb(200 16 46 / .16) 0deg 170deg, rgb(255 92 112 / .55) 240deg, #FF3B55 310deg, #E0112F 345deg, rgb(200 16 46 / .16) 360deg); animation: bd-spin 2.4s linear infinite; }
/* Leuchtschein: statisch rot und weichgezeichnet, nur die Deckkraft „atmet“ (läuft auf der Grafikkarte, kein Neuzeichnen des Blurs je Bild) */
.bd-soon.is-alert::before { background: var(--minus); opacity: .3; animation: bd-glow 2.4s ease-in-out infinite; }
@keyframes bd-glow { 50% { opacity: .55; } }
.bd-soon.is-alert .bd-soon-state { background: var(--minus-soft); color: var(--minus); }
.bd-soon.is-alert .bd-soon-state::before { animation: pulse 1.6s ease-in-out infinite; }
.bd-soon.is-alert .bd-soon-ico { background: var(--minus); }
@keyframes bd-spin { to { --bd-spin: 360deg; } }
/* Alles erledigt: statischer grüner Rahmen */
.bd-soon.is-clear { background: var(--plus); }
.bd-soon.is-clear::before { opacity: .18; }
.bd-soon.is-clear .bd-soon-state { background: var(--plus-soft); color: var(--plus); }
.bd-soon.is-clear .bd-soon-ico { background: var(--plus); }
/* Ohne Bewegung (Systemeinstellung): durchgehend roter Rahmen statt Lauflicht */
@media (prefers-reduced-motion: reduce) { .bd-soon.is-alert { background: var(--minus); } }

/* Einträge im Feld: Kacheln in Spalten, so viele wie Platz ist */
.bd-soon .bd-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 10px 14px; }
.bd-soon .bd-item { margin-inline: 0; padding-inline: 12px; background: var(--surface-2); border-radius: 14px; }
.bd-soon .bd-item:hover { background: var(--surface-3); }
.bd-soon .bd-item + .bd-item .bd-main { border-top: 0; }
.bd-soon .bd-item.is-done { background: var(--surface-band); }
.bd-owner { font-weight: 600; color: var(--ink); }
.bd-soon .bd-empty { padding-block: 10px; }
