@font-face {
  font-family: 'Roboto Flex';
  src: url('/static/core/fonts/roboto-flex-3.200.woff2') format('woff2-variations');
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Material Symbols Rounded';
  src: url('/static/core/fonts/material-symbols-rounded-2.962.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

* {
  box-sizing: border-box;
}

/* Dünne, gerundete Scrollbalken im Material-You-Ton statt des klobigen
   Browser-Standards - Firefox über scrollbar-*, Chromium/Safari über ::-webkit-*. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--md-sys-color-outline-variant) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--md-sys-color-outline-variant);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--md-sys-color-outline);
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: 'Roboto Flex', system-ui, sans-serif;
  background: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
}

a {
  color: var(--md-sys-color-primary);
}

/* Bisher gab es keine eigene Typografie-Skala - h1/h2 liefen überall auf reinen
   Browser-Defaults, nur die Übersicht/Anstehend-Überschrift (.task-feed h2 weiter
   unten) hatte eine Ad-hoc-Anpassung bekommen. Dadurch wirkten gleichrangige
   Überschriften (z. B. "Fällig in den nächsten 7 Tagen" vs. "Erscheinungsbild" in
   den Einstellungen) unterschiedlich groß, obwohl beides Abschnittstitel derselben
   Ebene sind. */
h1 {
  font-size: 1.6rem;
  font-weight: 500;
  margin: 0 0 16px;
}

/* tasks/_view_header.html: Editier-Icon direkt hinter Emoji+Projektname, öffnet
   projects:edit - h1 ist sonst reiner Blocktext, hier als Flex-Zeile für die
   vertikale Zentrierung von Text und Icon-Button. */
.view-header__title {
  display: flex;
  align-items: center;
  gap: 4px;
}

h2 {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0 0 12px;
}

.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  vertical-align: middle;
}

input[type='date']::-webkit-calendar-picker-indicator,
input[type='datetime-local']::-webkit-calendar-picker-indicator {
  filter: invert(0);
}

:root[data-theme='dark'] input[type='date']::-webkit-calendar-picker-indicator,
:root[data-theme='dark'] input[type='datetime-local']::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) input[type='date']::-webkit-calendar-picker-indicator,
  :root:not([data-theme='light']) input[type='datetime-local']::-webkit-calendar-picker-indicator {
    filter: invert(1);
  }
}

/* Flatpickrs Kopfzeile (Monat/Jahr) neu ausgerichtet: das eigene M3-Dropdown für
   Monat und Jahr ist ein <button> mit eigener Box, nicht mehr das inline-select
   bzw. der Zahlen-Spinner, auf die Flatpickrs Standardlayout (position:absolute,
   text-align:center, 135% Schriftgröße) zugeschnitten ist - ohne diese Regeln
   ragt der Button aus der 34px hohen Kopfzeile heraus und Monat/Jahr überlappen
   sich. Gilt unabhängig vom Theme, deshalb kein [data-theme]-Selektor. */
.flatpickr-current-month {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: absolute;
  inset: 0;
  width: 100%;
  left: 0;
  padding: 0;
  height: 34px;
  font-size: 13px;
  font-weight: 500;
}

.flatpickr-current-month .m3-select--compact .m3-select__control {
  padding: 2px 6px 2px 8px;
  font-size: 13px;
}

.flatpickr-current-month .m3-select--compact .m3-select__arrow svg {
  width: 14px;
  height: 14px;
}

/* Flatpickrs eigene Regel .flatpickr-current-month .flatpickr-monthDropdown-months
   setzt position:relative mit zwei Klassen Spezifität - höher als unsere generische
   .m3-select__native-Verstecken-Regel (eine Klasse) in controls.css. Ohne diesen
   spezifischeren Gegen-Selektor bleibt der native <select> sichtbar und zeigt sich
   zusätzlich zum eigenen Button (Ursache für den doppelten Monatsnamen). */
.flatpickr-current-month .flatpickr-monthDropdown-months.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;
}

