* { box-sizing: border-box; }

/* --- Farben (hell) ------------------------------------------------------- */
:root {
    color-scheme: light;
    --bg: #f2f4f7;
    --card: #ffffff;
    --text: #1f2933;
    --muted: #7b8794;
    --faint: #9aa5b1;
    --line: #e4e7eb;
    --input-bg: #ffffff;
    --input-border: #cbd2d9;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --on-accent: #ffffff;
    --accent-soft: #eff6ff;
    --accent-line: #bfdbfe;
    --danger: #e12d39;
    --danger-soft: #fde8e8;
    --warn: #d97706;
    --ok: #16a34a;
    --mark: #fef08a;
    --shadow: 0 4px 20px rgba(0, 0, 0, .06);
}

/* --- Farben (dunkel): automatisch nach System oder per Schalter ---------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0f141a;
        --card: #1a2129;
        --text: #e4e7eb;
        --muted: #9aa5b1;
        --faint: #616e7c;
        --line: #2a333d;
        --input-bg: #121820;
        --input-border: #3e4c59;
        --accent: #60a5fa;
        --accent-hover: #93c5fd;
        --on-accent: #0b1220;
        --accent-soft: #1e2a3b;
        --accent-line: #1e3a5f;
        --danger: #f87171;
        --danger-soft: #3b1f22;
        --warn: #fbbf24;
        --ok: #4ade80;
        --mark: #854d0e;
        --shadow: 0 4px 20px rgba(0, 0, 0, .4);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f141a;
    --card: #1a2129;
    --text: #e4e7eb;
    --muted: #9aa5b1;
    --faint: #616e7c;
    --line: #2a333d;
    --input-bg: #121820;
    --input-border: #3e4c59;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --on-accent: #0b1220;
    --accent-soft: #1e2a3b;
    --accent-line: #1e3a5f;
    --danger: #f87171;
    --danger-soft: #3b1f22;
    --warn: #fbbf24;
    --ok: #4ade80;
    --mark: #854d0e;
    --shadow: 0 4px 20px rgba(0, 0, 0, .4);
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--accent); }
form { margin: 0; }
/* Das hidden-Attribut muss gewinnen, auch wenn eine Klasse display: flex o. ä. setzt */
[hidden] { display: none !important; }
h1 { margin-top: 0; }
mark { background: var(--mark); color: inherit; border-radius: 2px; }

