/* ========================================
   Finanzplaner — Cursor-inspired Dark Theme
   ======================================== */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #0a0a0a;
    --bg-card: #171717;
    --bg-card-hover: #1f1f1f;
    --bg-input: #1a1a1a;
    --bg-modal: #171717;
    --bg-elevated: #222222;
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    --border-subtle: rgba(255, 255, 255, 0.04);

    --text-primary: rgba(255, 255, 255, 0.92);
    --text-secondary: rgba(255, 255, 255, 0.55);
    --text-muted: rgba(255, 255, 255, 0.35);

    --accent: #ffffff;
    --accent-hover: #e5e5e5;
    --accent-fg: #0a0a0a;
    --accent-bg: rgba(255, 255, 255, 0.08);

    --green: #4ade80;
    --green-bg: rgba(74, 222, 128, 0.12);
    --green-text: #4ade80;

    --red: #f87171;
    --red-bg: rgba(248, 113, 113, 0.12);
    --red-text: #f87171;

    --yellow: #fbbf24;
    --yellow-bg: rgba(251, 191, 36, 0.12);

    --blue: rgba(255, 255, 255, 0.75);
    --blue-bg: rgba(255, 255, 255, 0.06);

    --cyan: #67e8f9;
    --cyan-bg: rgba(103, 232, 249, 0.1);

    --purple: #c4b5fd;
    --purple-bg: rgba(196, 181, 253, 0.1);

    --sidebar-width: 220px;
    --header-height: 52px;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --shadow: none;
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
    --transition: 150ms ease;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--text-secondary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text-primary); }
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ========================================
   Header (Mobile)
   ======================================== */
.app-header {
    display: flex; align-items: center; justify-content: space-between;
    height: var(--header-height); padding: 0 1rem;
    background: var(--bg-primary); border-bottom: 1px solid var(--border-subtle);
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 0.75rem; }
.app-header .app-title {
    font-size: 0.95rem; font-weight: 600;
    display: flex; align-items: center; gap: 0.5rem;
    color: var(--text-primary);
}
.app-header .app-title i { color: var(--text-muted); font-size: 0.9rem; }

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width); background: var(--bg-primary);
    border-right: 1px solid var(--border-subtle);
    display: flex; flex-direction: column; z-index: 200;
    transform: translateX(-100%); transition: transform var(--transition);
}
.sidebar.open { transform: translateX(0); }
.sidebar-header {
    padding: 1.1rem 1rem 0.75rem;
    border-bottom: none;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 0.55rem;
}
.sidebar-brand-icon {
    width: 28px; height: 28px; border-radius: 7px;
    background: var(--bg-card); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; color: var(--text-secondary);
}
.sidebar-brand-name {
    font-size: 0.9rem; font-weight: 600; color: var(--text-primary);
    letter-spacing: -0.01em;
}
.sidebar-header .app-title {
    font-size: 1rem; font-weight: 600;
    display: flex; align-items: center; gap: 0.5rem;
}
.sidebar-header .app-title i { color: var(--text-muted); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.5rem 0.65rem; }
.nav-group { margin-bottom: 1.1rem; }
.nav-group:last-child { margin-bottom: 0; }
.nav-group-label {
    display: block; padding: 0 0.5rem; margin-bottom: 0.35rem;
    font-size: 0.68rem; font-weight: 500; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--text-muted);
}
.nav-list { list-style: none; padding: 0; }
.nav-item {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.5rem 0.65rem; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 0.84rem; font-weight: 500;
    transition: color var(--transition), background var(--transition); cursor: pointer;
}
.nav-item:hover { color: var(--text-primary); background: var(--bg-card); }
.nav-item.active {
    color: var(--text-primary);
    background: var(--bg-card);
}
.nav-item i { width: 16px; text-align: center; font-size: 0.82rem; opacity: 0.7; }
.nav-item.active i { opacity: 1; }
.sidebar-footer {
    padding: 0.65rem; margin-top: auto;
    border-top: 1px solid var(--border-subtle);
}
.nav-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 150; backdrop-filter: blur(2px); }
.nav-overlay.open { display: block; }

/* ========================================
   Main Content
   ======================================== */
.main-content { padding-top: var(--header-height); min-height: 100vh; background: var(--bg-primary); }
.view { display: none; padding: 1.25rem 1rem; max-width: 960px; margin: 0 auto; }
.view.active { display: block; }

/* ========================================
   Page Header
   ======================================== */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.page-header-main { min-width: 0; }
.page-title {
    font-size: 1.5rem; font-weight: 600; letter-spacing: -0.03em;
    color: var(--text-primary); line-height: 1.2; margin-bottom: 0.25rem;
}
.page-subtitle {
    font-size: 0.84rem; color: var(--text-muted); font-weight: 400; line-height: 1.4;
}
.page-header-actions {
    display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0;
    padding-top: 0.15rem;
}

/* ========================================
   Settings Page
   ======================================== */
.settings-layout {
    display: flex; flex-direction: column; gap: 0.85rem;
    padding-bottom: 2rem;
    width: 100%;
}
.settings-card { overflow: visible; }
.settings-card-header {
    padding: 1rem 1.15rem 0.65rem;
    border-bottom: 1px solid var(--border-subtle);
}
.settings-card-header h3 {
    font-size: 0.92rem; font-weight: 600; color: var(--text-primary);
    margin-bottom: 0.15rem;
}
.settings-card-header p {
    font-size: 0.78rem; color: var(--text-muted); line-height: 1.4;
}
.settings-card-body { padding: 1rem 1.15rem 1.15rem; }
.settings-card-body .form-group:last-child { margin-bottom: 0; }
.settings-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.settings-save-bar {
    display: flex; justify-content: flex-end;
    padding-top: 0.25rem;
}

