/* ============================================================
   Lebenskosten – App Styles
   ============================================================ */

:root {
    --sidebar-width: 260px;
    --topbar-height: 56px;

    --color-bg:           #0f1117;
    --color-surface:      #1a1d27;
    --color-surface-2:    #22263a;
    --color-border:       rgba(255,255,255,0.08);
    --color-text:         #e2e8f0;
    --color-text-muted:   #94a3b8;
    --color-primary:      #6366f1;
    --color-primary-dark: #4f46e5;
    --color-success:      #22c55e;
    --color-danger:       #ef4444;
    --color-warning:      #f59e0b;
    --color-info:         #3b82f6;
    --color-income:       #22c55e;
    --color-expense:      #ef4444;
    --color-paid:         #22c55e;
    --color-unpaid:       #f59e0b;

    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  16px;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:  0 8px 30px rgba(0,0,0,0.5);
}

/* ── Light Theme Variables ── */
[data-bs-theme="light"] {
    --color-bg:           #f8fafc;
    --color-surface:      #ffffff;
    --color-surface-2:    #f1f5f9;
    --color-border:       rgba(0,0,0,0.09);
    --color-text:         #1e293b;
    --color-text-muted:   #64748b;
    --shadow-sm:          0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:          0 4px 12px rgba(0,0,0,0.10);
    --shadow-lg:          0 8px 30px rgba(0,0,0,0.12);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    background: var(--color-bg);
    color: var(--color-text);
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); }

/* ── Bootstrap 5 Dark Override ── */
/* Hintergrund & Schrift */
.bg-dark, [data-bs-theme="dark"] {
    --bs-body-bg: var(--color-bg);
    --bs-body-color: var(--color-text);
}
[data-bs-theme="light"] {
    --bs-body-bg: var(--color-bg);
    --bs-body-color: var(--color-text);
}

/* Formularfelder */
.form-control,
.form-select,
.form-control:disabled {
    background-color: var(--color-surface-2) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}
.form-control::placeholder { color: var(--color-text-muted) !important; }
.form-control:focus,
.form-select:focus {
    background-color: var(--color-surface-2) !important;
    border-color: var(--color-primary) !important;
    color: var(--color-text) !important;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2) !important;
}
.form-select option {
    background-color: #1a1d27;
    color: var(--color-text);
}

/* Input-Group */
.input-group-text {
    background-color: var(--color-surface-2);
    border-color: var(--color-border);
    color: var(--color-text-muted);
}

/* Checkboxen & Radio-Buttons */
.form-check-input {
    background-color: var(--color-surface-2);
    border-color: rgba(255,255,255,0.3);
}
.form-check-input:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}
.form-check-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

/* Modals */
.modal-content {
    background-color: var(--color-surface) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}
.modal-header,
.modal-footer {
    border-color: var(--color-border) !important;
}

/* Alerts */
.alert-danger  { background-color: rgba(239,68,68,0.15);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-success { background-color: rgba(34,197,94,0.15);  border-color: rgba(34,197,94,0.3);  color: #86efac; }
.alert-warning { background-color: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.3); color: #fcd34d; }
.alert-info    { background-color: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.3); color: #93c5fd; }

/* Tabellen */
.table { --bs-table-bg: transparent; --bs-table-color: var(--color-text); }
.table-active { --bs-table-active-bg: rgba(99,102,241,0.1); }

/* List-Group */
.list-group-item {
    background-color: transparent !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
}

/* Dropdown */
.dropdown-menu {
    background-color: var(--color-surface);
    border-color: var(--color-border);
}
.dropdown-item { color: var(--color-text); }
.dropdown-item:hover { background-color: var(--color-surface-2); color: var(--color-text); }

/* Color-Picker */
.form-control-color { min-width: 48px; padding: 4px; }

/* ── Layout ── */
body.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.25s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text) !important;
    letter-spacing: -0.02em;
}

.sidebar-brand i {
    font-size: 1.4rem;
    color: var(--color-primary);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 1rem;
}

