/*
 * FantiDo – Stylesheet.
 * Abschnitt 1: übernommene Seiten-Komponenten (Details, Projekte, Kalender, Einstellungen).
 * Abschnitt 2: Design-System und neue Oberfläche (überschreibt Abschnitt 1 bei Bedarf).
 */

.stack-sm { display: flex; flex-direction: column; gap: var(--space-3); }
.inline-actions, .split-row, .inline-form { display: flex; align-items: center; gap: var(--space-2); }
.split-row { justify-content: space-between; }
.dashboard-section, .task-section { margin-bottom: var(--space-8); }
.task-section h2 { border-bottom: 1px solid var(--color-border); padding-bottom: var(--space-2); }
.priority-badge, .tag-chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 7px; font-size: .72rem; }
.priority-badge.priority-low { color: var(--color-text-muted); background: var(--color-surface-hover); }
.priority-badge.priority-normal { color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 12%, transparent); }
.priority-badge.priority-high { color: var(--color-warning); background: color-mix(in srgb, var(--color-warning) 14%, transparent); }
.priority-badge.priority-critical { color: var(--color-danger); background: color-mix(in srgb, var(--color-danger) 14%, transparent); }
.tag-chip { color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 10%, transparent); }
.subtask-count { color: var(--color-text-muted); }
.task-edit-form { max-width: 720px; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.list-card { display: block; }
.list-card-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.list-card h2 { font-size: 1rem; }
.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  overflow-wrap: anywhere;
}
.project-grid > .card + .card { margin-top: 0; }
.project-card:hover, .project-card:focus-within { border-color: var(--color-primary); }
.project-card-header { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.project-card-status { padding: 2px 8px; border-radius: 999px; background: var(--color-surface-hover); color: var(--color-text-muted); font-size: .75rem; font-weight: 600; }
.project-card-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 1.125rem; margin: 0; }
.project-card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-lg); }
.project-card-link:focus-visible { outline: none; }
.project-card-link:focus-visible::after { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.project-card-description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; color: var(--color-text-muted); font-size: .875rem; margin: 0; }
.project-card-metadata { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-3); margin: 0; font-size: .8125rem; }
.project-card-metadata dt { color: var(--color-text-muted); }
.project-card-metadata dd { margin: var(--space-1) 0 0; }
.project-card-tasks { margin-top: auto; }
.project-card-task-heading { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.project-card-open { margin: 0; font-size: .875rem; }
.project-card-open strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.project-card-percentage { flex-shrink: 0; font-size: .875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.project-card-completion { margin: var(--space-2) 0 0; font-size: .8125rem; }
.project-card-scope { margin: var(--space-1) 0 0; font-size: .75rem; color: var(--color-text-muted); }
.project-card-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-2); border-top: 1px solid var(--color-border); padding-top: var(--space-3); }
.project-card-members { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
.project-card-member-count { color: var(--color-text-muted); font-size: .8125rem; }
.project-card .avatar-stack { margin: 0; }
.project-card .avatar-more { width: auto; min-width: 28px; padding-inline: 5px; }
.project-card-edit { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding-inline: var(--space-2); border-radius: var(--radius-sm); color: var(--color-primary); font-size: .8125rem; font-weight: 600; }
.project-card-edit:hover { background: var(--color-primary-soft); }
@media (min-width: 768px) and (max-width: 1199px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.project-hero { display: flex; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-6); }
.project-progress-large { min-width: 220px; }
.button-row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.detail-back { margin-bottom: var(--space-4); color: var(--color-text-muted); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--space-4); margin-bottom: var(--space-4); }
.detail-split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-4); }
.detail-section { margin-bottom: var(--space-4); }
.detail-description h2, .subtasks-section h2 { font-size: 1rem; }
.detail-properties dl { display: grid; grid-template-columns: 1fr; gap: var(--space-1); margin: 0; }
.detail-properties dt { color: var(--color-text-muted); font-size: .75rem; margin-top: var(--space-2); }
.detail-properties dd { margin: 0; }
.detail-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.empty-state-icon { font-size: 1.5rem; }
.comment-list { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); }
.comment-card { padding: var(--space-4); }
.comment-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.comment-body p:last-child { margin-bottom: 0; }
.attachment-upload-form { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-4); }
.attachment-upload-form input[type="file"] { max-width: 100%; }
.attachment-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); }
.attachment-card { display: flex; flex-direction: column; gap: var(--space-3); }
.attachment-preview { border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface-hover); min-height: 140px; display: flex; align-items: center; justify-content: center; }
.attachment-preview img { width: 100%; height: 160px; object-fit: cover; display: block; }
.attachment-icon { font-size: 1rem; font-weight: 700; color: var(--color-text-muted); }
.attachment-meta { display: flex; flex-direction: column; gap: var(--space-2); }
.timeline-bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(32px, 1fr)); gap: var(--space-2); align-items: end; min-height: 220px; }
.timeline-bar { display: flex; flex-direction: column; gap: var(--space-2); align-items: center; min-width: 0; }
.timeline-columns { display: flex; align-items: end; justify-content: center; gap: 4px; height: 180px; width: 100%; }
.timeline-column { width: 8px; border-radius: 999px; background: var(--color-surface-hover); }
.timeline-column.created { background: color-mix(in srgb, var(--color-primary) 55%, white); }
.timeline-column.completed { background: var(--color-success); }
.timeline-column.due { background: var(--color-warning); }
.settings-form, .profile-form { display: flex; flex-direction: column; gap: var(--space-4); }
.settings-stack { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-4); }
.generated-token code, .api-code-block { display: block; overflow-x: auto; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--color-surface-hover); border: 1px solid var(--color-border); margin: var(--space-2) 0 0; }
.token-row { padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); }
.danger-zone {
  margin-top: var(--space-6);
  border-color: color-mix(in srgb, var(--color-danger) 45%, var(--color-border));
  background: color-mix(in srgb, var(--color-danger) 4%, var(--color-surface));
}
.shortcut-grid { display: grid; gap: var(--space-2); }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.search-result-row { padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
.plain-list { margin: 0; padding-left: 1.2rem; }
.template-card { display: flex; flex-direction: column; gap: var(--space-3); }
.template-use-form { margin-top: auto; }
.planned-item-row, .compact-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.planned-item-row { padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.focus-timer-values { text-align: right; }
.focus-timer-values strong { display: block; font-size: 2rem; }
.tag-chip-warning { background: color-mix(in srgb, var(--color-warning) 14%, transparent); color: var(--color-warning); }
@media (max-width: 767px) {
.form-grid, .detail-grid, .detail-split-grid, .project-grid { grid-template-columns: 1fr; }
.project-hero { flex-direction: column; }
.project-progress-large { min-width: 0; }
.search-form, .inline-form, .attachment-upload-form { flex-wrap: wrap; }
.search-form input, .inline-form select, .attachment-upload-form input[type="file"] { flex-basis: 100%; }
.detail-actions { width: 100%; }
.detail-actions .button { flex: 1; }
}
@media (max-width: 767px) {
.planned-item-row, .compact-row { align-items: flex-start; flex-direction: column; }
.focus-timer-values { text-align: left; }
}
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); }
.calendar-toolbar > div { display: flex; align-items: center; gap: var(--space-2); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--color-border); border-left: 1px solid var(--color-border); }
.calendar-cell { min-height: 110px; padding: var(--space-2); border-right: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); background: var(--color-surface); }
.calendar-cell.is-today { background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface)); }
.calendar-date { color: var(--color-text-muted); font-size: .8rem; margin-bottom: var(--space-2); }
.calendar-task { display: block; padding: 3px 5px; margin-bottom: 3px; border-radius: 4px; background: var(--color-surface-hover); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-more { font-size: .72rem; color: var(--color-primary); }
.calendar-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--space-2); }
.calendar-day { min-height: 300px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: var(--space-3); }
.calendar-day h2 { font-size: .85rem; }
.calendar-day h2 small { color: var(--color-text-muted); margin-left: .25rem; }
.calendar-day-view { max-width: 700px; }
.reminder-row { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3); background: var(--color-surface); border: 1px solid var(--color-border); }
.reminder-row.compact { justify-content: space-between; padding-inline: 0; border: 0; background: transparent; }
.reminder-row span { color: var(--color-text-muted); }
.activity-row { display: flex; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
.activity-row small { display: block; color: var(--color-text-muted); }
@media (max-width: 767px) {
.calendar-toolbar { align-items: flex-start; flex-direction: column; }
.calendar-view-links { width: 100%; overflow-x: auto; }
.calendar-grid { font-size: .7rem; }
.calendar-cell { min-height: 64px; padding: 3px; }
.calendar-task { width: 8px; height: 8px; padding: 0; border-radius: 50%; text-indent: -9999px; }
.calendar-week { overflow-x: auto; grid-template-columns: repeat(7, minmax(130px, 1fr)); }
}
.notification-row.is-unread {
  border-left: 3px solid var(--color-primary);
  padding-left: var(--space-3);
}
.settings-stack {
  margin-top: var(--space-6);
}
.inline-form {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.token-row,
.notification-row {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}
.token-row:last-child,
.notification-row:last-child {
  border-bottom: 0;
}


/*
 * FantiDo – ruhiges, aufgabenorientiertes Interface.
 * Aufbau: Design-Tokens → Basis → Layout → Komponenten → Seiten → Responsive.
 * Die wichtigste Information (heutige Aufgaben) bekommt immer das stärkste visuelle Gewicht.
 */

:root {
  --color-background: #f5f6f8;
  --color-surface: #ffffff;
  --color-surface-hover: #f0f1f4;
  --color-text: #1b1e27;
  --color-text-muted: #667085;
  --color-border: #e5e7ec;
  --color-primary: #4a57d6;
  --color-primary-hover: #3e49bd;
  --color-primary-contrast: #ffffff;
  --color-primary-soft: color-mix(in srgb, var(--color-primary) 10%, transparent);
  --color-danger: #d9382f;
  --color-warning: #c77a0a;
  --color-success: #168a4a;
  --color-xp: #2a9d8f;
  --color-priority-high: #e0463d;
  --color-priority-normal: #e6a117;
  --color-priority-low: #b6bcc8;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 10px 30px rgba(16, 24, 40, 0.12);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --header-height: 56px;
  --sidebar-width: 248px;
  --bottom-nav-height: 64px;
}

[data-theme="dark"] {
  --color-background: #101216;
  --color-surface: #171a20;
  --color-surface-hover: #20242c;
  --color-text: #eceef2;
  --color-text-muted: #98a0ae;
  --color-border: #272b34;
  --color-primary: #8b95f5;
  --color-primary-hover: #a6aefa;
  --color-primary-contrast: #101216;
  --color-danger: #f0675e;
  --color-warning: #e0a03a;
  --color-success: #3dbd78;
  --color-xp: #4cc2b2;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --color-background: #101216;
    --color-surface: #171a20;
    --color-surface-hover: #20242c;
    --color-text: #eceef2;
    --color-text-muted: #98a0ae;
    --color-border: #272b34;
    --color-primary: #8b95f5;
    --color-primary-hover: #a6aefa;
    --color-primary-contrast: #101216;
    --color-danger: #f0675e;
    --color-warning: #e0a03a;
    --color-success: #3dbd78;
    --color-xp: #4cc2b2;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
  }
}

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

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

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  background: var(--color-background);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body[data-connection="offline"] .connection-banner { display: flex; }

a { color: inherit; text-decoration: none; }
button { font: inherit; }
img { max-width: 100%; }

h1, h2, h3, h4 { margin: 0 0 var(--space-2); font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 var(--space-3); }

:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: var(--radius-sm); }

summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--color-surface); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }

.eyebrow { color: var(--color-text-muted); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: var(--space-1); }
.muted { color: var(--color-text-muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.block { display: block; }
.wrap { flex-wrap: wrap; }
.link-subtle { color: var(--color-text-muted); font-size: 0.85rem; }
.link-subtle:hover { color: var(--color-primary); }
.count { display: inline-block; min-width: 1.4em; padding: 0 6px; border-radius: 999px; background: var(--color-surface-hover); color: var(--color-text-muted); font-size: 0.75rem; font-weight: 600; text-align: center; vertical-align: middle; }

/* ---------- Layout ---------- */

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

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: var(--space-6) var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.app-brand { display: inline-flex; align-items: center; gap: 8px; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.brand-icon { display: block; width: 30px; height: 30px; flex: none; }
.app-nav { display: flex; flex-direction: column; gap: 2px; }
.app-nav-section { margin-top: var(--space-4); display: flex; flex-direction: column; gap: 2px; }
.app-nav-section h2 { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); padding: 0 12px; margin-bottom: 4px; font-weight: 600; }

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--color-text-muted);
  font-weight: 500;
  transition: background-color 0.12s, color 0.12s;
}
.app-nav-link:hover { background: var(--color-surface-hover); color: var(--color-text); }
.app-nav-link.is-active { background: var(--color-primary-soft); color: var(--color-primary); font-weight: 600; }
.nav-icon { width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--color-primary); color: var(--color-primary-contrast); border-radius: 999px; padding: 0 7px; font-size: 0.72rem; font-weight: 600; }

.sidebar-footer { margin-top: auto; border-top: 1px solid var(--color-border); padding-top: var(--space-3); display: flex; flex-direction: column; gap: 2px; }
.sidebar-footer form, .more-sheet form { margin: 0; }
.button-reset { background: none; border: 0; width: 100%; text-align: left; cursor: pointer; font: inherit; }

.command-palette-trigger { align-self: flex-start; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: transparent; color: var(--color-text-muted); padding: 4px 10px; font-size: 0.75rem; cursor: pointer; }

.app-main { flex: 1; min-width: 0; }
.app-content { padding: var(--space-8) var(--space-8) 96px; max-width: 1080px; width: 100%; margin: 0 auto; }

.mobile-header, .bottom-nav { display: none; }

.auth-layout { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-6); gap: var(--space-4); }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
.auth-brand .brand-icon { width: 38px; height: 38px; }
.auth-card { width: min(420px, 100%); padding: var(--space-6); }
.auth-card h1 { font-size: 1.5rem; }
.auth-links { margin: var(--space-4) 0 0; text-align: center; font-size: 0.9rem; color: var(--color-text-muted); }
.auth-links a:hover { color: var(--color-primary); }

.page-heading, .section-heading, .detail-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap; }
.page-heading h1, .section-heading h2, .detail-header h1 { margin-bottom: 0; }
.section-heading { margin-bottom: var(--space-3); }
.section-title { margin: var(--space-8) 0 var(--space-3); }