/* ========================================
   Month Navigation
   ======================================== */
.month-nav { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.month-nav.compact { margin-bottom: 0; }
.month-title { font-size: 0.88rem; font-weight: 500; min-width: 120px; text-align: center; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ========================================
   Insight Banner
   ======================================== */
.insight-banner {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.75rem 1rem; margin-bottom: 0.85rem;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); font-size: 0.82rem;
    color: var(--text-secondary); line-height: 1.45;
}
.insight-banner:empty { display: none; }
.insight-icon {
    width: 30px; height: 30px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; flex-shrink: 0;
    background: var(--accent-bg); color: var(--text-secondary);
}
.insight-text { flex: 1; }
.insight-text strong { color: var(--text-primary); font-weight: 600; }

/* ========================================
   KPI Cards
   ======================================== */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.65rem; margin-bottom: 0.85rem; }
.kpi-card {
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
    padding: 1rem 1.1rem 0.75rem; display: flex; flex-direction: column; gap: 0.15rem;
    min-height: 118px;
}
.kpi-label {
    font-size: 0.72rem; color: var(--text-muted); font-weight: 500;
    letter-spacing: 0.02em; text-transform: uppercase;
}
.kpi-value {
    font-size: 1.45rem; font-weight: 600; letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums; line-height: 1.15;
    margin: 0.1rem 0 0.05rem;
}
.kpi-meta {
    font-size: 0.74rem; color: var(--text-muted); line-height: 1.3;
    min-height: 1rem;
}
.kpi-meta:empty { min-height: 0; }
.kpi-income .kpi-value { color: var(--green-text); }
.kpi-expense .kpi-value { color: var(--red-text); }
.kpi-fixed .kpi-value { color: var(--text-primary); }
.kpi-savings-transfer .kpi-value { color: var(--cyan); }
.kpi-spark {
    width: 100%; height: 32px; margin-top: auto; padding-top: 0.35rem;
    opacity: 0.85;
}

/* Mobile: kompaktere KPI-Cards */
@media (max-width: 767px) {
    .view { padding: 1rem 0.75rem; max-width: 100%; overflow-x: clip; }
    .main-content { overflow-x: clip; }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .page-header-actions {
        flex-wrap: wrap;
        justify-content: space-between;
        width: 100%;
        padding-top: 0;
        gap: 0.5rem;
    }
    .page-header-actions .btn { max-width: 100%; }

    .month-nav { width: 100%; justify-content: center; }
    .month-title { min-width: 0; flex: 1; font-size: 0.82rem; }

    .kpi-grid { gap: 0.5rem; margin-bottom: 0.75rem; }
    .kpi-card { padding: 0.85rem 0.9rem 0.65rem; min-height: 108px; min-width: 0; }
    .kpi-value {
        font-size: 1.2rem;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .kpi-spark { height: 26px; }

    .balance-grid { gap: 0.5rem; }
    .balance-card { padding: 0.9rem 0.95rem; min-width: 0; }
    .balance-amount {
        font-size: 1.45rem;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .tx-toolbar-filters { flex-wrap: wrap; }
    .tx-toolbar-filters > * { flex: 1 1 calc(50% - 0.2rem); min-width: 0; }
    .tx-toolbar-filters .search-box { flex: 1 1 100%; }

    .form-row { flex-direction: column; gap: 0.5rem; }

    .cat-row { flex-wrap: wrap; align-items: stretch; }
    .cat-name-input { flex: 1 1 8rem; min-width: 0; }
    .cat-icon-input { width: auto; flex: 1 1 6rem; min-width: 0; }

    .compare-values { flex-wrap: wrap; justify-content: flex-end; gap: 0.35rem; }
    .compare-val { min-width: 0; }

    .settings-save-bar { justify-content: stretch; }
    .settings-save-bar .btn { width: 100%; }

    .page-title { font-size: 1.3rem; }
    .page-header { margin-bottom: 1.15rem; }

    .modal-overlay {
        align-items: flex-end;
        padding-top: 3rem;
    }
    .modal {
        position: relative;
        max-height: 85vh;
        padding-top: 1.65rem;
    }
    .modal::before {
        content: '';
        position: absolute;
        top: 0.55rem;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--border-light, var(--border));
        opacity: 0.85;
    }
}
@media (max-width: 380px) {
    .kpi-card { padding: 0.75rem 0.8rem 0.6rem; }
    .kpi-value { font-size: 1.05rem; }
}

/* ========================================
   Balance Cards
   ======================================== */
.balance-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; margin-bottom: 0.85rem; }
.balance-card {
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); padding: 1.1rem 1.15rem;
}
.balance-checking .balance-header { color: var(--text-secondary); }
.balance-savings .balance-header { color: var(--text-secondary); }
.balance-header {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.8rem; margin-bottom: 0.35rem; font-weight: 500;
}
.balance-header i { font-size: 0.8rem; }
.balance-amount { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.balance-amount .cents { font-size: 0.55em; font-weight: 600; opacity: 0.7; vertical-align: super; margin-left: 1px; }
.balance-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.savings-hero { margin-bottom: 1.25rem; }
.savings-hero .balance-amount { font-size: 1.8rem; }

/* ========================================
   Quick Actions (Floating icon pills)
   ======================================== */
.quick-actions {
    position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
    display: flex; gap: 0.35rem; padding: 0.35rem;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: 999px; z-index: 50; box-shadow: var(--shadow-lg);
}
.pill {
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 50%;
    border: none; background: var(--bg-elevated);
    color: var(--text-muted); font-size: 0.95rem;
    cursor: pointer; transition: all 200ms ease; position: relative;
    font-family: inherit;
}
.pill:hover { transform: scale(1.08); color: var(--text-primary); background: var(--bg-card-hover); }
.pill-expense:hover { background: var(--red); color: #fff; }
.pill-income:hover { background: var(--green); color: var(--accent-fg); }
.pill-transfer:hover { background: var(--cyan); color: var(--accent-fg); }
.pill-fixedcost:hover { background: var(--yellow); color: var(--accent-fg); }
.pill-savings:hover { background: var(--cyan); color: var(--accent-fg); }

/* Tooltip */
.pill::after {
    content: attr(title); position: absolute; bottom: calc(100% + 10px); left: 50%;
    transform: translateX(-50%) scale(0.9); padding: 0.3rem 0.6rem;
    background: var(--bg-primary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 0.72rem; font-weight: 500;
    color: var(--text-primary); white-space: nowrap;
    opacity: 0; pointer-events: none; transition: all 200ms ease;
}
.pill:hover::after { opacity: 1; transform: translateX(-50%) scale(1); }

/* ========================================
   Cards
   ======================================== */
.card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; }
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-subtle);
}
.card-header h3 {
    font-size: 0.82rem; font-weight: 500;
    display: flex; align-items: center; gap: 0.4rem; color: var(--text-secondary);
    letter-spacing: 0.01em;
}
.card-header h3 i { font-size: 0.8rem; }
.card-body { padding: 0; }