/* Gleiches Problem wie oben, hier für den Jahres-Zahlen-Spinner: Flatpickrs
   .flatpickr-current-month .numInputWrapper{width:6ch} ist ebenfalls
   spezifischer als unsere generische .m3-select__native-Regel. */
.flatpickr-current-month .numInputWrapper.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;
}

.flatpickr-current-month .m3-select--year .m3-select__control {
  padding: 2px 4px 2px 6px;
  font-size: 13px;
  font-weight: 400;
}

/* Stunde/Minute als eigene M3-Dropdowns statt Zahlen-Spinner (siehe
   app.js::enhanceFlatpickrTimeUnit) - dieselbe Verstecken-Spezifitätsfalle wie
   beim Jahr oben, hier für .flatpickr-time .numInputWrapper (Flatpickrs eigene
   Regel setzt width:40%;height:40px;float:left mit zwei Klassen Spezifität). */
.flatpickr-time .numInputWrapper.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;
}

.flatpickr-time .m3-select--time {
  height: 40px;
  display: flex;
  align-items: center;
}

.flatpickr-time .m3-select--time .m3-select__control {
  padding: 2px 4px;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.flatpickr-time .m3-select--time .m3-select__arrow svg {
  width: 14px;
  height: 14px;
}

/* Übernehmen-Button am Kalenderfuß (siehe app.js::ensureFlatpickrConfirmButton). */
.flatpickr-confirm {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  border: none;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0 0 5px 5px;
}

.flatpickr-confirm:hover {
  opacity: 0.9;
}

.flatpickr-confirm svg {
  width: 18px;
  height: 18px;
}

/* Flatpickr liefert nur ein helles Farbschema mit - im dunklen Theme per Tokens
   überschrieben. Das Kalender-Popup hängt außerhalb von .app-shell direkt in
   <body>, deshalb globale Selektoren statt einer Verschachtelung darunter. */
:root[data-theme='dark'] .flatpickr-calendar {
  background: var(--md-sys-color-surface-container);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

:root[data-theme='dark'] .flatpickr-calendar.arrowTop:before {
  border-bottom-color: var(--md-sys-color-surface-container);
}

:root[data-theme='dark'] .flatpickr-month,
:root[data-theme='dark'] .flatpickr-current-month input.cur-year {
  color: var(--md-sys-color-on-surface);
  fill: var(--md-sys-color-on-surface);
}

:root[data-theme='dark'] .flatpickr-current-month span.cur-month:hover,
:root[data-theme='dark'] .numInputWrapper:hover {
  background: var(--md-sys-color-surface-container-high);
}

:root[data-theme='dark'] .flatpickr-months .flatpickr-prev-month,
:root[data-theme='dark'] .flatpickr-months .flatpickr-next-month {
  color: var(--md-sys-color-on-surface-variant);
  fill: var(--md-sys-color-on-surface-variant);
}

:root[data-theme='dark'] .numInputWrapper span.arrowUp:after {
  border-bottom-color: var(--md-sys-color-on-surface-variant);
}

:root[data-theme='dark'] .numInputWrapper span.arrowDown:after {
  border-top-color: var(--md-sys-color-on-surface-variant);
}

:root[data-theme='dark'] .flatpickr-weekday {
  color: var(--md-sys-color-on-surface-variant);
}

:root[data-theme='dark'] .flatpickr-day {
  color: var(--md-sys-color-on-surface);
}

:root[data-theme='dark'] .flatpickr-day.today {
  border-color: var(--md-sys-color-outline);
}

:root[data-theme='dark'] .flatpickr-day:hover,
:root[data-theme='dark'] .flatpickr-day.today:hover,
:root[data-theme='dark'] .flatpickr-day:focus {
  background: var(--md-sys-color-surface-container-highest);
  border-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

:root[data-theme='dark'] .flatpickr-day.selected,
:root[data-theme='dark'] .flatpickr-day.selected:hover,
:root[data-theme='dark'] .flatpickr-day.selected:focus {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

:root[data-theme='dark'] .flatpickr-day.flatpickr-disabled,
:root[data-theme='dark'] .flatpickr-day.flatpickr-disabled:hover,
:root[data-theme='dark'] .flatpickr-day.prevMonthDay,
:root[data-theme='dark'] .flatpickr-day.nextMonthDay,
:root[data-theme='dark'] .flatpickr-day.notAllowed {
  color: var(--md-sys-color-on-surface-variant);
  opacity: 0.38;
}

:root[data-theme='dark'] .flatpickr-calendar.hasTime .flatpickr-time {
  border-top-color: var(--md-sys-color-outline-variant);
}

:root[data-theme='dark'] .flatpickr-time input {
  color: var(--md-sys-color-on-surface);
}

:root[data-theme='dark'] .flatpickr-am-pm {
  color: var(--md-sys-color-on-surface);
}

/* Flatpickr setzt für Fokus/Hover der Uhrzeit-Felder ein festes helles Grau
   (#eee) - genau das sorgt für den "weiß hinterlegt"-Effekt im dunklen Theme. */
:root[data-theme='dark'] .flatpickr-time input:hover,
:root[data-theme='dark'] .flatpickr-time input:focus,
:root[data-theme='dark'] .flatpickr-am-pm:hover,
:root[data-theme='dark'] .flatpickr-am-pm:focus {
  background: var(--md-sys-color-surface-container-high);
}

:root[data-theme='dark'] .flatpickr-time .numInputWrapper span {
  border-color: var(--md-sys-color-outline-variant);
}

:root[data-theme='dark'] .numInputWrapper span:hover {
  background: var(--md-sys-color-surface-container-high);
}

:root[data-theme='dark'] .numInputWrapper span:active {
  background: var(--md-sys-color-surface-container-highest);
}

/* Flatpickrs eigenes CSS hat für die Zeit-Spinner (Stunde/Minute) eine
   spezifischere Pfeilfarb-Regel als die allgemeine .numInputWrapper-Variante
   oben - ohne eigenen, gleich spezifischen Selektor bleiben diese Pfeile fest
   dunkelgrau statt dem Theme zu folgen. */
:root[data-theme='dark'] .flatpickr-time .numInputWrapper span.arrowUp:after {
  border-bottom-color: var(--md-sys-color-on-surface-variant);
}

:root[data-theme='dark'] .flatpickr-time .numInputWrapper span.arrowDown:after {
  border-top-color: var(--md-sys-color-on-surface-variant);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .flatpickr-calendar {
    background: var(--md-sys-color-surface-container);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  }

  :root:not([data-theme='light']) .flatpickr-calendar.arrowTop:before {
    border-bottom-color: var(--md-sys-color-surface-container);
  }

  :root:not([data-theme='light']) .flatpickr-month,
  :root:not([data-theme='light']) .flatpickr-current-month input.cur-year {
    color: var(--md-sys-color-on-surface);
    fill: var(--md-sys-color-on-surface);
  }

  :root:not([data-theme='light']) .flatpickr-current-month span.cur-month:hover,
  :root:not([data-theme='light']) .numInputWrapper:hover {
    background: var(--md-sys-color-surface-container-high);
  }

  :root:not([data-theme='light']) .flatpickr-months .flatpickr-prev-month,
  :root:not([data-theme='light']) .flatpickr-months .flatpickr-next-month {
    color: var(--md-sys-color-on-surface-variant);
    fill: var(--md-sys-color-on-surface-variant);
  }

  :root:not([data-theme='light']) .numInputWrapper span.arrowUp:after {
    border-bottom-color: var(--md-sys-color-on-surface-variant);
  }

  :root:not([data-theme='light']) .numInputWrapper span.arrowDown:after {
    border-top-color: var(--md-sys-color-on-surface-variant);
  }

  :root:not([data-theme='light']) .flatpickr-weekday {
    color: var(--md-sys-color-on-surface-variant);
  }

  :root:not([data-theme='light']) .flatpickr-day {
    color: var(--md-sys-color-on-surface);
  }

  :root:not([data-theme='light']) .flatpickr-day.today {
    border-color: var(--md-sys-color-outline);
  }

  :root:not([data-theme='light']) .flatpickr-day:hover,
  :root:not([data-theme='light']) .flatpickr-day.today:hover,
  :root:not([data-theme='light']) .flatpickr-day:focus {
    background: var(--md-sys-color-surface-container-highest);
    border-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
  }

  :root:not([data-theme='light']) .flatpickr-day.selected,
  :root:not([data-theme='light']) .flatpickr-day.selected:hover,
  :root:not([data-theme='light']) .flatpickr-day.selected:focus {
    background: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
  }

  :root:not([data-theme='light']) .flatpickr-day.flatpickr-disabled,
  :root:not([data-theme='light']) .flatpickr-day.flatpickr-disabled:hover,
  :root:not([data-theme='light']) .flatpickr-day.prevMonthDay,
  :root:not([data-theme='light']) .flatpickr-day.nextMonthDay,
  :root:not([data-theme='light']) .flatpickr-day.notAllowed {
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.38;
  }

  :root:not([data-theme='light']) .flatpickr-calendar.hasTime .flatpickr-time {
    border-top-color: var(--md-sys-color-outline-variant);
  }

  :root:not([data-theme='light']) .flatpickr-time input {
    color: var(--md-sys-color-on-surface);
  }

  :root:not([data-theme='light']) .flatpickr-am-pm {
    color: var(--md-sys-color-on-surface);
  }

  :root:not([data-theme='light']) .flatpickr-time input:hover,
  :root:not([data-theme='light']) .flatpickr-time input:focus,
  :root:not([data-theme='light']) .flatpickr-am-pm:hover,
  :root:not([data-theme='light']) .flatpickr-am-pm:focus {
    background: var(--md-sys-color-surface-container-high);
  }

  :root:not([data-theme='light']) .flatpickr-time .numInputWrapper span {
    border-color: var(--md-sys-color-outline-variant);
  }

  :root:not([data-theme='light']) .numInputWrapper span:hover {
    background: var(--md-sys-color-surface-container-high);
  }

  :root:not([data-theme='light']) .numInputWrapper span:active {
    background: var(--md-sys-color-surface-container-highest);
  }

  :root:not([data-theme='light']) .flatpickr-time .numInputWrapper span.arrowUp:after {
    border-bottom-color: var(--md-sys-color-on-surface-variant);
  }

  :root:not([data-theme='light']) .flatpickr-time .numInputWrapper span.arrowDown:after {
    border-top-color: var(--md-sys-color-on-surface-variant);
  }
}

.app-shell {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
}

.app-content {
  flex: 1;
  min-width: 0;
  padding: 16px;
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
}

/* --- Seitenleiste --- */

.sidebar {
  display: flex;
  flex-direction: column;
  width: 280px;
  flex-shrink: 0;
  background: var(--md-sys-color-surface-container);
  border-right: 1px solid var(--md-sys-color-outline-variant);
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 8px 8px 8px 16px;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  font-weight: 500;
}

.sidebar__brand-logo {
  height: 24px;
  width: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  font-size: 0.9rem;
}

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

.sidebar__link--active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.sidebar__link--muted {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.85rem;
}

.sidebar__section {
  margin-top: 8px;
}

.sidebar__section-header {
  display: block;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--md-sys-color-on-surface-variant);
}

.sidebar__section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 4px;
}

.sidebar__section-header-row .sidebar__section-header {
  padding-right: 0;
}

/* Klickbarer Wrapper aus Pfeil + Überschrift zum Ein-/Ausklappen eines ganzen
   Abschnitts (aktuell: Gespeicherte Filter) - anders als .tree-item__toggle (klappt
   nur die Kinder EINES Knotens ein) hier für eine komplette Seitenleisten-Sektion. */
.sidebar__section-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  min-width: 0;
}

.sidebar__section-toggle .sidebar__section-header {
  padding-left: 0;
}

.sidebar__section-toggle-icon {
  flex-shrink: 0;
  color: var(--md-sys-color-on-surface-variant);
  transition: transform 0.15s ease;
}

.sidebar__section-toggle--collapsed .sidebar__section-toggle-icon {
  transform: rotate(-90deg);
}

.sidebar__section-action {
  width: 24px;
  height: 24px;
  color: var(--md-sys-color-on-surface-variant);
}

.sidebar__section-action--add {
  width: 32px;
  height: 32px;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.sidebar__section-action--add:hover {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.tree-item {
  display: flex;
  align-items: center;
  border-radius: 8px;
}

.tree-item__toggle,
.tree-item__toggle-spacer {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-left: 2px;
}

.tree-item__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  border-radius: 4px;
  transition: transform 0.15s ease;
}

.tree-item__toggle:hover {
  background: var(--md-sys-color-surface-container-highest);
}

/* Standardstellung ist "ausgeklappt" (Pfeil zeigt nach unten) - eingeklappt dreht
   sich der Pfeil nach rechts statt ein zweites Icon nachzuladen. */
.tree-item__toggle--collapsed svg {
  transform: rotate(-90deg);
}

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

.tree-item:hover .tree-item__star {
  opacity: 1;
}

.tree-item__link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  /* Links davon steht jetzt immer ein Ein-/Ausklapp-Pfeil oder sein Platzhalter
     (siehe .tree-item__toggle/-spacer oben) - das eigene linke Padding kann darum
     knapper ausfallen als früher, wo die Verschachtelung direkt hier ansetzte. */
  padding: 6px 4px 6px 4px;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  font-size: 0.9rem;
}

.tree-item__icon {
  font-size: 18px;
  color: var(--md-sys-color-primary);
  flex-shrink: 0;
}

.tree-item__title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-item__star-form {
  display: flex;
}

.tree-item__star {
  background: none;
  border: none;
  padding: 6px 12px 6px 4px;
  display: flex;
  cursor: pointer;
  color: var(--md-sys-color-outline-variant);
  opacity: 0;
}

.tree-item__star--active {
  color: #f2b705;
  opacity: 1;
}

.tree-item__star .material-symbols-rounded {
  font-size: 18px;
}

.tree-item__edit {
  width: 28px;
  height: 28px;
  padding: 5px;
  opacity: 0;
  flex-shrink: 0;
}

.tree-item:hover .tree-item__edit {
  opacity: 1;
}

.tree-item__emoji {
  display: inline-block;
  width: 16px;
  flex-shrink: 0;
  font-size: 0.9rem;
  line-height: 1;
  text-align: center;
}

/* Nur bei Hover/Fokus sichtbar, wie .tree-item__star daneben - rechts ausgerichtet
   durch die normale Flex-Reihenfolge (.tree-item__link hat flex:1 und nimmt den
   übrigen Platz, Stern und Griff bleiben als letzte Flex-Items am Ende der Zeile). */
.tree-item__drag-handle {
  display: flex;
  align-items: center;
  padding: 6px 8px 6px 4px;
  color: var(--md-sys-color-outline-variant);
  opacity: 0;
  cursor: grab;
  flex-shrink: 0;
}

.tree-item:hover .tree-item__drag-handle {
  opacity: 1;
}

.tree-item__drag-handle:active {
  cursor: grabbing;
}

.sidebar__footer {
  padding: 8px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

.sidebar__footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 4px 0;
}

.sidebar__user {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-mobile-bar {
  display: none;
}

/* Einklappbare Seitenleiste (Desktop): eigenständig vom mobilen Off-Canvas-Menü
   oben (das schon per Default eingeklappt ist) - deshalb strikt auf Breiten
   oberhalb des mobilen Breakpoints beschränkt, damit sich beide Mechanismen
   nicht in die Quere kommen. Zustand lebt im data-sidebar-Attribut auf <html>,
   siehe core/js/app.js::toggleSidebarCollapse und das Inline-Script in base.html. */
/* .icon-btn.sidebar-expand-btn (zwei Klassen) statt nur .sidebar-expand-btn:
   controls.css lädt nach app.css, .icon-btns eigenes "display: inline-flex"
   hätte bei gleicher Spezifität (je eine Klasse) sonst gewonnen und den Button
   trotz display:none hier sichtbar gelassen - dieselbe Kaskaden-Falle wie schon
   bei den Flatpickr-Overrides. */
.icon-btn.sidebar-expand-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 15;
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
}

@media (min-width: 881px) {
  html[data-sidebar='collapsed'] .sidebar {
    display: none;
  }

  html[data-sidebar='collapsed'] .icon-btn.sidebar-expand-btn {
    display: flex;
  }
}

@media (max-width: 880px) {
  /* .app-shell ist sonst eine Row-Flexbox (Sidebar neben Content) - die mobile
     Leiste war dadurch selbst ein Row-Flex-Item und wurde per Default-Stretch
     auf die volle Höhe des Contents gezogen (title/hamburger dadurch vertikal
     mittig in einer hohen, schmalen Spalte statt in einer normalen Kopfzeile). */
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 30;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.3);
  }

  .sidebar.sidebar--open {
    transform: translateX(0);
  }

  /* Die Desktop-Einklapp-Funktion ist hier ohne Wirkung (siehe @media (min-width:
     881px) oben) - der Button im Header wäre also nur verwirrend, da die mobile
     Schublade bereits über den Hamburger in .app-mobile-bar bzw. das Antippen
     des Backdrops geschlossen wird. Zwei Klassen im Selektor aus demselben Grund
     wie bei .icon-btn.sidebar-expand-btn oben (Kaskaden-Gleichstand mit .icon-btn
     aus controls.css, das nach app.css lädt). */
  .icon-btn.sidebar__collapse-btn {
    display: none;
  }

  .app-mobile-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--md-sys-color-surface-container);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .app-mobile-bar__title {
    font-weight: 500;
  }

  .app-sidebar-backdrop {
    display: none;
  }

  .app-sidebar-backdrop.app-sidebar-backdrop--open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 20;
  }
}