/* ---------- Komponenten ---------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-4);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--space-4); }
.form-card { max-width: 640px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-4); }
.card-grid > .card + .card { margin-top: 0; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 42px;
  padding: 0 var(--space-4);
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}
.button:hover { background: var(--color-primary-hover); }
.button.button-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.button.button-secondary:hover { background: var(--color-surface-hover); }
.button.button-danger { background: transparent; color: var(--color-danger); border-color: color-mix(in srgb, var(--color-danger) 35%, var(--color-border)); }
.button.button-danger:hover { background: color-mix(in srgb, var(--color-danger) 10%, transparent); }
.button-block { width: 100%; }

.icon-btn, .icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1.05rem;
  padding: 0 8px;
}
.icon-btn:hover, .icon-button:hover { background: var(--color-surface-hover); color: var(--color-text); }
.icon-btn.is-active { color: var(--color-priority-normal); }

.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--color-surface-hover); color: var(--color-text-muted); }
.badge-success { background: color-mix(in srgb, var(--color-success) 14%, transparent); color: var(--color-success); }
.badge-primary { background: var(--color-primary-soft); color: var(--color-primary); }
.badge-muted { background: var(--color-surface-hover); color: var(--color-text-muted); }

.progress-track { background: var(--color-surface-hover); border-radius: 99px; height: 8px; overflow: hidden; margin: var(--space-2) 0; }
.progress-track span { display: block; height: 100%; background: var(--color-primary); border-radius: inherit; transition: width 0.4s ease; }
.progress-xp span { background: var(--color-xp); }

/* Formulare */

.field { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }
.field label, .field .label { font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea,
.recurrence-row input, .recurrence-row select, .search-form input[type="search"], .sort-form select {
  padding: 10px 12px;
  min-height: 42px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  max-width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--color-primary); outline-offset: 0; border-color: transparent; }
.field > input:not([type="checkbox"]):not([type="radio"]), .field > select, .field > textarea { width: 100%; min-width: 0; }
.input-lg { font-size: 1.15rem !important; padding: 14px 16px !important; }
.input-sm { width: 76px; }
.stack-form { display: flex; flex-direction: column; gap: var(--space-3); }
.stack-form .field { margin-bottom: 0; }
.form-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-4); }
.form-errors { color: var(--color-danger); background: color-mix(in srgb, var(--color-danger) 10%, transparent); padding: var(--space-3); border-radius: var(--radius-sm); margin-bottom: var(--space-3); }
.advanced-options { margin: var(--space-2) 0 var(--space-2); border-top: 1px solid var(--color-border); padding-top: var(--space-2); }
.advanced-options > summary { color: var(--color-text-muted); font-size: 0.9rem; font-weight: 500; padding: 8px 0; }
.advanced-options > summary::before { content: "＋ "; }
.advanced-options[open] > summary::before { content: "－ "; }
.advanced-options > .stack-form, .advanced-options > .field { padding-top: var(--space-2); }

.chip-group { display: flex; flex-wrap: wrap; gap: var(--space-2); border: 0; padding: 0; margin: 0 0 var(--space-4); min-width: 0; }
.chip-choice { position: relative; }
.chip-choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip-choice span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-surface); font-size: 0.92rem; font-weight: 500; transition: background-color 0.12s, border-color 0.12s; }
.chip-choice input:checked + span { background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-primary); font-weight: 600; }
.chip-choice input:focus-visible + span { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.recurrence-row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.recurrence-custom { display: inline-flex; align-items: center; gap: 6px; }
.recurrence-custom[hidden] { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.form-grid .field { margin-bottom: var(--space-3); }
.checkbox-label { display: inline-flex; align-items: center; gap: var(--space-2); margin-right: var(--space-3); color: var(--color-text); min-height: 32px; }

/* Toasts */

#flash { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 60; width: min(480px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.auth-layout #flash { position: static; transform: none; width: min(420px, 100%); }
.flash { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 12px 16px; border-radius: var(--radius-md); font-size: 0.95rem; background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-md); pointer-events: auto; animation: soft-pop 0.25s ease-out; }
.flash-close { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1.1rem; padding: 0 4px; }
.flash-notice { border-color: color-mix(in srgb, var(--color-success) 35%, var(--color-border)); }
.flash-alert { border-color: color-mix(in srgb, var(--color-danger) 45%, var(--color-border)); color: var(--color-danger); }
.flash-reward { border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border)); background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface)); font-weight: 600; }

@keyframes soft-pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }

.connection-banner { display: none; align-items: center; justify-content: center; gap: var(--space-2); background: color-mix(in srgb, var(--color-warning) 18%, var(--color-surface)); color: var(--color-text); padding: var(--space-2) var(--space-4); font-size: 0.9rem; }
.loading-indicator { position: fixed; top: 0; left: 0; height: 3px; width: 100%; background: linear-gradient(90deg, var(--color-primary), transparent); animation: loading-slide 1s linear infinite; z-index: 100; }
@keyframes loading-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.empty-state { text-align: center; padding: var(--space-8) var(--space-4); color: var(--color-text-muted); }
.empty-state h2 { color: var(--color-text); font-size: 1.2rem; }
.empty-state-icon { font-size: 2.2rem; margin-bottom: var(--space-2); }
.empty-state .button { margin-top: var(--space-2); }
.card > .empty-state { padding: var(--space-6) var(--space-4); }

/* Dialoge */

.modal-dialog { width: min(560px, calc(100% - 24px)); max-height: 92vh; overflow: auto; border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 0; background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-md); }
.modal-dialog[open] { animation: soft-pop 0.18s ease-out; }
.modal-dialog::backdrop { background: rgba(16, 18, 24, 0.45); }
.modal-content { padding: var(--space-4) var(--space-6) var(--space-6); }
.modal-content .section-heading { margin-bottom: var(--space-3); }
.shortcut-grid { display: grid; gap: var(--space-2); }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
kbd { border: 1px solid var(--color-border); border-bottom-width: 2px; border-radius: var(--radius-sm); padding: 2px 8px; font-size: 0.75rem; background: var(--color-surface-hover); color: var(--color-text-muted); }

.command-palette { width: min(560px, calc(100% - 2rem)); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); padding: var(--space-3); box-shadow: var(--shadow-md); }
.command-palette::backdrop { background: rgba(0, 0, 0, 0.3); }
.command-palette input { width: 100%; padding: var(--space-3); border: 0; border-bottom: 1px solid var(--color-border); background: transparent; color: inherit; font: inherit; }
.command-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-sm); }
.command-item:hover, .command-item:focus { background: var(--color-surface-hover); outline: none; }

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

.task-stack { display: flex; flex-direction: column; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 0 var(--space-4); box-shadow: var(--shadow-sm); }
.card .task-stack, .more-tasks .task-stack, .done-card .task-stack { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
.task-group { margin-bottom: var(--space-6); }
.group-title { display: flex; align-items: center; gap: var(--space-2); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); margin: 0 0 var(--space-2) var(--space-1); }
.group-title.is-overdue { color: var(--color-danger); }

.task-row { position: relative; display: flex; align-items: center; gap: var(--space-3); padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.task-stack > .task-row:last-child, .task-stack > .task-row:only-child { border-bottom: 0; }
.task-row.priority-high::before { content: ""; position: absolute; left: calc(var(--space-4) * -1); top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--color-priority-high); }
.task-row.priority-high .task-title { font-weight: 650; }
.task-row.priority-low .task-title { color: var(--color-text-muted); font-weight: 450; }
.task-row.is-completed .task-title { text-decoration: line-through; color: var(--color-text-muted); font-weight: 450; }
.task-row.is-completed::before { display: none; }

