/* Handgerollte, M3-nahe Formularelemente als Ersatz für @material/web (siehe Plan:
   keine Lit-Web-Components mehr, kein Node-Build-Schritt nötig). Nutzt dieselben
   --md-sys-color-*-Tokens aus tokens.css wie zuvor die Web Components. */

.btn-filled,
.btn-tonal,
.btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 24px;
  border-radius: 20px;
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn-filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.btn-filled:hover {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-tonal {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  text-decoration: none;
}

.btn-tonal--active {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

/* Gleiche Form wie .btn-tonal, aber in der M3-Fehlerfarbe statt Sekundär - für
   destruktive Aktionen (löschen), die trotzdem gleichwertig neben anderen Tonal-
   Buttons in einer Aktionsreihe stehen sollen, nicht als reiner Text-Link abfallen. */
.btn-tonal--danger {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.btn-text {
  padding: 0 12px;
  background: transparent;
  color: var(--md-sys-color-primary);
}

.btn-text:hover {
  background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent);
}

summary {
  list-style: none;
}

details form {
  margin-top: 12px;
}

summary::-webkit-details-marker {
  display: none;
}

.btn-filled:disabled,
.btn-tonal:disabled,
.btn-text:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
}

/* Ohne das gewinnt .icon-btns "display: inline-flex" (Autoren-Stylesheet) gegen das
   "display: none" aus dem hidden-Attribut (nur User-Agent-Stylesheet, verliert bei
   der Kaskade immer gegen Autoren-CSS, unabhängig von der Spezifität) - ein Element
   mit sowohl .icon-btn als auch [hidden] (z. B. list-item__description-edit beim
   Umschalten in den Bearbeiten-Modus) blieb dadurch trotz .hidden = true sichtbar. */
.icon-btn[hidden] {
  display: none;
}

.icon-btn:hover {
  background: var(--md-sys-color-surface-container-high);
}

.icon-btn--filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  flex-shrink: 0;
}

.icon-btn--filled:hover {
  background: var(--md-sys-color-primary);
  opacity: 0.88;
}

/* Zeigt an, dass für dieses Icon schon ein Wert gewählt ist (Datum/Label/
   Beschreibung in der Schnellerfassungszeile) - ohne das wäre nach dem Öffnen
   und Schließen eines Popovers nicht erkennbar, ob etwas ausgewählt wurde. */
.icon-btn--active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

/* Gleicher Gelbton wie .tree-item__star--active in der Seitenleiste (app.css) -
   Favoriten sollen in der Aufgabenzeile genauso auf den ersten Blick erkennbar
   sein wie im Projektbaum, nicht im unauffälligen Sekundärfarbton von
   .icon-btn--active. */
.icon-btn--favorite {
  color: #f2b705;
}

.notification-bell {
  position: relative;
}

.notification-bell__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  border-radius: 999px;
  font-size: 0.65rem;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.text-field {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border-radius: 4px;
  border: 1px solid var(--md-sys-color-outline);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: inherit;
  font-size: 1rem;
}

.text-field:focus {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: -1px;
}

/* --- Eigenes M3-Dropdown (ersetzt den nativen <select>-Listenpfeil, den Browser
   nicht stylebar machen - siehe core/js/app.js::enhanceSelect). Der ursprüngliche
   <select> bleibt im DOM (visuell versteckt, aber weiter Teil der Formularübermittlung
   und der :required-Validierung), die Bedienung läuft über Button + Listbox. */

.m3-select {
  position: relative;
  display: block;
  width: 100%;
}

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

.m3-select__control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 4px;
  border: 1px solid var(--md-sys-color-outline);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: inherit;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
}

.m3-select__control:hover {
  background: var(--md-sys-color-surface-container-low);
}

/* Kompakte Variante für Inline-Kontexte wie den Flatpickr-Monatswechsler -
   fügt sich in den umgebenden Textfluss statt eine volle Formularzeile zu
   beanspruchen (siehe core/js/app.js::enhanceSelect, compact-Fall). */