/* Suchleisten-Button oben in der Seitenleiste (core/_sidebar.html) - öffnet dasselbe
   Overlay wie Strg/Cmd+K (core/js/app.js::openSearch), sieht aber wie ein
   Sucheingabefeld aus statt wie ein normaler Nav-Link, damit die Funktion auch ohne
   das Tastenkürzel zu kennen auffindbar ist. */
.sidebar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 8px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
}

.sidebar__search:hover {
  background: var(--md-sys-color-surface-container-highest);
}

.sidebar__search span:first-of-type {
  flex: 1;
}

.sidebar__search-kbd {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--md-sys-color-surface-container-highest);
  font-size: 0.7rem;
}

/* Such-Overlay (Strg/Cmd+K bzw. .sidebar__search) - fixed statt Teil des normalen
   Layoutflusses, damit es unabhängig von Sidebar-Zustand/Scrollposition immer
   mittig-oben über allem liegt. */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
  background: rgba(0, 0, 0, 0.4);
}

/* Derselbe Kaskaden-Fall wie .icon-btn[hidden] weiter oben: "display: flex" aus dem
   Autoren-Stylesheet gewinnt sonst gegen das "display: none" aus dem hidden-Attribut
   (nur User-Agent-Stylesheet) - das Overlay blieb dadurch trotz hidden dauerhaft
   sichtbar, unabhängig vom JS-Toggle in openSearch/closeSearch. */