/* --- Formularelemente ---------------------------------------------------- */
input[type=text], input[type=password], input[type=date], input[type=time], input[type=search], select, textarea {
    padding: 9px 11px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
    min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { width: 100%; resize: vertical; }

button {
    padding: 9px 15px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: var(--on-accent);
    font: inherit;
    cursor: pointer;
}
button:hover { background: var(--accent-hover); }
button.secondary { background: var(--line); color: var(--text); }
button.secondary:hover { background: var(--input-border); }
button.danger-btn { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
button.danger-btn:hover { background: var(--danger-soft); }
button.link { background: none; color: var(--muted); padding: 0; }
button.link:hover { background: none; text-decoration: underline; }

.icon {
    background: none; color: var(--faint); padding: 4px 6px;
    text-decoration: none; font-size: 1rem;
}
.icon:hover { background: none; color: var(--accent); }
.icon.danger:hover { color: var(--danger); }

/* --- Rahmen -------------------------------------------------------------- */
.topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 10px 24px; background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.topbar .search { flex: 1; max-width: 360px; }
.topbar .search input { width: 100%; padding: 7px 11px; }
.topbar nav { display: flex; gap: 16px; align-items: center; margin-left: auto; }
.topbar nav a { text-decoration: none; }
.topbar .user { color: var(--muted); }

.flash {
    max-width: 960px; margin: 16px auto 0; padding: 10px 14px;
    background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 8px;
}

.card {
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
    min-width: 0;
}

.app {
    display: grid; grid-template-columns: 220px 1fr; gap: 24px;
    max-width: 1000px; margin: 24px auto; padding: 0 16px;
}
.wide { max-width: 760px; margin: 24px auto; }
.muted { color: var(--muted); }
.empty { color: var(--muted); }

/* --- Login / Registrierung ---------------------------------------------- */
.auth { max-width: 380px; margin: 64px auto; }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.auth label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
.error { color: var(--danger); }

/* --- Seitenleiste -------------------------------------------------------- */
.sidebar ul { list-style: none; padding: 0; margin: 0 0 12px; }
.sidebar li a {
    display: flex; gap: 6px; align-items: center;
    padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none;
}
.sidebar li a:hover { background: var(--line); }
.sidebar li a.active { background: var(--accent); color: var(--on-accent); }
.sidebar li.sep {
    margin: 16px 10px 6px; font-size: .75rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--muted);
}
.sidebar .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .shared { font-size: .8rem; }
.sidebar .count { font-size: .8rem; opacity: .7; }
.sidebar .manage { font-size: .9rem; text-decoration: none; padding: 0 10px; }

/* --- Aufgaben-Formular --------------------------------------------------- */
.todo-form { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.todo-form .title-input { width: 100%; font-size: 1.05rem; padding: 11px 13px; }
.todo-form .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.todo-form .buttons { display: flex; gap: 10px; align-items: center; margin-left: auto; }
/* Notizfeld beim Anlegen erst zeigen, wenn ein Titel getippt ist. Nicht schon bei Fokus: Das Titelfeld hat
   autofocus, sonst klappte das Feld bei jedem Seitenaufruf (z. B. Klick auf Sortierung/Filter) auf. */
.todo-form:not(.editing) textarea { display: none; }
.todo-form:not(.editing):has(.title-input:not(:placeholder-shown)) textarea,
.todo-form:not(.editing) textarea:not(:placeholder-shown) { display: block; }

/* Tag-Vorschläge */
.tags-wrap { position: relative; flex: 1 1 170px; display: flex; }
.tags-wrap .tags-input { width: 100%; }
.suggest {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 10;
    display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
    min-width: 100%; padding: 6px; background: var(--card);
    border: 1px solid var(--input-border); border-radius: 8px; box-shadow: var(--shadow);
}
.suggest button {
    padding: 3px 9px; border-radius: 999px; font-size: .85rem;
    background: var(--accent-soft); color: var(--accent);
}
.suggest button.active, .suggest button:hover { background: var(--accent); color: var(--on-accent); }
.suggest .hint { margin-left: auto; font-size: .75rem; color: var(--muted); }

/* --- Filter & Tags ------------------------------------------------------- */
.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 20px 0 8px; }
.filter { display: flex; gap: 6px; flex-wrap: wrap; }
.filter a { color: var(--muted); text-decoration: none; padding: 4px 10px; border-radius: 6px; font-size: .95rem; }
.filter a:hover { color: var(--text); }
.filter a.active { background: var(--line); color: var(--text); }
.filter.sort a { font-size: .85rem; }

.tagbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tag {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent);
    font-size: .8rem; text-decoration: none;
}
.tag:hover, .tag.active { background: var(--accent); color: var(--on-accent); }

/* --- Aufgabenliste ------------------------------------------------------- */
.todos { list-style: none; padding: 0; margin: 0; }
.todos > li {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--line);
    background: var(--card);
}
.todos > li:target { background: var(--accent-soft); border-radius: 8px; }
.todos .body { flex: 1; min-width: 0; padding-top: 3px; }
.todos .title { word-break: break-word; }
.todos > li.done > .body > .title { text-decoration: line-through; color: var(--faint); }
.todos .empty { justify-content: center; }
.todos .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; font-size: .8rem; }
.todos .meta:empty { display: none; }

.handle {
    width: 14px; flex: none; padding-top: 4px;
    color: var(--faint); cursor: grab; user-select: none; touch-action: none;
}
.sortable-ghost { opacity: .4; }
.sortable-chosen { box-shadow: var(--shadow); }

.due { color: var(--muted); }
.due.today { color: var(--warn); font-weight: 600; }
.due.overdue { color: var(--danger); font-weight: 600; }
.assignee { color: var(--muted); }
.assignee.me { color: var(--accent); font-weight: 600; }

.check {
    flex: none; width: 26px; height: 26px; padding: 0;
    border: 2px solid var(--accent); border-radius: 50%;
    background: transparent; color: var(--accent); font-size: .85rem;
}
.check:hover { background: var(--accent-soft); }
li.done > form > .check, li.done > .check { background: var(--accent); color: var(--on-accent); }
.check.small { width: 20px; height: 20px; font-size: .7rem; border-width: 2px; }

