/*
 * app.css – ProjectHub Haupt-Stylesheet
 * Nutzt ausschließlich CSS-Variablen aus dem aktiven Theme.
 * Niemals Farben direkt hier eintragen – immer var(--...) verwenden!
 */

/* ============================================================
   Reset & Basis
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

:root {
    /* Höhe der mobilen Tab-Leiste + typischer Touch-Bereich (Abstand zum scrollbaren Inhalt) */
    --mobile-tab-bar-height: 4.5rem;
    /* Extra Luft unter der Tab-Bar (iPhone Home-Indikator) */
    --mobile-tab-bar-bottom-gap: 1rem;
    /* Sidebar: Nav-Zeilen gleich hoch (ein-/ausgeklappt) */
    --sidebar-nav-item-height: 2.75rem;
    /* Schmale / eingeklappte Sidebar-Breite */
    --sidebar-width-narrow: 4.5rem;
    /* Nav-Icon-Breite (muss zu .sidebar-nav .nav-icon passen) */
    --sidebar-nav-icon-size: 16px;
    /* Ausgeklappt: linker Rand bis Icon = wie zentriertes Nav-Icon in schmaler Leiste: (Breite − Icon) / 2 */
    --sidebar-padding-x: calc((var(--sidebar-width-narrow) - var(--sidebar-nav-icon-size)) / 2);
    /* Dashboard + Analyse: gleiche Mindestbreite für Stat-Kacheln (einheitliche Spalten-Umbrüche auf schmalen Viewports) */
    --stat-grid-min: 160px;
}

body {
    font-family: 'Geist', 'Inter', system-ui, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.25s, color 0.25s;
}

/* Matrix-Theme: Hintergrund-Canvas (matrix-rain.js); in app.css, damit es beim Theme-Wechsel zuverlässig ausblendet */
.matrix-rain-bg {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.28;
}

html[data-theme="matrix"] .matrix-rain-bg {
    display: block;
}

@media (prefers-reduced-motion: reduce) {
    html[data-theme="matrix"] .matrix-rain-bg {
        display: none !important;
    }
}

/* Aurora-Theme: weiche Farbflächen hinter .layout (nur CSS) */
.aurora-bg {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

html[data-theme="aurora"] .aurora-bg {
    display: block;
    opacity: 0.4;
}

@media (prefers-reduced-motion: reduce) {
    html[data-theme="aurora"] .aurora-bg {
        display: none !important;
    }
}

html[data-theme="aurora"] .aurora-blob {
    position: absolute;
    width: clamp(220px, 50vmin, 460px);
    height: clamp(220px, 50vmin, 460px);
    border-radius: 50%;
    filter: blur(56px);
    opacity: 0.72;
    will-change: transform;
}

html[data-theme="aurora"] .aurora-blob--a {
    background: color-mix(in srgb, var(--accent) 52%, transparent);
    top: -14%;
    left: -10%;
    animation: aurora-move-a 23s ease-in-out infinite;
}

html[data-theme="aurora"] .aurora-blob--b {
    background: rgba(167, 139, 250, 0.4);
    top: 36%;
    right: -16%;
    animation: aurora-move-b 27s ease-in-out infinite;
}

html[data-theme="aurora"] .aurora-blob--c {
    background: rgba(125, 211, 252, 0.32);
    bottom: -22%;
    left: 18%;
    animation: aurora-move-c 25s ease-in-out infinite;
}

@keyframes aurora-move-a {
    0%, 100% { transform: translate(0, 0) scale(1); }
    42% { transform: translate(11vw, 7vh) scale(1.1); }
    72% { transform: translate(-6vw, 11vh) scale(0.93); }
}

@keyframes aurora-move-b {
    0%, 100% { transform: translate(0, 0) scale(1.04); }
    48% { transform: translate(-11vw, -7vh) scale(0.9); }
    78% { transform: translate(5vw, 9vh) scale(1.08); }
}

@keyframes aurora-move-c {
    0%, 100% { transform: translate(0, 0) scale(1); }
    44% { transform: translate(9vw, -11vh) scale(1.12); }
    82% { transform: translate(-11vw, 5vh) scale(0.88); }
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 99px; }

/* ============================================================
   Layout – Sidebar + Main
   ============================================================ */
.layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    /* Keine Breiten-Transition: Icons bleiben beim Ein-/Ausklappen ohne „Einziehen“ */
}

/* Vertikale Kante nur unterhalb des Logo-Streifens (= Topbar-Höhe), optisch mit Header bündig */
.sidebar::after {
    content: '';
    position: absolute;
    top: var(--topbar-height, 56px);
    right: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
    pointer-events: none;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

html.sidebar-collapsed {
    --sidebar-width: var(--sidebar-width-narrow);
}

html.sidebar-collapsed .logo-text,
html.sidebar-collapsed .sidebar-link-text {
    display: none;
}

html.sidebar-collapsed .sidebar-logo {
    justify-content: flex-start;
    gap: 0;
    padding-left: max(0px, calc(var(--sidebar-padding-x) - 12px));
    padding-right: max(
        0.25rem,
        calc(var(--sidebar-width-narrow) - var(--sidebar-padding-x) - 38px)
    );
}

html.sidebar-collapsed .sidebar-nav a,
html.sidebar-collapsed .sidebar-nav-toggle {
    justify-content: flex-start;
}

.sidebar-footer {
    margin-top: auto;
    padding: 0rem;
}

/* Ein-/Ausklappen: gleiche Zeile wie Navigationspunkte */
.sidebar-nav-toggle {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    height: var(--sidebar-nav-item-height);
    min-height: var(--sidebar-nav-item-height);
    padding: 0 var(--sidebar-padding-x);
    box-sizing: border-box;
    width: 100%;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: inherit;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    border: none;
    background: none;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
}

.sidebar-nav-toggle:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

.sidebar-nav-toggle .nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: transform 0.22s ease, opacity 0.15s;
}

.sidebar-nav-toggle:hover .nav-icon {
    opacity: 1;
}

html.sidebar-collapsed .sidebar-nav-toggle .nav-icon {
    transform: rotate(180deg);
}

/* Schmal: Sidebar immer als schmale Leiste (Icons); Toggle aus — Zustand gilt wieder ab ca. 1024px
   --sidebar-width wird auf --sidebar-width-narrow gesetzt (Theme setzt die ausgeklappte Breite) */
@media (max-width: 64rem) {
    :root {
        --sidebar-width: var(--sidebar-width-narrow);
    }

    .sidebar .logo-text,
    .sidebar .sidebar-link-text {
        display: none;
    }

    .sidebar-logo {
        justify-content: flex-start;
        gap: 0;
        padding-left: max(0px, calc(var(--sidebar-padding-x) - 12px));
        padding-right: max(
            0.25rem,
            calc(var(--sidebar-width-narrow) - var(--sidebar-padding-x) - 38px)
        );
    }

    .sidebar-nav a,
    .sidebar-nav-toggle {
        justify-content: flex-start;
    }

    .sidebar-footer {
        display: none;
    }
}