.sidebar-section {
    padding: 8px 16px;
}

.sidebar-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.sidebar-nav {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav li.sidebar-section-label {
    padding: 12px 20px 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--color-text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 0;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: var(--color-text);
    background: var(--color-surface-2);
}

.sidebar-link.active {
    color: var(--color-primary);
    background: rgba(99,102,241,0.12);
    border-left-color: var(--color-primary);
}

.sidebar-link i { font-size: 1rem; width: 18px; text-align: center; }

/* Book switcher items */
.book-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    overflow: hidden;
}

.book-item-active {
    background: rgba(99,102,241,0.15);
    color: var(--color-primary);
    border: 1px solid rgba(99,102,241,0.25);
}

.book-item-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--color-text-muted);
    text-align: left;
    cursor: pointer;
    width: 100%;
    transition: all 0.15s ease;
}

.book-item-btn:hover {
    background: var(--color-surface-2);
    border-color: var(--color-border);
    color: var(--color-text);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px; height: 34px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-name  { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.72rem; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Topbar (Mobile) ── */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 900;
    font-weight: 600;
}

/* ── Content Area ── */
.content-area {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 32px;
    flex: 1;
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .content-area { margin-left: 0; padding: 16px; padding-top: calc(var(--topbar-height) + 16px); }
}

/* ── Flash Messages ── */
.flash-container {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 9999;
    width: 340px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (max-width: 575.98px) {
    .flash-container { left: 16px; right: 16px; width: auto; bottom: 16px; }
}

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0;
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* ── Cards ── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--color-border);
    padding: 16px 20px;
    font-weight: 600;
}

.card-body { padding: 20px; }

/* ── Summary Cards ── */
.summary-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.summary-card .label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.summary-card .value {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
}

.summary-card .sub {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.summary-card .icon {
    position: absolute;
    top: 16px; right: 16px;
    font-size: 1.8rem;
    opacity: 0.15;
}

.summary-card.income  { border-top: 3px solid var(--color-income); }
.summary-card.expense { border-top: 3px solid var(--color-expense); }
.summary-card.balance { border-top: 3px solid var(--color-primary); }
.summary-card.paid    { border-top: 3px solid var(--color-paid); }
.summary-card.unpaid  { border-top: 3px solid var(--color-unpaid); }

.value.positive { color: var(--color-income); }
.value.negative { color: var(--color-expense); }
.value.neutral  { color: var(--color-primary); }

/* ── Tables ── */
.table {
    color: var(--color-text);
}

.table thead th {
    background: var(--color-surface-2);
    border-color: var(--color-border);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    padding: 10px 12px;
    white-space: nowrap;
}

.table tbody td {
    border-color: var(--color-border);
    padding: 10px 12px;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--color-surface-2);
}

/* ── Entry Rows ── */
.entry-row.is-paid {
    opacity: 0.6;
}

.entry-row.is-paid td:first-child {
    text-decoration: line-through;
    color: var(--color-text-muted);
}