/* Details: Notizen + Checkliste */
.details { margin-top: 4px; font-size: .9rem; }
.details summary {
    display: inline-flex; gap: 10px; cursor: pointer; list-style: none;
    color: var(--muted); font-size: .8rem; user-select: none;
}
.details summary::-webkit-details-marker { display: none; }
.details summary:hover { color: var(--accent); }
.details summary .complete { color: var(--ok); }
.details .add-hint { opacity: 0; transition: opacity .15s; }
.todos > li:hover .add-hint, .details[open] .add-hint, .add-hint:focus { opacity: 1; }
.details[open] summary { margin-bottom: 8px; }
.notes {
    padding: 8px 12px; margin-bottom: 8px; border-left: 3px solid var(--accent-line);
    background: var(--bg); border-radius: 0 6px 6px 0; word-break: break-word;
}
.subtasks { list-style: none; padding: 0; margin: 0 0 6px; }
.subtasks li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.subtasks li .title { flex: 1; }
.subtasks li.done .title { text-decoration: line-through; color: var(--faint); }
.subtasks li.done .check { background: var(--accent); color: var(--on-accent); }
.subtasks .icon { font-size: .8rem; opacity: 0; }
.subtasks li:hover .icon { opacity: 1; }
.sub-add input { width: 100%; padding: 6px 10px; font-size: .9rem; }

footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 16px; color: var(--muted); font-size: .9rem;
}

/* --- Suche --------------------------------------------------------------- */
.results .result { display: flex; flex-direction: column; gap: 4px; flex: 1; color: var(--text); text-decoration: none; padding: 2px 4px; border-radius: 6px; }
.results .result:hover { background: var(--bg); }
.results li.done .title { text-decoration: line-through; color: var(--faint); }
.snippet { font-size: .85rem; color: var(--muted); }

/* --- Projektverwaltung --------------------------------------------------- */
.add { display: flex; gap: 8px; flex-wrap: wrap; }
.add .grow { flex: 1 1 200px; }
.project { border-top: 1px solid var(--line); padding: 16px 0; }
.project header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.project h2 { margin: 0; font-size: 1.1rem; }
.project h2 a { color: var(--text); text-decoration: none; }
.project p { margin: 8px 0 0; font-size: .9rem; }
.members { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.member {
    display: inline-flex; align-items: center; gap: 2px;
    padding: 3px 4px 3px 10px; background: var(--bg); border-radius: 999px; font-size: .9rem;
}
.member .icon { font-size: .8rem; padding: 0 4px; color: var(--muted); }
.member .icon:hover { color: var(--accent); }
.members-legend { font-size: .8rem; margin: -4px 0 10px; }
.member.role-owner { background: var(--accent-soft); }
.member.role-manager { box-shadow: inset 0 0 0 1px var(--accent-line); }
.member.disabled { opacity: .55; text-decoration: line-through; }
.roles-help { margin: 12px 0 4px; font-size: .9rem; }
.roles-help summary { cursor: pointer; color: var(--accent); }
.roles-help td:not(:first-child), .roles-help th { text-align: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline { display: flex; gap: 6px; }
.inline input { width: 160px; }

/* --- Titel klickbar (öffnet Bearbeiten) ---------------------------------- */
.todos .body > a.title, .dash-list a.title { color: var(--text); text-decoration: none; cursor: text; }
.todos .body > a.title:hover, .dash-list a.title:hover { color: var(--accent); }
.dash-list a.title { cursor: pointer; }

/* --- Priorität ----------------------------------------------------------- */
.check.prio-3 { border-color: var(--danger); color: var(--danger); }
.check.prio-2 { border-color: var(--warn); color: var(--warn); }
.check.prio-1 { border-color: var(--accent); }
.check.prio-3:hover { background: var(--danger-soft); }
li.done > form > .check.prio-3 { background: var(--danger); color: var(--on-accent); }
li.done > form > .check.prio-2 { background: var(--warn); color: var(--on-accent); }
.prio { font-weight: 600; }
.prio.prio-3 { color: var(--danger); }
.prio.prio-2 { color: var(--warn); }
.prio.prio-1 { color: var(--accent); }

/* --- Drag & Drop auf Projekte -------------------------------------------- */
.dragging .sidebar a[data-project]:not(.active) { outline: 1px dashed var(--input-border); outline-offset: -1px; }
.sidebar a.drop-target {
    outline: 2px solid var(--accent) !important; background: var(--accent-soft); transform: scale(1.03);
    transition: transform .1s;
}
.over-project .todos .sortable-ghost { opacity: .15; }
.sortable-fallback { opacity: .9 !important; box-shadow: var(--shadow); border-radius: 8px; }

.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
    padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--card);
    box-shadow: var(--shadow); font-size: .9rem; transition: opacity .4s; max-width: calc(100% - 32px);
}
.toast.hide { opacity: 0; }