.m3-select--compact {
  display: inline-block;
  width: auto;
  vertical-align: middle;
}

.m3-select--compact .m3-select__control {
  width: auto;
  padding: 4px 6px 4px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: inherit;
  font-weight: 700;
  color: inherit;
}

.m3-select--compact .m3-select__control:hover {
  background: var(--md-sys-color-surface-container-high);
}

.m3-select--compact .m3-select__arrow svg {
  width: 16px;
  height: 16px;
}


.m3-select__control:focus-visible,
.m3-select--open .m3-select__control {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: -1px;
}

.m3-select__control:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.m3-select__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m3-select__value--placeholder {
  color: var(--md-sys-color-on-surface-variant);
}

/* Pfeil/Haken als Inline-SVG statt Icon-Font-Ligatur: die vendorte, auf die
   Sidebar-Icons subsettete Material-Symbols-Schrift enthält diese beiden
   Zeichen nicht, ein erneutes Subsetting nur dafür wäre unverhältnismäßig -
   zwei geometrische Formen lassen sich verlustfrei als SVG nachbilden. */
.m3-select__arrow {
  flex-shrink: 0;
  display: flex;
  color: var(--md-sys-color-on-surface-variant);
  transition: transform 0.15s ease;
}

.m3-select__arrow svg {
  display: block;
  width: 20px;
  height: 20px;
}

.m3-select--open .m3-select__arrow {
  transform: rotate(180deg);
}

.m3-select__menu {
  /* top/left/width werden beim Öffnen per JS (positionMenu in app.js) gesetzt -
     position:fixed statt einer Positionierung relativ zum Wrapper, da manche
     Einsatzorte (z. B. Flatpickrs .flatpickr-month) einen overflow:hidden-Vorfahren
     haben, der ein absolut positioniertes Menü sonst abschneiden würde. */
  position: fixed;
  /* Muss über Flatpickrs eigenem Kalender-Popup liegen (dessen CSS nutzt bis zu
     z-index:99999), da unser Menü z. B. beim Monats-Dropdown als Geschwister-Element
     direkt in <body> hängt und sonst darunter läge. */
  z-index: 100000;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.12);
  transform-origin: top center;
  animation: m3-menu-in 0.12s ease-out;
}

@keyframes m3-menu-in {
  from {
    opacity: 0;
    transform: scaleY(0.9);
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

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

.m3-select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}

.m3-select__option:hover,
.m3-select__option--active {
  background: var(--md-sys-color-surface-container-highest);
}

.m3-select__option--selected {
  color: var(--md-sys-color-primary);
  font-weight: 500;
}

.m3-select__option-check {
  display: flex;
  flex-shrink: 0;
  visibility: hidden;
}

.m3-select__option-check svg {
  display: block;
  width: 18px;
  height: 18px;
}

.m3-select__option--selected .m3-select__option-check {
  visibility: visible;
}

.m3-select--invalid .m3-select__control {
  border-color: var(--md-sys-color-error);
}

input[type='checkbox'] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--md-sys-color-primary);
  cursor: pointer;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--md-sys-color-surface-container);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 1px 3px rgba(0, 0, 0, 0.2);
}

.list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  text-decoration: none;
  color: var(--md-sys-color-on-surface);
}

/* Keine Trennlinie mehr zwischen den Zeilen - die Zeilen sitzen jetzt direkt auf
   derselben Fläche, Abgrenzung entsteht nur noch über den Hover-Hintergrund. */
.list-item:hover {
  background: var(--md-sys-color-surface-container-high);
}

/* Vertikaler Strich in Projektfarbe, direkt nach dem Erledigt-Haken - anders als
   der frühere Hover-Rahmen dauerhaft sichtbar, damit man einer Aufgabe auch ohne
   Hovern ansieht, zu welchem Projekt sie gehört (relevant vor allem in
   projektübergreifenden Listen wie Übersicht/Anstehend). Hintergrundfarbe kommt
   inline aus project.hex_color/task.project_hex_color. */
.list-item__project-bar {
  width: 4px;
  align-self: stretch;
  min-height: 20px;
  border-radius: 999px;
  flex-shrink: 0;
}

