:root {
  color-scheme: light;
  --ink: #24324a;
  --muted: #58677e;
  --accent: #4058b5;
  --border: #d5ddeb;
  --surface: #ffffff;
  --background: #f3f5fa;
  --hover: #e9eefb;
  --hover-border: #a7b4df;
  --accent-hover: #304497;
  --danger: #a52d3d;
  --focus: #986000;
  --input-border: #bfcadd;
  --list-surface: #e9edf5;
  --card-border: #d1d9e7;
  --card-shadow: #24324a08;
  --done: #267346;
  --subtle: #edf0f8;
  --high-ink: #9b293e;
  --high-surface: #fbe7eb;
  --middle-ink: #805307;
  --middle-surface: #fff1d5;
  --low-ink: #286754;
  --low-surface: #e3f3ed;
  --dot-border: #0003;
  --empty-border: #b2bfd4;
  --empty-surface: #ffffff80;
  --table-border: #e3e8f2;
  --table-hover: #f1f4fc;
  --dialog-shadow: #15244233;
  --backdrop: #18243a88;
  --toast-surface: #293953;
  --toast-border: #ffffff55;
  --toast-shadow: #18243a33;
  --drag-shadow: #17253f44;
  --drop-surface: #dce3ff;
  --on-accent: #ffffff;
  --toast-ink: #ffffff;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf2fa; --muted: #bac6d9; --accent: #8baaff; --border: #485b75; --surface: #1e2b40;
  --background: #121b2b;
  --hover: #2b3c59;
  --hover-border: #8baaff;
  --accent-hover: #a2bbff;
  --danger: #ff9aab;
  --focus: #ffc05a;
  --input-border: #677d9d;
  --list-surface: #18243a;
  --card-border: #485b75;
  --card-shadow: #00000030;
  --done: #70ce97;
  --subtle: #27364f;
  --high-ink: #ffb4c1;
  --high-surface: #482936;
  --middle-ink: #ffd18a;
  --middle-surface: #413724;
  --low-ink: #a0dfc2;
  --low-surface: #223f35;
  --dot-border: #ffffff80;
  --empty-border: #677d9d;
  --empty-surface: #1e2b40;
  --table-border: #485b75;
  --table-hover: #2b3c59;
  --dialog-shadow: #00000080;
  --backdrop: #00000099;
  --toast-surface: #bac6d9;
  --toast-border: #485b75;
  --toast-shadow: #00000060;
  --drag-shadow: #00000080;
  --drop-surface: #2b3c59;
  --on-accent: #121b2b; --toast-ink: #121b2b;
  --palette-rot: #ff8293; --palette-orange: #ffac6b; --palette-gelb: #dec663; --palette-gruen: #70ce97;
  --palette-tuerkis: #5acacb; --palette-blau: #84adff; --palette-lila: #c69aef; --palette-grau: #a4b2c7;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1.2rem; margin: 0 0 1rem; overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; }
button, input, select { min-height: 44px; }
button { min-width: 44px; max-width: 100%; overflow-wrap: anywhere; }
label, fieldset, .toolbar > div, .board-controls, .list-header h2 { min-width: 0; }
fieldset, .label-choices label { max-width: 100%; }
.label-choices label { min-width: 44px; }
button {
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
  color: var(--ink); padding: .55rem .85rem; cursor: pointer;
}
button:hover:not(:disabled) { background: var(--hover); border-color: var(--hover-border); }
button:disabled { cursor: not-allowed; }
button.primary, button[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
button.primary:hover:not(:disabled), button[aria-pressed="true"]:hover { background: var(--accent-hover); }
button.danger { color: var(--danger); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--input-border); border-radius: 8px; padding: .6rem;
  color: var(--ink); background: var(--surface); min-width: 0;
}
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; font-weight: 600; }
.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1.2rem;
  padding: 1rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .65rem; }