.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; padding-bottom: 5rem; }

/* ========================================
   Transaction Items
   ======================================== */
.transactions-list { display: flex; flex-direction: column; }
.tx-item {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition); cursor: pointer;
}
.tx-item:last-child { border-bottom: none; }
.tx-item:hover { background: var(--bg-card-hover); }
.tx-item.planned .tx-icon,
.tx-item.planned .tx-info,
.tx-item.planned .tx-amount,
.tx-item.planned .tx-actions { opacity: 0.5; }
.tx-item.planned .tx-amount::before { content: "("; }
.tx-item.planned .tx-amount::after { content: ")"; }

.tx-icon {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; flex-shrink: 0;
}
.tx-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.18rem; }
.tx-title {
    font-size: 0.87rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 0.35rem;
}
.tx-meta {
    font-size: 0.72rem; color: var(--text-muted);
    display: flex; align-items: center; gap: 0.4rem;
    flex-wrap: nowrap; overflow: hidden;
}
.tx-date {
    display: inline-flex; align-items: center; gap: 0.25rem;
    flex-shrink: 0; font-variant-numeric: tabular-nums;
}
.tx-cat-badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.08rem 0.4rem; border-radius: 4px;
    font-size: 0.68rem; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 140px;
}
.tx-amount {
    font-size: 0.95rem; font-weight: 700;
    white-space: nowrap; flex-shrink: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
    min-width: 88px;
}
.tx-amount.positive { color: var(--green-text); }
.tx-amount.negative { color: var(--red-text); }
.tx-amount.transfer { color: var(--cyan); }
@media (max-width: 480px) {
    .tx-cat-badge { max-width: 100px; }
    .tx-amount { min-width: 80px; font-size: 0.9rem; }
}
.tx-actions { display: flex; gap: 0.15rem; opacity: 0; transition: opacity var(--transition); }
.tx-item:hover .tx-actions { opacity: 1; }
.tx-carryover {
    background: var(--bg-card); border-bottom-color: transparent; cursor: default;
    opacity: 0.7; border-left: 2px solid var(--border-light); padding-left: calc(0.85rem - 2px);
}
.tx-carryover:hover { background: var(--bg-card); }
.tx-carryover .tx-title { font-style: italic; }

.tx-planned-badge {
    font-size: 0.65rem; color: var(--yellow); border: 1px solid rgba(210,153,34,0.3);
    padding: 0.05rem 0.35rem; border-radius: var(--radius-sm); font-weight: 600;
}

/* ========================================
   Fixed Costs
   ======================================== */
.fixed-costs-summary {
    display: flex; align-items: center; gap: 1.5rem; padding: 0.9rem 1.1rem;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); margin-bottom: 0.85rem; flex-wrap: wrap;
}
.fc-summary-item { display: flex; flex-direction: column; }
.fc-summary-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }
.fc-summary-value { font-size: 1.1rem; font-weight: 700; }
.fixed-costs-list { display: flex; flex-direction: column; gap: 0.35rem; }
.fc-item {
    display: flex; align-items: center; gap: 0.65rem; padding: 0.9rem 1rem;
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
    transition: background var(--transition);
}
.fc-item:hover { background: var(--bg-card-hover); }
.fc-item.inactive { opacity: 0.45; }
.fc-item.is-transfer { border-left: none; }
.fc-info { flex: 1; min-width: 0; }
.fc-name { font-size: 0.9rem; font-weight: 500; }
.fc-details { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.1rem; }
.fc-amount {
    font-size: 1rem; font-weight: 700; color: var(--red-text); white-space: nowrap;
    font-variant-numeric: tabular-nums; text-align: right; min-width: 90px;
}
.fc-amount.transfer-amount { color: var(--cyan); }
.fc-actions { display: flex; gap: 0.15rem; }
.fc-interval-badge {
    font-size: 0.65rem; padding: 0.05rem 0.35rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); color: var(--text-muted); font-weight: 500;
}

/* ========================================
   Savings Goals
   ======================================== */