.search-overlay[hidden] {
  display: none;
}

.search-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 70vh;
  background: var(--md-sys-color-surface-container);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.search-modal__input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  flex-shrink: 0;
}

.search-modal__icon {
  color: var(--md-sys-color-on-surface-variant);
  flex-shrink: 0;
}

.search-modal__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 1rem;
  color: var(--md-sys-color-on-surface);
  outline: none;
}

.search-modal__results {
  overflow-y: auto;
  padding: 8px;
}

.search-modal__group {
  margin-bottom: 8px;
}

.search-modal__group-label {
  display: block;
  padding: 6px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--md-sys-color-on-surface-variant);
}

.search-modal__result {
  border-radius: 8px;
  padding: 8px;
}

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

.search-modal__result-meta {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--md-sys-color-on-surface-variant);
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.header-row h1,
.header-row h2 {
  margin: 0;
}

/* surface-container statt surface-container-low, dazu ein Hauch Schattenwurf (kein
   Rahmen, keine Trennlinie) - das reicht im Hellmodus ohnehin, gibt Karten im
   Dunkelmodus aber überhaupt erst eine erkennbare Kante gegenüber dem Seitenhintergrund. */
.card {
  background: var(--md-sys-color-surface-container);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 1px 3px rgba(0, 0, 0, 0.2);
}