/* Mobil: Tab-Leiste unterhalb von .layout (fixed = Viewport-Breite, kein Flex-Nebeneinander) */
.mobile-tab-bar {
    display: none;
    position: fixed;
    left: max(0.55rem, env(safe-area-inset-left));
    right: max(0.55rem, env(safe-area-inset-right));
    bottom: calc(var(--mobile-tab-bar-bottom-gap) + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    z-index: 200;
    background: color-mix(in srgb, var(--bg-surface) 74%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-strong) 68%, transparent);
    border-radius: 1.2rem;
    box-shadow: 0 12px 32px color-mix(in srgb, #000 20%, transparent);
    padding: 0.35rem 0.45rem;
    justify-content: space-around;
    align-items: stretch;
    gap: 0.2rem;
    -webkit-backdrop-filter: blur(18px) saturate(1.25);
    backdrop-filter: blur(18px) saturate(1.25);
}

.mobile-tab-bar a,
.mobile-tab-bar button.mobile-tab-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.14rem;
    padding: 0.36rem 0.12rem;
    min-height: 3.35rem;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.95rem;
    min-width: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

.mobile-tab-bar a span,
.mobile-tab-bar button.mobile-tab-bar-item span {
    display: block;
    width: 100%;
    text-align: center;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-tab-bar a .nav-icon,
.mobile-tab-bar button.mobile-tab-bar-item .nav-icon {
    width: 22px;
    height: 22px;
    opacity: 0.65;
    flex-shrink: 0;
}

.mobile-tab-bar a.active,
.mobile-tab-bar button.mobile-tab-bar-item.active {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--bg-surface) 72%, transparent);
    box-shadow:
        inset 0 0 0 1px color-mix(in srgb, var(--border-strong) 52%, transparent),
        0 2px 8px color-mix(in srgb, #000 12%, transparent);
}

.mobile-tab-bar a.active .nav-icon,
.mobile-tab-bar button.mobile-tab-bar-item.active .nav-icon {
    opacity: 1;
}

.mobile-tab-bar a:active,
.mobile-tab-bar button.mobile-tab-bar-item:active {
    transform: scale(0.98);
}

/* Desktop: kein Topbar-Logo (nur in Sidebar); Mobil siehe @media unten */
.topbar-brand {
    display: none;
}

@media (max-width: 48rem) {
    .user-menu-name {
        display: none;
    }

    .mobile-tab-bar {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        justify-content: stretch;
        align-items: stretch;
        gap: 0.15rem;
    }

    .mobile-tab-bar a,
    .mobile-tab-bar button.mobile-tab-bar-item {
        flex: none;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .mobile-tab-bar-item--center .nav-icon {
        opacity: 0.85;
    }

    .sidebar {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100%;
        padding-bottom: calc(var(--mobile-tab-bar-height) + var(--mobile-tab-bar-bottom-gap) + env(safe-area-inset-bottom, 0px));
    }

    .topbar-new-project {
        display: none !important;
    }

    .topbar-brand {
        display: flex;
        align-items: center;
        flex-shrink: 0;
        margin-right: 0.25rem;
        text-decoration: none;
        border-radius: var(--radius-md);
    }

    .topbar-brand-logo {
        display: block;
        width: 36px;
        height: 36px;
        object-fit: contain;
        border-radius: var(--radius-md);
    }
}

/* Desktop: verhindert "zu eng geschobenes" Gesamt-Layout */
@media (min-width: 48.01rem) {
    html, body {
        min-width: 960px;
    }
}

.topbar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Einstellungen Unterseite: schmal = Zurück im Titel (Chevron wie „<“), gleiche Typo/Farbe wie Titel */
.topbar-title-plain {
    font: inherit;
    color: inherit;
}

.topbar-title-back {
    display: none;
    position: relative;
    font: inherit;
    color: inherit;
    text-decoration: none;
}

.topbar-title-back:hover {
    text-decoration: none;
    color: inherit;
}

/* Pfeil aus dem Textfluss: „Einstellungen“ steht wie der normale Titel */
.topbar-title-back-text {
    font: inherit;
    color: inherit;
}

.topbar-title-back-icon {
    position: absolute;
    right: 100%;
    margin-right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    display: block;
    pointer-events: none;
}

@media (max-width: 48rem) {
    .topbar--settings-sub .topbar-title-plain {
        display: none;
    }

    .topbar--settings-sub .topbar-title {
        overflow: visible;
    }

    .topbar--settings-sub .topbar-title-back {
        display: inline-block;
    }
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Benutzer-Menü (Theme + Konto) */
.user-menu {
    position: relative;
}

.user-menu > summary {
    list-style: none;
}

.user-menu > summary::-webkit-details-marker {
    display: none;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0 0.5rem 0 0;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 16px var(--radius-md) var(--radius-md) 16px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.user-menu-trigger:hover {
    background: var(--bg-surface-2);
    border-color: var(--border);
}

.user-menu[open] > .user-menu-trigger {
    background: var(--bg-surface-2);
    border-color: var(--border);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-muted);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;
    display: grid;
    place-items: center;
    text-align: center;
    flex-shrink: 0;
}

.user-menu-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-chevron {
    opacity: 0.55;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.user-menu[open] .user-menu-chevron {
    transform: rotate(180deg);
}

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 248px;
    padding: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
}

.user-menu-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.user-menu-label + .theme-switcher {
    margin-bottom: 0.15rem;
}

.user-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.65rem 0;
}

.user-menu-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.user-menu-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.6rem;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
}

.user-menu-nav a:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

.user-menu-nav a.active {
    background: var(--accent-muted);
    color: var(--accent);
    font-weight: 500;
}

.user-menu-nav .nav-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
}

.user-menu-nav a.active .nav-icon {
    opacity: 1;
}

.page-body {
    padding: 2rem 2rem;
    flex: 1;
}

/* Einstellungen: links Untermenü; schmal = iOS-ähnlich Liste → Detail */
.settings-layout {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
    width: 100%;
    max-width: none;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: sticky;
    top: calc(var(--topbar-height) + 1rem);
}

.settings-nav a {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid transparent;
}

.settings-nav a:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

.settings-nav a.active {
    background: var(--accent-muted);
    color: var(--accent);
    border-color: var(--border);
}

.settings-nav a.settings-nav-link--split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
}

.settings-nav-label {
    min-width: 0;
}

.settings-nav-meta {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

.settings-nav a.active .settings-nav-meta {
    color: var(--accent);
    opacity: 0.9;
}

.settings-content {
    min-width: 0;
}

.settings-content .card {
    margin-bottom: 1.25rem;
}

.settings-content .card:last-child {
    margin-bottom: 0;
}

.settings-choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-start;
}

.settings-telegram-toggle .todo-check {
    margin-top: 0;
}

.settings-theme-preview {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    flex-shrink: 0;
    box-sizing: border-box;
    border: 1px solid var(--border-strong);
}