/* --- Dashboard ----------------------------------------------------------- */
.dashboard { min-width: 0; }
.dash-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-head h1 { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
    display: flex; flex-direction: column; gap: 2px; padding: 14px 16px;
    background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
    color: var(--text); text-decoration: none; border-top: 3px solid var(--line);
}
a.kpi:hover { border-top-color: var(--accent); }
.kpi b { font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .85rem; color: var(--muted); }
.kpi.bad { border-top-color: var(--danger); } .kpi.bad b { color: var(--danger); }
.kpi.warn { border-top-color: var(--warn); } .kpi.warn b { color: var(--warn); }
.kpi.good { border-top-color: var(--ok); } .kpi.good b { color: var(--ok); }

.inbox-hint {
    display: block; margin-bottom: 16px; padding: 10px 14px; border-radius: 8px;
    background: var(--accent-soft); border: 1px solid var(--accent-line); text-decoration: none;
}
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-section { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 16px 18px; }
.dash-section h2 { font-size: 1rem; margin: 0 0 10px; }
.dash-section.bad h2 { color: var(--danger); }
.dash-section p { margin: 0; font-size: .9rem; }
.dash-list { list-style: none; padding: 0; margin: 0; }
.dash-list li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line); }
.dash-list li:last-child { border-bottom: 0; }
.dash-list .check { margin-top: 1px; }
.dash-list li.done .check { background: var(--accent); color: var(--on-accent); }
.dash-list li.done .check.prio-3 { background: var(--danger); }
.dash-list li.done .check.prio-2 { background: var(--warn); }
.dash-list li.done a.title { text-decoration: line-through; color: var(--faint); }
.dash-section.good h2 { color: var(--ok); }
/* Klick auf eine Kachel: angesprungenen Abschnitt kurz hervorheben (sonst passiert scheinbar nichts, wenn er schon sichtbar ist) */
.dash-col > [id] { scroll-margin-top: 16px; }
.dash-col > [id]:target > .dash-section { animation: target-flash 1.6s ease-out; }
@keyframes target-flash {
    0%, 40% { box-shadow: 0 0 0 3px var(--accent), var(--shadow); }
    100% { box-shadow: var(--shadow); }
}
.dash-list .body { flex: 1; min-width: 0; }
.dash-list .meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: .78rem; margin-top: 3px; }
.proj-chip { padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, var(--pc) 16%, transparent); border-left: 3px solid var(--pc); }

.progress-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.progress-list a { display: flex; justify-content: space-between; gap: 8px; color: var(--text); text-decoration: none; font-size: .9rem; }
.progress-list a:hover .name { color: var(--accent); }
.progress-list .muted { font-size: .8rem; white-space: nowrap; }
.overdue-text { color: var(--danger); }
.bar { height: 6px; margin-top: 5px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--pc); border-radius: 999px; }

