/* ============================================================================
   fima24 v2 — Design-System (Horizon-UI-Stil)
   Modernes CSS ohne Framework: Custom Properties, Grid/Flexbox,
   automatischer + manueller Dark Mode, mobile Bottom-Navigation.
   ========================================================================== */

/* DM Sans (selbst gehostet, variabler Font) — keine externen CDNs */
@font-face {
    font-family: "DM Sans";
    font-style: normal;
    font-weight: 100 1000;
    font-display: swap;
    src: url("/assets/fonts/dmsans-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "DM Sans";
    font-style: normal;
    font-weight: 100 1000;
    font-display: swap;
    src: url("/assets/fonts/dmsans-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    /* DM Sans / Inter werden genutzt, sobald als Webfont vorhanden; sonst System-Stack */
    --font: "DM Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "Cascadia Code", Consolas, monospace;

    /* Palette: neutral-forward, ein ruhiger Akzent (Linear/Stripe-Lineage) */
    --bg: #fbfbfc;
    --surface: #ffffff;
    --surface-2: #f4f4f6;
    --border: #e8e8ec;
    --border-strong: #d6d7dc;
    --text: #16181d;
    --text-muted: #60646c;       /* ≥ 4.5:1 auf Weiß */
    --text-subtle: #8b8f98;      /* nur dekorativ */
    --accent: #3498db;           /* eTime-Blau (Peter River) */
    --accent-2: #5dade2;
    --accent-hover: #2980b9;
    --accent-soft: #eaf4fc;
    --gradient: linear-gradient(135deg, #5dade2 0%, #3498db 100%);  /* nur Marketing-Flächen */
    --positive: #1a7f55;
    --negative: #d23b3b;
    --warning: #9a6700;
    --positive-bg: #1a7f55;
    --negative-bg: #ee5d50;
    --warning-bg: #ffb547;

    /* Neutral-Rampe (kühle Grautöne) */
    --n-50: #fbfbfc; --n-100: #f4f4f6; --n-200: #e8e8ec; --n-300: #d6d7dc;
    --n-400: #a0a3ab; --n-500: #71757e; --n-600: #60646c; --n-700: #3a3d44;
    --n-800: #222428; --n-900: #16181d;

    /* Tiefe trägt der Rand, nicht der Schatten (Linear-Schärfe) */
    --card-highlight: 0 0 0 transparent;
    --e1: 0 1px 2px rgb(16 24 40 / .05);
    --e2: 0 2px 8px rgb(16 24 40 / .06), 0 1px 2px rgb(16 24 40 / .04);
    --e3: 0 8px 24px rgb(16 24 40 / .12), 0 2px 6px rgb(16 24 40 / .06);
    --shadow: var(--e1);
    --shadow-lg: var(--e3);

    /* Gestraffte Radien */
    --radius: 12px;
    --radius-sm: 8px;

    /* 8pt-Spacing-Skala */
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;

    /* Modulare Type-Skala (~1.25) + Zeilenhöhen */
    --text-xs: .75rem; --text-sm: .875rem; --text-base: 1rem;
    --text-lg: 1.25rem; --text-xl: 1.5rem; --text-2xl: 2rem; --text-3xl: 2.25rem;
    --leading-tight: 1.2; --leading-normal: 1.5;

    /* ---- Semantisches Design-System (Aliase auf die Basis-Token) ---- */
    --color-primary: #3498db;        --color-primary-hover: #2980b9;
    --color-secondary: #60646c;      --color-accent: #00f5d4;
    --color-success: #1a7f55;        --color-warning: #9a6700;       --color-error: #d23b3b;
    --color-surface: #ffffff;        --color-background: #fbfbfc;
    --radius-xs: 6px;  --radius-md: 12px;  --radius-lg: 16px;  --radius-xl: 24px;
    --shadow-sm: var(--e1);  --shadow-md: var(--e2);  --shadow-strong: var(--e3);
    --s8: 64px;
    --ease: cubic-bezier(.2, .8, .2, 1);  --dur-fast: 120ms;  --dur: 180ms;

    --sidebar-w: 250px;
}

/* Typografie-Rollen (H1–Caption) als Utilities */
.h1 { font-size: var(--text-2xl); font-weight: 800; line-height: var(--leading-tight); letter-spacing: -.02em; margin: 0; }
.h2 { font-size: var(--text-xl); font-weight: 700; line-height: var(--leading-tight); letter-spacing: -.01em; margin: 0; }
.h3 { font-size: var(--text-lg); font-weight: 600; line-height: var(--leading-tight); margin: 0; }
.body { font-size: var(--text-base); font-weight: 450; line-height: var(--leading-normal); }
.caption { font-size: var(--text-xs); font-weight: 500; line-height: 1.4; color: var(--text-muted); }

[data-theme="dark"] {
    --bg: #0a0a0c;
    --surface: #141518;
    --surface-2: #1b1c20;
    --border: #26272b;
    --border-strong: #34353a;
    --text: #f7f8f8;
    --text-muted: #8a8f98;
    --text-subtle: #6c7079;
    --accent: #5dade2;
    --accent-2: #85c1e9;
    --accent-hover: #85c1e9;
    --accent-soft: #123243;
    --gradient: linear-gradient(135deg, #5dade2 0%, #2980b9 100%);
    --positive: #1ed79b;
    --negative: #fb7185;
    --warning: #fbbf24;
    --positive-bg: #1ed79b;
    --negative-bg: #fb7185;
    --warning-bg: #fbbf24;
    --e1: 0 1px 2px rgb(0 0 0 / .4);
    --e2: 0 2px 8px rgb(0 0 0 / .5);
    --e3: 0 8px 24px rgb(0 0 0 / .6);
    --shadow: var(--e1);
    --shadow-lg: var(--e3);
    --card-highlight: 0 0 0 transparent;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0a0a0c;
        --surface: #141518;
        --surface-2: #1b1c20;
        --border: #26272b;
        --border-strong: #34353a;
        --text: #f7f8f8;
        --text-muted: #8a8f98;
        --text-subtle: #6c7079;
        --accent: #5dade2;
        --accent-2: #85c1e9;
        --accent-hover: #85c1e9;
        --accent-soft: #123243;
        --gradient: linear-gradient(135deg, #5dade2 0%, #2980b9 100%);
        --positive: #1ed79b;
        --negative: #fb7185;
        --warning: #fbbf24;
        --positive-bg: #1ed79b;
        --negative-bg: #fb7185;
        --warning-bg: #fbbf24;
        --e1: 0 1px 2px rgb(0 0 0 / .4);
        --e2: 0 2px 8px rgb(0 0 0 / .5);
        --e3: 0 8px 24px rgb(0 0 0 / .6);
        --shadow: var(--e1);
        --shadow-lg: var(--e3);
        --card-highlight: 0 0 0 transparent;
    }
}

/* Wählbare Akzentfarbe (data-accent auf <html>) */
[data-accent="teal"]   { --accent: #0d9488; --accent-2: #14b8a6; --accent-hover: #0b7e74; --accent-soft: #d6f3ef; --gradient: linear-gradient(120deg, #0d9488, #2dd4bf); }
[data-accent="violet"] { --accent: #7c5cff; --accent-2: #a78bfa; --accent-hover: #6a49f0; --accent-soft: #eae5ff; --gradient: linear-gradient(120deg, #7c5cff, #a78bfa); }
[data-accent="green"]  { --accent: #1e9e6a; --accent-2: #34d399; --accent-hover: #18865a; --accent-soft: #def0e7; --gradient: linear-gradient(120deg, #1e9e6a, #34d399); }
[data-accent="orange"] { --accent: #e07b1a; --accent-2: #fb923c; --accent-hover: #c76a12; --accent-soft: #fdecd9; --gradient: linear-gradient(120deg, #e07b1a, #fb923c); }
[data-accent="rose"]   { --accent: #e0467e; --accent-2: #fb7185; --accent-hover: #cc386e; --accent-soft: #fce0eb; --gradient: linear-gradient(120deg, #e0467e, #fb7185); }
[data-theme="dark"][data-accent="teal"]   { --accent-soft: #0c3b37; }
[data-theme="dark"][data-accent="violet"] { --accent-soft: #2a2350; }
[data-theme="dark"][data-accent="green"]  { --accent-soft: #123528; }
[data-theme="dark"][data-accent="orange"] { --accent-soft: #3a2710; }
[data-theme="dark"][data-accent="rose"]   { --accent-soft: #3a1626; }

* { box-sizing: border-box; }

html { font-size: 16px; }

/* Skeleton-Loading (Shimmer) */
.skeleton {
    position: relative; overflow: hidden;
    background: var(--surface-2); border-radius: var(--radius-sm); color: transparent !important;
    min-height: 1em;
}
.skeleton::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent);
    transform: translateX(-100%); animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
/* Rücklagen/Sparziele: Fortschrittsbalken (Breite setzt JS via CSSOM) */
.goal-bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: .3rem; max-width: 340px; }
.goal-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.goal-bar i.done { background: var(--positive); }

/* Dashboard: vom Nutzer ausgeblendete Karten (gewinnt gegen hidden-Toggles der Loader) */
[data-card].card-hidden { display: none !important; }

/* Notizblock: Vorschau mit Zeilenumbrüchen, Karte klickbar */
.note-card { cursor: pointer; }
.note-preview { white-space: pre-wrap; word-break: break-word; }

/* Monospace-Inline (IBAN/BIC im IBAN-Rechner) */
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .02em; }

/* Optimistische Löschung: Zeile/Element sanft ausblenden */
@keyframes list-leave { to { opacity: 0; transform: translateX(14px); } }
.leaving { animation: list-leave .22s ease forwards; pointer-events: none; }

/* Navigations-Fortschritt: schmaler Balken oben, sobald der Browser die
   nächste Seite lädt (app.js setzt ihn bei beforeunload) — sofortiges
   Feedback auf langsamen Verbindungen statt „nichts passiert". */
#nav-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0;
    background: var(--accent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 55%, transparent);
    z-index: 3000; pointer-events: none;
    animation: nav-progress 8s cubic-bezier(.08, .6, .15, 1) forwards;
}
@keyframes nav-progress {
    0%   { width: 0; }
    8%   { width: 38%; }
    100% { width: 94%; }
}

/* Sanfter Farbübergang beim Umschalten Hell/Dunkel/Akzent (app.js setzt
   die Klasse kurzzeitig). KEIN !important, damit prefers-reduced-motion
   (transition: none !important) weiterhin gewinnt. */
html.theme-anim, html.theme-anim body, html.theme-anim * {
    transition: background-color .3s ease, color .3s ease, border-color .3s ease, fill .3s ease;
}

/* Skip-Link: nur bei Tastatur-Fokus sichtbar */
.skip-link {
    position: fixed; top: -60px; left: var(--s3); z-index: 1000;
    background: var(--accent); color: #fff; padding: .55rem 1rem;
    border-radius: var(--radius-sm); font-weight: 600; box-shadow: var(--e2);
    transition: top .15s ease;
}
.skip-link:focus { top: var(--s3); outline: 2px solid #fff; outline-offset: 2px; }
.content:focus { outline: none; }
.confetti-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2000; }

/* Styleguide: Illustrations-Galerie */
.sg-illos { display: flex; flex-wrap: wrap; gap: var(--s5); align-items: center; }
.sg-illo { width: 64px; height: 64px; color: var(--accent); }
.sg-illo svg { width: 100%; height: 100%; display: block; }

/* Anzeigedichte: kompakt (Konto → Darstellung) — engere Paddings */
[data-density="compact"] .card { padding: var(--s4); }
[data-density="compact"] table.data td,
[data-density="compact"] table.data th { padding-top: .4rem; padding-bottom: .4rem; }
[data-density="compact"] .btn { padding-top: .42rem; padding-bottom: .42rem; }
[data-density="compact"] .field { gap: var(--s1); }
[data-density="compact"] .stat-card { padding: var(--s4); }
/* Skeleton-Zeilen in Datentabellen (Breitenvariation ohne Inline-Styles) */
.skeleton-line { display: block; height: .8em; width: 70%; border-radius: 6px; }
.skeleton-row td:nth-child(2n) .skeleton-line { width: 55%; }
.skeleton-row td:first-child .skeleton-line { width: 80%; }
.skeleton-row td.num .skeleton-line, .skeleton-row td:last-child .skeleton-line { width: 45%; margin-left: auto; }
.skeleton-row:hover { background: none !important; }
.accent-swatches { display: flex; gap: .6rem; flex-wrap: wrap; }
.accent-swatch { width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.accent-swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.accent-swatch.sw-blue   { background: #3498db; }
.accent-swatch.sw-teal   { background: #0d9488; }
.accent-swatch.sw-violet { background: #7c5cff; }
.accent-swatch.sw-green  { background: #1e9e6a; }
.accent-swatch.sw-orange { background: #e07b1a; }
.accent-swatch.sw-rose   { background: #e0467e; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* SVG-Icons (Logo/Sprite) */
svg.icon { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
/* Font-Awesome-Icons */
i.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}
.btn i.icon { width: auto; min-width: 1em; font-size: .92em; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}
@keyframes pop-in {
    from { opacity: 0; transform: scale(.96) translateY(8px); }
    to   { opacity: 1; transform: none; }
}
@keyframes backdrop-in {
    from { opacity: 0; }
}

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

/* Cross-Document View Transitions (@view-transition { navigation: auto })
   wurden ENTFERNT: sie froren die Android-WebView (FiMa-App) bei jedem
   Seitenwechsel sekundenlang im Übergangs-Snapshot ein und hängten auch
   Headless-Chrome-Captures auf. Die view-transition-names bleiben — sie
   greifen nur noch bei den JS-gesteuerten Same-Document-Übergängen (viewSwap). */
::view-transition-old(root), ::view-transition-new(root) {
    animation-duration: 180ms;
    animation-timing-function: cubic-bezier(.2, .8, .2, 1);
}
.sidebar { view-transition-name: sidebar; }
.topbar  { view-transition-name: topbar; }
.bottomnav { view-transition-name: bottomnav; }

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem .75rem;
    gap: 1rem;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    padding: .25rem .5rem;
}
.brand:hover { text-decoration: none; }
.brand .icon { width: 1.7rem; height: 1.7rem; color: var(--accent); }
.brand span {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Testumgebung (test.fima24.de): Logo blinkt + TEST-Tag, damit sofort klar
   ist, dass man NICHT auf den Produktivdaten arbeitet. */
@keyframes logo-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: .25; }
}
.brand .icon.logo-test { animation: logo-blink 1.2s ease-in-out infinite; color: var(--warning, #e8a13c); }
.env-test-tag {
    font-size: .6em;
    font-weight: 800;
    letter-spacing: .06em;
    vertical-align: super;
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
    color: #e8a13c;
}

.sidebar-nav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .95rem;
    font-weight: 500;
    width: 100%;
    border: 0;
    background: none;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-link.active::before {
    content: "";
    position: absolute;
    left: -.4rem;
    top: 18%;
    bottom: 18%;
    width: 4px;
    border-radius: 4px;
    background: var(--accent);
}

.sidebar-footer { display: flex; flex-direction: column; gap: .15rem; }

.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: .8rem .75rem .3rem; }
.nav-link-sm { font-size: .85rem; padding: .45rem .75rem; }
.nav-link-sm i.icon { font-size: .85rem; color: var(--warning); }

.layout-main { margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100dvh; min-width: 0; overflow-x: clip; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 2rem;
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.page-title { font-size: 1.55rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }

/* Globale Suche (Topbar) */
.topbar-search { position: relative; flex: 1; max-width: 460px; margin: 0 1rem; }
.topbar-search__icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.topbar-search__icon i.icon { width: auto; font-size: .95rem; }
.topbar-search input { width: 100%; padding-left: 2.4rem; padding-right: 3.2rem; border-radius: 999px; background: var(--surface); }
kbd, .kbd { font-family: var(--mono); font-size: .72em; line-height: 1; padding: .2em .45em; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); color: var(--text-muted); white-space: nowrap; }
.topbar-search__kbd { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); cursor: pointer; }
.topbar-search__kbd:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 760px) { .topbar-search__kbd { display: none; } }
.topbar-search__results {
    position: absolute; left: 0; right: 0; top: calc(100% + .5rem);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); padding: .4rem; z-index: 40; max-height: 70vh; overflow: auto;
}
.topbar-search__group { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: .5rem .6rem .2rem; }
.topbar-search__item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem .6rem; border-radius: var(--radius-sm); color: var(--text); }
.topbar-search__item:hover { background: var(--surface-2); text-decoration: none; }
.topbar-search__item .muted { color: var(--text-muted); font-size: .8rem; white-space: nowrap; }
.topbar-search__empty { padding: .8rem .6rem; color: var(--text-muted); font-size: .88rem; }
@media (max-width: 700px) { .topbar-search { display: none; } }

/* Benutzer-Menü (Dropdown oben rechts) */
.user-menu { position: relative; }
.user-menu__trigger {
    display: flex; align-items: center; gap: .5rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
    padding: .3rem .8rem .3rem .35rem; cursor: pointer; color: var(--text); font: inherit;
    box-shadow: var(--shadow); transition: background-color .15s ease;
}
.user-menu__trigger:hover { background: var(--surface-2); }
.user-menu__avatar {
    width: 2rem; height: 2rem; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: #fff;
}
.user-menu__avatar i.icon { width: auto; font-size: 1rem; }
.user-menu__name { font-size: .9rem; font-weight: 600; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__caret { font-size: .7rem; color: var(--text-muted); transition: transform .15s ease; }
.user-menu.open .user-menu__caret { transform: rotate(180deg); }
.user-menu__dropdown {
    position: absolute; right: 0; top: calc(100% + .5rem); min-width: 210px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); padding: .4rem; display: none; z-index: 30;
}
.user-menu.open .user-menu__dropdown { display: block; animation: pop-in .15s ease both; }
.user-menu__item {
    display: flex; align-items: center; gap: .65rem; width: 100%;
    padding: .55rem .7rem; border: 0; background: none; border-radius: var(--radius-sm);
    color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; text-align: left;
}
.user-menu__item:hover { background: var(--surface-2); text-decoration: none; }
.user-menu__item--danger:hover { color: var(--negative); }
.user-menu__item i.icon { width: 1.2rem; color: var(--text-muted); }
.user-menu__form { margin: 0; }
.user-menu__section { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: .5rem .7rem .2rem; }
.user-menu__sep { height: 1px; background: var(--border); margin: .4rem 0; }
.user-menu__startpage { display: block; padding: .1rem .7rem .3rem; margin: 0; }
.user-menu__startpage select { width: 100%; }

/* Banner beim Ansehen eines freigegebenen Kontos */
.acting-banner {
    display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
    margin: .25rem 2rem 0; padding: .6rem 1rem;
    background: color-mix(in srgb, var(--warning) 16%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
    border-radius: var(--radius-sm); color: var(--text); font-size: .9rem;
}
.acting-banner span { flex: 1; }
.acting-banner i.icon { color: var(--warning); }
@media (max-width: 900px) { .acting-banner { margin: .25rem .9rem 0; } }

/* Volle Bildschirmbreite */
.content { padding: var(--s5) var(--s6) var(--s7); display: flex; flex-direction: column; gap: var(--s5); width: 100%; }
.content > * { animation: fade-up .35s ease both; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.content > *:nth-child(4) { animation-delay: .12s; }
.content > *:nth-child(5) { animation-delay: .16s; }

.bottomnav { display: none; }

@media (max-width: 900px) {
    .sidebar { display: none; }
    .layout-main { margin-left: 0; }
    .content { padding: .25rem .9rem 5.5rem; }
    .topbar { padding: .9rem; }

    .bottomnav {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        position: fixed;
        inset: auto 0 0 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
        z-index: 20;
    }
    .bottomnav-link {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: .15rem;
        font-size: .65rem;
        color: var(--text-muted);
        padding: .35rem 0 .25rem;
        border-radius: var(--radius-sm);
        transition: color .15s ease;
    }
    .bottomnav-link.active { color: var(--accent); }
    .bottomnav-link.active::before {
        content: "";
        position: absolute;
        top: 0;
        width: 26px;
        height: 3px;
        border-radius: 0 0 3px 3px;
        background: var(--accent);
    }
    .bottomnav-link:hover { text-decoration: none; }
}

/* ---------------------------------------------------------------- Karten */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--e1), var(--card-highlight);
    padding: var(--s5);
    transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card:hover { box-shadow: var(--e2), var(--card-highlight); }
/* Bewusst KEIN translateY bei Hover (Nutzer-Vorgabe: keine Positionswechsel) */
a.card:hover { border-color: var(--border-strong); }

.card-title {
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
    margin: 0 0 var(--s3);
}

.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); }
.card-header .card-title { margin: 0; }
/* Mobil: Aktions-Reihe unter den Titel stapeln, statt daneben zu quetschen */
@media (max-width: 640px) {
    .card-header { flex-wrap: wrap; gap: var(--s3); }
    .card-header > .row { width: 100%; }
}

/* [hidden] global durchsetzen: Author-Regeln wie .btn { display: inline-flex }
   schlagen sonst die UA-Regel [hidden]{display:none}, sodass el.hidden=true
   wirkungslos bliebe. */
[hidden] { display: none !important; }

/* Onboarding (leeres Konto) */
.onboarding { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s5); background: var(--gradient); color: #fff; border: 0; }
.onboarding[hidden] { display: none; }
.onboarding__text h2 { margin: 0 0 .25rem; font-size: var(--text-lg); }
.onboarding__text p { margin: 0; opacity: .92; }
/* Fortschrittsbalken (Breite CSP-fest über step-Klasse) */
.onboarding__bar { height: 6px; max-width: 260px; margin-top: .45rem; background: color-mix(in srgb, currentColor 18%, transparent); border-radius: 999px; overflow: hidden; }
.onboarding__bar > span { display: block; height: 100%; width: 0; border-radius: 999px; background: currentColor; transition: width .4s var(--ease, ease); }
.onboarding__bar.step-1 > span { width: 33%; }
.onboarding__bar.step-2 > span { width: 66%; }
.onboarding__bar.step-3 > span { width: 100%; }
@media (prefers-reduced-motion: reduce) { .onboarding__bar > span { transition: none; } }
.onboarding__steps { display: flex; flex-wrap: wrap; gap: var(--s3); }
.onboarding__step { display: flex; align-items: center; gap: var(--s3); background: rgb(255 255 255 / .15); border-radius: var(--radius-sm); padding: var(--s3) var(--s4); color: #fff; }
.onboarding__step:hover { background: rgb(255 255 255 / .25); text-decoration: none; }
.onboarding__step .muted { display: block; color: rgb(255 255 255 / .82); font-size: var(--text-xs); }
.onboarding__num { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #fff; color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.onboarding__try { display: flex; align-items: center; gap: var(--s3); width: 100%; margin-top: var(--s1); color: rgb(255 255 255 / .92); font-size: var(--text-sm); }
.onboarding__count { display: block; margin-top: var(--s2); color: rgb(255 255 255 / .82); font-size: var(--text-xs); }
.onboarding__step.done { background: rgb(255 255 255 / .28); }
.onboarding__step.done .onboarding__num { background: var(--accent-2, #fff); color: #fff; }
.onboarding__step.done strong { text-decoration: line-through; opacity: .85; }
.onboarding__try .btn-ghost { color: #fff; }
.onboarding__try .btn-ghost:hover { background: rgb(255 255 255 / .18); }

/* Dashboard-Hero (Begrüßung) */
/* Ruhige Begrüßungszeile statt lautem Gradient-Banner (Linear/Stripe-Ton) */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s5);
    padding: var(--s1) 0 0;
    background: none;
    color: var(--text);
}
.hero-eyebrow { margin: 0; font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); text-transform: capitalize; }
.hero-title { margin: .15rem 0 .2rem; font-size: var(--text-xl); font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.hero-sub { margin: 0; font-size: var(--text-sm); color: var(--text-muted); }
.hero-illo { width: 96px; flex-shrink: 0; color: var(--accent); opacity: .2; }
.hero-illo svg { width: 100%; height: auto; display: block; }
@media (max-width: 640px) {
    .hero-illo { display: none; }
    .hero-title { font-size: var(--text-lg); }
}

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
/* Objekt-Kacheln: einheitliche Größe. auto-FILL (nicht -fit) verhindert, dass
   eine einzelne Kachel auf volle Breite streckt; feste Mindestbreite begrenzt
   die Spaltenzahl (kein „6 nebeneinander"). */
.object-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }

.stat-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.stat-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-muted); font-size: var(--text-sm); font-weight: 500; }
.stat-card { display: flex; align-items: center; gap: var(--s4); }

/* Primärer KPI (Gesamtsaldo) dominiert visuell */
.stat-card--primary {
    grid-column: span 2;
    flex-direction: column; align-items: stretch; justify-content: center; gap: var(--s2);
    background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
    border-color: color-mix(in srgb, var(--accent) 18%, var(--border));
}
.stat-card--primary .stat-card__top { display: flex; align-items: center; gap: var(--s3); }
.stat-card--primary .stat-value { font-size: 2.4rem; }
.stat-value-row { display: flex; align-items: baseline; gap: var(--s4); flex-wrap: wrap; }
.kpi-spark { margin-left: auto; width: 132px; height: 36px; color: var(--accent); opacity: .85; flex-shrink: 0; }
.kpi-spark .spark { width: 100%; height: 100%; display: block; }
/* Mini-Sparklines neben Einnahmen/Ausgaben (erben pos/neg-Farbe) */
.kpi-spark-mini { display: inline-block; vertical-align: middle; width: 56px; height: 16px; margin-left: .35rem; opacity: .75; }
.kpi-spark-mini .spark { width: 100%; height: 100%; display: block; }
.kpi-spark-mini.pos { color: var(--positive); }
.kpi-spark-mini.neg { color: var(--negative); }
.kpi-delta { font-size: var(--text-sm); font-weight: 600; }
.kpi-delta.pos { color: var(--positive); }
.kpi-delta.neg { color: var(--negative); }
.stat-card__sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); font-size: var(--text-sm); color: var(--text); }
.stat-card__sub .dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.stat-card__sub .dot.pos { background: var(--positive); }
.stat-card__sub .dot.neg { background: var(--negative); }
@media (max-width: 640px) { .stat-card--primary { grid-column: span 1; } .stat-card--primary .stat-value { font-size: 2rem; } }

/* Skeleton-Breite für ladende Kennzahlen */
.stat-value.skeleton, .amount.skeleton { display: inline-block; min-width: 4ch; min-height: 1em; border-radius: 6px; }
.stat-icon {
    flex-shrink: 0; width: 3.5rem; height: 3.5rem; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent); font-size: 1.3rem;
}
.stat-icon i.icon { width: auto; }
.stat-icon.income { background: color-mix(in srgb, var(--positive) 16%, transparent); color: var(--positive); box-shadow: none; }
.stat-icon.expense { background: color-mix(in srgb, var(--negative) 16%, transparent); color: var(--negative); box-shadow: none; }

.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount.pos { color: var(--positive); }
.amount.neg { color: var(--negative); }

/* Positiver Statustext (z.B. "Datenbank ist aktuell."). Compound-Selektor,
   damit die Farbe auch .muted (gleiche Spezifitaet, spaeter definiert) schlaegt. */
.text-pos, .muted.text-pos { color: var(--positive); font-weight: 600; }

/* Geändertes (noch nicht gespeichertes) Formularfeld — Bernstein/Amber, NICHT
   rot (rot signalisiert einen Fehler, nicht bloß eine ungespeicherte Änderung). */
input.dirty, select.dirty, textarea.dirty,
input.dirty:focus, select.dirty:focus, textarea.dirty:focus {
    border-color: var(--warning);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 22%, transparent);
}

/* ---------------------------------------------------------------- Tabellen */

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

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
table.data th {
    text-align: left;
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    padding: var(--s3) var(--s3);
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
}
table.data td { padding: var(--s3); border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
table.data tbody tr:hover { background: var(--surface-2); }
/* Ziffern gleicher Breite in ALLEN Zahlenspalten (Mengen, Prozente, Zähler,
   Stunden …), damit die Spalten nicht „zappeln" — nicht nur bei Beträgen. */
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* Beträge als harte rechte Kante mit Ziffern gleicher Breite */
table.data td.num .amount, table.data td .amount { font-variant-numeric: tabular-nums; font-weight: 600; }
/* Zahlen-Eingaben durchgängig rechtsbündig mit gleichbreiten Ziffern */
.num-input { text-align: right; font-variant-numeric: tabular-nums; }
table.data .muted { color: var(--text-muted); font-size: var(--text-xs); }
/* Summenzeile im Tabellenfuss (z. B. Rechnungsübersicht: Netto/Brutto der Filtermenge) */
table.data tfoot .sum-row td { font-weight: 700; border-top: 2px solid var(--border-strong); background: color-mix(in srgb, var(--surface-2) 55%, transparent); }

/* Jahres-Filterleiste (Depot-Aufstellung u. a.) */
.year-filter { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }

/* Depot-Aufstellung: breite Monats-Matrix je Wertpapier (Dividenden JAN–DEZ + Summenspalten) */
table.depot-portfolio { font-size: var(--text-xs); white-space: nowrap; }
table.depot-portfolio th, table.depot-portfolio td { padding: .35rem .5rem; }
table.depot-portfolio td.num { font-variant-numeric: tabular-nums; }
table.depot-portfolio th.sum, table.depot-portfolio td.sum { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }

/* Kostenart-Zelle: ruhiger Text, der erst bei Klick zum Auswahlfeld wird */
.cost-cell {
    display: inline-block;
    max-width: 100%;
    padding: .15rem .45rem;
    margin: -.15rem -.45rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background .12s ease, color .12s ease;
}
.cost-cell:hover { background: var(--accent-soft); color: var(--accent); }
.cost-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cost-cell--empty { color: var(--text-muted); font-style: italic; }

/* Segmentierte Auswahl (z. B. Erscheinungsbild System/Hell/Dunkel) */
.segmented { display: inline-flex; gap: .25rem; padding: .25rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.segmented button {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .4rem .8rem; border: none; background: none; cursor: pointer;
    color: var(--text-muted); font: inherit; font-size: var(--text-sm); font-weight: 500;
    border-radius: var(--radius-sm); transition: background .12s ease, color .12s ease;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Datentabellen auf Mobil als Karten (statt Horizontalscroll) */
@media (max-width: 640px) {
    table.cards-mobile thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    table.cards-mobile, table.cards-mobile tbody, table.cards-mobile tr, table.cards-mobile td { display: block; width: 100%; }
    table.cards-mobile tr {
        border: 1px solid var(--border); border-radius: var(--radius-sm);
        background: var(--surface) !important; box-shadow: var(--e1);
        margin-bottom: var(--s3); padding: var(--s2) var(--s3);
    }
    table.cards-mobile td {
        display: flex; justify-content: space-between; align-items: center; gap: var(--s3);
        border: 0; padding: .35rem 0; text-align: right;
        /* Lange, ungebrochene Strings (Verwendungszweck, IBAN) dürfen die Karte
           nicht sprengen — sonst wird die ganze Seite horizontal scrollbar. */
        min-width: 0; overflow-wrap: anywhere; word-break: break-word;
    }
    table.cards-mobile td::before {
        content: attr(data-label); flex-shrink: 0;
        color: var(--text-muted); font-weight: 600; font-size: var(--text-xs);
        text-transform: uppercase; letter-spacing: .04em; text-align: left;
    }
    table.cards-mobile td:not([data-label]) { justify-content: flex-end; }
    table.cards-mobile td:not([data-label])::before { content: none; }
    table.cards-mobile td > .muted { text-align: right; }
    table.cards-mobile td select { width: auto; max-width: 60%; }
}

/* ---------------------------------------------------------------- Formulare */

.form-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }

.field { display: flex; flex-direction: column; gap: var(--s2); }
.field > label { font-size: var(--text-sm); font-weight: 600; color: var(--text); }
.field.span-2 { grid-column: span 2; }
.field.field-end { align-self: end; }
.form-note { margin: 0; padding: var(--s2) var(--s3); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-muted); font-size: var(--text-sm); }
.form-note.span-2 { grid-column: 1 / -1; }

input, select, textarea {
    font-family: inherit;
    font-size: .95rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .55rem .7rem;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
/* Sichtbarer Tastatur-Fokus für Buttons/Links (Maus-Klick bleibt ruhig) */
.btn:focus-visible, .nav-link:focus-visible, .tab:focus-visible, a:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
input[type="checkbox"] { width: auto; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    font-family: inherit;
    font-size: .92rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    padding: .6rem 1.25rem;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    white-space: nowrap;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 24%, transparent);
    transition: background-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform .08s ease;
}
.btn:hover {
    background: var(--accent-hover);
    text-decoration: none;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 28%, transparent);
}
.btn:active { transform: translateY(1px); }
.btn svg.icon { width: 1.05rem; height: 1.05rem; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: none; }
.btn-secondary:hover { background: var(--surface-2); box-shadow: none; }

.btn-danger { background: var(--negative); box-shadow: 0 1px 2px color-mix(in srgb, var(--negative) 24%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--negative) 88%, #000); box-shadow: 0 4px 12px color-mix(in srgb, var(--negative) 28%, transparent); }
.btn-success { background: var(--positive); box-shadow: 0 1px 2px color-mix(in srgb, var(--positive) 24%, transparent); }
.btn-success:hover { background: color-mix(in srgb, var(--positive) 88%, #000); box-shadow: 0 4px 12px color-mix(in srgb, var(--positive) 28%, transparent); }

.btn-ghost { background: none; color: var(--text-muted); padding: .35rem .45rem; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); box-shadow: none; }

.btn-sm { font-size: .8rem; padding: .35rem .7rem; }

/* ---------------------------------------------------------------- Badges & Tabs */

.badge {
    display: inline-flex;
    align-items: center;
    /* Badges untereinander bündig, egal ob mit oder ohne Icon (inline-flex
       richtet sich sonst an der Baseline des ERSTEN Kindes aus) */
    vertical-align: middle;
    gap: .3rem;
    font-size: .72rem;
    font-weight: 600;
    border-radius: 999px;
    padding: .15rem .6rem;
    background: var(--accent-soft);
    color: var(--accent);
}
.badge.green { background: color-mix(in srgb, var(--positive) 15%, transparent); color: var(--positive); }
.badge.red { background: color-mix(in srgb, var(--negative) 15%, transparent); color: var(--negative); }
.badge.gray { background: var(--surface-2); color: var(--text-muted); }
.badge.yellow { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
/* Objekt-Titel (inline umbenennbar) — Ziel der Shared-Element-Transition */
.object-title { font-size: var(--text-lg); font-weight: 700; letter-spacing: -.01em; margin: 0; view-transition-name: object-title; }
::view-transition-group(object-title) { animation-duration: 240ms; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }

/* Chart-Tooltip + Hover-Punkte */
.chart-tip {
    position: absolute; z-index: 5; pointer-events: none;
    background: var(--n-900); color: #fff; font-size: var(--text-xs); line-height: 1.35;
    padding: .4rem .6rem; border-radius: 8px; box-shadow: var(--e3); white-space: nowrap;
}
[data-theme="dark"] .chart-tip { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.chart-tip[hidden] { display: none; }
.chart-dot { opacity: 0; transition: opacity .12s ease; }
.chart-dot--on { opacity: 1; }

.status-cell { display: inline-flex; align-items: center; gap: .4rem; }
.status-mark { color: var(--text-subtle); display: inline-flex; }
.status-mark i.icon { width: auto; font-size: .85rem; }
.badge-invoice { margin-left: .4rem; background: var(--accent-soft); color: var(--accent); font-weight: 600; vertical-align: middle; }
.badge-invoice i.icon { font-size: .7rem; width: auto; }
.ocr-text { white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; background: var(--surface-2); padding: .6rem; border-radius: var(--radius-sm); font-size: .8rem; margin: .4rem 0 0; }

/* XRechnung-Viewer: Kopf-Grid + größerer XML-Bereich */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem 1.6rem; margin-top: .4rem; }
.einvoice-xml { max-height: 460px; font-family: var(--mono); }
.sums-table { margin-left: auto; min-width: 260px; }
.sums-table td { padding: .3rem .6rem; }

.flash-message {
    border-left: 4px solid var(--accent);
    font-weight: 500;
}

/* Befehls-Palette (⌘/Strg-K) */
.cmdk { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.cmdk[hidden] { display: none; }
.cmdk__backdrop { position: absolute; inset: 0; background: rgb(16 24 40 / .45); animation: backdrop-in .15s ease; }
.cmdk__panel { position: relative; width: min(92vw, 580px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--e3); overflow: hidden; animation: pop-in .15s ease both; }
.cmdk__search { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); border-bottom: 1px solid var(--border); }
.cmdk__search i.icon { color: var(--text-muted); width: auto; }
.cmdk__search input { border: 0; padding: 0; font-size: var(--text-lg); background: none; }
.cmdk__search input:focus { outline: none; box-shadow: none; }
.cmdk__list { list-style: none; margin: 0; padding: var(--s2); max-height: 52vh; overflow: auto; }
.cmdk__group { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: var(--s3) var(--s2) var(--s1); }
.cmdk__item { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-radius: var(--radius-sm); cursor: pointer; }
.cmdk__item i.icon { color: var(--text-muted); width: 1.2rem; }
.cmdk__item .cmdk__title { font-weight: 500; }
.cmdk__item .cmdk__sub { margin-left: auto; color: var(--text-muted); font-size: var(--text-xs); }
.cmdk__item.active { background: var(--accent-soft); }
.cmdk__item.active i.icon, .cmdk__item.active .cmdk__title { color: var(--accent); }
.cmdk__empty { padding: var(--s5); color: var(--text-muted); text-align: center; }
.cmdk__hint { display: flex; gap: var(--s4); justify-content: center; padding: var(--s2); border-top: 1px solid var(--border); color: var(--text-subtle); font-size: var(--text-xs); }
@media (max-width: 640px) { .cmdk__hint { display: none; } }

/* Aufklapp-Bereiche (<details>) außerhalb der Overflow-Menüs — dezenter
   Chevron statt Browser-Dreieck; Hover ändert NUR die Farbe (keine Positions-
   verschiebung), der Marker dreht beim Öffnen. */
details:not(.menu) > summary {
    list-style: none; cursor: pointer; user-select: none;
    display: inline-flex; align-items: center; gap: .4rem;
    font-weight: 600; color: var(--text-muted); padding: .2rem 0;
}
details:not(.menu) > summary::-webkit-details-marker, details:not(.menu) > summary::marker { display: none; }
details:not(.menu) > summary::before { content: "\25B8"; font-size: .8em; transition: transform .15s ease; }
details:not(.menu)[open] > summary::before { transform: rotate(90deg); }
details:not(.menu) > summary:hover { color: var(--text); }
@media (prefers-reduced-motion: reduce) { details:not(.menu) > summary::before { transition: none; } }

/* Overflow-Menü (native <details>, CSP-sicher) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker, .menu > summary::marker { display: none; content: ""; }
.menu > summary::after { content: "\25BE"; font-size: .7em; margin-left: .35rem; opacity: .7; }
.menu__list {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
    display: flex; flex-direction: column; gap: 2px; min-width: 220px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--e3); padding: var(--s1);
    animation: pop-in .14s ease both;
}
.menu__list .btn {
    justify-content: flex-start; width: 100%;
    background: none; border: 0; box-shadow: none; color: var(--text); font-weight: 500;
}
.menu__list .btn:hover { background: var(--surface-2); box-shadow: none; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
    padding: .6rem 1rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-muted);
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-up .25s ease both; view-transition-name: tab-panel; }
::view-transition-group(tab-panel) { animation-duration: 200ms; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
.tab-panel > .card + .card { margin-top: 1.25rem; }

/* Konto-Chips (Umsatzliste nach Konto/Bankverbindung trennen) */
.account-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.account-chips:empty { display: none; }
.account-chips .chip {
    border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
    border-radius: 999px; padding: .35rem .85rem; font-size: .85rem; font-weight: 500; cursor: pointer;
}
.account-chips .chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Inline-Checkbox-Beschriftung (z.B. „Inaktive ausblenden") */
.checkline { display: inline-flex; align-items: center; gap: .4rem; color: var(--text-muted); cursor: pointer; }
tr.row-inactive td { opacity: .55; }
/* Bankverbindung wird gerade abgerufen (Einzelabruf/Rundruf) */
tr.row-syncing td { background: rgba(52, 152, 219, .12); }
/* Split-Teilzeilen einer Buchung (Auswertung) */
tr.split-row td { background: rgba(127, 127, 127, .08); font-size: var(--text-sm); }
/* Inline-Kommentar/Notiz je Buchung */
.movement-note { display: inline-block; margin-top: .15rem; font-size: var(--text-sm); cursor: pointer; border-radius: 5px; padding: 0 .25rem; overflow-wrap: anywhere; max-width: 100%; }
.movement-note:hover { background: rgba(52, 152, 219, .12); }
.movement-note--empty { color: var(--text-muted); opacity: .75; }
/* Konto-Gruppenkopf in der Umsatzliste („Alle Konten") */
tr.group-row td { background: var(--surface-2); font-weight: 700; color: var(--text); }

/* Konsolen-/Log-Ausgabe (z.B. Legacy-Import) */
.log-output {
    margin-top: .75rem; max-height: 22rem; overflow: auto;
    padding: .75rem .9rem; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font-family: var(--mono);
    font-size: .8rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}

/* 2FA-Wiederherstellungscodes */
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem .75rem; margin: .75rem 0; }
.recovery-codes li { padding: 0; }
.recovery-codes code { font-size: 1rem; letter-spacing: .05em; }

/* ---------------------------------------------------------------- Filterleiste */

.filterbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.filterbar .field { min-width: 150px; flex: 0 1 auto; }
.filterbar .grow { flex: 1 1 220px; }

/* ---------------------------------------------------------------- Toasts */

.toasts {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    z-index: 100;
}
.toast {
    display: flex; align-items: flex-start; gap: .6rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    box-shadow: var(--e3);
    padding: .7rem 1rem;
    max-width: 360px;
    font-size: var(--text-sm);
    animation: toast-in .22s cubic-bezier(.2, .8, .2, 1);
}
.toast i.icon { width: auto; font-size: 1rem; margin-top: .1rem; }
.toast.success { border-left-color: var(--positive); }
.toast.success i.icon { color: var(--positive); animation: pop-check .35s ease both; }
.toast.error { border-left-color: var(--negative); }
.toast.error i.icon { color: var(--negative); }
.toast.info i.icon { color: var(--accent); }
.toast__action { margin-left: auto; align-self: center; background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: .1rem .3rem; border-radius: 6px; }
.toast__action:hover { background: var(--accent-soft); }
.toast--out { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(12px); } }
@keyframes pop-check { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }

/* Optimistisches „gespeichert"-Feedback (kurzes grünes Aufleuchten) */
.saved { animation: saved-flash .9s ease; }
@keyframes saved-flash {
    0% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--positive) 60%, transparent); }
    100% { box-shadow: 0 0 0 2px transparent; }
}

/* Inline-Bearbeitung in Tabellenzellen */
.inline-edit { padding: .25rem .4rem; font-size: var(--text-sm); border-radius: 6px; min-width: 8ch; }
.editable { cursor: text; border-radius: 6px; padding: .1rem .25rem; margin: -.1rem -.25rem; transition: background .12s ease; }
.editable:hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--border-strong); }

@media (max-width: 900px) {
    .toasts { bottom: calc(4.5rem + env(safe-area-inset-bottom)); left: 1rem; }
}

/* ---------------------------------------------------------------- Modal */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgb(8 12 20 / .55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 50;
    animation: backdrop-in .15s ease both;
}
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: min(560px, 100%);
    max-height: 90dvh;
    overflow-y: auto;
    padding: 1.5rem;
    animation: pop-in .2s ease both;
}
.modal h2 { margin: 0 0 1rem; font-size: 1.15rem; }
/* Aktionsleiste (Schließen/Speichern) klebt am unteren Modalrand -> immer
   sichtbar, während der Inhalt darüber scrollt. Negative Ränder = Modal-Polsterung
   (1.5rem), damit die Leiste randlos über die volle Breite bis zum Boden geht. */
.modal-actions {
    display: flex; justify-content: flex-end; gap: .6rem;
    position: sticky; bottom: -1.5rem; z-index: 1;
    margin: 1rem -1.5rem -1.5rem;
    padding: .85rem 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------------- Auth (Login/Registrierung/…) */

.auth-page {
    min-height: 100dvh;
    background:
        radial-gradient(circle 460px at 12% 18%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
        radial-gradient(circle 420px at 88% 82%, color-mix(in srgb, var(--positive) 11%, transparent), transparent 60%),
        var(--bg);
    background-attachment: fixed;
}

.auth-shell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100dvh;
    max-width: 1440px;
    margin: 0 auto;
}

/* Hero (links) */
.auth-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 3.5rem;
    gap: 1rem;
}
.auth-hero .brand { font-size: 1.6rem; padding: 0; margin-bottom: 1.5rem; }
.auth-hero h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); line-height: 1.15; margin: 0; max-width: 30ch; letter-spacing: -.01em; }
.auth-hero .lead { font-size: 1.1rem; color: var(--text-muted); margin: 0; max-width: 42ch; line-height: 1.6; }
.auth-features { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.auth-features li { display: flex; align-items: center; gap: .75rem; color: var(--text); font-size: .95rem; }
.auth-features .tick {
    flex-shrink: 0; width: 1.6rem; height: 1.6rem; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--positive) 16%, transparent); color: var(--positive); font-size: .7rem;
}