.settings-theme-preview-bg,
.settings-theme-preview-accent {
    flex: 1 1 50%;
    min-width: 0;
    min-height: 100%;
}

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Modal (Einstellungen: Neuer / Bearbeiten Benutzer) — zentriert im Viewport */
.ph-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    /* Über mobiler Tab-Leiste (z-index 200) und Topbar */
    z-index: 600;
    border: none;
    padding: 0;
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    color: var(--text-primary);
    width: min(26rem, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    max-height: min(90dvh, 40rem);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.ph-modal::backdrop {
    background: var(--bg-overlay);
}

.ph-modal-form {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ph-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
}

.ph-modal-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.ph-modal-body {
    padding: 1.1rem 1.25rem 0.25rem;
    overflow-y: auto;
    max-height: min(70vh, 28rem);
}

.ph-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 1rem 1.25rem 1.15rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

.ph-modal-foot--split {
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.75rem;
}

.ph-modal-foot-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
}

.ph-modal-close {
    flex-shrink: 0;
}

/* Projekt bearbeiten: gleiche Größe wie „Neues Projekt“ (ph-modal--project-new), Fußzeile Löschen | Abbrechen + Speichern */
.ph-modal.ph-modal--project-edit {
    width: min(44rem, calc(100vw - 1.5rem));
    max-height: min(92dvh, 58rem);
}

.ph-modal.ph-modal--project-edit .ph-modal-body {
    max-height: min(80dvh, 50rem);
    padding-bottom: 0.5rem;
}

/* Neues Projekt (global): mehr Breite & Höhe für Formular + Tags */
.ph-modal.ph-modal--project-new {
    width: min(44rem, calc(100vw - 1.5rem));
    max-height: min(92dvh, 58rem);
}

.ph-modal.ph-modal--project-new .ph-modal-body {
    max-height: min(80dvh, 50rem);
    padding-bottom: 0.5rem;
}

/* Kosten: gleiche Modal-Größe wie Projekt-Formulare */
.ph-modal.ph-modal--kosten {
    width: min(44rem, calc(100vw - 1.5rem));
    max-height: min(92dvh, 58rem);
}

.ph-modal.ph-modal--kosten .ph-modal-body {
    max-height: min(80dvh, 50rem);
    padding-bottom: 0.5rem;
}

/* Live-Hinweise bei Namen/URL (Duplikat / ähnlichstes Projekt) */
.project-input-hint {
    display: none;
    font-size: 12px;
    line-height: 1.45;
    margin-top: 0.4rem;
}

.project-input-hint.project-input-hint--visible {
    display: block;
}

.project-input-hint--warn {
    color: var(--color-warning);
    font-weight: 500;
}

.project-input-hint--info {
    color: var(--text-secondary);
}

/* ToDo bearbeiten: Status / Priorität / Fälligkeit nebeneinander — genug Platz für Prio-Text */
.ph-modal.ph-modal--todo-edit {
    width: min(42rem, calc(100vw - 1.5rem));
}

.ph-modal.ph-modal--todo-edit .ph-modal-body .form-group {
    min-width: 0;
}

.ph-modal.ph-modal--todo-edit select {
    width: 100%;
    min-width: 0;
}

/* Datenbank: Zuordnung — mehr Höhe für alle Dropdowns */
.ph-modal.ph-modal--db-map {
    width: min(32rem, calc(100vw - 1.5rem));
    max-height: min(92dvh, 56rem);
}

.ph-modal.ph-modal--db-map .ph-modal-body {
    max-height: min(78dvh, 46rem);
    padding-bottom: 1rem;
}

.ph-modal-foot--project-edit {
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.ph-modal-foot--project-edit .ph-modal-foot-actions {
    margin-left: auto;
    flex-shrink: 0;
}

/* Projekt neu/bearbeiten: Tag-Chips, Checkbox dezent wenn unchecked */
.project-tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.project-tag-chip {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: var(--tag-accent);
    border: 1px solid color-mix(in srgb, var(--tag-accent) 42%, transparent);
    background: color-mix(in srgb, var(--tag-accent) 12%, transparent);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.project-tag-chip:has(input:checked) {
    background: color-mix(in srgb, var(--tag-accent) 24%, transparent);
    border-color: color-mix(in srgb, var(--tag-accent) 72%, transparent);
}

/* Eigene Checkbox: transparent, Tagfarbe scheint durch (kein grauer Browser-Kasten) */
.project-tag-chip input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 0.8rem;
    height: 0.8rem;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 3px;
    border: 1px solid color-mix(in srgb, var(--tag-accent) 50%, transparent);
    background: transparent;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tag-accent) 15%, transparent);
    opacity: 1;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.project-tag-chip input[type="checkbox"]:hover {
    background: color-mix(in srgb, var(--tag-accent) 12%, transparent);
    border-color: color-mix(in srgb, var(--tag-accent) 62%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tag-accent) 22%, transparent);
}

.project-tag-chip input[type="checkbox"]:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--tag-accent) 65%, transparent);
    outline-offset: 1px;
}

.project-tag-chip:has(input:checked) input[type="checkbox"] {
    background-color: color-mix(in srgb, var(--tag-accent) 72%, transparent);
    border-color: color-mix(in srgb, var(--tag-accent) 92%, transparent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6.2 5 8.7 9.5 3.3' stroke='%23fff' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: 0.65rem 0.65rem;
    background-position: center;
    background-repeat: no-repeat;
}

html[data-theme="light"] .project-tag-chip:has(input:checked) input[type="checkbox"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6.2 5 8.7 9.5 3.3' stroke='%231a1a1f' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Tag-Modal: Farb-Swatches (hell, gut erkennbar) */
.tag-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag-color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.28),
        0 0 0 1px rgba(0, 0, 0, 0.22);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tag-color-swatch:hover {
    transform: scale(1.08);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.4),
        0 0 0 2px var(--accent-muted);
}

.tag-color-swatch:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.settings-users-cards {
    display: none;
    flex-direction: column;
    gap: 0.75rem;
}

.settings-user-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    background: var(--bg-surface-2);
}

.settings-user-card-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.65rem;
}

.settings-user-card-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.settings-user-card-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
}