.task-check-cell { flex: 0 0 auto; }
.task-check-form { display: flex; margin: 0; }
.task-check { position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 2px solid var(--color-border); border-radius: 50%; background: transparent; color: transparent; cursor: pointer; font-size: 0.9rem; font-weight: 700; transition: border-color 0.12s, background-color 0.12s, color 0.12s; }
.task-check::after { content: ""; position: absolute; inset: -8px; }
button.task-check:hover, button.task-check:focus-visible { border-color: var(--color-success); color: var(--color-success); }
.task-check.is-checked { background: var(--color-success); border-color: var(--color-success); color: #fff; }
button.task-check.is-checked:hover { background: transparent; color: var(--color-success); }
.task-row.priority-high button.task-check:not(.is-checked) { border-color: color-mix(in srgb, var(--color-priority-high) 55%, var(--color-border)); }

.task-main { min-width: 0; flex: 1; }
.task-title { display: block; font-size: 1rem; font-weight: 550; overflow-wrap: anywhere; }
.task-title:hover { color: var(--color-primary); }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 2px; font-size: 0.8rem; color: var(--color-text-muted); }
.task-due.is-overdue { color: var(--color-danger); font-weight: 600; }
.meta-priority { color: var(--color-priority-high); font-weight: 600; }
.meta-chip { display: inline-flex; align-items: center; padding: 0 8px; border-radius: 999px; background: var(--color-surface-hover); font-size: 0.75rem; }
.meta-goal { color: var(--color-primary); background: var(--color-primary-soft); }
.chip-link.is-active { background: var(--color-primary-soft); color: var(--color-primary); font-weight: 600; }
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.task-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; opacity: 0.55; transition: opacity 0.12s; }
.task-row:hover .task-actions, .task-actions:focus-within { opacity: 1; }
.task-actions .inline-form { margin: 0; display: flex; }
.row-menu { position: relative; }
.row-menu[open] .menu-panel { display: flex; }
.menu-panel { display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 180px; flex-direction: column; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 4px; }
.menu-panel a, .menu-panel button { display: block; width: 100%; padding: 10px 12px; text-align: left; background: none; border: 0; border-radius: var(--radius-sm); color: var(--color-text); font: inherit; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--color-surface-hover); }
.menu-panel .is-danger { color: var(--color-danger); }
.menu-panel form { margin: 0; }

.filter-bar { display: flex; align-items: center; gap: var(--space-1); margin-bottom: var(--space-4); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-link { white-space: nowrap; color: var(--color-text-muted); padding: 8px 14px; border-radius: 999px; font-weight: 500; font-size: 0.92rem; }
.filter-link:hover { background: var(--color-surface-hover); color: var(--color-text); }
.filter-link.is-active { background: var(--color-text); color: var(--color-surface); }
.filter-link .count { margin-left: 4px; }
.toolbar { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
.search-form { display: flex; align-items: center; gap: var(--space-2); }
.search-form input[type="search"] { flex: 1; min-width: 0; }

/* ---------- Dashboard ---------- */

.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-6); align-items: start; }
.dashboard-main { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.dashboard-main > .card + .card, .dashboard-side > .card + .card { margin-top: 0; }
.dashboard-side { position: sticky; top: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }

.today-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-2); }
.today-header h1 { margin-bottom: 0; font-size: 1.9rem; }

.day-progress { padding: var(--space-3) var(--space-4); }
.day-progress .split-row { margin-bottom: 0; }
.day-progress .progress-track { margin-bottom: 0; }

.focus-card { padding: var(--space-6) var(--space-4) var(--space-3); border-color: color-mix(in srgb, var(--color-primary) 28%, var(--color-border)); background: linear-gradient(180deg, color-mix(in srgb, var(--color-primary) 6%, var(--color-surface)), var(--color-surface) 70%); box-shadow: var(--shadow-md); }
.focus-card h2 { font-size: 1.3rem; }
.focus-card .section-heading { margin-bottom: var(--space-2); }
.focus-card .task-row { padding: 14px 0; }
.focus-card .task-title { font-size: 1.1rem; }

.more-tasks, .done-card { padding: 0 var(--space-4); }
.more-tasks > summary, .done-card > summary { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; min-height: 48px; }
.more-tasks > summary::after, .done-card > summary::after { content: "▾"; color: var(--color-text-muted); transition: transform 0.15s; }
.more-tasks[open] > summary::after, .done-card[open] > summary::after { transform: rotate(180deg); }
.done-card { color: var(--color-text-muted); box-shadow: none; background: transparent; }
.done-card > summary strong { font-weight: 600; }
.more-tasks[open] > summary, .done-card[open] > summary { border-bottom: 1px solid var(--color-border); }

.overdue-card { border-color: color-mix(in srgb, var(--color-danger) 28%, var(--color-border)); padding-top: var(--space-4); }
.overdue-card h2 { color: var(--color-danger); font-size: 1rem; margin-bottom: var(--space-1); }
.inline-details > summary { padding: 12px 0; color: var(--color-text-muted); font-size: 0.9rem; }

.expedition-mini .split-row { margin-bottom: 0; }
.expedition-mini .progress-track { margin: var(--space-3) 0 var(--space-2); }
.expedition-line { margin: var(--space-3) 0 0; line-height: 1.7; }
.expedition-line .is-reached { color: var(--color-text); }
.expedition-line .is-current { color: var(--color-primary); font-weight: 650; }
.streak { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--color-priority-normal) 14%, transparent); font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.level-chip { background: var(--color-primary-soft); color: var(--color-primary); padding: 4px 12px; border-radius: 999px; font-weight: 650; font-size: 0.85rem; }

.goals-mini h2 { margin-bottom: 0; }
.goal-mini-row { display: block; padding: var(--space-2) 0; }
.goal-mini-row strong { font-weight: 550; overflow-wrap: anywhere; }
.goal-mini-row .progress-track { margin-bottom: 0; }

/* ---------- Ziele ---------- */

.goal-card { display: flex; flex-direction: column; gap: 4px; transition: box-shadow 0.15s, transform 0.15s; }
.goal-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.goal-card h2 { margin: 0; overflow-wrap: anywhere; }
.goal-percent { font-weight: 650; color: var(--color-primary); }
.goal-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.goal-meta .is-overdue { color: var(--color-danger); font-weight: 600; }
.goal-percent-lg { font-size: 2rem; letter-spacing: -0.02em; }
.goal-summary { margin-bottom: var(--space-6); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--space-3); margin: var(--space-4) 0; }
.stat { background: var(--color-surface-hover); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; }
.stat strong { font-size: 1.35rem; line-height: 1.2; }
.stat span { color: var(--color-text-muted); font-size: 0.8rem; }

/* ---------- Expedition & Belohnungen ---------- */