/* Stage + Karte (rechts) */
.auth-stage { display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.auth-card {
    width: min(440px, 100%);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 6px);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: pop-in .3s ease both;
}
.auth-card__head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.auth-card__icon {
    width: 3.4rem; height: 3.4rem; border-radius: 16px; margin-bottom: .3rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--gradient);
    color: #fff; font-size: 1.4rem;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
}
.auth-card__icon i.icon { width: auto; }
.auth-card h2 { margin: 0; font-size: 1.4rem; }
.auth-card__sub { margin: 0; color: var(--text-muted); font-size: .9rem; }

/* SSO-Buttons */
.auth-sso {
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    width: 100%; padding: .6rem 1rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font-weight: 600; font-size: .9rem;
    transition: background .15s ease, border-color .15s ease;
}
.auth-sso:hover { background: var(--surface-2); border-color: var(--accent); text-decoration: none; }
.auth-sso i { font-size: 1.1rem; width: 1.2rem; text-align: center; }
.auth-sso--google i { color: #ea4335; }
.auth-sso--microsoft i { color: #0078d4; }
.auth-sso--apple i { color: var(--text); }

.auth-divider { display: flex; align-items: center; gap: .75rem; color: var(--text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Input mit Icon-Präfix */
.input-group { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; transition: border-color .15s ease, box-shadow .15s ease; }
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-group .prefix { display: inline-flex; align-items: center; justify-content: center; padding: 0 .8rem; color: var(--text-muted); background: var(--surface-2); }
.input-group input { border: 0; border-radius: 0; }
.input-group input:focus { outline: none; box-shadow: none; }

.auth-links { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; justify-content: center; }
.auth-links a { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--text-muted); }
.auth-links a:hover { color: var(--accent); }
.auth-links form { display: inline; }
.btn-link-plain { background: none; border: 0; padding: 0; font: inherit; color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; }
.btn-link-plain:hover { color: var(--accent); }
.btn-block { width: 100%; }

.auth-brand { display: flex; align-items: center; gap: .6rem; font-size: 1.5rem; font-weight: 700; justify-content: center; }
.auth-brand .icon { width: 2rem; height: 2rem; color: var(--accent); }
.auth-brand i.icon { width: auto; font-size: 1.7rem; }
/* Turnstile-Widget (size: flexible) auf volle Formularbreite wie Felder/Buttons */
.cf-turnstile { width: 100%; }
.cf-turnstile iframe { width: 100% !important; }
.auth-error {
    background: color-mix(in srgb, var(--negative) 12%, transparent);
    color: var(--negative);
    border-radius: var(--radius-sm);
    padding: .6rem .8rem;
    font-size: .9rem;
}
.auth-note {
    background: color-mix(in srgb, var(--positive) 12%, transparent);
    color: var(--positive);
    border-radius: var(--radius-sm);
    padding: .6rem .8rem;
    font-size: .9rem;
}

/* Rechtslinks als Fußzeile innerhalb der Auth-Karte (rechts), nicht am Seitenende */
.auth-legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .4rem 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: .78rem;
}
.auth-legal a { color: var(--text-muted); }
.auth-legal a:hover { color: var(--accent); }

.legal-page { max-width: 820px; margin: 0 auto; padding: 2rem 1.25rem 3rem; display: flex; flex-direction: column; gap: 1.25rem; }
.legal-page .brand { font-size: 1.4rem; }
.legal-content { line-height: 1.6; }
.legal-content h1 { font-size: 1.6rem; margin: 0 0 1rem; }
.legal-content h2 { font-size: 1.05rem; margin: 1.5rem 0 .4rem; }
.legal-content ul { padding-left: 1.2rem; }
.legal-links { text-align: center; font-size: .85rem; color: var(--text-muted); }
.legal-links a { color: var(--text-muted); }
.legal-links a:hover { color: var(--accent); }

@media (max-width: 920px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-hero { padding: 2.5rem 1.5rem 0; text-align: center; align-items: center; }
    .auth-features { display: none; }
    .auth-stage { padding: 1.5rem; }
}

/* ---------------------------------------------------------------- Diverses */

.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2.5rem 1rem;
}
.empty .icon { width: 2.2rem; height: 2.2rem; margin-bottom: .5rem; }
.empty i.icon { width: auto; font-size: 2rem; opacity: .55; }

.list-plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list-plain li { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }

.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.muted { color: var(--text-muted); }
.text-center { text-align: center; margin: 0; }
.small { font-size: var(--text-sm); }
.mt { margin-top: var(--s4); }
.hidden { display: none !important; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }

.object-card { display: flex; flex-direction: column; gap: .4rem; transition: border-color .2s ease, box-shadow .2s ease; }
.object-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow-lg); }
.object-card .row { color: var(--text); }
.object-card h3 { margin: 0; font-size: 1.02rem; }
.object-card .type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
}
.object-card .type-icon i.icon { font-size: 1.05rem; width: auto; }