.settings-user-card-actions {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.settings-user-card-dl {
    margin: 0;
    display: grid;
    gap: 0.45rem;
    font-size: 13px;
}

.settings-user-card-dl > div {
    display: grid;
    grid-template-columns: 4.75rem minmax(0, 1fr);
    gap: 0.5rem;
    align-items: start;
}

.settings-user-card-dl dt {
    margin: 0;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.settings-user-card-dl dd {
    margin: 0;
    color: var(--text-secondary);
    word-break: break-word;
}

@media (max-width: 48rem) {
    .settings-users-table-wrap {
        display: none !important;
    }

    .settings-users-cards {
        display: flex;
    }

    /* Ein sichtbares Panel: sonst landet es in der 11rem-Spalte, rechts bleibt leer */
    .settings-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .settings-layout--index .settings-content {
        display: none !important;
    }

    .settings-layout:not(.settings-layout--index) .settings-nav {
        display: none !important;
    }

    .settings-nav {
        position: static;
    }

    .settings-nav a {
        padding: 0.75rem 0.85rem;
        font-size: 15px;
        border: none;
        background: var(--bg-surface-2);
    }

    .settings-nav a.active {
        border: none;
        background: var(--accent-muted);
    }

    .settings-layout--index .settings-nav a.active {
        background: var(--bg-surface-2);
        color: var(--text-secondary);
    }

    .settings-layout--index .settings-nav a.active .settings-nav-meta {
        color: var(--text-muted);
        opacity: 1;
    }

    .settings-nav a.settings-nav-link--split {
        display: flex;
    }

    .settings-page .btn {
        border: none;
    }

    .ph-modal {
        width: calc(100vw - 2rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
        max-width: none;
        max-height: calc(100vh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }
}

/* Projektseite: Zugangsdaten & Checkliste */
.project-panels {
    display: grid;
    gap: 1.5rem;
    align-items: start;
    grid-template-columns: 1fr;
    width: 100%;
    min-width: 0;
}

.project-panels > * {
    min-width: 0;
    max-width: 100%;
}

@media (min-width: 62rem) {
    .project-panels {
        grid-template-columns: minmax(22rem, 1fr) minmax(0, 1fr);
    }

    .project-panel-config {
        min-width: 22rem;
    }
}

/* Datenbank: Abschnitt unter Zugangsdaten (gleiche Karte; keine extra Linie — trennt der letzte Config-Eintrag) */
.project-panel-database {
    margin-top: 1rem;
    padding-top: 0.15rem;
}

.project-panel-database-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.project-panel-database-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex-shrink: 0;
}

.project-panel-database-head-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem 0.75rem;
    flex: 1;
    min-width: 0;
}

.project-db-status-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex: 1 1 10rem;
}

.project-config-empty {
    text-align: center;
    padding: 1.15rem 0.75rem 0.35rem;
    color: var(--text-muted);
}

.project-config-empty-text {
    font-size: 13px;
    margin: 0 0 0.35rem;
}

.project-config-empty-link {
    font-size: 12px;
    font-weight: 400;
    font-family: inherit;
    color: var(--accent);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.project-config-empty-link:hover {
    text-decoration: underline;
}

.project-db-status-text {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-db-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
}

.project-db-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0 0 0.85rem;
}

.project-db-hint--warn {
    color: var(--color-warning);
    font-size: 13px;
}

/* Datenbank: nur ⋮-Icon, Dropdown breit genug für eine Zeile */
.project-db-menu {
    position: relative;
    flex-shrink: 0;
}

.project-db-menu-trigger {
    color: var(--text-secondary);
}

.project-db-menu-trigger:hover {
    color: var(--text-primary);
}

.project-db-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 40;
    width: max-content;
    max-width: min(22rem, calc(100vw - 1.25rem));
    min-width: 12rem;
    padding: 0.35rem 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.project-db-menu-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    margin: 0;
    padding: 0.55rem 0.85rem 0.55rem 0.75rem;
    font: inherit;
    font-size: 13px;
    text-align: left;
    color: var(--text-primary);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
}

.project-db-menu-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    color: var(--text-muted);
}

.project-db-menu-item:hover:not(:disabled) .project-db-menu-icon {
    color: var(--text-secondary);
}

.project-db-menu-icon svg {
    display: block;
    width: 16px;
    height: 16px;
}

.project-db-menu-label {
    min-width: 0;
    white-space: nowrap;
}

.project-db-menu-item:hover:not(:disabled) {
    background: var(--bg-surface-3);
}

.project-db-menu-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.project-db-menu-item--link {
    line-height: 1.35;
}

.project-db-map-intro {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: -0.25rem 0 1rem;
}

.project-db-server-info {
    margin-top: 0.65rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.project-db-server-info-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    margin: 0 0 0.45rem;
}

.project-db-server-info-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0;
    flex-shrink: 0;
}

.project-db-server-info-cache {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.35;
    margin: 0;
    text-align: right;
    white-space: nowrap;
    min-width: 0;
}

.project-db-server-dl {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(7rem, 38%) 1fr;
    gap: 0.25rem 0.75rem;
    font-size: 12px;
    line-height: 1.45;
}

.project-db-server-dl dt {
    margin: 0;
    color: var(--text-muted);
    font-weight: 500;
}

.project-db-server-dl dd {
    margin: 0;
    color: var(--text-secondary);
    font-family: var(--font-mono, ui-monospace, monospace);
    word-break: break-word;
}

.project-db-backup-summary {
    margin: 0 0 0.85rem;
}

/* ============================================================
   Projektseite (project.php) — Header, ToDos mobil
   ============================================================ */
.project-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}

.project-header-main {
    flex: 1;
    min-width: 0;
}

.project-header-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.project-header-url {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 320px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    overflow: hidden;
}

.project-header-url-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.project-header-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.project-header-tags {
    margin-top: 0.15rem;
}

.project-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.project-page .project-todos-cards {
    display: none !important;
}

.project-todo-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding: 0.35rem 0 0.3rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.35rem;
}

.project-todo-group-label--inline {
    margin-bottom: 0.25rem;
}

.project-todo-group-count {
    font-weight: 400;
}

.project-todo-group-spacer {
    height: 0.5rem;
}

.project-page .project-todos-cards .todo-card-head-actions,
.todos-page .todo-card-head-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    margin-top: -2px;
}

.project-page .project-todos-cards .todo-card-head-actions .todo-card-edit,
.todos-page .todo-card-head-actions .todo-card-edit {
    margin-top: 0;
}

.project-page .project-todos-cards .todo-card-head-actions {
    gap: 0.55rem;
}

.todos-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