.list-item__body {
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  /* tasks/_task_row.html nutzt hierfür einen <button> statt <a> (Klick zeigt die
     Beschreibung inline statt zur Detailseite zu wechseln) - Button-Grundstile
     zurücksetzen, damit er optisch nicht von der Projektlisten-<a>-Variante abweicht. */
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.list-item__headline {
  display: block;
  font-size: 1rem;
}

/* Fälligkeitsdatum/Projekt und Tag-Chips in einer Zeile statt untereinander - die
   Aufgabenzeile soll durch Labels nicht höher werden, deshalb flex statt block plus
   overflow:hidden (bei sehr vielen Labels werden die hintersten stillschweigend
   abgeschnitten statt die Zeile zu vergrößern). */
.list-item__supporting {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: hidden;
  font-size: 0.8rem;
  color: var(--md-sys-color-on-surface-variant);
}

.list-item__due {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}

.list-item--muted {
  opacity: 0.6;
}

/* Favorit/Bearbeiten/Löschen nur bei Hover (bzw. Tastaturfokus) einblenden, statt
   dauerhaft jede Zeile mit drei Icons zu überladen - opacity/pointer-events statt
   display:none, damit sich beim Ein-/Ausblenden nichts in der Zeile verschiebt. */
.list-item__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}

.list-item:hover .list-item__actions,
.list-item:focus-within .list-item__actions {
  opacity: 1;
  pointer-events: auto;
}

/* Kleiner als der sonst übliche .icon-btn (40px) - in der Aufgabenzeile gibt sonst
   gerade dieser Button (nicht der Text) die Zeilenhöhe vor, weil er auch bei
   opacity:0 Platz beansprucht. */
.list-item__actions .icon-btn {
  width: 36px;
  height: 36px;
}

.list-item__actions .icon-btn .material-symbols-rounded,
.list-item__actions .icon-btn svg {
  width: 20px;
  height: 20px;
  font-size: 20px;
}

/* Beschreibungs-Vorschau (Klick auf den Aufgabentext, siehe app.js) - per
   flex-basis:100% im umgebenden .list-item (flex-wrap: wrap) auf eine eigene Zeile
   unter Checkbox/Titel/Aktionen gezwungen, statt als normales Flex-Item daneben zu
   landen. */
.list-item__description {
  position: relative;
  flex-basis: 100%;
  padding-left: 40px;
  font-size: 0.9rem;
  color: var(--md-sys-color-on-surface-variant);
}

.list-item__description :is(p, ul, ol):first-child {
  margin-top: 0;
}

.list-item__description :is(p, ul, ol):last-child {
  margin-bottom: 0;
}

/* Zusätzlich zum festen Zeilen-Einzug von .list-item__description (40px, richtet
   die Box unter dem Aufgabentitel aus) - dieses padding-left ist eigens für den
   Editier-Button, damit die erste Textzeile nicht unter ihm beginnt. */
.list-item__description-view {
  padding-left: 40px;
}

/* Links oben, auf Höhe des Textanfangs (nicht am äußeren Rand der Box - dort läge
   der Button unter dem 40px-Zeilen-Einzug, optisch unter dem Erledigt-Haken statt
   über der Beschreibung). .list-item__description ist dafür position:relative,
   unabhängig davon, ob gerade die Ansicht oder das Bearbeiten-Formular sichtbar ist.
   Kleiner als der normale .icon-btn (40px): bei voller Größe hängt das Icon (in der
   Mitte einer 40px-Box zentriert) sichtbar unter die viel kürzere erste Textzeile der
   Beschreibung (0.9rem) herab statt bündig mit ihr abzuschließen. */
.list-item__description-edit {
  position: absolute;
  top: 0;
  left: 40px;
  width: 22px;
  height: 22px;
  padding: 2px;
}

.list-item__description-form .rich-text-editor {
  margin-bottom: 8px;
}

.list-item.done .list-item__headline {
  text-decoration: line-through;
  color: var(--md-sys-color-on-surface-variant);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 12px;
  border-radius: 999px;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-size: 0.85rem;
}