.login-card {
  max-width: 400px;
  margin: 48px auto;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.form-row label {
  font-size: 0.85rem;
  color: var(--md-sys-color-on-surface-variant);
}

.form-row--inline {
  flex-direction: row;
  align-items: center;
}

/* Schalter (.switch) + separates Text-<span> statt Text im <label> selbst (siehe
   tasks/list.html, tasks/table.html, filters/edit.html) - der 4px-Standardabstand
   von .form-row reicht für Checkbox+Text in einem <label> (via ".form-row--inline
   label" oben), wirkt neben dem breiteren Schalter aber zu eng. */
.form-row--inline:has(.switch) {
  gap: 12px;
}

.form-row--inline label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--md-sys-color-on-surface);
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-state {
  text-align: center;
  color: var(--md-sys-color-on-surface-variant);
  padding: 32px 0;
}

.error-text {
  color: var(--md-sys-color-error);
}

.success-text {
  color: var(--md-sys-color-primary);
}

.hint {
  font-size: 0.85rem;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 12px;
}

/* Einmalige Klartext-Anzeige eines neu erstellten API-/CalDAV-Tokens (preferences/
   templates/preferences/account.html) - deutlich auffälliger als eine normale
   Erfolgsmeldung im Fließtext, mit eigenem Kopieren-Button statt den Text von Hand
   markieren zu müssen. */