.project-page .project-todos-cards .todo-card-desc {
    margin: 0 0 0.35rem;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-page .project-todos-cards .todo-card-meta--project {
    justify-content: flex-end;
}

.project-page .project-todos-cards .todo-card-meta--project .todo-card-due {
    text-align: right;
}

.project-page .project-todos-cards > .project-todo-group-label:first-child {
    padding-top: 0;
}

.project-page .project-todos-cards .todo-card + .project-todo-group-label,
.project-page .project-todos-cards .project-todo-group-spacer + .project-todo-group-label {
    margin-top: 0.35rem;
}

.project-page .project-todos-cards .todo-card-due--overdue {
    color: var(--color-danger);
    font-weight: 600;
}

.project-page .project-todos-cards .todo-card-due--empty {
    color: var(--text-muted);
    opacity: 0.65;
}

@media (max-width: 48rem) {
    .project-header {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 1.35rem;
    }

    .project-header-url {
        max-width: 100%;
    }

    .project-header-actions {
        width: 100%;
    }

    .project-header-btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .project-panels {
        gap: 1.15rem;
    }

    .project-page .card .card-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .project-page .card .card-header .card-title {
        flex: 1;
        min-width: 0;
    }

    .project-page .card .card-header .btn-primary {
        width: 100%;
        flex-shrink: 1;
        padding-left: 0.65rem;
        padding-right: 0.65rem;
        white-space: normal;
    }

    .project-page .project-todos-desktop {
        display: none !important;
    }

    .project-page .project-todos-cards {
        display: flex !important;
        flex-direction: column;
        gap: 0.55rem;
    }

    .project-page .card {
        padding: 1rem;
    }

    .project-config-row {
        flex-wrap: wrap;
        max-width: 100%;
    }

    .project-config-row > div {
        min-width: 0;
    }
}

@media (max-width: 26rem) {
    .project-page .card .card-header .btn-primary {
        justify-content: center;
    }
}

/* ============================================================
   Sidebar Navigation
   ============================================================ */
.sidebar-logo {
    flex-shrink: 0;
    height: var(--topbar-height, 56px);
    min-height: var(--topbar-height, 56px);
    padding: 0 var(--sidebar-padding-x) 0 max(0px, calc(var(--sidebar-padding-x) - 12px));
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.sidebar-logo .logo-text {
    font-size: 16px; font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.sidebar-section {
    padding: 0rem 0;
}

.sidebar-section-label {
    padding: 0.4rem var(--sidebar-padding-x);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sidebar-nav a, .nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    height: var(--sidebar-nav-item-height);
    min-height: var(--sidebar-nav-item-height);
    padding: 0 var(--sidebar-padding-x);
    box-sizing: border-box;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
}

.sidebar-nav a:hover, .nav-item:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

.sidebar-nav a.active, .nav-item.active {
    background: var(--accent-muted);
    color: var(--accent);
    font-weight: 500;
}

.sidebar-nav .nav-icon {
    width: 16px; height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
}

.sidebar-nav a.active .nav-icon { opacity: 1; }

/* ============================================================
   Karten / Surfaces
   ============================================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.card-sm { padding: 1rem; border-radius: var(--radius-md); }
.card-lg { padding: 1.75rem; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtle {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

/* ============================================================
   Projekt-Karten (Dashboard)
   ============================================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    isolation: isolate;
}

.project-card {
    position: relative;
    z-index: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 100%;
    box-sizing: border-box;
    /* Nur transform weich — Schatten sofort, weniger „gewischter“ Übergang beim Text */
    transition: transform 0.2s cubic-bezier(0.33, 1, 0.68, 1), border-color 0.2s ease;
    transform: translate3d(0, 0, 0);
    transform-origin: center center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    cursor: pointer;
}

.project-card.is-search-hidden {
    display: none;
}

.project-card:hover {
    z-index: 1;
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translate3d(0, 0, 0) scale3d(1.02, 1.02, 1);
}

@media (prefers-reduced-motion: reduce) {
    .project-card {
        transition: border-color 0.2s ease;
        transform: none;
    }

    .project-card:hover {
        transform: none;
    }
}

.project-card-mid {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

.project-card .tags-list {
    margin-top: auto;
}

.project-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.project-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.project-name-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.project-favicon,
.project-favicon-fallback {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.project-favicon {
    display: block;
    object-fit: cover;
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
}

.project-favicon-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    text-transform: uppercase;
}

.project-favicon[hidden],
.project-favicon-fallback[hidden] {
    display: none !important;
}

.project-url {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.project-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.project-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

.project-meta-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.project-meta-updated {
    flex-shrink: 0;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    text-align: right;
}

/* ============================================================
   Tags
   ============================================================ */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    border: 1.5px solid currentColor;
    background: transparent;
}

.tags-list { display: flex; flex-wrap: wrap; gap: 5px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-strong);
    background: var(--bg-surface-2);
    color: var(--text-primary);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    text-decoration: none;
    line-height: 1;
}

.btn:hover { background: var(--bg-surface-3); }
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--btn-primary-bg, var(--accent));
    border-color: var(--btn-primary-border, var(--accent));
    color: var(--btn-primary-fg, var(--text-on-accent));
}

.btn-primary:hover {
    background: var(--btn-primary-bg-hover, var(--accent-hover));
    border-color: var(--btn-primary-bg-hover, var(--accent-hover));
    color: var(--btn-primary-fg, var(--text-on-accent));
}

.btn-danger {
    background: var(--bg-danger);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

/* Nach .btn/.btn:hover: sonst überschreiben Basis-Button-Stile die Varianten */
.btn.btn-danger-solid,
a.btn.btn-danger-solid {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: #fff;
}

.btn.btn-danger-solid:hover,
a.btn.btn-danger-solid:hover {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: #fff;
    filter: brightness(1.08);
}

.btn.btn-danger-solid:active,
a.btn.btn-danger-solid:active {
    filter: brightness(0.95);
}

a.btn.btn-danger-solid {
    text-decoration: none;
}

/* .btn setzt display:inline-flex und gewinnt sonst gegen [hidden] */
.btn[hidden] {
    display: none !important;
}

/* Klein-Buttons: gleiche Höhe & Schrift wie Standard-.btn (Lesbarkeit + einheitliche Klickfläche) */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 14px;
    font-weight: 500;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-md);
    justify-content: center;
    min-width: 2.35rem;
    min-height: 2.35rem;
    box-sizing: border-box;
    font-size: 14px;
}

.btn-icon svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Zähler-Badge in Filter-Tabs (z. B. ToDos) – passt zu hellem/dunklem Primär-Button */
.btn-tab-count {
    border-radius: 99px;
    padding: 0 0.35rem;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.18);
}

.btn-primary .btn-tab-count {
    background: color-mix(in srgb, var(--btn-primary-fg, var(--text-on-accent)) 22%, transparent);
}

/* ============================================================
   Formulare
   ============================================================ */
.form-group { margin-bottom: 1rem; }

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