.savings-goals-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }
.sg-item { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 1rem; }
.sg-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.sg-name { font-weight: 600; font-size: 0.9rem; }
.sg-target { font-size: 0.8rem; color: var(--text-muted); }
.sg-progress-bar { height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; margin-bottom: 0.4rem; }
.sg-progress-fill { height: 100%; border-radius: 3px; background: var(--cyan); transition: width 0.4s ease; }
.sg-footer { display: flex; align-items: center; justify-content: space-between; }
.sg-current { font-size: 1rem; font-weight: 700; color: var(--cyan); }
.sg-percentage { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }

/* ========================================
   View Header
   ======================================== */
.view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
.view-header h2 { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.view-header h2 i { font-size: 0.95rem; color: var(--text-muted); }
.view-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.section-title { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; }

/* ========================================
   Transactions Toolbar
   ======================================== */
.tx-toolbar {
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); padding: 0.75rem; margin-bottom: 0.85rem;
    display: flex; flex-direction: column; gap: 0.5rem;
}
.tx-toolbar-top {
    display: flex; align-items: center; justify-content: space-between;
}
.tx-toolbar-top .month-nav { margin-bottom: 0; }
.tx-toolbar-filters {
    display: flex; gap: 0.35rem; align-items: center;
}
.tx-toolbar-filters > * { flex: 1; min-width: 0; }
.tx-toolbar-filters .search-box { flex: 1.5; }

.search-box {
    position: relative; display: flex; align-items: center;
}
.search-box i {
    position: absolute; left: 0.6rem; font-size: 0.75rem; color: var(--text-muted); pointer-events: none;
}
.search-box .input { padding-left: 1.8rem; }

@media (min-width: 768px) {
    .tx-toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
    .tx-toolbar-top { flex: 0 0 auto; }
    .tx-toolbar-filters { flex: 1; max-width: 500px; }
}

/* ========================================
   Stats
   ======================================== */
.stats-summary {
    display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.stats-summary:empty { display: none; }
.stat-pill {
    display: flex; flex-direction: column; padding: 0.75rem 1rem;
    background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
    flex: 1; min-width: 120px;
}
.stat-pill-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }
.stat-pill-value { font-size: 1.15rem; font-weight: 700; }

.stats-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.chart-container { padding: 0.85rem; position: relative; height: 260px; }

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.5rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-elevated); color: var(--text-primary);
    font-size: 0.82rem; font-weight: 500; cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    white-space: nowrap; font-family: inherit;
}
.btn[hidden] { display: none !important; }
.modal-delete-btn.is-hidden { display: none !important; }
.btn:hover { background: var(--bg-card-hover); border-color: var(--border-light); }

.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }

.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #e5443d; border-color: #e5443d; }

.btn-sm { padding: 0.3rem 0.55rem; font-size: 0.78rem; }

.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-secondary); cursor: pointer;
    transition: background var(--transition), color var(--transition); font-size: 0.9rem;
}
.btn-icon:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-icon.sm { width: 28px; height: 28px; font-size: 0.8rem; }

/* ========================================
   Toggle Buttons (Vorgemerkt, Sparauftrag, Aktiv)
   ======================================== */
.toggle-planned, .toggle-option {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-input); color: var(--text-muted);
    font-size: 0.82rem; font-weight: 500; cursor: pointer;
    transition: all var(--transition); font-family: inherit;
    justify-content: center; white-space: nowrap; flex-shrink: 0;
}
.toggle-planned:hover, .toggle-option:hover {
    border-color: var(--border-light); color: var(--text-secondary);
}
.toggle-planned.active {
    border-color: var(--yellow); color: var(--yellow); background: var(--yellow-bg);
}
.toggle-option.active {
    border-color: var(--green); color: var(--green-text); background: var(--green-bg);
}
.toggle-option.active-transfer {
    border-color: var(--cyan); color: var(--cyan); background: var(--cyan-bg);
}

/* ========================================
   Forms
   ======================================== */
.input {
    width: 100%; padding: 0.55rem 0.75rem;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: 0.87rem; transition: border-color var(--transition); font-family: inherit;
}
.input:focus { outline: none; border-color: var(--border-light); box-shadow: 0 0 0 2px rgba(255,255,255,0.06); }
.input::placeholder { color: var(--text-muted); }
.input-sm { padding: 0.35rem 0.6rem; font-size: 0.8rem; }

select.input {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23636e7b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.65rem center; padding-right: 1.8rem;
}

.form-group { margin-bottom: 0.85rem; }
.form-group label {
    display: block; font-size: 0.8rem; font-weight: 500;
    color: var(--text-secondary); margin-bottom: 0.3rem;
}
.form-row { display: flex; gap: 0.65rem; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.4rem; padding-top: 0.5rem; }
.form-actions-split { justify-content: space-between; align-items: center; }
.form-actions-split .form-actions-end { display: flex; gap: 0.4rem; margin-left: auto; }

/* ========================================
   Type Selector
   ======================================== */
.type-selector-wrap {
    display: flex; border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; background: var(--bg-input);
}
.type-section { flex: 1; }
.type-section-label {
    font-size: 0.68rem; font-weight: 600; color: var(--text-muted);
    text-align: center; padding: 0.4rem 0 0.2rem;
}
.type-section-btns { display: flex; }
.type-divider { width: 2px; background: var(--border-light); flex-shrink: 0; margin: 0.3rem 0; }

.type-btn {
    flex: 1; padding: 0.6rem 0.5rem; border: none; background: transparent;
    color: var(--text-muted); font-size: 0.8rem; font-weight: 500;
    cursor: pointer; transition: all var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 0.3rem;
    font-family: inherit; border-top: 1px solid var(--border);
}
.type-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.type-btn i { font-size: 0.75rem; }