/* Schmale Chip-Variante für Labels in der Aufgabenzeile - deutlich kompakter als
   .chip oben, damit die Zeilenhöhe durch Labels nicht wächst. Muss NACH .chip
   stehen: beide Regeln haben dieselbe Spezifität, bei identischer Spezifität
   gewinnt die später notierte - stand diese Regel vor .chip, überschrieb dessen
   asymmetrisches padding (4px 6px 4px 12px) sie wieder und der Text saß sichtbar
   nach rechts verschoben. */
.chip--tag {
  flex-shrink: 0;
  padding: 1px 8px;
  font-size: 0.65rem;
  line-height: 1.3;
}

.chip__remove-form {
  display: flex;
}

.chip__remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  opacity: 0.7;
}

.chip__remove:hover {
  opacity: 1;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.inline-form .text-field {
  flex: 1;
}

.label-row {
  flex: 1;
  margin-top: 0;
}

input[type='color'] {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
}

.branding-logo-preview {
  height: 48px;
  width: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--md-sys-color-surface-container-high);
}

.comment-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment {
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  padding-bottom: 12px;
}

.comment__meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 0.8rem;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 4px;
}

.radio-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.radio-option input[type='radio'] {
  accent-color: var(--md-sys-color-primary);
  width: 18px;
  height: 18px;
}

.project-color {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* --- Rich-Text-Editor (Beschreibung) --- */

.rich-text-editor {
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 4px;
  background: var(--md-sys-color-surface);
  overflow: hidden;
}

.rich-text-editor:focus-within {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: -1px;
}

.rich-text-editor__toolbar {
  display: flex;
  gap: 2px;
  padding: 4px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-low);
}

.rte-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
}

.rte-btn svg {
  width: 18px;
  height: 18px;
}

.rte-btn:hover {
  background: var(--md-sys-color-surface-container-high);
}

.rte-btn--active {
  color: var(--md-sys-color-primary);
  background: var(--md-sys-color-secondary-container);
}

.rich-text-editor__content {
  padding: 12px 16px;
  min-height: 140px;
  color: var(--md-sys-color-on-surface);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
}

.rich-text-editor__content:focus {
  outline: none;
}

.rich-text-editor__content p {
  margin: 0 0 8px;
}

.rich-text-editor__content p:last-child {
  margin-bottom: 0;
}

.rich-text-editor__content ul,
.rich-text-editor__content ol {
  padding-left: 20px;
  margin: 0 0 8px;
}

.rich-text-editor__content a {
  color: var(--md-sys-color-primary);
}

/* --- Schnellerfassungszeile (Startseite/Aufgabenliste) --- */

.quick-add__row {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
}

.quick-add__title {
  flex: 1;
  min-width: 80px;
}

.quick-add__field {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

/* Auf Touch-Geräten ersetzt sich Flatpickr selbst durch ein natives
   type=date/datetime-local-Input direkt nach dem eigentlichen (versteckten)
   Feld - ungestylt stand das als leere weiße Box neben dem Icon-Button. Der
   Button ruft weiterhin korrekt mobileInput.focus()+.click() auf (Flatpickrs
   eigener Mechanismus für Toggle-Elemente im Wrap-Modus, siehe
   flatpickr-4.6.13.min.js), das funktioniert auch deckungsgleich und
   unsichtbar über dem Icon platziert statt sichtbar danebenstehend.
   pointer-events:none, damit echte Taps weiterhin den darunterliegenden
   Icon-Button treffen (der Klick auf mobileInput kommt nur programmatisch
   von dort, nicht per Touch). */
.quick-add__field .flatpickr-mobile {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  border: 0;
  padding: 0;
}

.quick-add__description {
  margin-top: 8px;
}

/* Icon-Gruppe (Fälligkeitsdatum/Projekt/Label/Beschreibung) - auf Desktop nur
   ein Inline-Wrapper zwischen Titel und Absenden-Button (sieht wie eine
   durchgehende Zeile aus), auf schmalen Bildschirmen per @media unten auf eine
   eigene volle Zeile oberhalb von Titel+Absenden-Button umgebrochen. */
.quick-add__icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 880px) {
  .quick-add__row {
    flex-wrap: wrap;
    row-gap: 8px;
    column-gap: 12px;
  }

  .quick-add__icons {
    order: -1;
    width: 100%;
    flex-wrap: wrap;
  }
}