textarea { resize: vertical; min-height: 80px; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* ============================================================
   Badges / Status
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-success { background: var(--bg-success); color: var(--color-success); }
.badge-warning { background: var(--bg-warning); color: var(--color-warning); }
.badge-danger  { background: var(--bg-danger);  color: var(--color-danger); }
.badge-info    { background: var(--bg-info);    color: var(--color-info); }
.badge-muted   { background: var(--bg-surface-3); color: var(--text-muted); }

/* ============================================================
   Flash-Nachrichten
   ============================================================ */
.flash-region {
    padding: 2rem 2rem 0;
}

/* Mobil: muss NACH den Basis-Regeln stehen, sonst setzen .page-body (2rem) und
   .topbar (1.5rem) die kompakteren Werte aus dem frühen @media-Block wieder außer Kraft. */
@media (max-width: 48rem) {
    .page-body {
        padding: 1rem max(1rem, env(safe-area-inset-left, 0px)) 1rem max(1rem, env(safe-area-inset-right, 0px));
    }

    .topbar {
        padding-left: max(1rem, env(safe-area-inset-left, 0px));
        padding-right: max(1rem, env(safe-area-inset-right, 0px));
    }

    .flash-region {
        padding-top: 1rem;
        padding-bottom: 0;
        padding-left: max(1rem, env(safe-area-inset-left, 0px));
        padding-right: max(1rem, env(safe-area-inset-right, 0px));
    }
}

@keyframes flash-enter {
    from {
        opacity: 0;
        transform: translateY(-14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes flash-exit {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-14px);
    }
}

.flash {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin: 0;
    border-left: 3px solid;
    pointer-events: auto;
    animation: flash-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.flash.flash-is-hiding {
    pointer-events: none;
    animation: flash-exit 0.42s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@media (prefers-reduced-motion: reduce) {
    .flash {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .flash.flash-is-hiding {
        animation: none;
        opacity: 0;
        transform: none;
        transition: opacity 0.2s ease;
    }
}

.flash-success { background: var(--bg-success); color: var(--color-success); border-color: var(--color-success); }
.flash-danger  { background: var(--bg-danger);  color: var(--color-danger);  border-color: var(--color-danger); }
.flash-info    { background: var(--bg-info);    color: var(--color-info);    border-color: var(--color-info); }

/* ============================================================
   Tabellen
   ============================================================ */
.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 0.6rem 1rem;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-surface-2); }

/* ============================================================
   Config-Einträge (Passwort-Felder)
   ============================================================ */
.config-type-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    opacity: 0.9;
}

.config-type-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* WordPress (Simple Icons, MIT) – nur bei Treffer in Bezeichnung/Wert */
.config-type-icon--wordpress {
    color: #21759b;
}

.config-value-wrap {
    font-family: var(--font-mono, 'Fira Code', monospace);
    font-size: 13px;
}

.config-value-masked { letter-spacing: 0.2em; color: var(--text-muted); }
.config-value-revealed { color: var(--text-primary); }

/* ============================================================
   ToDo-Items
   ============================================================ */
.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.todo-item:last-child { border-bottom: none; }

.todo-item-actions {
    display: flex;
    gap: 0.65rem;
    flex-shrink: 0;
    align-items: center;
}

.project-page .project-todos-desktop .todo-item-actions .priority-dot {
    margin-top: 0;
}

.project-page .project-todos-cards .todo-card--project .todo-card-accent {
    display: none;
}

.project-page .project-todos-cards .todo-card-head-actions .priority-dot--project-card {
    margin-top: 0;
}

.todo-check {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-strong);
    border-radius: 5px;
    flex-shrink: 0;
    margin: 0;
    margin-top: 2px;
    padding: 0;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    box-sizing: border-box;
    vertical-align: middle;
}

.todo-check:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.todo-check:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    box-sizing: border-box;
    transform: translate(-50%, calc(-50% + 0.5px)) rotate(45deg);
    transform-origin: center;
}

html[data-theme="aurora"] .todo-check:checked::after,
html[data-theme="matrix"] .todo-check:checked::after {
    border-color: #14141e;
}

.todo-title { font-size: 14px; flex: 1; }
.todo-title.done { text-decoration: line-through; color: var(--text-muted); }

/* ============================================================
   ToDo-Übersichtsseite (todos.php)
   ============================================================ */
.todos-page .todos-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.todos-page .todos-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.todos-page .todos-tab {
    flex-shrink: 0;
}

.todos-page .todos-toolbar-filters {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
}

.todos-page .todos-project,
.todos-page .todos-priority {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.todos-page .todos-project-label,
.todos-page .todos-priority-label {
    display: none;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.todos-page .todos-project select,
.todos-page .todos-priority select {
    min-width: 11rem;
}

.todos-page .todos-cards {
    display: none;
}

/* Analyse (analyse.php) */
.analyse-stat-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(var(--stat-grid-min), 1fr));
    align-items: stretch;
}

.analyse-stat-grid > .card.analyse-stat {
    height: 100%;
}

.analyse-chart-card {
    margin-top: 1.25rem;
}

.analyse-chart {
    padding: 0.25rem 0 0.5rem;
}

.analyse-chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.35rem;
    min-height: 9rem;
    padding: 0 0.15rem;
}

.analyse-chart-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.analyse-chart-bar-wrap {
    position: relative;
    width: 100%;
    max-width: 2.75rem;
    height: 7rem;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    padding: 2px;
    box-sizing: border-box;
    overflow: visible;
}

.analyse-chart-bar {
    width: 100%;
    min-height: 0;
    border-radius: calc(var(--radius-sm) - 2px);
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, transparent), var(--accent));
    align-self: flex-end;
    transition: height 0.25s ease, opacity 0.16s ease;
}

.analyse-chart-bar--cost {
    background: linear-gradient(180deg, color-mix(in srgb, var(--color-warning) 70%, transparent), var(--color-warning));
    position: relative;
    z-index: 1;
}

.analyse-chart-bar-wrap--cost {
    position: relative;
}

.analyse-chart-bar-segments {
    position: absolute;
    left: 2px;
    right: 2px;
    bottom: 2px;
    display: flex;
    flex-direction: column-reverse;
    gap: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease, gap 0.16s ease;
    z-index: 2;
}

.analyse-chart-segment {
    display: block;
    width: 100%;
    border-radius: 2px;
    transform-origin: center;
    transform: scaleX(1);
    transition: transform 0.16s ease;
}

.analyse-chart-bar-wrap--cost:hover .analyse-chart-bar--cost {
    opacity: 0.16;
}

.analyse-chart-bar-wrap--cost.is-tap-active .analyse-chart-bar--cost {
    opacity: 0.16;
}

.analyse-chart-bar-wrap--cost:hover .analyse-chart-bar-segments {
    opacity: 1;
    gap: 2px;
}

.analyse-chart-bar-wrap--cost.is-tap-active .analyse-chart-bar-segments {
    opacity: 1;
    gap: 2px;
}

.analyse-chart-bar-wrap--cost:hover .analyse-chart-segment {
    transform: scaleX(0.9);
}

.analyse-chart-bar-wrap--cost.is-tap-active .analyse-chart-segment {
    transform: scaleX(0.9);
}

.analyse-chart-bar-segments--week {
    z-index: 2;
}

.analyse-chart-segment--week {
    background: color-mix(in srgb, var(--accent) calc(84% - (var(--seg-idx, 0) * 7%)), var(--bg-surface));
}

.analyse-chart-segment--cost {
    background: color-mix(in srgb, var(--color-warning) calc(86% - (var(--seg-idx, 0) * 7%)), var(--bg-surface));
}

.analyse-chart-cost-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.45rem);
    transform: translateX(-50%) translateY(4px);
    min-width: 11rem;
    max-width: min(16rem, 70vw);
    padding: 0.45rem 0.55rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.14s ease, transform 0.14s ease;
    z-index: 5;
}

.analyse-chart-cost-tooltip-row {
    display: grid;
    grid-template-columns: minmax(4.5rem, 1fr) auto;
    gap: 0.8rem;
    align-items: baseline;
    font-size: 12px;
    line-height: 1.35;
}

.analyse-chart-cost-tooltip-row + .analyse-chart-cost-tooltip-row {
    margin-top: 0.18rem;
}