.brand-icon { color: var(--accent); font-size: 1.8rem; }
.board-controls, .toolbar, .actions, .view-switch, .dialog-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.board-controls { flex: 1; justify-content: flex-end; }
.board-controls select { width: min(260px, 100%); }
main { padding: 1.2rem 1.5rem; }
.toolbar { justify-content: space-between; margin-bottom: 1rem; }
.filters {
  display: grid; grid-template-columns: minmax(180px, 2fr) repeat(5, minmax(110px, 1fr));
  gap: .7rem; padding: 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  align-items: end;
}
.filters button { grid-column: auto; }
.filter-note, .hint { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.workspace-info { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
#summary { font-weight: 600; margin: .5rem 0; }
#filter-active { font-size: .85rem; color: var(--accent); }
#drag-help { margin: .3rem 0 1rem; }
#workspace { min-width: 0; }
.board-view { display: flex; align-items: flex-start; gap: 1rem; overflow-x: auto; padding: .25rem .25rem 1.2rem; min-height: 320px; scrollbar-gutter: stable; }
.kanban-list { flex: 0 0 300px; width: 300px; background: var(--list-surface); border: 1px solid var(--border); border-radius: 12px; padding: .7rem; }
.list-header { display: flex; align-items: flex-start; gap: .35rem; margin-bottom: .5rem; }
.list-header h2 { font-size: 1rem; flex: 1; margin: .7rem 0; }
.list-actions { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .7rem; }
.list-actions button { font-size: .85rem; padding: .4rem .65rem; }
.count { color: var(--muted); font-size: .8rem; white-space: nowrap; padding-top: .8rem; }
.drag-handle { min-width: 44px; min-height: 44px; touch-action: none; user-select: none; cursor: grab; padding: .45rem .65rem; flex-shrink: 0; }
.cards { min-height: 65px; display: flex; flex-direction: column; gap: .65rem; padding-bottom: .65rem; }
.card { background: var(--surface); border: 1px solid var(--card-border); border-radius: 10px; padding: .7rem; box-shadow: 0 2px 4px var(--card-shadow); overflow-wrap: anywhere; }
.card.done { border-left: 4px solid var(--done); }
.card-top { display: flex; gap: .35rem; align-items: flex-start; }
.card-title { border: none; background: transparent; text-align: left; font-weight: 650; flex: 1; padding: .55rem .2rem; min-width: 0; overflow-wrap: anywhere; }
.card.done .card-title { text-decoration: line-through; color: var(--muted); }
.card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; font-size: .82rem; color: var(--muted); }
.priority { padding: .2rem .45rem; border-radius: 6px; background: var(--subtle); }
.priority-hoch { color: var(--high-ink); background: var(--high-surface); }
.priority-mittel { color: var(--middle-ink); background: var(--middle-surface); }
.priority-niedrig { color: var(--low-ink); background: var(--low-surface); }
.labels { display: flex; flex-wrap: wrap; gap: .35rem; }
.label-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .45rem; border: 1px solid var(--border); border-radius: 6px; font-size: .8rem; background: var(--surface); color: var(--ink); max-width: 100%; overflow-wrap: anywhere; }
.label-dot { width: .75rem; height: .75rem; border: 1px solid var(--dot-border); border-radius: 50%; flex-shrink: 0; }
.status-button { font-size: .82rem; margin-top: .65rem; }
.add-card { width: 100%; background: transparent; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--empty-border); border-radius: 12px; background: var(--empty-surface); line-height: 1.6; }
.empty p { margin: 0 0 1rem; }
.empty-list { color: var(--muted); font-size: .85rem; padding: .5rem; margin: 0; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th, td { padding: .8rem; text-align: left; border-bottom: 1px solid var(--table-border); overflow-wrap: anywhere; max-width: 320px; }
th { background: var(--subtle); font-size: .9rem; }
th button { background: transparent; border-color: transparent; padding: .3rem; text-align: left; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--table-hover); }
tbody tr.done td:first-child { color: var(--muted); text-decoration: line-through; }
td .status-button { margin: 0; }
dialog { border: 1px solid var(--border); border-radius: 16px; padding: 1.5rem; width: min(600px, calc(100% - 1.5rem)); max-height: calc(100dvh - 2rem); overflow-y: auto; color: var(--ink); background: var(--surface); box-shadow: 0 16px 70px var(--dialog-shadow); }
dialog::backdrop { background: var(--backdrop); }
dialog form > label { margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 0; padding: .7rem; }
legend { font-size: .9rem; }
.label-choices { display: flex; gap: .5rem; flex-wrap: wrap; }
.label-choices label { flex-direction: row; align-items: center; padding: .4rem; min-height: 44px; }
.label-choices input { width: 20px; height: 20px; min-height: 20px; }
.dialog-actions { justify-content: flex-end; margin-top: 1rem; }
#card-delete { margin-right: auto; }
.form-error { color: var(--danger); font-size: .9rem; }
.label-row { display: flex; align-items: center; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.label-row .label-chip { margin-right: auto; }
#toast { position: fixed; bottom: 1rem; right: 1rem; left: 1rem; margin-left: auto; max-width: 650px; background: var(--toast-surface); color: var(--toast-ink); border-radius: 12px; padding: .7rem 1rem; display: flex; align-items: center; gap: 1rem; box-shadow: 0 4px 20px var(--toast-shadow); z-index: 100; }
#toast-text { flex: 1; overflow-wrap: anywhere; }
#toast button { background: transparent; color: var(--toast-ink); border-color: var(--toast-border); }
.drag-source { display: none; }
.drag-ghost { position: fixed; pointer-events: none; z-index: 200; opacity: .9; transform: rotate(2deg); max-height: 180px; overflow: hidden; box-shadow: 0 12px 25px var(--drag-shadow); }
.drop-placeholder { border: 2px dashed var(--accent); background: var(--drop-surface); border-radius: 10px; flex-shrink: 0; min-height: 70px; }
.drop-placeholder.list-placeholder { width: 300px; flex-basis: 300px; min-height: 250px; }
body.dragging { user-select: none; cursor: grabbing; }
#workspace[aria-busy="true"] { opacity: .65; }
.calendar-navigation { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.calendar-navigation h2 { flex: 1 1 200px; margin: 0; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .35rem; }
.calendar-weekday { text-align: center; font-weight: 600; padding: .5rem; }
.calendar-day { min-width: 0; min-height: 110px; padding: .4rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.calendar-day h3 { font-size: .9rem; margin: .2rem 0 .5rem; }
.calendar-blank { background: transparent; border-color: transparent; }
.calendar-today { border: 2px solid var(--accent); }
.calendar-mobile-weekday { display: none; }
.calendar-card { width: 100%; text-align: left; font-size: .85rem; padding: .4rem; margin-bottom: .3rem; }
.calendar-card.done { text-decoration: line-through; color: var(--muted); }
.calendar-undated { margin-top: 1.5rem; }
@media (max-width: 1050px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters button { grid-column: auto; }
}
@media (max-width: 600px) {
  .app-header, main { padding: .85rem; }
  .board-controls { flex: 0 0 100%; justify-content: flex-start; width: 100%; gap: .4rem; }
  .board-controls select { flex: 0 0 100%; width: 100%; }
  .board-controls label { width: 100%; }
  .toolbar { align-items: flex-start; }
  .actions { width: 100%; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .75rem; }
  .filters label:first-child { grid-column: 1 / -1; }
  .kanban-list { flex-basis: min(300px, calc(100vw - 3rem)); width: min(300px, calc(100vw - 3rem)); }
  .drop-placeholder.list-placeholder { flex-basis: min(300px, calc(100vw - 3rem)); width: min(300px, calc(100vw - 3rem)); }
  .form-grid { grid-template-columns: 1fr; }
  dialog { padding: 1rem; }
  .dialog-actions > button { flex-grow: 1; }
  .filter-note { font-size: .78rem; }
  /* Monthly agenda at phone width: each day and card has a full touch target. */
  .calendar-grid { grid-template-columns: minmax(0, 1fr); }
  .calendar-weekday, .calendar-blank { display: none; }
  .calendar-mobile-weekday { display: inline; }
  .calendar-day { min-height: 44px; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color .12s; }
}

/* S5: Nur Akzentstreifen, keine Schrift auf freien Farbflächen. */
:root {
  --palette-rot: #b83342; --palette-orange: #af5400; --palette-gelb: #8b7200; --palette-gruen: #267346;
  --palette-tuerkis: #007b7c; --palette-blau: #3264ba; --palette-lila: #8551b0; --palette-grau: #647080;
}
[data-color="rot"] { --item-color: var(--palette-rot); }
[data-color="orange"] { --item-color: var(--palette-orange); }
[data-color="gelb"] { --item-color: var(--palette-gelb); }
[data-color="gruen"] { --item-color: var(--palette-gruen); }
[data-color="tuerkis"] { --item-color: var(--palette-tuerkis); }
[data-color="blau"] { --item-color: var(--palette-blau); }
[data-color="lila"] { --item-color: var(--palette-lila); }
[data-color="grau"] { --item-color: var(--palette-grau); }
.app-header { border-top: 5px solid var(--item-color, var(--border)); }
#board-select { border-left: 5px solid var(--item-color, var(--border)); }
.card[data-color]:not([data-color=""]) { border-left: 5px solid var(--item-color); }
.card.done { border-bottom: 3px solid var(--palette-gruen); }
.progress-display { font-size: .82rem; margin-top: .5rem; }
.progress-track { height: 6px; background: var(--list-surface); border-radius: 3px; margin-top: .35rem; overflow: hidden; }
.progress-fill { display: block; height: 100%; background: var(--accent); }
.palette, .progress-choices { display: flex; flex-wrap: wrap; gap: .45rem; }
.color-swatch { border-left: 7px solid var(--item-color, var(--border)); }
.color-swatch[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
#card-form > fieldset { margin-bottom: 1rem; }
.checklist-add { display: flex; gap: .5rem; margin-top: .4rem; }
.checklist-add button { flex: none; white-space: nowrap; }
.checklist-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: .4rem; margin-bottom: .7rem; }
.checklist-check { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
.checklist-check input { width: 20px; min-height: 20px; height: 20px; }
.checklist-delete { width: 44px; height: 44px; padding: 0; }

input[type="checkbox"] { accent-color: var(--accent); }
#theme-toggle { flex-shrink: 0; font-size: 1.2rem; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
button:disabled { color: var(--muted); background: var(--subtle); border-color: var(--border); }
#card-progress button[aria-pressed="true"]:disabled { outline: 2px solid var(--accent); outline-offset: 1px; }


[hidden] { display: none !important; }
.login-panel { max-width: 420px; margin: 2rem auto; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.login-panel label { display: block; margin-bottom: 1rem; }
.login-panel input { display: block; width: 100%; margin-top: .4rem; }
.login-panel button { width: 100%; }
#account-open { max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .login-panel { margin: 1rem; padding: 1rem; }
}
/* Zusammenarbeit: kompakte Namen, große Stern-/Kommentarziele. */
.favorite-button { min-width: 44px; min-height: 44px; font-size: 1.5rem; flex-shrink: 0; }
.favorite-filter { display: flex; flex-direction: row; align-items: center; gap: .5rem; min-height: 44px; }
.favorite-filter input { width: auto; }
.assigned-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-name { display: inline-block; border-left: 4px solid var(--item-color, var(--accent)); padding-left: .4rem; font-size: .85em; }
.calendar-card .board-name { display: block; margin-top: .25rem; }
#board-choices { display: flex; flex-wrap: wrap; gap: .6rem; }
.board-choice-group { flex: 1 1 240px; margin-bottom: 0; min-width: 0; }
.board-choice-group label { display: flex; flex-direction: row; align-items: center; gap: .5rem; min-height: 44px; }
.board-choice-group input { width: auto; }
.comment { padding: .65rem 0; border-bottom: 1px solid var(--border); }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