.rank-card h2 { font-size: 1.35rem; margin-bottom: 2px; }
.stage-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.stage { position: relative; display: flex; gap: var(--space-4); padding: 0 0 var(--space-4); opacity: 0.6; }
.stage.is-reached { opacity: 1; }
.stage:not(:last-child)::after { content: ""; position: absolute; left: 19px; top: 44px; bottom: 4px; width: 2px; background: var(--color-border); }
.stage.is-reached:not(:last-child)::after { background: var(--color-primary); opacity: 0.45; }
.stage-icon { flex: 0 0 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--color-surface-hover); font-size: 1.2rem; }
.stage.is-current .stage-icon { background: var(--color-primary-soft); box-shadow: 0 0 0 3px var(--color-primary-soft); }
.stage-body { min-width: 0; flex: 1; padding-top: 6px; }
.stage-body p { margin: 0; }
.achievement-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3); }
.achievement { display: flex; gap: var(--space-3); padding: var(--space-3); border: 1px dashed var(--color-border); border-radius: var(--radius-md); opacity: 0.65; }
.achievement.is-unlocked { opacity: 1; border-style: solid; background: var(--color-surface-hover); }
.achievement p { margin: 0; }
.achievement-icon { font-size: 1.5rem; }
.reward-card.is-ready { border-color: color-mix(in srgb, var(--color-success) 45%, var(--color-border)); }
.reward-card.is-redeemed { opacity: 0.6; }
.reward-card h2 { margin-bottom: 2px; }
.reward-card + .reward-card { margin-top: 0; }
.card-list { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-6); }
.card-list > .card + .card { margin-top: 0; }

/* ---------- Admin & Tabellen ---------- */

.table-card { padding: 0; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); padding: 12px 16px; border-bottom: 1px solid var(--color-border); font-weight: 600; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.table-link { font-weight: 600; }
.table-link:hover { color: var(--color-primary); }
.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 24px; margin: 0 0 var(--space-4); }
.detail-list dt { color: var(--color-text-muted); }
.detail-list dd { margin: 0; }
.list-rows { display: flex; flex-direction: column; }
.list-row { display: flex; justify-content: space-between; gap: var(--space-3); padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.list-row:last-child { border-bottom: 0; }
.generated-token { margin-bottom: var(--space-4); border-color: color-mix(in srgb, var(--color-warning) 40%, var(--color-border)); }
.generated-token code { display: block; margin: var(--space-2) 0; padding: var(--space-3); font-size: 1.1rem; background: var(--color-surface-hover); border-radius: var(--radius-sm); overflow-wrap: anywhere; user-select: all; }

/* ---------- Mobile Navigation ---------- */

.bottom-nav-icon { font-size: 1.15rem; line-height: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .dashboard { grid-template-columns: minmax(0, 1fr) 280px; }
  .app-content { padding: var(--space-6) var(--space-6) 96px; }
}

@media (max-width: 767px) {
  html, body { max-width: 100vw; }
  h1 { font-size: 1.5rem; }
  .app-sidebar { display: none; }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--space-4);
    padding-top: env(safe-area-inset-top, 0px);
    background: color-mix(in srgb, var(--color-surface) 92%, transparent);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .app-shell { flex-direction: column; }
  .app-main { width: 100%; }
  .app-content { padding: var(--space-4) var(--space-4) calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 32px); }
  #flash { top: calc(var(--header-height) + 8px); }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    border-top: 1px solid var(--color-border);
    backdrop-filter: blur(12px);
    z-index: 25;
  }
  .bottom-nav-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--bottom-nav-height); font-size: 0.7rem; font-weight: 500; color: var(--color-text-muted); position: relative; }
  .bottom-nav-link.is-active { color: var(--color-primary); font-weight: 650; }
  .bottom-nav-add { justify-self: center; align-self: center; display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 14px; border-radius: 50%; background: var(--color-primary); color: var(--color-primary-contrast); font-size: 2rem; line-height: 1; box-shadow: 0 6px 18px color-mix(in srgb, var(--color-primary) 45%, transparent); }
  .bottom-nav-spacer { display: block; }

  .more-menu { padding: 0; }
  .more-menu > summary { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; height: var(--bottom-nav-height); }
  .more-sheet { position: absolute; right: 8px; bottom: calc(100% + 8px); width: min(260px, calc(100vw - 16px)); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 6px; display: flex; flex-direction: column; max-height: 70vh; overflow-y: auto; }
  .more-sheet a, .more-sheet button { display: block; width: 100%; padding: 12px 14px; text-align: left; background: none; border: 0; border-radius: var(--radius-sm); color: var(--color-text); font: inherit; font-size: 0.95rem; cursor: pointer; }
  .more-sheet a:active, .more-sheet button:active { background: var(--color-surface-hover); }

  .dashboard { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .dashboard-side { position: static; }
  .today-header { align-items: flex-start; }
  .today-header h1 { font-size: 1.55rem; }
  .hide-mobile { display: none !important; }

  .card { padding: var(--space-4); border-radius: var(--radius-md); }
  .focus-card { padding-top: var(--space-4); }
  .task-stack { border-radius: var(--radius-md); }
  .task-row { padding: 14px 0; gap: 12px; }
  .task-check { width: 32px; height: 32px; }
  .task-actions { opacity: 1; }
  .task-title { font-size: 1.02rem; }
  .icon-btn, .icon-button { min-width: 40px; height: 40px; }

  .page-heading { align-items: flex-start; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
  .page-heading > .button { width: 100%; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .button { min-height: 46px; }
  .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea,
  .recurrence-row input, .recurrence-row select, .search-form input[type="search"] { font-size: 16px; min-height: 46px; }
  .chip-choice span { min-height: 44px; }

  .task-dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 92dvh; }
  .modal-content { padding: var(--space-4) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom, 0px)); }
  .form-actions .button { flex: 1; }

  .data-table th, .data-table td { padding: 10px 12px; }
  .detail-list { grid-template-columns: 1fr; gap: 0; }
  .detail-list dd { margin-bottom: var(--space-2); }
  .card-grid { grid-template-columns: 1fr; }
  .auth-card { padding: var(--space-4); }
}

/* Formularelemente – einheitliche Design-Tokens und Komponenten */

:root {
  --control-height: 42px;
  --control-radius: 10px;
  --control-pad-x: 12px;
  --color-field-disabled: var(--color-surface-hover);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--color-primary) 28%, transparent);
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
  --icon-calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='3'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
}

/* Gemeinsame Basis für alle Eingabefelder, auch außerhalb von .field */
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
.field select, .field textarea,
.recurrence-row input, .recurrence-row select,
.search-form input[type="search"], .sort-form select,
.inline-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]),
.inline-form select, .stack-sm input[type="datetime-local"], .stack-sm input[type="date"],
select.calendar-filter, .calendar-filter, .task-form select {
  min-height: var(--control-height);
  padding: 9px var(--control-pad-x);
  border: 1px solid var(--color-border);
  border-radius: var(--control-radius);
  background-color: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  max-width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s, background-color 0.12s;
}
.field textarea { min-height: 96px; line-height: 1.45; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--color-text-muted); opacity: 0.8; }

:is(.field input, .field select, .field textarea, .recurrence-row input, .recurrence-row select, .inline-form input, .inline-form select, .stack-sm input, .calendar-filter, .sort-form select):hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
}
:is(.field input, .field select, .field textarea, .recurrence-row input, .recurrence-row select, .inline-form input, .inline-form select, .stack-sm input, .calendar-filter, .sort-form select, .search-form input):focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}
:is(.field input, .field select, .field textarea, .recurrence-row input, .recurrence-row select, .inline-form input, .inline-form select, .stack-sm input, .calendar-filter):disabled {
  background-color: var(--color-field-disabled);
  color: var(--color-text-muted);
  cursor: not-allowed;
  opacity: 0.75;
}
:is(.field input, .field select, .field textarea, .inline-form input, .stack-sm input):is([aria-invalid="true"], :user-invalid),
.field_with_errors :is(input, select, textarea) {
  border-color: var(--color-danger);
}
:is(.field input, .field select, .field textarea, .inline-form input, .stack-sm input):is([aria-invalid="true"], :user-invalid):focus,
.field_with_errors :is(input, select, textarea):focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-danger) 25%, transparent);
}
.field_with_errors { display: contents; }
.field .field-hint, .field small, .field .field-error { font-size: 0.8rem; color: var(--color-text-muted); }
.field .field-error { color: var(--color-danger); }