.type-btn.active[data-color="red"] { color: #fff; background: var(--red); }
.type-btn.active[data-color="green"] { color: #fff; background: var(--green); }
.type-btn.active[data-color="cyan"] { color: #fff; background: var(--cyan); }
.type-btn.active[data-color="purple"] { color: #fff; background: var(--purple); }

/* ========================================
   Modals
   ======================================== */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.65); z-index: 300;
    justify-content: center; align-items: flex-end; padding: 0;
    backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-modal); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0; width: 100%;
    max-height: 90vh; overflow-y: auto; padding: 1.35rem;
    padding-bottom: max(1.35rem, env(safe-area-inset-bottom, 0px));
    animation: modalSlideUp 280ms ease;
    box-shadow: var(--shadow-lg);
}
.modal-sm { max-width: 380px; }
@keyframes modalSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-body { padding: 0.25rem 0; }

/* ========================================
   Categories Manager
   ======================================== */
.categories-manager { display: flex; flex-direction: column; gap: 0.35rem; max-height: 280px; overflow-y: auto; }
.cat-row {
    display: flex; align-items: center; gap: 0.35rem;
    padding: 0.25rem; border-radius: var(--radius-sm);
    background: var(--bg-card); border: 1px solid transparent;
}
.cat-row:hover { border-color: var(--border); }
.cat-sort-btns { display: flex; flex-direction: column; gap: 1px; }
.cat-sort-btns button {
    display: flex; align-items: center; justify-content: center;
    width: 20px; height: 14px; border: none; background: transparent;
    color: var(--text-muted); cursor: pointer; font-size: 0.55rem;
    border-radius: 2px;
}
.cat-sort-btns button:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.cat-color-input {
    width: 32px; height: 32px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 2px; background: var(--bg-input); cursor: pointer;
}
.cat-name-input { flex: 1; }
.cat-icon-input { width: 130px; }

/* ========================================
   Custom Category Select
   ======================================== */
.cat-select { position: relative; }
.cat-select-trigger {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.55rem 0.75rem; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: border-color var(--transition);
    min-height: 38px;
}
.cat-select-trigger:hover { border-color: var(--border-light); }
.cat-select.open .cat-select-trigger { border-color: var(--border-light); }
.cat-select-label {
    display: flex; align-items: center; gap: 0.45rem;
    font-size: 0.87rem; color: var(--text-primary); flex: 1; min-width: 0;
}
.cat-select-label .cat-icon-box {
    width: 24px; height: 24px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; flex-shrink: 0;
}
.cat-select-label.empty { color: var(--text-muted); }
.cat-select-arrow { font-size: 0.65rem; color: var(--text-muted); transition: transform var(--transition); }
.cat-select.open .cat-select-arrow { transform: rotate(180deg); }

.cat-select-dropdown {
    display: none; position: fixed; left: 0; right: 0;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); z-index: 350; max-height: 220px;
    overflow-y: auto; box-shadow: var(--shadow-lg);
    width: auto; min-width: 200px;
}
.cat-select.open .cat-select-dropdown { display: block; }

.cat-option {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.75rem; cursor: pointer;
    font-size: 0.85rem; color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
}
.cat-option:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.cat-option.selected { background: var(--accent-bg); color: var(--text-primary); }
.cat-option .cat-icon-box {
    width: 26px; height: 26px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; flex-shrink: 0;
}

/* ========================================
   Badges
   ======================================== */
.cat-badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.1rem 0.4rem; border-radius: var(--radius-sm);
    font-size: 0.72rem; font-weight: 500; white-space: nowrap;
}
.status-badge {
    display: inline-flex; align-items: center;
    padding: 0.15rem 0.4rem; border-radius: var(--radius-sm);
    font-size: 0.72rem; font-weight: 500;
}
.status-badge.active { background: var(--green-bg); color: var(--green-text); }
.status-badge.inactive { background: var(--red-bg); color: var(--red-text); }