[data-quick-add-chips]:not(:empty) {
  margin-top: 8px;
}

/* Popover-Auswahl (Projekt/Labels in der Schnellerfassungszeile) - <details>/
   <summary> statt eigenem JS-Dropdown, da native Checkboxen/Radios für eine
   Mehrfachauswahl bzw. einfache Auswahl hier genügen. app.js::initPopoverPickers
   portalt das Menü nach <body> (position:fixed, siehe unten) und markiert das
   Icon aktiv, wenn etwas ausgewählt ist. */
.popover-picker {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.popover-picker > summary {
  list-style: none;
  cursor: pointer;
}

.popover-picker > summary::-webkit-details-marker {
  display: none;
}

.popover-picker__menu {
  /* top/left werden per JS gesetzt (initPopoverPickers in app.js) - das Menü
     hängt direkt in <body>, nicht mehr im <details>, da ein overflow-x:auto-
     Vorfahre (.quick-add__row) es sonst vertikal abschneiden würde. */
  position: fixed;
  z-index: 100000;
  min-width: 200px;
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
  background: var(--md-sys-color-surface-container);
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.12);
}

.popover-picker__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}

.popover-picker__option:hover {
  background: var(--md-sys-color-surface-container-high);
}

.popover-picker__option input[type='checkbox'],
.popover-picker__option input[type='radio'] {
  accent-color: var(--md-sys-color-primary);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* --- Reaktionen --- */

.reaction-bar {
  align-items: center;
}

.reaction-chip {
  border: none;
  cursor: pointer;
  font: inherit;
}

.reaction-chip--active {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: -2px;
}

.reaction-picker {
  position: relative;
  display: inline-block;
}

.reaction-picker > summary {
  list-style: none;
  cursor: pointer;
}

.reaction-picker > summary::-webkit-details-marker {
  display: none;
}

.reaction-picker__menu {
  position: absolute;
  z-index: 30;
  top: 100%;
  left: 0;
  margin-top: 4px;
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--md-sys-color-surface-container);
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.12);
}

.reaction-picker__emoji {
  border: none;
  background: none;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.reaction-picker__emoji:hover {
  background: var(--md-sys-color-surface-container-high);
}

/* Variante für größere Auswahlen (Projekt-Icon, mehrere hundert statt 7 Reaktionen) -
   der Reaktions-Picker selbst bleibt eine einzeilige Leiste, hier braucht es ein festes
   Raster statt flex-wrap (Emoji-Glyphen sind unterschiedlich breit, ein Grid mit
   fester Spaltenzahl hält die 8 Spalten deshalb zuverlässiger ein als umbrechendes
   Flex) plus Höhenbegrenzung mit Scroll, sonst reicht das Menü über den Bildschirm. */
.icon-picker__menu {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  width: 288px;
  max-height: 280px;
  overflow-y: auto;
}

.icon-picker__menu .reaction-picker__emoji {
  padding: 4px;
  text-align: center;
}

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

.relation-group__title {
  font-size: 0.8rem;
  color: var(--md-sys-color-on-surface-variant);
  margin: 8px 0 4px;
}

.chip a {
  color: inherit;
  text-decoration: none;
}

.text-field--narrow {
  max-width: 110px;
}

/* .inline-form .text-field { flex: 1; } weiter oben hat zwei Klassen (Spezifität
   0,2,0) und gewinnt daher gegen ein alleinstehendes .text-field--narrow (0,1,0)
   unabhängig von der Reihenfolge im Quelltext - das enge Zahlenfeld wurde dadurch
   trotz max-width genauso aufgeblasen/zusammengeschrumpft wie sein Geschwister-
   Select, sobald es in einem .inline-form steckt (Wiederholungs-Anzahl, Minuten
   vor Erinnerung). Feste flex-basis statt flex:1 behebt das - gleiche Spezifität,
   aber später notiert. */
.inline-form .text-field--narrow {
  flex: 0 0 90px;
  max-width: 90px;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--md-sys-color-primary);
}