/* Select-Felder: nativer Dropdown mit einheitlichem Pfeil */
.field select, .recurrence-row select, .inline-form select, .sort-form select, .calendar-filter, .task-form select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: var(--icon-chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.field select option, .inline-form select option { white-space: normal; background: var(--color-surface); color: var(--color-text); }
.field select:invalid { color: var(--color-text-muted); }

/* Datum und Zeit: natives Popup, eigenes Icon im Eingabefeld */
input[type="date"], input[type="datetime-local"], input[type="time"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  min-width: 0;
  color-scheme: light;
  font-variant-numeric: tabular-nums;
  background-image: var(--icon-calendar);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px !important;
}
[data-theme="dark"] input[type="date"], [data-theme="dark"] input[type="datetime-local"], [data-theme="dark"] input[type="time"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] input[type="date"], [data-theme="system"] input[type="datetime-local"], [data-theme="system"] input[type="time"] { color-scheme: dark; }
}
input[type="date"]::-webkit-calendar-picker-indicator, input[type="datetime-local"]::-webkit-calendar-picker-indicator, input[type="time"]::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0 0 0 auto;
  width: 40px;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
input[type="date"]::-webkit-datetime-edit, input[type="datetime-local"]::-webkit-datetime-edit { padding: 0; }
input[type="date"]:disabled, input[type="datetime-local"]:disabled { background-image: var(--icon-calendar); }

/* Checkboxen und Radio-Buttons */
input[type="checkbox"], input[type="radio"] { accent-color: var(--color-primary); width: 18px; height: 18px; flex: 0 0 auto; margin: 0; cursor: pointer; }
.checkbox-label { cursor: pointer; }
.checkbox-label:has(input:disabled), input:disabled + span { cursor: not-allowed; opacity: 0.6; }

/* Tags: ein gemeinsames Aussehen für Übersicht, Detail und Formular */
.tag-chip, .meta-chip.tag-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--color-primary) 22%, transparent);
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
a.tag-chip { text-decoration: none; transition: background-color 0.12s, border-color 0.12s; }
a.tag-chip:hover { background: color-mix(in srgb, var(--color-primary) 18%, transparent); border-color: var(--color-primary); }
.tag-chip-warning { border-color: color-mix(in srgb, var(--color-warning) 30%, transparent); }
.chip-row { min-width: 0; }

.tag-picker { gap: 6px; max-height: 168px; overflow-y: auto; margin: 0; padding: 2px; }
.tag-choice { max-width: 100%; }
.tag-choice span {
  min-height: 32px;
  max-width: 100%;
  padding: 0 12px;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-choice:hover input:not(:checked):not(:disabled) + span { background: var(--color-surface-hover); border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border)); }
.tag-choice input:checked + span::before { content: "✓"; margin-right: 6px; font-weight: 700; }
.chip-choice input:disabled { cursor: not-allowed; }
.chip-choice input:disabled + span { opacity: 0.5; }
.chip-choice input:focus-visible + span { box-shadow: var(--focus-ring); outline: 2px solid var(--color-primary); }

/* Upload-Bereich */
.attachment-upload-form { align-items: stretch; }
.dropzone {
  position: relative;
  display: flex;
  flex: 1 1 280px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 112px;
  padding: var(--space-4);
  border: 1.5px dashed color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  text-align: center;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
.dropzone:hover, .dropzone.is-dragover { background: var(--color-primary-soft); border-color: var(--color-primary); }
.dropzone:focus-within { border-color: var(--color-primary); box-shadow: var(--focus-ring); }
.dropzone-icon { color: var(--color-primary); }
.dropzone-text { font-weight: 600; font-size: 0.92rem; }
.dropzone-file { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82rem; color: var(--color-text-muted); }
.dropzone-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.attachment-upload-form .button { align-self: center; }

/* Datei-Button (Fallback für Datei-Inputs ohne Upload-Bereich) */
input[type="file"]:not(.dropzone-input) { max-width: 100%; font: inherit; color: var(--color-text-muted); }
input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-right: var(--space-3);
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--control-radius);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s;
}
input[type="file"]::file-selector-button:hover { background: var(--color-surface-hover); }

@media (max-width: 720px) {
  .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .field select, .field textarea,
  .inline-form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]), .inline-form select,
  .stack-sm input, .calendar-filter, .sort-form select { font-size: 16px; min-height: 46px; }
  .tag-choice span { min-height: 40px; }
  .dropzone { min-height: 96px; }
  .attachment-upload-form .button { width: 100%; }
}

/* Tag-Eingabe */
.tag-input { position: relative; }
.tag-input-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: var(--control-height); padding: 5px 8px;
  border: 1px solid var(--color-border); border-radius: var(--control-radius);
  background: var(--color-surface); cursor: text;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.tag-input-box:hover { border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border)); }
.tag-input-box:focus-within { border-color: var(--color-primary); box-shadow: var(--focus-ring); }
.tag-input-box .chip-row { gap: 6px; max-width: 100%; }
.tag-input .tag-input-field {
  flex: 1 1 140px; min-width: 120px; min-height: 28px !important; padding: 0 4px !important;
  border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: transparent; color: var(--color-text); font: inherit; outline: none;
}
.tag-chip-removable { padding-right: 2px; min-height: 28px; gap: 2px; }
.tag-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.tag-chip.is-new { border-style: dashed; }
.tag-chip-remove {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 22px; height: 22px; padding: 0; border: 0; border-radius: 999px;
  background: transparent; color: inherit; font-size: 1rem; line-height: 1; cursor: pointer;
}
.tag-chip-remove:hover { background: color-mix(in srgb, var(--color-danger) 16%, transparent); color: var(--color-danger); }
.tag-chip-remove:focus-visible { outline: 2px solid var(--color-primary); }
.tag-suggestions {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 240px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  border: 1px solid var(--color-border); border-radius: var(--control-radius);
  background: var(--color-surface); box-shadow: var(--shadow-md);
}
.tag-suggestions[hidden] { display: none; }
.tag-suggestion { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; min-height: 36px; }
.tag-suggestion.is-active, .tag-suggestion:hover { background: var(--color-primary-soft); }
.tag-suggestion-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-suggestion-badge { flex: 0 0 auto; font-size: 0.7rem; padding: 1px 8px; border-radius: 999px; background: var(--color-surface-hover); color: var(--color-text-muted); }
.tag-suggestion-badge.is-new { background: var(--color-primary-soft); color: var(--color-primary); font-weight: 600; }
.tag-input .field-error[hidden] { display: none; }
.tag-input .field-error { margin: 4px 0 0; }
@media (max-width: 720px) {
  .tag-input .tag-input-field { font-size: 16px; min-height: 36px; }
  .tag-suggestion { min-height: 44px; }
}