.chart-box { width: 100%; overflow: hidden; }
/* viewBox der Charts = Container-Breite (siehe charts.js), daher 1:1 rendern —
   kein Hoch-/Runterskalieren, Labels bleiben konstant lesbar. */
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-box--donut { display: flex; justify-content: center; }
/* Auswertung: Verlaufs-Balken breit, Kostenart-Donuts schmaler daneben. */
.chart-cols { display: grid; gap: var(--s5); grid-template-columns: 1.4fr 1fr 1fr; align-items: start; }
@media (max-width: 900px) { .chart-cols { grid-template-columns: 1fr; } }

.pagination { display: flex; align-items: center; gap: .6rem; justify-content: center; margin-top: 1rem; }
.pagination .page-jump { width: 4.5rem; text-align: center; padding: .35rem .4rem; }

/* FinTS */
.tan-image { max-width: 240px; border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* Rechnungs-Dialog */
.invoice-modal { width: min(960px, 100%); }
/* Scrollbares Modal: nur der Tabellenbereich scrollt, Kopf (mit X) und Fußzeile
   (Schließen) bleiben fix sichtbar. */
.modal.modal-scroll { display: flex; flex-direction: column; overflow: hidden; }
.modal.modal-scroll > .table-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; }
.invoice-modal .num-input { max-width: 90px; text-align: right; }
.invoice-modal table.data td { padding: .3rem .35rem; }