.token-reveal {
  padding: 12px;
  margin-bottom: 12px;
  background: var(--md-sys-color-primary-container);
  border-radius: 8px;
}

.token-reveal__hint {
  font-size: 0.85rem;
  color: var(--md-sys-color-on-primary-container);
  margin: 0 0 8px;
}

.token-reveal__row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.token-reveal__value {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  padding: 8px 12px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  border-radius: 4px;
  font-size: 0.85rem;
}

.admin-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-stat {
  flex: 1;
  min-width: 120px;
  text-align: center;
}

.admin-stat__value {
  display: block;
  font-size: 2rem;
  font-weight: 500;
}

.admin-stat__label {
  display: block;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.85rem;
}

/* --- Tabelle --- */

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--md-sys-color-surface-container);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.data-table th a {
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table tr.done td:nth-child(2) a {
  text-decoration: line-through;
  color: var(--md-sys-color-on-surface-variant);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.task-feed {
  margin-top: 16px;
}

.range-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

/* --- Kanban --- */

.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: flex-start;
}

.kanban-column {
  flex: 0 0 260px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 140px);
}

.kanban-column__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-weight: 500;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.kanban-column__count {
  font-size: 0.8rem;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container-high);
  border-radius: 999px;
  padding: 1px 8px;
}

.kanban-column__header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.kanban-column__menu {
  position: relative;
}

.kanban-column__menu > summary {
  list-style: none;
  font-size: 1.1rem;
  line-height: 1;
}

.kanban-column__menu > summary::-webkit-details-marker {
  display: none;
}

.kanban-column__menu-panel {
  position: absolute;
  z-index: 30;
  top: 100%;
  right: 0;
  margin-top: 4px;
  width: 240px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 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);
}

.kanban-column__menu-panel .btn-text {
  justify-content: flex-start;
  padding-left: 4px;
}

.kanban-column--add {
  flex: 0 0 260px;
  display: flex;
  align-items: flex-start;
  padding: 8px;
}

.kanban-column--add form {
  display: flex;
  gap: 4px;
  width: 100%;
}

.kanban-column--add .text-field {
  flex: 1;
}

.kanban-column__body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

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

.kanban-card {
  background: var(--md-sys-color-surface-container);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card__title {
  font-size: 0.9rem;
}

.kanban-card__due {
  font-size: 0.75rem;
  color: var(--md-sys-color-on-surface-variant);
}