/* --- Filter-Builder --- */

.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.filter-row .text-field {
  flex: 1;
  min-width: 0;
}

/* Die drei per JS zu M3-Dropdowns umgebauten <select> (Verknüpfung/Feld/Operator)
   sind nach der Umwandlung keine .text-field-Elemente mehr (siehe enhanceSelect in
   core/js/app.js), sondern deren umschließendes .m3-select - ohne feste Basis
   konkurrieren sie über den width:100%-Mechanismus mit dem Wertfeld und drängen es
   auf eine kaum lesbare Breite zusammen. */
.filter-row > .m3-select {
  flex: 0 1 160px;
  min-width: 110px;
}

.filter-row__value {
  flex: 2 1 220px;
  min-width: 180px;
}

@media (max-width: 880px) {
  /* Verknüpfung/Feld/Operator (je min-width 110px) + Wertfeld (min-width 180px)
     + Löschen-Icon sprengen in einer Zeile jede Telefonbreite - ohne Umbruch
     musste man seitlich scrollen, um das Wertfeld oder den Löschen-Button
     übrhaupt zu sehen. order:10 schickt das Wertfeld unabhängig von seiner
     Position im Markup in eine eigene volle Zeile, die drei Dropdowns und der
     Löschen-Button bleiben in der/den Zeile(n) darüber und brechen bei Bedarf
     selbst um. */
  .filter-row {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .filter-row__value {
    order: 10;
    flex-basis: 100%;
  }
}

/* An/Aus-Schalter für "Aufgaben ohne gesetzten Wert einschließen" (filter_include_nulls) -
   bewusst kein Kästchen pro Bedingungszeile: die Vikunja-API kennt diesen Parameter nur
   einmal pro Filteranfrage, nie pro Feld - ein Schalter außerhalb der Zeilenliste macht
   das eindeutig statt eine Feld-Genauigkeit vorzutäuschen, die es serverseitig gar nicht
   gibt. */
.switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 40px;
  height: 24px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch__track {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: 2px;
  border-radius: 999px;
  background: var(--md-sys-color-surface-container-highest);
  border: 2px solid var(--md-sys-color-outline);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.switch__thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--md-sys-color-outline);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.switch input:checked + .switch__track {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
}

.switch input:checked + .switch__track .switch__thumb {
  transform: translateX(16px);
  background: var(--md-sys-color-on-primary);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.filter-nulls-toggle {
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: 8px;
}

.filter-nulls-toggle__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.filter-nulls-toggle__label {
  font-size: 0.9rem;
  color: var(--md-sys-color-on-surface);
}

/* Label-/Projekt-Mehrfachauswahl im Filter-Builder (siehe app.js::
   buildFilterMultiSelectWidget) - wiederverwendetes .popover-picker, aber als
   volle Zeilenbreite statt der inline-content-sized Variante aus der
   Schnellerfassung. */
.filter-value-picker {
  display: flex;
  width: 100%;
  flex-shrink: 1;
}

.filter-value-picker__summary {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-row--inline-fields {
  /* .form-row selbst setzt flex-direction:column (Label über Feld) - ohne die
     Zeile explizit wieder auf row zu drehen, bleiben die beiden Felder trotz
     "display: flex" untereinander statt nebeneinander. */
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
}

.form-row--inline-fields > div {
  flex: 1;
  min-width: 0;
}

/* Projektliste: Zeile bekommt zusätzlich zum Titel-Link einen Bearbeiten-Icon-Button -
   die Umrandung wandert deshalb vom .list-item auf das umschließende <li>. */
#project-list li {
  display: flex;
  align-items: center;
}

#project-list .list-item {
  flex: 1;
  min-width: 0;
}