.badge-income  { background: rgba(34,197,94,0.15);  color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.badge-expense { background: rgba(239,68,68,0.15);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.badge-paid    { background: rgba(34,197,94,0.15);  color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.badge-unpaid  { background: rgba(245,158,11,0.15); color: #fcd34d; border: 1px solid rgba(245,158,11,0.3); }

/* ── Paid Toggle Button ── */
.btn-paid {
    border: none;
    background: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    font-size: 1.1rem;
}

.btn-paid:hover { background: var(--color-surface-2); }
.btn-paid.paid  { color: var(--color-success); }
.btn-paid.unpaid { color: var(--color-text-muted); }

/* ── Forms ── */
.form-control, .form-select {
    background: var(--color-surface-2);
    border-color: var(--color-border);
    color: var(--color-text);
}

.form-control:focus, .form-select:focus {
    background: var(--color-surface-2);
    border-color: var(--color-primary);
    color: var(--color-text);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

/* ── Buttons ── */
.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    font-weight: 500;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}

/* ── Month Navigator ── */
.month-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 8px 16px;
    display: inline-flex;
}

.month-nav .month-label {
    font-weight: 700;
    font-size: 1rem;
    min-width: 140px;
    text-align: center;
}

.month-nav a {
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

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

/* ── Frequency badges ── */
.freq-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--color-surface-2);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

/* ── Progress Bar ── */
.progress {
    background: var(--color-surface-2);
    border-radius: 999px;
    height: 6px;
}

/* ── Login Page ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 16px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 28px;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.login-logo i { font-size: 2rem; color: var(--color-primary); }

/* ── Amount colors ── */
.amount-income  { color: var(--color-income); font-weight: 600; }
.amount-expense { color: var(--color-expense); font-weight: 600; }

/* ── Divider ── */
.divider { border-color: var(--color-border); }

/* ── Year chart container ── */
.chart-container { position: relative; height: 280px; }

/* ── Category dot ── */
.cat-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
}

/* ── Day badge ── */
.day-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

/* ── Overlay für Sidebar (Mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
}

.sidebar-overlay.show { display: block; }

/* ── Bitcoin Card ── */
.btc-price-card {
    background: linear-gradient(135deg, var(--color-surface), #1a1f35);
    border: 1px solid rgba(247,147,26,0.3);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.btc-icon { color: #f7931a; font-size: 2rem; }

/* ── Sortable drag ghost (Einstellungen-Seite) ── */
.sortable-ghost {
    opacity: 0.4;
    background: var(--color-surface-2) !important;
    border-color: var(--color-primary) !important;
}

/* ══ GridStack Dashboard ════════════════════════════════════════════════════ */

/* GridStack-Item-Content als Flex-Column damit die Karte die volle Höhe füllt */
.grid-stack-item-content {
    display:        flex !important;
    flex-direction: column;
    overflow:       hidden !important;
    border-radius:  var(--radius-md);
}

/* Karte füllt den gesamten Bereich des Grid-Items */
.dash-card {
    flex:           1 1 0;
    min-height:     0;
    display:        flex;
    flex-direction: column;
    margin:         0 !important;
    border-radius:  var(--radius-md);
    overflow:       hidden;
}

.dash-card .card-header {
    display:      flex;
    align-items:  center;
    gap:          8px;
    flex-shrink:  0;
    user-select:  none;
}

.dash-card .card-body {
    flex:        1 1 0;
    min-height:  0;
}

/* Chart-spezifische Card-Body */
.dash-chart-body {
    display:        flex !important;
    flex-direction: column;
    padding:        10px !important;
}
.dash-chart-body .chart-container {
    flex:       1;
    height:     0;       /* flex-grow übernimmt die Höhe */
    min-height: 120px;
    position:   relative;
}
.dash-chart-body canvas {
    position: absolute !important;
    inset:    0 !important;
    width:    100% !important;
    height:   100% !important;
}

/* Stat-Zeilen (summary / bitcoin_stats) */
.dash-stat-row {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         14px 20px;
    font-size:       .95rem;
}
.dash-stat-row--bar {
    flex-direction: column;
    align-items:    stretch;
    padding-bottom: 10px;
}

/* ── Edit-Modus ── */

/* Drag-Icon: normalerweise unsichtbar, im Edit-Modus sichtbar */
.dash-drag-icon {
    display:    none;
    cursor:     grab;
    color:      rgba(99,102,241,.7);
    font-size:  1.1rem;
    flex-shrink:0;
    transition: color .15s;
}
.dash-drag-icon:hover  { color: var(--color-primary); }
.dash-drag-icon:active { cursor: grabbing; }

.dash-edit-mode .dash-drag-icon { display: inline-block; }

/* Im Edit-Modus: Karten bekommen lila Rahmen zur Orientierung */
.dash-edit-mode .dash-card {
    border-color:   rgba(99,102,241,.5) !important;
    box-shadow:     0 0 0 1px rgba(99,102,241,.2);
}

/* GridStack Resize-Handle anpassen */
.dash-edit-mode .grid-stack-item > .ui-resizable-handle {
    opacity: 1;
}
.grid-stack-item > .ui-resizable-se {
    width:          22px !important;
    height:         22px !important;
    background:     var(--color-primary);
    border-radius:  4px 0 var(--radius-sm) 0;
    right:          0 !important;
    bottom:         0 !important;
    opacity:        0;
    transition:     opacity .2s;
}
.dash-edit-mode .grid-stack-item > .ui-resizable-se { opacity: 1; }

/* Im Edit-Modus: Links/Buttons in Karten deaktivieren */
.dash-edit-mode .dash-card .card-body   a,
.dash-edit-mode .dash-card .card-body   button,
.dash-edit-mode .dash-card .card-header a {
    pointer-events: none;
    user-select:    none;
}

/* ── Offene Zahlungen: Erledigt-Button ── */
.upcoming-check-btn {
    width:           28px;
    height:          28px;
    border-radius:   50%;
    border:          2px solid var(--color-border);
    background:      transparent;
    color:           var(--color-text-muted);
    font-size:       .8rem;
    cursor:          pointer;
    flex-shrink:     0;
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         0;
    transition:      background .15s, border-color .15s, color .15s;
}
.upcoming-check-btn:hover {
    border-color: var(--color-success);
    color:        var(--color-success);
    background:   rgba(34,197,94,.1);
}

/* ── Modul entfernen (X-Button) ── */
.dash-remove-btn {
    display:         none;
    position:        absolute;
    top:             6px;
    right:           6px;
    z-index:         20;
    width:           26px;
    height:          26px;
    border-radius:   50%;
    border:          none;
    background:      rgba(239,68,68,.85);
    color:           #fff;
    font-size:       .75rem;
    cursor:          pointer;
    align-items:     center;
    justify-content: center;
    padding:         0;
    transition:      background .15s, transform .1s;
    pointer-events:  auto !important;   /* override card-body disable */
}
.dash-remove-btn:hover  { background: #ef4444; transform: scale(1.1); }
.dash-edit-mode .dash-remove-btn { display: flex; }

/* ── FAB: Module hinzufügen ── */
#poolBtn {
    display:         none;
    position:        fixed;
    bottom:          106px;
    right:           24px;
    z-index:         1070;
    width:           52px;
    height:          52px;
    border-radius:   50%;
    border:          none;
    background:      var(--color-primary);
    color:           #fff;
    font-size:       1.5rem;
    cursor:          pointer;
    align-items:     center;
    justify-content: center;
    box-shadow:      0 4px 16px rgba(99,102,241,.55);
    transition:      transform .15s, box-shadow .15s;
}
#poolBtn.visible { display: flex; }
#poolBtn:hover   { transform: scale(1.08); box-shadow: 0 6px 22px rgba(99,102,241,.75); }

/* ── Pool-Panel ── */
#poolPanel {
    display:       none;
    position:      fixed;
    bottom:        170px;
    right:         24px;
    z-index:       1065;
    background:    var(--color-surface);
    border:        1px solid rgba(99,102,241,.4);
    border-radius: var(--radius-lg);
    padding:       12px;
    min-width:     230px;
    box-shadow:    var(--shadow-lg);
}
#poolPanel.open { display: block; }

.pool-tile {
    display:     flex;
    align-items: center;
    gap:         10px;
    padding:     8px 10px;
    border-radius: var(--radius-sm);
    cursor:      pointer;
    transition:  background .15s;
    color:       var(--color-text);
    font-size:   .88rem;
}
.pool-tile:hover { background: rgba(99,102,241,.15); }
.pool-tile i     { color: var(--color-primary); font-size: 1rem; flex-shrink: 0; }

/* GridStack Ghost beim Drag */
.grid-stack-placeholder > .placeholder-content {
    background:     rgba(99,102,241,.12) !important;
    border:         2px dashed rgba(99,102,241,.5) !important;
    border-radius:  var(--radius-md) !important;
}

/* ── Responsive Tweaks ── */
@media (max-width: 575.98px) {
    .summary-card .value { font-size: 1.3rem; }
    .page-title { font-size: 1.2rem; }
}

/* ── Sortierbare Tabellen: konsistente Spaltenbreiten ── */
.sortable-table {
    table-layout: fixed;
    width: 100%;
}
.sortable-table th,
.sortable-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Feste Breiten für Aktions- und kleine Spalten */
.sortable-table th[style*="width:40px"],
.sortable-table td:first-child:has(+ td + td + td + td + td + td) {
    width: 40px;
}
/* Betrag-Spalte immer rechts + fixe Breite */
.sortable-table .col-betrag { width: 110px; text-align: right; }
/* Status fixe Breite */
.sortable-table .col-status { width: 110px; }
/* Aktionen fixe Breite */
.sortable-table .col-actions { width: 80px; text-align: right; }

/* ── Custom Category Select ── */
.cat-select-wrap {
    position: relative;
}
.cat-select-btn {
    cursor: pointer;
    user-select: none;
    padding-left: 10px;
    gap: 8px;
}
.cat-select-btn .cat-select-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cat-dot-sm {
    display:       inline-block;
    width:         10px;
    height:        10px;
    border-radius: 50%;
    flex-shrink:   0;
}
.cat-type-badge {
    font-size:     .68rem;
    padding:       1px 5px;
    border-radius: 4px;
    margin-left:   4px;
    white-space:   nowrap;
}
.cat-type-badge.cat-income  { background: rgba(34,197,94,.15);  color: #22c55e; }
.cat-type-badge.cat-expense { background: rgba(239,68,68,.15);  color: #ef4444; }
.cat-savings-icon { color: var(--color-primary); font-size: .8rem; margin-left: 4px; }

.cat-select-menu {
    display:      none;
    position:     absolute;
    top:          calc(100% + 4px);
    left:         0;
    right:        0;
    z-index:      1060;
    background:   var(--color-surface);
    border:       1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow:   var(--shadow-md);
    max-height:   280px;
    overflow:     hidden;
    display:      none;
    flex-direction: column;
}
.cat-select-menu.open { display: flex; }
.cat-select-search-wrap { flex-shrink: 0; }
.cat-select-items {
    overflow-y: auto;
    flex:       1;
}
.cat-select-item {
    display:      flex;
    align-items:  center;
    gap:          8px;
    padding:      7px 12px;
    cursor:       pointer;
    font-size:    .9rem;
    transition:   background .1s;
}
.cat-select-item:hover,
.cat-select-item.active { background: rgba(99,102,241,.15); }
.cat-select-item.hidden { display: none; }

/* Autocomplete suggestions in kategorien.php */
.cat-name-suggestions {
    position:     absolute;
    top:          100%;
    left:         0;
    right:        0;
    z-index:      1060;
    background:   var(--color-surface);
    border:       1px solid var(--color-border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow:   var(--shadow-sm);
    max-height:   180px;
    overflow-y:   auto;
    display:      none;
}
.cat-name-suggestions.open { display: block; }
.cat-name-suggest-item {
    display:      flex;
    align-items:  center;
    gap:          8px;
    padding:      7px 12px;
    cursor:       pointer;
    font-size:    .9rem;
    transition:   background .1s;
}
.cat-name-suggest-item:hover { background: rgba(99,102,241,.15); }

/* ── Theme Selector ── */
.theme-option {
    display: inline-flex;
    align-items: center;
    padding: .4rem .9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    cursor: pointer;
    font-size: .875rem;
    transition: border-color .15s, background .15s;
    background: var(--color-surface-2);
    color: var(--color-text);
}
.theme-option:hover {
    border-color: var(--color-primary);
}
.theme-option.active {
    border-color: var(--color-primary);
    background: rgba(99,102,241,.12);
    color: var(--color-primary);
}