/* --- Projektfarben (Kalender) ------------------------------------------- */
.pc-0 { --pc: #3b82f6; } .pc-1 { --pc: #10b981; } .pc-2 { --pc: #f59e0b; } .pc-3 { --pc: #8b5cf6; }
.pc-4 { --pc: #ec4899; } .pc-5 { --pc: #14b8a6; } .pc-6 { --pc: #ef4444; } .pc-7 { --pc: #64748b; }

/* --- Kalender ------------------------------------------------------------ */
.calendar { max-width: 1100px; margin: 24px auto; }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.cal-head h1 { margin: 0; font-size: 1.4rem; min-width: 190px; text-align: center; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav .icon { font-size: 1.6rem; line-height: 1; }
.today-btn {
    margin-left: 8px; padding: 4px 12px; border: 1px solid var(--input-border);
    border-radius: 6px; color: var(--text); text-decoration: none; font-size: .9rem;
}
.today-btn:hover { background: var(--line); }

.cal-grid {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
    border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.cal-wd {
    padding: 6px; font-size: .8rem; font-weight: 600; color: var(--muted); text-align: center;
    border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.cal-day {
    min-height: 104px; padding: 4px; display: flex; flex-direction: column; gap: 2px;
    border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0;
}
.cal-day.weekend { background: color-mix(in srgb, var(--bg) 50%, transparent); }
.cal-day.other { opacity: .45; }
.cal-day .num { font-size: .8rem; color: var(--muted); align-self: flex-end; padding: 1px 6px; }
.cal-day.today .num { background: var(--accent); color: var(--on-accent); border-radius: 999px; font-weight: 700; }

.cal-item {
    display: block; padding: 2px 6px; border-radius: 4px; font-size: .78rem;
    color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    background: color-mix(in srgb, var(--pc) 16%, transparent);
    border-left: 3px solid var(--pc);
}
.cal-item:hover { background: color-mix(in srgb, var(--pc) 30%, transparent); }
.cal-item .time { font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-item.done .t { text-decoration: line-through; color: var(--faint); }
.cal-item.virtual { opacity: .55; border-left-style: dashed; }
.cal-item.overdue { box-shadow: inset 0 0 0 1px var(--danger); }
.cal-item .proj { color: var(--muted); font-size: .9em; margin-left: auto; }
.legend { font-size: .8rem; margin-top: 10px; }

/* Terminübersicht */
.agenda-day { margin-bottom: 18px; }
.agenda-day h2 { font-size: .95rem; margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.agenda-day.is-today h2 { color: var(--accent); }
.overdue-block h2 { color: var(--danger); }
.agenda-row { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
.agenda-row .date { width: 44px; flex: none; font-size: .85rem; color: var(--danger); font-variant-numeric: tabular-nums; }
.agenda-row .cal-item { flex: 1; display: flex; gap: 6px; align-items: baseline; font-size: .9rem; padding: 6px 10px; white-space: normal; }

/* --- Einstellungen ------------------------------------------------------- */
.settings section { border-top: 1px solid var(--line); padding: 18px 0; }
.settings section:first-of-type { border-top: 0; padding-top: 0; }
.settings h2 { font-size: 1.1rem; margin: 0 0 8px; }
.settings h3 { font-size: .95rem; margin: 16px 0 8px; }
.settings p { margin: 0 0 10px; }
.settings .stack { display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.settings .actions { align-items: center; margin-bottom: 8px; }
.settings code { font-size: .82rem; word-break: break-all; }
.settings fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0; }
.settings legend { color: var(--muted); font-size: .85rem; padding: 0 4px; }
.settings label { display: flex; align-items: center; gap: 6px; font-size: .92rem; }
.api-new { margin-top: 12px; }
.api-new summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.api-projects { display: flex; flex-direction: column; gap: 2px; padding-left: 22px; }
.secret {
    margin: 0 0 12px; padding: 12px 14px; border-radius: 8px;
    background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.secret strong { display: block; margin-bottom: 8px; font-size: .9rem; }
.secret p { margin: 8px 0 0; font-size: .9rem; }
.secret details { margin-top: 8px; font-size: .9rem; }
.secret ul { margin: 6px 0 0; padding-left: 20px; }
.copy-row { display: flex; gap: 6px; }
.copy-row input { flex: 1; font-family: ui-monospace, monospace; font-size: .8rem; }
.invites { width: 100%; border-collapse: collapse; font-size: .88rem; margin-top: 8px; }
.invites th { text-align: left; color: var(--muted); font-weight: 600; }
.invites th, .invites td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.invites tr.muted td { color: var(--muted); }

/* --- Reiter (Einstellungen, Administration) ------------------------------ */
.tabs {
    display: flex; gap: 4px; margin: 0 0 20px; border-bottom: 1px solid var(--line);
    overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    padding: 8px 12px; color: var(--muted); text-decoration: none; white-space: nowrap;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a[href="/admin"]:not(.active), .tabs a[href="/einstellungen"]:not(.active):last-child { margin-left: auto; }
.settings section:first-of-type { padding-top: 0; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* --- Administration ------------------------------------------------------ */
.user-list { list-style: none; padding: 0; margin: 16px 0 0; }
.user-list li {
    display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap;
    padding: 12px 0; border-top: 1px solid var(--line);
}
.user-list li.disabled .who strong { text-decoration: line-through; color: var(--muted); }
.user-list .who { flex: 1 1 260px; min-width: 0; }
.user-list .buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.small { font-size: .82rem; }
button.small { padding: 5px 10px; }
.badge {
    display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px;
    font-size: .75rem; background: var(--line); color: var(--text); vertical-align: 1px;
}
.badge.admin { background: var(--accent-soft); color: var(--accent); }
.badge.off { background: var(--danger-soft); color: var(--danger); }
.button-link { font-size: .82rem; padding: 5px 10px; border-radius: 8px; text-decoration: none; align-self: center; }
.button-link.danger { color: var(--danger); }
.delete-plan { max-width: none !important; }
.delete-plan .decision { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.delete-plan ul { margin: 0; padding-left: 20px; font-size: .92rem; }

/* --- Handy --------------------------------------------------------------- */
@media (max-width: 700px) {
    .dash-grid { grid-template-columns: 1fr; }
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .cal-day { min-height: 64px; padding: 2px; }
    .cal-item { font-size: .65rem; padding: 1px 3px; border-left-width: 2px; }
    .cal-item .time, .cal-item .rep { display: none; }
    .cal-head h1 { min-width: 0; font-size: 1.15rem; }
    .invites th:nth-child(2), .invites td:nth-child(2) { display: none; }

    /* Rahmen */
    /* minmax(0, …): sonst wächst die Spalte mit der langen Projekt-Chip-Zeile mit, statt sie scrollen zu lassen */
    .app { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 0; }
    .topbar { padding: 10px 16px; flex-wrap: wrap; gap: 10px 16px; }
    .topbar .search { order: 3; flex-basis: 100%; max-width: none; }
    .topbar nav { gap: 14px; }
    .topbar .uname { display: none; }                 /* nur ⚙ – Einstellungen bleiben erreichbar */
    .card { padding: 16px; }
    .user-list .buttons { justify-content: flex-start; }

    /* Seitenleiste → eine wischbare Zeile mit Projekt-Chips, bleibt beim Scrollen oben
       (Projekt wechseln und Aufgaben auf ein Projekt ziehen geht so von überall) */
    .sidebar {
        position: sticky; top: 0; z-index: 5;
        margin: 0 -16px; padding: 8px 16px;
        background: var(--bg); border-bottom: 1px solid var(--line);
    }
    .sidebar ul {
        display: flex; gap: 6px; margin: 0;
        overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
    }
    .sidebar ul::-webkit-scrollbar { display: none; }
    .sidebar li.sep, .sidebar .manage { display: none; }
    .sidebar li a {
        white-space: nowrap; padding: 6px 12px;
        border: 1px solid var(--line); border-radius: 999px; background: var(--card);
    }
    .sidebar .name { max-width: 150px; }
    .dragging .sidebar a[data-project]:not(.active) { outline-offset: 1px; }
    .todos > li, section[id], .dash-col > [id] { scroll-margin-top: 70px; }   /* Sprungziele (#todo-7) nicht unter der Leiste verstecken */

    /* Filter und Sortierung: je eine wischbare Zeile statt Umbruch */
    .toolbar { flex-direction: column; gap: 6px; margin-top: 16px; }
    .filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .filter::-webkit-scrollbar { display: none; }
    .filter a { white-space: nowrap; }

    /* Fingergerechte Tippflächen */
    .todos .icon { padding: 10px; margin: -6px -2px; }
    .handle { width: 24px; margin-left: -6px; text-align: center; font-size: 1.1rem; }
    .todo-form .buttons { margin-left: 0; }
    .subtasks .icon, .add-hint { opacity: 1; }

    /* Neue Aufgabe: erst nur das Titelfeld (Enter speichert), Datum/Priorität/Tags … erscheinen beim Tippen */
    .todo-form:not(.editing):not(:has(.title-input:not(:placeholder-shown))) .row { display: none; }
    main.card > h1 { font-size: 1.5rem; }

    /* iOS zoomt in Eingabefelder unter 16 px hinein (und nicht wieder heraus) */
    input, select, textarea { font-size: 16px !important; }
}