/* Projektmitglieder und Avatare */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--color-primary-soft); color: var(--color-primary);
  font-size: 0.7rem; font-weight: 700; border: 2px solid var(--color-surface);
}
.avatar-stack { display: flex; margin: var(--space-2) 0; }
.avatar-stack .avatar { margin-left: -6px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-more { background: var(--color-surface-hover); color: var(--color-text-muted); }
.user-chip .avatar { width: 20px; height: 20px; font-size: 0.6rem; border: 0; margin-right: 6px; background: color-mix(in srgb, var(--color-primary) 18%, transparent); }
.tag-suggestion .avatar { width: 24px; height: 24px; }
.tag-suggestion { justify-content: flex-start; }
.member-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: flex; flex-direction: column; }
.member-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
.member-row .avatar { width: 36px; height: 36px; font-size: 0.8rem; }
.member-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.member-info strong, .member-info .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row form { margin: 0; flex: 0 0 auto; }
.member-add { display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.member-add .tag-input { width: 100%; }
@media (max-width: 720px) { .member-row { flex-wrap: wrap; } .member-add .button { width: 100%; } }
.workspace-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.workspace-card { display: block; }
.workspace-card h2 { font-size: 1rem; margin-bottom: var(--space-1); }
.workspace-stats { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.callout { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--color-primary) 30%, var(--color-border)); background: color-mix(in srgb, var(--color-primary) 7%, transparent); margin-bottom: var(--space-4); }
.callout p { margin: 0; }
/* ---------- Workspace-Navigation ---------- */
.workspace-nav { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.workspace-nav-header { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 12px; }
.workspace-nav-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); font-weight: 600; }
.workspace-nav-title:hover { color: var(--color-text); }
.workspace-nav-add { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; color: var(--color-text-muted); font-weight: 600; }
.workspace-nav-add:hover { background: var(--color-surface-hover); color: var(--color-text); }
.workspace-nav-list { list-style: none; margin: 0; padding: 2px; display: flex; flex-direction: column; gap: 2px; max-height: min(40vh, 320px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.workspace-nav-item { min-width: 0; }
.workspace-nav-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: 7px 10px 7px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.workspace-nav-chip:hover { background: var(--color-surface-hover); color: var(--color-text); }
.workspace-nav-chip.is-active { background: var(--color-primary-soft); border-color: color-mix(in srgb, var(--color-primary) 35%, transparent); color: var(--color-primary); font-weight: 600; }
.workspace-nav-chip-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-nav-badge { flex-shrink: 0; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--color-text-muted) 16%, transparent); color: var(--color-text); font-size: 0.7rem; font-weight: 600; line-height: 1.4; text-align: center; font-variant-numeric: tabular-nums; }
.workspace-nav-chip.is-active .workspace-nav-badge { background: var(--color-primary); color: var(--color-primary-contrast); }
.workspace-nav.is-sorting .workspace-nav-chip { cursor: grabbing; }
.workspace-nav-item.is-dragging { position: relative; z-index: 1; }
.workspace-nav-item.is-dragging .workspace-nav-chip { background: var(--color-surface); border-color: var(--color-primary); color: var(--color-text); box-shadow: 0 6px 18px rgb(0 0 0 / 0.14); }
.workspace-nav-error { margin: 0; padding: 4px 12px; font-size: 0.75rem; color: var(--color-danger); }
.mobile-workspace-nav { display: none; }

@media (max-width: 767px) {
  .mobile-workspace-nav { display: block; border-bottom: 1px solid var(--color-border); background: var(--color-surface); }
  .workspace-nav--mobile .workspace-nav-list { flex-direction: row; gap: 6px; max-height: none; overflow-x: auto; overflow-y: hidden; padding: 8px var(--space-4); scroll-padding-inline: var(--space-4); scrollbar-width: none; }
  .workspace-nav--mobile .workspace-nav-list::-webkit-scrollbar { display: none; }
  .workspace-nav--mobile .workspace-nav-item { flex-shrink: 0; }
  .workspace-nav--mobile .workspace-nav-chip { max-width: 60vw; min-height: 36px; padding: 6px 12px; border-color: var(--color-border); border-radius: 999px; background: var(--color-surface); }
  .workspace-nav--mobile .workspace-nav-chip.is-active { border-color: color-mix(in srgb, var(--color-primary) 45%, transparent); background: var(--color-primary-soft); }
}
.member-role-form { display: flex; align-items: center; gap: var(--space-2); }
@media (max-width: 960px) { .workspace-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .workspace-grid { grid-template-columns: 1fr; } }
.task-blocked-badge { display: inline-flex; align-items: center; width: fit-content; padding: 2px 8px; border: 1px solid color-mix(in srgb, var(--color-warning) 35%, var(--color-border)); border-radius: 999px; background: color-mix(in srgb, var(--color-warning) 10%, transparent); color: var(--color-warning); font-size: .75rem; font-weight: 600; }
.task-check.is-disabled { border-color: color-mix(in srgb, var(--color-warning) 35%, var(--color-border)); color: var(--color-warning); cursor: not-allowed; opacity: .72; }
.task-link-list { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-3) 0; padding: 0; list-style: none; }
.task-link-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2); }
.dependency-section h3 { margin-top: var(--space-4); font-size: .9rem; }
.subtask-quick-add { flex-wrap: wrap; margin-top: var(--space-3); }
.subtask-quick-add input { flex: 1 1 220px; min-width: 0; }
.completed-subtasks { margin-top: var(--space-3); }
.completed-subtasks > summary { cursor: pointer; color: var(--color-text-muted); }
@media (max-width: 600px) {
  .subtask-quick-add { align-items: stretch; flex-direction: column; }
  .subtask-quick-add .button { width: 100%; }
}

/* Aufgabenbaum: Kacheln, Hierarchielinien und Blocker */
.task-tree-section {
  --tone-warning-text: color-mix(in srgb, var(--color-warning) 62%, var(--color-text));
  --tone-success-text: color-mix(in srgb, var(--color-success) 62%, var(--color-text));
  --tone-danger-text: color-mix(in srgb, var(--color-danger) 70%, var(--color-text));
  display: flex; flex-direction: column; gap: var(--space-3); min-width: 0;
}
.tree-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.tree-toolbar-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.button.button-sm { min-height: 34px; padding: 0 12px; font-size: 0.82rem; border-radius: var(--radius-sm); }
.tree-pagination { display: flex; align-items: center; justify-content: center; gap: var(--space-3); }
.tree-error { border: 1px solid color-mix(in srgb, var(--color-danger) 30%, var(--color-border)); border-radius: var(--radius-lg); }

.task-tree, .tree-children { list-style: none; margin: 0; padding: 0; }
.task-tree { display: flex; flex-direction: column; gap: 6px; }
.tree-item { position: relative; min-width: 0; }
.tree-children { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 0 19px; padding-left: 16px; }
.tree-children[hidden] { display: none; }
.tree-children > .tree-item::before { content: ""; position: absolute; left: -16px; top: -6px; bottom: -6px; border-left: 2px solid var(--color-border); }
.tree-children > .tree-item:last-child::before { bottom: auto; height: 34px; }
.tree-children > .tree-item::after { content: ""; position: absolute; left: -16px; top: 27px; width: 14px; border-top: 2px solid var(--color-border); }