.analyse-chart-cost-tooltip-partner {
    color: var(--text-secondary);
}

.analyse-chart-cost-tooltip-amount {
    color: var(--text-primary);
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.analyse-chart-bar-wrap--cost:hover .analyse-chart-cost-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.analyse-chart-bar-wrap--cost.is-tap-active .analyse-chart-cost-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.analyse-chart-week-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.45rem);
    transform: translateX(-50%) translateY(4px);
    min-width: 11rem;
    max-width: min(16rem, 70vw);
    padding: 0.45rem 0.55rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.14s ease, transform 0.14s ease;
    z-index: 5;
}

.analyse-chart-week-tooltip-row {
    display: grid;
    grid-template-columns: minmax(4.5rem, 1fr) auto;
    gap: 0.8rem;
    align-items: baseline;
    font-size: 12px;
    line-height: 1.35;
}

.analyse-chart-week-tooltip-row + .analyse-chart-week-tooltip-row {
    margin-top: 0.18rem;
}

.analyse-chart-week-tooltip-project {
    color: var(--text-secondary);
}

.analyse-chart-week-tooltip-count {
    color: var(--text-primary);
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.analyse-chart-bar-wrap--week:hover .analyse-chart-week-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.analyse-chart-bar-wrap--week.is-tap-active .analyse-chart-week-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.analyse-chart-bar-wrap--week:hover .analyse-chart-bar {
    opacity: 0.16;
}

.analyse-chart-bar-wrap--week.is-tap-active .analyse-chart-bar {
    opacity: 0.16;
}

.analyse-chart-bar-wrap--week:hover .analyse-chart-bar-segments--week {
    opacity: 1;
    gap: 2px;
}

.analyse-chart-bar-wrap--week.is-tap-active .analyse-chart-bar-segments--week {
    opacity: 1;
    gap: 2px;
}

.analyse-chart-bar-wrap--week:hover .analyse-chart-segment--week {
    transform: scaleX(0.9);
}

.analyse-chart-bar-wrap--week.is-tap-active .analyse-chart-segment--week {
    transform: scaleX(0.9);
}

.analyse-chart-count {
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    line-height: 1;
}

.analyse-chart-label {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    word-break: break-word;
}

.analyse-uv-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.analyse-uv-filter-label {
    font-size: 11px;
    color: var(--text-muted);
}

.analyse-uv-filter select {
    min-width: 11rem;
}

.card-header--analyse-uv {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
}

.analyse-uv-header-left {
    display: flex;
    flex-direction: column;
    flex: 1 1 12rem;
    min-width: 0;
    min-height: 3.5rem;
}

.analyse-uv-header-left .card-title {
    line-height: 1.25;
}

.analyse-uv-title-value {
    margin-top: auto;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.analyse-line-chart-wrap {
    position: relative;
    width: 100%;
    overflow-x: auto;
}

.analyse-line-chart {
    width: 100%;
    min-width: 38rem;
    height: auto;
    display: block;
}

.analyse-line-chart--mobile {
    display: none;
}

.analyse-line-axis {
    stroke: color-mix(in srgb, var(--text-muted) 35%, transparent);
    stroke-width: 1;
}

.analyse-line-path {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.analyse-line-path--multi {
    stroke-width: 1.8;
    opacity: 0.95;
}

.analyse-line-point {
    fill: var(--accent);
    stroke: transparent !important;
    stroke-width: 0 !important;
    outline: none;
    cursor: pointer;
}

.analyse-line-series.is-dim,
.analyse-line-point--series.is-dim {
    opacity: 0.16;
}

.analyse-line-series.is-highlight {
    opacity: 1;
    stroke-width: 2.8;
}

.analyse-line-point--series.is-highlight {
    opacity: 1;
}

.analyse-line-point.is-selected {
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(1.9);
    stroke: transparent !important;
    stroke-width: 0 !important;
}

.analyse-line-chart text.analyse-line-x-label {
    font-size: 7px;
    fill: var(--text-muted);
}

.analyse-line-chart text.analyse-line-y-label {
    font-size: 7px;
    fill: var(--text-muted);
}

.analyse-uv-legend {
    margin-top: 0.55rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.8rem;
}

.analyse-uv-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    min-width: 0;
    cursor: pointer;
}

.analyse-uv-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.analyse-uv-legend-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.analyse-line-point-tooltip {
    position: fixed;
    z-index: 1200;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -110%);
    transition: opacity 0.12s ease;
    min-width: 10rem;
    max-width: none;
    width: max-content;
    padding: 0.42rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    font-size: 12px;
    line-height: 1.35;
    white-space: pre;
}

.analyse-line-point-tooltip.is-visible {
    opacity: 1;
}

.analyse-stat {
    padding: 1rem 1.1rem;
    min-height: 5.75rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    box-sizing: border-box;
}

.analyse-stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.analyse-stat-value {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    margin-top: auto;
    padding-top: 0.35rem;
}

.analyse-stat--ok .analyse-stat-value {
    color: var(--color-success);
}

.analyse-stat--warn .analyse-stat-value {
    color: var(--color-warning);
}

.analyse-stat--danger .analyse-stat-value {
    color: var(--color-danger);
}

@media (max-width: 40rem) {
    .analyse-cost-title-suffix {
        display: none;
    }

    /* Mobil: nur die letzten 6 Balken zeigen (aktuellste Werte) */
    .analyse-chart-bars > .analyse-chart-col:nth-last-child(n + 7) {
        display: none;
    }

    .analyse-chart {
        overflow-x: clip;
    }

    .analyse-uv-filter {
        width: 100%;
        margin-top: 0.4rem;
    }

    .analyse-uv-filter select {
        min-width: 0;
        width: 100%;
    }

    .analyse-line-chart {
        min-width: 30rem;
    }

    .analyse-line-chart--desktop {
        display: none;
    }

    .analyse-line-chart--mobile {
        display: block;
    }

    .analyse-chart-bars {
        min-height: 8rem;
    }

    .analyse-chart-bar-wrap {
        height: 5.5rem;
    }

    .analyse-chart-bar-wrap--cost,
    .analyse-chart-bar-wrap--week {
        cursor: pointer;
    }

    .analyse-chart-cost-tooltip,
    .analyse-chart-week-tooltip {
        position: fixed;
        left: var(--tap-tooltip-left, 50vw);
        top: var(--tap-tooltip-top, 20vh);
        bottom: auto;
        transform: translateX(-50%) translateY(0);
        max-width: calc(100vw - 1rem);
        z-index: 1200;
    }
}

.todos-page .todo-card,
.project-page .project-todos-cards .todo-card {
    display: flex;
    align-items: stretch;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease;
}

.todos-page .todo-card:hover,
.project-page .project-todos-cards .todo-card:hover {
    border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.todos-page .todo-card--done,
.project-page .project-todos-cards .todo-card--done {
    opacity: 0.9;
}

.todos-page .todo-card--done:hover,
.project-page .project-todos-cards .todo-card--done:hover {
    transform: translateY(-1px);
}

.todos-page .todo-card-accent,
.project-page .project-todos-cards .todo-card-accent {
    width: 5px;
    flex-shrink: 0;
    background: var(--todo-prio, var(--text-muted));
}

.todos-page .todo-card-inner,
.project-page .project-todos-cards .todo-card-inner {
    flex: 1;
    min-width: 0;
    padding: 0.85rem 1rem 0.75rem 0.85rem;
}

.todos-page .todo-card-head,
.project-page .project-todos-cards .todo-card-head {
    display: flex;
    align-items: flex-start;
    flex-wrap: nowrap;
    gap: 0.55rem;
    min-width: 0;
}

.todos-page .todo-card-check-form,
.project-page .project-todos-cards .todo-card-check-form {
    margin: 0;
    flex-shrink: 0;
    line-height: 0;
}

.todos-page .todo-card-title,
.project-page .project-todos-cards .todo-card-title {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    padding-top: 1px;
}

.todos-page .todo-card-title.todo-title.done,
.project-page .project-todos-cards .todo-card-title.todo-title.done {
    font-weight: 500;
}

.todos-page .todo-card-edit,
.project-page .project-todos-cards .todo-card-edit {
    flex-shrink: 0;
    margin-top: -2px;
}

.todos-page .todo-card-meta,
.project-page .project-todos-cards .todo-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.55rem;
    padding-top: 0.6rem;
    border-top: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
    font-size: 12px;
}

.todos-page .todo-card-project {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.todos-page .todo-card-project:hover {
    text-decoration: underline;
}

.todos-page .todo-card-due,
.project-page .project-todos-cards .todo-card-due {
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

@media (max-width: 48rem) {
    .todos-page .todos-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .todos-page .todos-tabs {
        gap: 0.3rem;
    }

    .todos-page .todos-tab {
        justify-content: center;
    }

    .todos-page .todos-toolbar-filters {
        margin-left: 0;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .todos-page .todos-project,
    .todos-page .todos-priority {
        align-items: stretch;
        width: 100%;
    }

    .todos-page .todos-project-label,
    .todos-page .todos-priority-label {
        display: block;
    }

    .todos-page .todos-project select,
    .todos-page .todos-priority select {
        width: 100%;
        min-width: 0;
    }

    .todos-page .card {
        padding: 1rem;
    }

    .todos-page .todos-table-wrap {
        display: none !important;
    }

    .todos-page .todos-cards {
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }

    /* Nach der Basis-`.todo-card`-Regel, sonst überschreibt `background: var(--bg-surface)` den Prio-Verlauf */
    .todos-page .todos-cards .todo-card,
    .project-page .project-todos-cards .todo-card {
        background: color-mix(in srgb, var(--todo-prio, var(--text-muted)) 13%, var(--bg-surface));
    }
}

@media (prefers-reduced-motion: reduce) {
    .todos-page .todo-card:hover,
    .todos-page .todo-card--done:hover,
    .project-page .project-todos-cards .todo-card:hover,
    .project-page .project-todos-cards .todo-card--done:hover {
        transform: none;
    }
}

.priority-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

/* ============================================================
   Suchfeld / Filter-Leiste
   ============================================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: nowrap;
    margin-bottom: 1.5rem;
}

.search-input-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.search-input-wrap input {
    padding-left: 2.25rem;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 14px; height: 14px;
    pointer-events: none;
}

.filter-bar select {
    flex-shrink: 0;
    width: auto;
}

@media (max-width: 600px) {
    .filter-bar { flex-wrap: wrap; }
    .search-input-wrap { flex: 1 1 100%; }
    .filter-bar select { flex: 1 1 calc(50% - 0.3rem); }
}

/* ============================================================
   Stat-Karten (Dashboard-Übersicht)
   ============================================================ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--stat-grid-min), 1fr));
    gap: 1rem;
    margin-bottom: 1.35rem;
    align-items: stretch;
}

.dashboard-greeting {
    margin: 0 0 1.5rem;
    padding: 0;
    line-height: 1.12;
    font-size: clamp(1.75rem, 2.8vw + 1rem, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.dashboard-greeting-line {
    font-weight: 600;
    color: var(--text-secondary);
}

.dashboard-greeting-name {
    font-weight: 700;
    color: var(--accent);
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 5.75rem;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    margin-top: auto;
    padding-top: 0.35rem;
}

.stat-value--success { color: var(--color-success); }
.stat-value--warning { color: var(--color-warning); }
.stat-value--danger { color: var(--color-danger); }

/* Light Theme: gezielte, etwas hellere Stat-Farben nur im Dashboard */
html[data-theme="light"] .stats-row .stat-card .stat-value--warning { color: #cf7f1c !important; }
html[data-theme="light"] .stats-row .stat-card .stat-value--danger { color: #d34747 !important; }

.stat-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============================================================
   Pagina / Utilities
   ============================================================ */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.25rem 0;
}

.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 11px; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }

/* ============================================================
   Login-Seite (außerhalb des Layouts)
   ============================================================ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.login-brand .logo-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.login-brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.login-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Login mobil: kein ablenkender „Schwebkasten“, Formular liegt auf Seitenhintergrund */
@media (max-width: 40rem) {
    .login-wrap {
        min-height: 100vh;
        min-height: 100dvh;
        align-items: flex-start;
        justify-content: flex-start;
        /* Safe Area + etwas Luft nach oben (nicht am oberen Rand „kleben“) */
        padding-top: calc(max(1.25rem, env(safe-area-inset-top, 0px)) + min(10vh, 3.25rem));
        padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
        padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
        box-sizing: border-box;
    }

    .login-card {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0.25rem 0 1rem;
        background: transparent;
        border: none;
        box-shadow: none;
        border-radius: 0;
    }

    .login-brand {
        margin-bottom: 1.25rem;
    }

    .login-sub {
        margin-bottom: 1.5rem;
    }

    /* iOS Safari: unter 16px zoomt die Seite beim Fokus ins Feld — vermeiden */
    .login-wrap input[type="text"],
    .login-wrap input[type="email"],
    .login-wrap input[type="password"] {
        font-size: 16px;
        line-height: 1.35;
    }
}

/* ============================================================
   Theme-Switcher (z. B. Benutzer-Menü)
   ============================================================ */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.theme-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    box-sizing: border-box;
    position: relative;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.theme-btn-preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    pointer-events: none;
}

.theme-btn-preview-bg,
.theme-btn-preview-accent {
    flex: 1 1 50%;
    min-width: 0;
    min-height: 100%;
}

.theme-btn:hover { transform: scale(1.15); }
.theme-btn.active { border-color: var(--accent); }

.theme-btn.active::after {
    content: '';
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    border: 1px solid var(--bg-surface);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.4 6.3 4.9 8.8 9.6 4.1' stroke='%23171a20' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 11px 11px;
}

/* Light-Theme: heller Haken sorgt auf dunklem Accent für besseren Kontrast */
.theme-btn.theme-btn--light.active::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.4 6.3 4.9 8.8 9.6 4.1' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