/* ========================================
   Empty State
   ======================================== */
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 2rem 1rem; color: var(--text-muted); text-align: center; gap: 0.15rem; }
.empty-state i { font-size: 1.6rem; margin-bottom: 0.35rem; opacity: 0.4; }
.empty-state p { font-size: 0.85rem; margin: 0 0 0.5rem; color: var(--text-secondary); }
.empty-state-hint { font-size: 0.78rem; margin: 0 0 0.65rem; color: var(--text-muted); line-height: 1.35; max-width: 22rem; }
.empty-state-cta { margin-top: 0.35rem; }
.empty-state--compact { padding: 0.65rem 0.5rem; }
.empty-state--compact p { font-size: 0.8rem; margin-bottom: 0.35rem; }
.empty-state--compact .empty-state-cta { margin-top: 0.15rem; }

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 500;
    display: flex; flex-direction: column-reverse; gap: 0.5rem;
    align-items: flex-end; pointer-events: none;
    max-width: calc(100vw - 2rem);
}
.toast {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.7rem 0.85rem 0.7rem 0.95rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    font-size: 0.82rem; font-weight: 500;
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25), 0 2px 6px rgba(0,0,0,0.15);
    pointer-events: auto;
    animation: toastSlide 250ms ease;
    max-width: 360px;
    min-width: 200px;
}
.toast .toast-icon { font-size: 0.95rem; flex-shrink: 0; }
.toast .toast-msg { flex: 1; min-width: 0; line-height: 1.3; }
.toast.success { border-left: 3px solid var(--green); }
.toast.success .toast-icon { color: var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.error   .toast-icon { color: var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
.toast.info    .toast-icon { color: var(--blue); }
.toast-dismiss {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 0.75rem; padding: 0.25rem;
    margin-left: 0.15rem; flex-shrink: 0;
    border-radius: 4px;
    transition: color 150ms, background 150ms;
}
.toast-dismiss:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.toast-undo {
    flex-shrink: 0; border: none; background: transparent;
    color: var(--blue); font-size: 0.82rem; font-weight: 600;
    cursor: pointer; padding: 0.2rem 0.45rem; border-radius: var(--radius-sm);
    font-family: inherit;
}
.toast-undo:hover { background: var(--bg-card-hover); }
.toast-undoable .toast-msg { flex: 1; min-width: 0; }

@keyframes toastSlide {
    from { opacity: 0; transform: translateY(0.6rem) translateX(0.4rem); }
    to   { opacity: 1; transform: translateY(0) translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(0.6rem); }
}

/* Auf Mobile: bottom-zentriert, oberhalb der Floating-Toggles */
@media (max-width: 767px) {
    .toast-container {
        bottom: 5.5rem;
        right: 1rem;
        left: 1rem;
        align-items: stretch;
    }
    .toast { max-width: none; min-width: 0; }
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ========================================
   Month Comparison
   ======================================== */
.compare-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0;
}
.compare-row {
    display: contents;
}
.compare-cell {
    padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}
.compare-row:last-child .compare-cell { border-bottom: none; }
.compare-label {
    color: var(--text-secondary); font-weight: 500;
    display: flex; align-items: center; gap: 0.4rem;
}
.compare-label i { font-size: 0.75rem; width: 14px; text-align: center; }
.compare-values {
    display: flex; align-items: center; justify-content: flex-end; gap: 0.65rem;
    text-align: right;
}
.compare-val { font-weight: 600; min-width: 75px; text-align: right; }
.compare-val.current { color: var(--text-primary); }
.compare-val.prev { color: var(--text-muted); font-weight: 400; }
.compare-delta {
    font-size: 0.72rem; font-weight: 600; padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm); white-space: nowrap;
}
.compare-delta.up { color: var(--green-text); background: var(--green-bg); }
.compare-delta.down { color: var(--red-text); background: var(--red-bg); }
.compare-delta.neutral { color: var(--text-muted); background: var(--bg-input); }

/* ========================================
   Offline Indicator
   ======================================== */
.offline-bar {
    display: none; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.35rem; background: var(--yellow-bg); border-bottom: 1px solid rgba(210,153,34,0.3);
    font-size: 0.75rem; font-weight: 500; color: var(--yellow);
    position: fixed; top: 0; left: 0; right: 0; z-index: 500;
}
body.offline .offline-bar { display: flex; }
body.offline .app-header { top: 28px; }
body.offline .main-content { padding-top: calc(var(--header-height) + 28px); }
@media (min-width: 768px) {
    body.offline .offline-bar { left: var(--sidebar-width); }
    body.offline .main-content { padding-top: 28px; }
}

.hide-mobile { display: none; }

/* ========================================
   DESKTOP
   ======================================== */
@media (min-width: 768px) {
    .app-header { display: none; }
    .mobile-menu-toggle { display: none; }
    .sidebar { transform: translateX(0); }
    .main-content { padding-top: 0; margin-left: var(--sidebar-width); }
    .view { padding: 2rem 2.5rem; max-width: none; }
    .page-title { font-size: 1.65rem; }
    .page-header { margin-bottom: 1.75rem; }
    .settings-layout {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
        max-width: 960px;
    }
    .settings-layout > .settings-card:has(.categories-manager) {
        grid-column: 1 / -1;
    }
    .settings-save-bar {
        grid-column: 1 / -1;
        padding-top: 0.5rem;
    }
    #view-settings .categories-manager {
        max-height: min(52vh, 520px);
    }
    .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
    .balance-grid { gap: 0.75rem; }
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid .card:last-child { grid-column: span 2; }
    .chart-container { height: 300px; }
    .month-title { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.02em; }
    .modal-overlay { align-items: center; padding: 2rem; }
    .modal {
        border-radius: var(--radius-lg); max-width: 520px;
        animation: modalFade 150ms ease;
        padding-bottom: 1.35rem;
        padding-top: 1.35rem;
        max-height: 90vh;
    }
    .modal::before { display: none; }
    .hide-mobile { display: inline; }
    .balance-amount { font-size: 2rem; }
    .kpi-value { font-size: 1.55rem; }
    .kpi-card { min-height: 128px; }
    .tx-actions { opacity: 0; }
    .quick-actions { left: calc(50% + var(--sidebar-width) / 2); }
    .pill { width: 46px; height: 46px; font-size: 1rem; }
}

@media (min-width: 1200px) {
    .settings-layout { max-width: 1100px; }
    #view-settings .categories-manager { max-height: min(58vh, 560px); }
    .kpi-card { padding: 0.85rem 1rem; }
    .balance-card { padding: 1.25rem; }
    .balance-amount { font-size: 2.2rem; }
}

@media (max-width: 380px) {
    html { font-size: 14px; }
    .kpi-card { padding: 0.6rem; }
    .kpi-value { font-size: 0.95rem; }
    .balance-amount { font-size: 1.25rem; }
    .pill { width: 38px; height: 38px; font-size: 0.85rem; }
    .page-header-actions .btn span,
    .page-header-actions .btn .hide-mobile { display: none; }
    .sort-controls { gap: 0.2rem; }
    .sort-btn { padding: 0.2rem 0.4rem; font-size: 0.68rem; }
}

@media (hover: none) {
    .tx-actions, .fc-actions { opacity: 1; }
    .pill::after { display: none; }
}

/* ========================================
   Sort Controls
   ======================================== */
.sort-controls { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.sort-btn {
    padding: 0.2rem 0.5rem; font-size: 0.72rem; font-weight: 500;
    background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-muted); cursor: pointer; transition: all 150ms ease;
    display: flex; align-items: center; gap: 0.25rem;
}
.sort-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.sort-btn.active { color: var(--text-primary); border-color: var(--border-light); background: var(--bg-elevated); }
.sort-btn i { font-size: 0.65rem; }