/* Buchungs-Intelligenz: Vorschläge aus der Historie */
.suggest-box { margin-top: 1rem; padding: .85rem 1rem; border: 1px solid var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.suggest-box h3 { margin: 0 0 .4rem; display: flex; align-items: center; gap: .4rem; font-size: .95rem; color: var(--accent); }
.suggest-box .list-plain li { border-bottom-color: color-mix(in srgb, var(--accent) 20%, transparent); }

/* Mieteingangs-Matrix */
td.rent-paid { background: color-mix(in srgb, var(--positive) 14%, transparent); color: var(--positive); font-weight: 600; }
td.rent-due { background: color-mix(in srgb, var(--negative) 12%, transparent); color: var(--negative); }
td.rent-partial { background: color-mix(in srgb, #f5a623 18%, transparent); color: #9a6300; font-weight: 600; }
/* Heatmap-Abstufung der Teilzahlungen: mehr offen = kräftigeres Orange */
td.rent-heat-3 { background: color-mix(in srgb, #f5a623 14%, transparent); }
td.rent-heat-2 { background: color-mix(in srgb, #f5a623 30%, transparent); }
td.rent-heat-1 { background: color-mix(in srgb, #f5a623 48%, transparent); color: #7a4e00; }
/* Legende unter der Mieteingangs-Matrix */
.rent-legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-top: var(--s2); font-size: var(--text-xs); color: var(--text-muted); }
.rent-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.rent-legend .sw { width: .85rem; height: .85rem; border-radius: 3px; display: inline-block; }
.rent-legend .sw-paid { background: color-mix(in srgb, var(--positive) 30%, transparent); }
.rent-legend .sw-due { background: color-mix(in srgb, var(--negative) 25%, transparent); }
.rent-legend .sw-heat-1 { background: color-mix(in srgb, #f5a623 48%, transparent); }
.rent-legend .sw-heat-2 { background: color-mix(in srgb, #f5a623 30%, transparent); }
.rent-legend .sw-heat-3 { background: color-mix(in srgb, #f5a623 14%, transparent); }
td.rent-none { color: var(--text-muted); }
/* Rechnungs-Modal: Positions-Werkzeuge — Katalog-Select kompakt auf btn-sm-Höhe,
   damit "+ Position", Auswahl und "Übernehmen" auf EINER Linie gleich hoch sitzen */
#inv-position-tools, #inv-position-tools .row { align-items: stretch; }
#inv-position-tools .btn { align-self: stretch; display: inline-flex; align-items: center; }
#inv-position-tools select { padding: .4rem .6rem; font-size: .875rem; max-width: 340px; }

/* Bankzugänge: „Zuletzt geprüft" — grün = heute, orange = <= 1 Woche, rot = älter */
.checked-today { color: var(--positive); font-weight: 600; }
.checked-week  { color: #b8860b; font-weight: 600; }
.checked-old   { color: var(--negative); font-weight: 600; }

/* Jahres-Spalten Soll/NK/Kalt/Warm rechts neben den Monaten (wie v1, leicht abgesetzt);
   Spalte 14 = erste Extra-Spalte (1 Label + 12 Monate) -> Trennlinie zu den Monaten. */
th.rent-extra, td.rent-extra { background: color-mix(in srgb, var(--text) 6%, transparent); }
#rents-matrix th:nth-child(14), #rents-matrix td:nth-child(14) { border-left: 2px solid var(--border, #ccc); }
td.rent-assignable { cursor: pointer; }
td.rent-assignable:hover { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ============================================================================
   UI-Politur — animierte Diagramme, Empty-States, Mikrointeraktionen
   (globale Einblendungen/Hover sind oben definiert; hier nur Ergänzungen)
   ========================================================================== */

@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes draw-in { to { stroke-dashoffset: 0; } }
@keyframes area-fade { from { opacity: 0; } to { opacity: .12; } }

/* Karten: dezenter Schatten beim Hovern (kein Positionswechsel) */
.card:hover { box-shadow: var(--shadow-lg); }

/* Chart-Animationen (Klassen werden in charts.js gesetzt) */
.chart-bar--pos, .chart-bar--neg { transform-box: fill-box; animation: bar-grow .55s cubic-bezier(.22,1,.36,1) both; }
.chart-bar--pos { transform-origin: bottom; }
.chart-bar--neg { transform-origin: top; }
.chart-area { animation: area-fade .8s ease both; }
.chart-line--animate { animation: draw-in .9s ease-out forwards; }
.chart-arc { animation: draw-in .8s ease-out both; }

/* Empty-State: freundlicher Platzhalter statt nackter „Keine Einträge"-Zeile */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 2.4rem 1rem; text-align: center; color: var(--text-muted); animation: pop-in .35s ease both; }
.empty-state .empty-illo { width: 96px; height: 96px; color: var(--accent); }
.empty-state .empty-illo svg { width: 100%; height: 100%; display: block; }
.empty-state .empty-illo i.icon { font-size: 48px; width: auto; }
.empty-state .empty-title { font-weight: 700; font-size: 1.02rem; color: var(--text); letter-spacing: -.01em; }
.empty-state .empty-text { font-size: .88rem; max-width: 34ch; line-height: 1.5; }
td > .empty-state { padding: 1.8rem 1rem; }

/* Vollflächiger Leerzustand mit CTA (z.B. „Noch keine Objekte") */
.empty-state-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s3); padding: var(--s7) var(--s5); }
.empty-state-card .empty-illo { width: 72px; height: 72px; color: var(--accent); opacity: .55; }
.empty-state-card .empty-illo svg { width: 100%; height: 100%; display: block; }
.empty-state-card h2 { margin: 0; font-size: var(--text-lg); }
.empty-state-card p { margin: 0 0 var(--s2); max-width: 48ch; line-height: var(--leading-normal); }

/* 2FA-Einrichtung: QR-Code + Schritte */
.totp-setup { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; margin: .5rem 0 1rem; }
.totp-qr { flex-shrink: 0; width: 168px; height: 168px; padding: 10px; background: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.totp-qr img, .totp-qr canvas { display: block; width: 100%; height: 100%; }
.totp-setup ol { margin: 0; flex: 1 1 240px; }
.totp-setup code { font-family: var(--mono); font-size: .85rem; word-break: break-all; }

/* Dokumentation (/docs) */
.docs { display: grid; grid-template-columns: 240px 1fr; gap: 1.5rem; align-items: start; }
.docs-nav { position: sticky; top: 5rem; display: flex; flex-direction: column; gap: .15rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem; box-shadow: var(--shadow); max-height: calc(100dvh - 7rem); overflow: auto; }
.docs-nav a { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-radius: var(--radius-sm); color: var(--text-muted); font-size: .9rem; }
.docs-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.docs-nav a i.icon { width: 1.1rem; color: var(--accent); }
.docs-body { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.docs-section { scroll-margin-top: 5rem; }
.docs-section h1 { font-size: 1.6rem; }
.docs-section h2 { font-size: 1.25rem; margin-top: 0; }
.docs-section h3 { font-size: 1rem; margin: 1rem 0 .3rem; color: var(--accent); }
.docs-section .lead { font-size: 1.05rem; color: var(--text-muted); }
.docs-section code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: .1rem .35rem; border-radius: 6px; }
@media (max-width: 800px) { .docs { grid-template-columns: 1fr; } .docs-nav { position: static; max-height: none; flex-flow: row wrap; } }

/* Cookie-Hinweis */
.cookie-notice {
    position: fixed; left: 1rem; right: 1rem; bottom: 1rem; max-width: 600px; margin: 0 auto;
    z-index: 60; display: flex; align-items: center; gap: 1rem;
    padding: .85rem 1.1rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.cookie-notice[hidden] { display: none; }
.cookie-notice p { margin: 0; flex: 1; font-size: .85rem; color: var(--text-muted); }
.cookie-notice .btn { flex-shrink: 0; }

/* Sortierbare Tabellen */
table.data thead th:not(:empty) { cursor: pointer; user-select: none; }
table.data thead th.sort-asc::after { content: " \25B2"; font-size: .7em; color: var(--accent); }
table.data thead th.sort-desc::after { content: " \25BC"; font-size: .7em; color: var(--accent); }

/* Reduced-Motion: SVG-Zeichnung sofort fertig zeigen
   (der globale Block oben deaktiviert bereits alle Animationen/Transitions) */
@media (prefers-reduced-motion: reduce) {
    .chart-line--animate, .chart-arc { stroke-dashoffset: 0 !important; }
}

/* Umsatz splitten: Summen-/Rest-Fuß, Fortschritt und Übersicht je Kostenart */
#split-table tfoot td { border-top: 1.5px solid var(--border-strong); font-weight: 700; padding-top: var(--s2); }
#split-table tfoot .split-rest-row td { color: var(--warning); border-top: 0; padding-top: 0; }
#split-table tfoot .split-rest-row .amount { color: var(--warning); }

.split-progress { display: flex; align-items: center; gap: var(--s3); min-width: 12rem; }
.split-bar { flex: 1; height: 8px; min-width: 5rem; background: var(--border); border-radius: 999px; overflow: hidden; }
.split-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .2s ease; }
.split-bar.is-done i { background: var(--positive); }
.small.ok { color: var(--positive); }

.split-overview { margin-top: var(--s3); }
.split-ov-title { margin-bottom: var(--s1); }
.split-ov-list li { padding: var(--s1) 0; }
.split-ov-list .icon { margin-right: var(--s2); }
.split-ov-warn { color: var(--warning); font-weight: 600; }
.split-ov-done { color: var(--positive); font-weight: 600; }

/* Steuern: Jahresübersicht (Donut je Objekt + Steuerverlauf-Linie) */
.tax-charts { display: grid; gap: var(--s5); grid-template-columns: minmax(200px, 300px) 1fr; align-items: center; }
@media (max-width: 720px) { .tax-charts { grid-template-columns: 1fr; } }
#tax-year-list tfoot td { border-top: 1.5px solid var(--border-strong); font-weight: 700; }

/* Umsatzsteuer-Monatsmatrix (Betreff × Monate + Quartale + Jahr) */
.vat-matrix th, .vat-matrix td { white-space: nowrap; }
.vat-matrix .vat-agg { font-weight: 600; background: var(--surface-2); }
.vat-matrix .vat-spacer td { height: var(--s2); border: 0; background: transparent; padding: 0; }

/* Kassenschnitt-Zählmaske */
.cash-count-table { max-width: 340px; }
.cash-count-table .num-input { width: 5.5rem; text-align: right; }

/* Cashflow-Kalender (Extras) */
.cashflow-kpis { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); margin-top: var(--s2); }
.cashflow-kpi { display: flex; flex-direction: column; gap: .1rem; }
.cashflow-kpi .amount { font-size: 1.15rem; font-weight: 700; }
.cashflow-day { border-top: 1px solid var(--border); padding: var(--s3) 0; }
.cashflow-day:first-child { border-top: 0; }
.cashflow-day.is-negative { background: color-mix(in srgb, var(--negative) 7%, transparent); border-radius: var(--radius-sm); padding-left: var(--s2); padding-right: var(--s2); }
.cashflow-day__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
.cashflow-day__events { list-style: none; margin: .35rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.cashflow-day__events li { display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--text-sm); }
.cashflow-ev__label { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cashflow-day__sum { margin-top: .3rem; }

/* Zähler-Schnellerfassung (mobile Ablese-Eingabe) */
.meter-quick td .meter-val { text-align: right; }
.meter-quick .meter-cons { font-variant-numeric: tabular-nums; }

/* Angebots-Pipeline (Kanban) */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-top: .5rem; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; flex-direction: column; min-height: 6rem; }
.kanban-col.is-over { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kanban-col__head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .5rem .6rem; font-weight: 600; border-bottom: 1px solid var(--border); }
.kanban-col__body { padding: .5rem; display: flex; flex-direction: column; gap: .5rem; }
.kanban-empty { text-align: center; margin: .5rem 0; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .6rem; cursor: grab; }
.kanban-card.is-dragging { opacity: .5; }
.kanban-card__num { font-weight: 600; }
.kanban-card__cust { font-size: .9rem; margin: .15rem 0; }
.kanban-card__foot { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
@media (max-width: 720px) { .kanban { grid-template-columns: 1fr 1fr; } }