.task-tile {
  position: relative; display: flex; align-items: flex-start; gap: var(--space-2); min-width: 0;
  padding: 8px 8px 8px 6px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-left: 3px solid var(--tile-accent, var(--color-border));
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.task-tile:hover { border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border)); border-left-color: var(--tile-accent, color-mix(in srgb, var(--color-primary) 40%, var(--color-border))); }
.task-tile:focus-within { box-shadow: var(--focus-ring); }
.task-tile.priority-high { --tile-accent: var(--color-priority-high); }
.task-tile.priority-low { --tile-accent: var(--color-priority-low); }
.task-tile.is-blocked { background: color-mix(in srgb, var(--color-warning) 6%, var(--color-surface)); }
.task-tile.is-completed { background: var(--color-surface-hover); --tile-accent: var(--color-success); box-shadow: none; }
.task-tile.is-completed .tile-title { color: var(--color-text-muted); text-decoration: line-through; font-weight: 500; }
.task-tile.is-context { background: transparent; border-style: dashed; border-left-style: dashed; box-shadow: none; --tile-accent: var(--color-border); }
.task-tile.is-context .tile-title { color: var(--color-text-muted); font-weight: 500; }

.tile-lead { position: relative; z-index: 2; display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.tree-toggle, .tree-toggle-spacer { display: inline-grid; place-items: center; width: 26px; height: 30px; }
.tree-toggle { padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--color-text-muted); cursor: pointer; }
.tree-toggle:hover { background: var(--color-surface-hover); color: var(--color-text); }
.tree-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.tree-chevron { width: 8px; height: 8px; margin-top: -3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform 0.15s ease; }
.tree-item.is-collapsed > .task-tile .tree-chevron { margin-top: 0; transform: rotate(-45deg); }

.tile-body { flex: 1; min-width: 0; }
.tile-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-height: 30px; }
.tile-title { font-size: 0.95rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; color: var(--color-text); }
.tile-title::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.tile-title:hover { color: var(--color-primary); }
.tile-title:focus-visible { outline: none; }
.tile-title:focus-visible::after { box-shadow: var(--focus-ring); outline: 2px solid var(--color-primary); }
.tile-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.78rem; color: var(--color-text-muted); }
.tile-due { white-space: nowrap; }
.tile-due.is-overdue { color: var(--tone-danger-text); font-weight: 600; }
.tile-assignees { margin: 0; }
.tile-assignees .avatar { width: 22px; height: 22px; font-size: 0.62rem; }

.tile-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border: 1px solid transparent; border-radius: 999px; font-size: 0.72rem; font-weight: 600; line-height: 1.5; }
.badge-status.status-open { background: var(--color-surface-hover); color: var(--color-text-muted); border-color: var(--color-border); }
.badge-status.status-in_progress { background: var(--color-primary-soft); color: var(--color-primary); }
.badge-status.status-waiting { background: color-mix(in srgb, var(--color-warning) 12%, transparent); color: var(--tone-warning-text); }
.badge-status.status-completed { background: color-mix(in srgb, var(--color-success) 12%, transparent); color: var(--tone-success-text); }
.badge-priority.priority-high { background: color-mix(in srgb, var(--color-priority-high) 12%, transparent); color: var(--tone-danger-text); }
.badge-priority.priority-low { background: var(--color-surface-hover); color: var(--color-text-muted); }
.badge-blocked { background: color-mix(in srgb, var(--color-warning) 14%, transparent); color: var(--tone-warning-text); border-color: color-mix(in srgb, var(--color-warning) 40%, transparent); }
.badge-subtasks { background: var(--color-primary-soft); color: var(--color-primary); }
.badge-subtasks .progress-track { width: 34px; height: 4px; margin: 0; background: color-mix(in srgb, var(--color-primary) 18%, transparent); }
.badge-context { border-style: dashed; border-color: var(--color-border); color: var(--color-text-muted); }

.tile-links { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 6px; }
.tile-links-label { font-size: 0.72rem; font-weight: 700; color: var(--tone-warning-text); }
.tile-blocks .tile-links-label { color: var(--color-text-muted); }
.tile-links-list { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; min-width: 0; }
.blocker-chip { display: inline-flex; align-items: center; gap: 4px; max-width: min(240px, 100%); padding: 1px 8px; border: 1px solid transparent; border-radius: 6px; font-size: 0.75rem; line-height: 1.5; }
.blocker-chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blocker-chip.is-open { background: color-mix(in srgb, var(--color-warning) 11%, transparent); border-color: color-mix(in srgb, var(--color-warning) 40%, transparent); color: var(--tone-warning-text); }
.blocker-chip.is-done { background: color-mix(in srgb, var(--color-success) 9%, transparent); border-color: color-mix(in srgb, var(--color-success) 30%, transparent); color: var(--tone-success-text); }
.blocker-chip.is-done .blocker-chip-title { text-decoration: line-through; }
.blocker-chip.is-blocked-task { background: var(--color-surface-hover); border-color: var(--color-border); color: var(--color-text-muted); }
.blocker-chip.is-hidden { border-style: dashed; }
a.blocker-chip:hover { border-color: currentColor; }
a.blocker-chip:focus-visible, .blocker-more > summary:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.blocker-more[open] { flex-basis: 100%; }
.blocker-more > summary { cursor: pointer; padding: 1px 6px; border-radius: 6px; color: var(--color-primary); font-size: 0.75rem; list-style: none; }
.blocker-more > summary::-webkit-details-marker { display: none; }
.blocker-more > summary:hover { background: var(--color-primary-soft); }
.blocker-more .tile-links-list { margin-top: 4px; }

.tile-actions { position: relative; z-index: 3; opacity: 0.75; }
.task-tile:hover .tile-actions, .tile-actions:focus-within { opacity: 1; }

/* Detailansicht: Hierarchie und Blocker */
.task-breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: 0 0 var(--space-1); padding: 0; list-style: none; font-size: 0.82rem; color: var(--color-text-muted); }
.task-breadcrumb li + li::before { content: "›"; margin-right: 6px; }
.task-breadcrumb a { color: var(--color-primary); }
.task-breadcrumb [aria-current] { color: var(--color-text); font-weight: 600; overflow-wrap: anywhere; }
.subtasks-section .task-tree-section { margin-top: var(--space-3); }
.subtask-assign { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.subtask-assign h3 { margin: 0 0 var(--space-1); font-size: 0.9rem; }
.blocker-state { font-size: 0.8rem; color: var(--color-text-muted); }
.blocker-state.is-open { color: color-mix(in srgb, var(--color-warning) 62%, var(--color-text)); font-weight: 600; }
.blocker-state.is-done { color: color-mix(in srgb, var(--color-success) 62%, var(--color-text)); }
.blocker-row.is-done a { text-decoration: line-through; color: var(--color-text-muted); }

@media (pointer: coarse) {
  .tree-toggle, .tree-toggle-spacer { width: 32px; height: 36px; }
  .tile-actions { opacity: 1; }
}
@media (max-width: 600px) {
  .tree-children { margin-left: 12px; padding-left: 10px; }
  .tree-children > .tree-item::before, .tree-children > .tree-item::after { left: -10px; }
  .tree-children > .tree-item::after { width: 8px; }
  .task-tile { padding: 8px 4px 8px 2px; gap: 4px; }
  .tree-toolbar-actions { width: 100%; }
  .tree-toolbar-actions .button { flex: 1; }
  .blocker-chip { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .tree-chevron, .task-tile { transition: none; }
}