/* ========================================
   Loading Skeletons
   ======================================== */
.loading-skeleton { padding: 0.25rem 0; }

/* Generic line variant (fallback) */
.skeleton-line {
    height: 52px; margin-bottom: 0.4rem;
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%; animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
.skeleton-line:nth-child(2) { opacity: 0.7; }
.skeleton-line:nth-child(3) { opacity: 0.4; width: 80%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Shared shimmer base */
.skel-bar, .skel-circle, .skel-square, .skel-pill, .skel-progress {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skel-row {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border);
}
.skel-row:last-child { border-bottom: none; }
.skel-circle { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
.skel-square { width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0; }
.skel-block { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.skel-bar { height: 10px; }
.skel-bar-title { width: 55%; max-width: 200px; }
.skel-bar-meta { height: 8px; width: 38%; max-width: 130px; opacity: 0.6; }
.skel-bar-amount { height: 14px; width: 70px; flex-shrink: 0; }
.skel-pill { width: 32px; height: 18px; border-radius: 999px; flex-shrink: 0; }

.skel-fc .skel-bar-amount { width: 80px; }

.skel-budget {
    padding: 0.55rem 0.4rem 0.7rem;
    border-bottom: 1px solid var(--border);
}
.skel-budget:last-child { border-bottom: none; }
.skel-budget .skel-row { gap: 0.4rem; }
.skel-progress { height: 6px; border-radius: 3px; margin-top: 0.45rem; }

.skel-cat-row {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0;
}
.skel-cat-row + .skel-cat-row { border-top: 1px solid var(--border); }
.skel-cat-row .skel-progress { height: 8px; border-radius: 4px; }
.skel-cat-row .skel-bar-amount { width: 60px; height: 11px; }

/* ========================================
   Swipe Actions
   ======================================== */
.swipe-container { position: relative; overflow: hidden; }
.swipe-item { position: relative; z-index: 1; background: var(--bg-secondary); transition: transform 200ms ease; }
.swipe-actions {
    position: absolute; right: 0; top: 0; bottom: 0;
    display: flex; align-items: stretch;
}
.swipe-action {
    display: flex; align-items: center; justify-content: center;
    width: 60px; color: #fff; font-size: 0.85rem; cursor: pointer;
}
.swipe-action.edit { background: var(--accent); }
.swipe-action.delete { background: var(--red); }

/* ========================================
   Inline Edit
   ======================================== */
.inline-edit {
    background: var(--bg-input); border: 1px solid var(--accent);
    color: var(--text-primary); padding: 0.15rem 0.35rem;
    border-radius: var(--radius-sm); font-size: inherit;
    max-width: 140px; outline: none;
}

/* ========================================
   Duplicate Warning
   ======================================== */
.duplicate-warning {
    background: rgba(210, 153, 34, 0.1); border: 1px solid rgba(210, 153, 34, 0.3);
    border-radius: var(--radius-sm); padding: 0.5rem 0.75rem;
    font-size: 0.8rem; color: var(--yellow); margin-bottom: 0.75rem;
    display: flex; align-items: center; gap: 0.5rem;
}
.duplicate-warning i { font-size: 1rem; }
.duplicate-warning .dismiss { cursor: pointer; margin-left: auto; opacity: 0.6; }
.duplicate-warning .dismiss:hover { opacity: 1; }

/* ========================================
   Quick Toggle
   ======================================== */
.quick-toggle {
    width: 32px; height: 18px; border-radius: 9px;
    background: var(--bg-input); border: 1px solid var(--border);
    cursor: pointer; position: relative; transition: all 150ms;
    flex-shrink: 0;
}
.quick-toggle::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--text-muted); transition: all 150ms;
}
.quick-toggle.active { background: var(--green-bg); border-color: var(--green); }
.quick-toggle.active::after { left: 16px; background: var(--green); }

/* ========================================
   Category Breakdown Bars
   ======================================== */
.cat-bar-row {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0.5rem;
}
.cat-bar-row + .cat-bar-row { border-top: 1px solid var(--border); }
.cat-bar-label {
    display: flex; align-items: center; gap: 0.4rem;
    min-width: 120px; flex-shrink: 0;
}
.cat-bar-icon {
    width: 24px; height: 24px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; flex-shrink: 0;
}
.cat-bar-name {
    font-size: 0.8rem; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cat-bar-track {
    flex: 1; height: 8px; background: var(--bg-input);
    border-radius: 4px; overflow: hidden; min-width: 60px;
}
.cat-bar-fill {
    height: 100%; border-radius: 4px;
    transition: width 400ms ease;
}
.cat-bar-amount {
    font-size: 0.8rem; font-weight: 500; color: var(--red-text);
    min-width: 70px; text-align: right; flex-shrink: 0;
}
@media (max-width: 480px) {
    .cat-bar-label { min-width: 90px; }
    .cat-bar-name { font-size: 0.75rem; }
    .cat-bar-amount { font-size: 0.75rem; min-width: 60px; }
}

/* Budget Progress */
.budget-item { padding: 0.5rem 0; }
.budget-item + .budget-item { border-top: 1px solid var(--border-subtle); }
.budget-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.3rem;
}
.budget-label {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.85rem; font-weight: 500;
}
.budget-actions {
    display: flex; align-items: center; gap: 0.3rem;
}
.budget-amount {
    font-size: 0.75rem; color: var(--text-muted);
}
.budget-progress {
    height: 6px; background: var(--bg-input);
    border-radius: 3px; overflow: hidden;
}
.budget-bar {
    height: 100%; border-radius: 3px;
    transition: width 400ms ease;
}
.budget-footer {
    display: flex; justify-content: space-between;
    font-size: 0.7rem; margin-top: 0.2rem;
}

/* ========================================
   Fixed Costs Gruppierung
   ======================================== */
.fc-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 0.6rem;
}
.fc-group-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.55rem 0.85rem;
    background: var(--bg-card-hover);
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
}
.fc-group-title {
    display: inline-flex; align-items: center; gap: 0.45rem;
    font-weight: 600; color: var(--text-secondary);
    letter-spacing: 0.01em;
}
.fc-group-title i { font-size: 0.7rem; opacity: 0.7; }
.fc-group-meta {
    display: inline-flex; align-items: center; gap: 0.85rem;
}
.fc-group-count {
    font-size: 0.7rem; color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.fc-group-sum {
    font-weight: 700; color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.fc-group-sum-unit {
    font-size: 0.65rem; color: var(--text-muted);
    font-weight: 500; margin-left: 0.15rem;
}
.fc-group-items {
    display: flex; flex-direction: column;
}
.fc-group-items .swipe-container { margin: 0; }
.fc-group-items .swipe-container .fc-item {
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: var(--bg-card);
}
.fc-group-items .swipe-container .fc-item.is-transfer {
    border-left: 3px solid var(--cyan);
}
.fc-group-items .swipe-container:last-child .fc-item {
    border-bottom: none;
}
.fc-group-items .swipe-container .fc-item:hover {
    background: var(--bg-card-hover);
}
@media (max-width: 480px) {
    .fc-group-header { padding: 0.5rem 0.65rem; }
    .fc-group-meta { gap: 0.55rem; }
}

/* ========================================
   Pagination
   ======================================== */
.tx-pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 0.6rem; padding: 0.75rem 0.5rem;
    margin-top: 0.25rem;
}
.tx-pagination:empty { display: none; }
.tx-pagination .btn {
    min-width: 36px; padding: 0.4rem 0.55rem;
}
.tx-pagination .btn:disabled {
    opacity: 0.35; cursor: not-allowed;
}
.tx-pagination .pagination-info {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 110px;
    text-align: center;
}

/* ========================================
   Expression Input – Rechenausdruck Preview
   ======================================== */
.expr-preview {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    min-height: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 150ms ease, opacity 150ms ease, margin-top 150ms ease;
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
    line-height: 1.2;
    pointer-events: none;
}
.expr-preview.visible {
    max-height: 1.5rem;
    opacity: 1;
    margin-top: 0.25rem;
}
.expr-preview.error {
    color: var(--red-text);
}
.input.input-error,
.cat-select-trigger.input-error {
    border-color: var(--red) !important;
    background: rgba(248, 81, 73, 0.05);
}
.input.input-error:focus {
    box-shadow: 0 0 0 2px rgba(248, 81, 73, 0.15);
}

.field-error {
    font-size: 0.72rem;
    color: var(--red-text);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    line-height: 1.2;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 150ms ease, opacity 150ms ease, margin-top 150ms ease;
}
.field-error.visible {
    max-height: 1.5rem;
    opacity: 1;
}
.field-error i {
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* Fixed Cost Next Booking Date */
.fc-next-date {
    font-size: 0.7rem; color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ========================================
   Monats-Abschluss-Banner
   ======================================== */
.month-recap-banner {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}
.month-recap-banner.visible { display: flex; }

.recap-icon {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.recap-icon.recap-positive {
    background: rgba(63, 185, 80, 0.12);
    color: var(--green-text);
}
.recap-icon.recap-negative {
    background: rgba(248, 81, 73, 0.12);
    color: var(--red-text);
}

.recap-body {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 0.1rem;
}
.recap-title {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.recap-text {
    font-size: 0.92rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.recap-text strong { font-weight: 700; }

.recap-link {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 150ms, border-color 150ms;
    flex-shrink: 0;
}
.recap-link:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}
.recap-dismiss {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: background 150ms, color 150ms;
}
.recap-dismiss:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
@media (max-width: 480px) {
    .month-recap-banner { padding: 0.55rem 0.7rem; gap: 0.55rem; }
    .recap-icon { width: 30px; height: 30px; font-size: 0.85rem; }
    .recap-title { font-size: 0.65rem; }
    .recap-text { font-size: 0.85rem; }
    .recap-link { padding: 0.35rem 0.55rem; }
}

/* Fixed Cost History Button (kleines Uhr-Icon im Betragsfeld) */
.fc-history-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px;
    margin-left: 0.35rem;
    padding: 0;
    border: none; background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    border-radius: 4px;
    transition: color 150ms, background 150ms;
    vertical-align: middle;
}
.fc-history-btn:hover {
    color: var(--accent);
    background: var(--bg-card-hover);
}

/* Fixed Cost History Modal Liste */
.fc-history-list {
    display: flex; flex-direction: column;
    max-height: 60vh;
    overflow-y: auto;
}
.fc-history-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.85rem;
    align-items: center;
    padding: 0.7rem 0.4rem;
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}
.fc-history-row:last-child { border-bottom: none; }
.fc-history-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.fc-history-amount {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}
.fc-history-delta {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    display: inline-flex; align-items: center; gap: 0.25rem;
    white-space: nowrap;
}
.fc-history-delta.up   { color: var(--red-text);   background: rgba(248, 81, 73, 0.08); }
.fc-history-delta.down { color: var(--green-text); background: rgba(63, 185, 80, 0.08); }
.fc-history-delta.neutral {
    color: var(--text-muted);
    background: var(--bg-card-hover);
}
.loading-placeholder {
    padding: 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
