/* ========================================
   Self Accountant — "Calm Finance" Design System
   Dark/Light theme, mobile-first, Söhne font
   ======================================== */

/* ========================================
   Söhne Font Family (by Klim Type Foundry)
   ======================================== */
@font-face { font-family: 'Sohne'; src: url('../fonts/Sohne-Light.otf') format('opentype'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sohne'; src: url('../fonts/Sohne-Regular.otf') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sohne'; src: url('../fonts/Sohne-Medium.otf') format('opentype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sohne'; src: url('../fonts/Sohne-SemiBold.otf') format('opentype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sohne'; src: url('../fonts/Sohne-Bold.otf') format('opentype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sohne'; src: url('../fonts/Sohne-ExtraBold.otf') format('opentype'); font-weight: 800; font-style: normal; font-display: swap; }

@font-face { font-family: 'Sohne Breit'; src: url('../fonts/SohneBreit-SemiBold.otf') format('opentype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sohne Breit'; src: url('../fonts/SohneBreit-Bold.otf') format('opentype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sohne Breit'; src: url('../fonts/SohneBreit-ExtraBold.otf') format('opentype'); font-weight: 800; font-style: normal; font-display: swap; }

@font-face { font-family: 'Sohne Mono'; src: url('../fonts/SohneMono-Regular.otf') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sohne Mono'; src: url('../fonts/SohneMono-SemiBold.otf') format('opentype'); font-weight: 600; font-style: normal; font-display: swap; }

:root {
    /* Background — zinc-950 / zinc-900 */
    --bg-primary: #09090b;
    --bg-surface: #18181b;
    --bg-surface-hover: #27272a;
    --bg-sidebar: #09090b;
    --bg-input: #27272a;
    --bg-elevated: #18181b;

    /* Borders — zinc-800 */
    --border: #27272a;
    --border-hover: #3f3f46;
    --border-focus: #a1a1aa;

    /* Text — zinc scale */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-inverse: #09090b;

    /* Accent */
    --accent: #3B82F6;
    --accent-hover: #2563EB;
    --accent-subtle: rgba(59, 130, 246, 0.15);
    --accent-glow: rgba(59, 130, 246, 0.2);

    /* Semantic — desaturated for shadcn feel */
    --income: #22c55e;
    --income-subtle: rgba(34, 197, 94, 0.1);
    --expense: #ef4444;
    --expense-subtle: rgba(239, 68, 68, 0.1);
    --warning: #eab308;
    --warning-subtle: rgba(234, 179, 8, 0.1);
    --info: #06b6d4;
    --info-subtle: rgba(6, 182, 212, 0.1);

    /* Layout */
    --sidebar-width: 260px;
    --mobile-header-h: 56px;
    --tab-bar-h: 56px;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --transition: 0.15s ease;

    /* Chart colors — muted palette */
    --chart-1: #3B82F6;
    --chart-2: #22c55e;
    --chart-3: #eab308;
    --chart-4: #ef4444;
    --chart-5: #8B5CF6;
    --chart-6: #EC4899;
    --chart-7: #06B6D4;
    --chart-8: #F97316;
}

/* ========================================
   Light Mode Overrides
   ======================================== */
:root.light-mode {
    /* Background — zinc light scale */
    --bg-primary: #ffffff;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f4f4f5;
    --bg-sidebar: #f4f4f5;
    --bg-input: #ffffff;
    --bg-elevated: #ffffff;

    /* Borders — zinc-200 */
    --border: #e4e4e7;
    --border-hover: #d4d4d8;
    --border-focus: #71717a;

    /* Text — zinc scale */
    --text-primary: #09090b;
    --text-secondary: #71717a;
    --text-muted: #a1a1aa;
    --text-inverse: #fafafa;

    /* Accent */
    --accent-subtle: rgba(59, 130, 246, 0.08);
    --accent-glow: rgba(59, 130, 246, 0.15);

    /* Semantic subtle backgrounds — lighter for white bg */
    --income-subtle: rgba(16, 185, 129, 0.08);
    --expense-subtle: rgba(239, 68, 68, 0.08);
    --warning-subtle: rgba(245, 158, 11, 0.08);
    --info-subtle: rgba(6, 182, 212, 0.08);
}

/* Light mode shadow — cards get subtle shadow instead of border contrast */
:root.light-mode .card,
:root.light-mode .login-card,
:root.light-mode .modal {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

:root.light-mode .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Light mode: flat KPI cards — shadcn style */
:root.light-mode .summary-card {
    background: var(--bg-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
}
:root.light-mode .summary-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Light mode sidebar — light gray */
:root.light-mode .sidebar {
    --bg-sidebar: #f4f4f5;
    background: #f4f4f5;
}
:root.light-mode .brand-version {
    color: #a1a1aa;
}
:root.light-mode .sidebar-footer {
    border-top-color: transparent;
}
:root.light-mode .user-avatar {
    background: #e4e4e7;
    border: none;
    color: #09090b;
}
:root.light-mode .user-name { color: #09090b; }
:root.light-mode .user-role { color: #a1a1aa; }
:root.light-mode .user-logout { color: #a1a1aa; }
:root.light-mode .user-logout:hover { color: #09090b; }
:root.light-mode .theme-toggle-label { color: #a1a1aa; }
:root.light-mode .theme-toggle-btn {
    color: #71717a;
    background: #e4e4e7;
    border-color: #d4d4d8;
}
:root.light-mode .theme-toggle-btn:hover {
    background: #d4d4d8;
    color: #09090b;
}

/* Light mode mobile header — dark text on light gray */
:root.light-mode .mobile-header {
    background: #f4f4f5;
    border-bottom-color: #e4e4e7;
}
:root.light-mode .mobile-title {
    color: #09090b;
}
:root.light-mode .hamburger span {
    background: #09090b;
}

/* Light mode tab bar — light gray to match body */
:root.light-mode .tab-bar {
    background: rgba(244, 244, 245, 0.95);
    border-top-color: #e4e4e7;
}
:root.light-mode .tab-bar-item {
    color: #09090b;
}
:root.light-mode .tab-bar-item.active,
:root.light-mode .tab-bar-item.more-active {
    color: #09090b;
    font-weight: 700;
}

/* Light mode table row hover */
:root.light-mode .table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Light mode list card */
:root.light-mode .list-card:hover {
    background: transparent;
}
:root.light-mode .date-group-header {
    background: var(--bg-primary);
}

/* Light mode sidebar text — dark on light gray */
:root.light-mode .brand-name {
    color: #09090b;
}
:root.light-mode .nav-label {
    color: #09090b;
}
:root.light-mode .nav-item {
    color: #09090b;
}
:root.light-mode .nav-item:hover {
    background: #e4e4e7;
    color: #09090b;
}
:root.light-mode .nav-item.active {
    background: #e4e4e7;
    color: #09090b;
}
:root.light-mode .nav-item svg {
    opacity: 0.5;
}
:root.light-mode .nav-item:hover svg {
    opacity: 0.8;
}
:root.light-mode .nav-item.active svg {
    opacity: 1;
}

/* Light mode scrollbar */
:root.light-mode ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}
:root.light-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Sohne', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-sidebar);
    color: var(--text-secondary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
::selection { background: var(--accent-subtle); color: var(--text-primary); }

/* ========================================
   Mobile Header
   ======================================== */
.mobile-header {
    display: none;
}

.mobile-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    -webkit-tap-highlight-color: transparent;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: var(--transition);
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: none;
    display: flex;
    flex-direction: column;
    z-index: 1100;
    transition: left var(--transition);
    overflow: hidden;
}

.sidebar.open { left: 0; }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: none;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.brand-name {
    display: block;
    font-family: 'Sohne Breit', 'Sohne', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-version {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: -1px;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}

.nav-section { padding: 4px 0; }

.nav-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-primary);
    padding: 12px 20px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    margin: 1px 8px;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 450;
    transition: var(--transition);
    border-radius: var(--radius-sm);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 550;
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.5;
}

.nav-item:hover svg { opacity: 0.8; }
.nav-item.active svg { opacity: 1; }

/* User Footer */
.sidebar-footer {
    border-top: none;
    padding: 12px 16px;
}

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

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

.user-info { flex: 1; min-width: 0; }

.user-name {
    display: block;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.user-logout {
    color: var(--text-muted);
    padding: 6px;
    border-radius: 6px;
    display: flex;
    transition: var(--transition);
}

.user-logout:hover {
    color: var(--expense);
    background: var(--expense-subtle);
}

/* Theme Toggle */
.theme-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.theme-toggle-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.theme-toggle-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-family: inherit;
    font-weight: 500;
    transition: all var(--transition);
}

.theme-toggle-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.theme-toggle-btn svg { width: 14px; height: 14px; }

/* Login theme toggle (floating) */
.login-theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
    z-index: 10;
}

.login-theme-toggle:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.login-theme-toggle svg { width: 18px; height: 18px; }

/* ========================================
   Main Content
   ======================================== */
.main-content {
    margin-top: 0;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 20px;
    min-height: 100vh;
    background: var(--bg-primary);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Page Header
   ======================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h2 {
    font-family: 'Sohne', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 360px;
    justify-content: flex-end;
}

.page-header-actions .btn-sm {
    height: 34px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-bar-compact {
    flex: 1;
    margin-bottom: 0;
}

.search-bar-compact .search-bar-input {
    padding: 6px 12px 6px 32px;
    font-size: 0.8rem;
    height: 34px;
    box-sizing: border-box;
}

.search-bar-compact .search-bar-icon {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.search-bar-compact .search-bar-count {
    right: 12px;
    font-size: 0.65rem;
}

/* ========================================
   Cards — Glass Surface
   ======================================== */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    transition: border-color var(--transition);
}

.card:hover { border-color: var(--border-hover); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 0;
    border-bottom: none;
}

.card-header h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   KPI / Summary Cards — Tinted Glass Tiles
   ======================================== */
.summary-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

/* --- Base card (shadcn flat) --- */
.summary-card {
    position: relative;
    background: var(--bg-surface);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: border-color var(--transition);
}

.summary-card:hover {
    border-color: var(--border-hover);
}

/* --- Header row: label + icon --- */
.summary-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.summary-card .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.4;
}

/* --- Icon (small, muted) --- */
.summary-card-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    opacity: 0.5;
}
.summary-card-icon svg { width: 16px; height: 16px; }

/* --- Amount (hero number) --- */
.summary-card .amount {
    font-family: 'Sohne', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

/* --- Subtitle line --- */
.summary-card-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 400;
}

/* No ambient glow — shadcn is flat */
.summary-card::before { display: none; }

/* --- Variants: only icon color differs, amounts stay primary --- */
.summary-card.income .summary-card-icon { color: var(--income); opacity: 1; }
.summary-card.expense .summary-card-icon { color: var(--expense); opacity: 1; }
.summary-card.balance .summary-card-icon { color: var(--text-primary); opacity: 1; }
.summary-card.today .summary-card-icon { color: var(--text-muted); opacity: 1; }

/* No colored amounts — keep primary text */
.summary-card.income .amount,
.summary-card.expense .amount,
.summary-card.balance .amount,
.summary-card.today .amount { color: var(--text-primary); }

/* ========================================
   Forms
   ======================================== */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--border-focus);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    cursor: pointer;
    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='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select.form-control option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

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

input[type="color"].form-control {
    height: 42px;
    padding: 4px;
    cursor: pointer;
}

input[type="file"].form-control {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-inline {
    display: flex;
    gap: 10px;
    align-items: end;
}

.form-inline .form-group { flex: 1; }

/* Checkbox styling */
input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 6px;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--text-primary);
    color: var(--text-inverse);
}
.btn-primary:hover {
    opacity: 0.9;
}

.btn-success { background: var(--income); color: #fff; }
.btn-success:hover { opacity: 0.9; }

.btn-danger { background: var(--expense); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

.btn-warning { background: var(--warning); color: var(--text-inverse); }
.btn-warning:hover { opacity: 0.9; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ========================================
   Alerts — Toast Style
   ======================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.88rem;
    font-weight: 450;
    border: 1px solid;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: var(--income-subtle);
    color: var(--income);
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: var(--expense-subtle);
    color: var(--expense);
    border-color: rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: var(--warning-subtle);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: var(--info-subtle);
    color: var(--info);
    border-color: rgba(6, 182, 212, 0.2);
}

/* ========================================
   Reminder Banner
   ======================================== */

.reminder-banner {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 16px;
    animation: slideDown 0.3s ease;
}

.reminder-banner-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #3B82F6;
    margin-bottom: 10px;
}

.reminder-banner-header svg { flex-shrink: 0; stroke: #3B82F6; }
.reminder-banner-header span { flex: 1; }

.reminder-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.reminder-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.reminder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    gap: 8px;
}

.reminder-item strong {
    flex: 1;
    color: var(--text-primary);
    font-weight: 550;
}

.reminder-item span {
    color: var(--text-muted);
    font-family: 'Sohne Mono', monospace;
    font-size: 0.72rem;
    white-space: nowrap;
}

.reminder-overdue {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--expense);
}

.reminder-today {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid var(--warning);
}

.reminder-soon {
    background: rgba(59, 130, 246, 0.06);
    border-left: 3px solid rgba(59, 130, 246, 0.3);
}

.reminder-more {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 4px;
}

.reminder-enable-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 8px 16px;
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 550;
    cursor: pointer;
    transition: background 0.2s;
}

.reminder-enable-btn:hover { background: rgba(59, 130, 246, 0.25); }
.reminder-enable-btn:disabled { opacity: 0.5; cursor: default; }

/* ========================================
   Tables
   ======================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table th, .table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table th {
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

/* ========================================
   Search Bar — Instant Filter
   ======================================== */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.search-bar-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    flex-shrink: 0;
}

.search-bar-input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 400;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-bar-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.search-bar-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--border-focus);
}

.search-bar-count {
    position: absolute;
    right: 16px;
    font-family: 'Sohne Mono', 'Sohne', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    pointer-events: none;
}

/* ========================================
   List Items — Refined Row Style
   ======================================== */
.list-cards {
    display: flex;
    flex-direction: column;
}

.list-card {
    background: transparent;
    border-radius: 0;
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.list-card:last-child { border-bottom: none; }

.list-card:hover {
    background: transparent;
}

/* No accent bar */
.list-card::before { display: none; }

/* --- Status dot indicator --- */
.list-card-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
}
.list-card-dot.dot-income { background: var(--income); }
.list-card-dot.dot-expense { background: var(--expense); }
.list-card-dot.dot-warning { background: var(--warning); }
.list-card-dot.dot-danger { background: var(--expense); }
.list-card-dot.dot-muted { background: var(--text-muted); }

/* --- Icon capsule (for pages that still use it) --- */
.list-card-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
    color: #fff;
    letter-spacing: -0.3px;
}

/* --- Body --- */
.list-card-body { flex: 1; min-width: 0; }

.list-card-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.list-card-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Amount --- */
.list-card-amount {
    font-family: 'Sohne', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    color: var(--text-primary);
    letter-spacing: -0.2px;
    text-align: right;
    min-width: 70px;
}

/* --- Action buttons --- */
.list-card-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity var(--transition);
    flex-shrink: 0;
}

.list-card:hover .list-card-actions { opacity: 1; }

/* ========================================
   MOBILE FIXES (< 768px)
   ======================================== */
@media (max-width: 767px) {
    /* Hide hamburger — tab bar replaces sidebar nav */
    .hamburger { display: none; }

    /* Hide old FAB — Add is now a tab */
    .fab { display: none !important; }

    /* Bottom padding for tab bar */
    .main-content {
        padding-bottom: calc(var(--tab-bar-h) + 16px + env(safe-area-inset-bottom, 0px));
    }

    .list-card-actions { opacity: 0.7; }

    /* Page header */
    .page-header h2 { font-size: 1.15rem; }
    .page-header-actions { max-width: none; flex: 1; }
    .search-bar-compact { min-width: 0; }

    /* Cards — tighter padding */
    .card { padding: 14px; }
    .card-header { margin-bottom: 12px; padding-bottom: 10px; }

    /* KPI cards — prevent amount overflow */
    .summary-card { padding: 14px; }
    .summary-card .amount {
        font-size: 1.05rem;
        word-break: break-word;
    }
    .summary-card-header { margin-bottom: 10px; }
    .summary-card-icon { width: 30px; height: 30px; border-radius: 8px; }
    .summary-card-icon svg { width: 14px; height: 14px; }

    /* Charts — constrain to viewport */
    .chart-container {
        min-height: 180px;
        max-height: 240px;
    }
    .chart-doughnut {
        max-height: 200px;
        min-height: 160px;
    }

    /* Bento grid gaps */
    .bento-grid { gap: 12px; }

    /* List card tighter on mobile */
    .list-card { padding: 10px 0; gap: 10px; }
    .list-card-icon { width: 30px; height: 30px; font-size: 0.7rem; border-radius: var(--radius-sm); }
    .list-card-title { font-size: 0.82rem; }
    .list-card-amount { font-size: 0.8rem; min-width: 65px; }

    /* Force summary-cards to 2-col max — override any inline 3-col */
    .summary-cards { grid-template-columns: 1fr 1fr !important; }

    /* Form rows stack on mobile */
    .form-row { grid-template-columns: 1fr !important; gap: 10px; }

    /* Button groups wrap on mobile */
    .btn-group { flex-wrap: wrap; }
    .btn-sm { padding: 5px 10px; font-size: 0.75rem; }

    /* Tables: smaller font on mobile */
    .table th, .table td { padding: 8px 10px; font-size: 0.78rem; }

    /* Filters stack on mobile */
    .filters { flex-direction: column; gap: 8px; }
    .filters .btn { width: 100%; }
    .filter-row { flex-direction: column; gap: 8px; }
    .filter-row .form-control { min-width: 0; }
    .stat-row { padding: 12px 14px; }
    .stat-value { font-size: 0.82rem; }
    .segmented-control { width: 100%; }
    .segment { flex: 1; text-align: center; }

    /* Hero balance — scale down */
    .total-balance-hero { font-size: 1.3rem !important; }

    /* Account cards — tighter on mobile */
    .account-card { padding: 14px 14px 14px 18px; }
    .account-card-accent { top: 10px; bottom: 10px; }
    .account-card-header { flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
    .account-card-name { font-size: 0.88rem; }
    .account-card-balance { font-size: 1.1rem; margin-bottom: 8px; word-break: break-word; }
    .account-card-stats { gap: 12px; font-size: 0.75rem; margin-bottom: 8px; }
    .account-card-actions { gap: 4px; }

    /* List card — ensure actions stay visible */
    .list-card-actions .btn { padding: 4px 8px; font-size: 0.72rem; }
}

/* Hero balance (accounts page) */
.total-balance-hero {
    font-family: 'Sohne Breit', 'Sohne', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    word-break: break-word;
}

/* ========================================
   Account Cards (Accounts page)
   ======================================== */
.account-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.account-card {
    position: relative;
    padding-left: 20px;
}

.account-card-accent {
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 4px;
    border-radius: 2px;
}

.account-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}

.account-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.account-card-balance {
    font-family: 'Sohne Breit', 'Sohne', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: -0.3px;
}

.account-card-stats {
    display: flex;
    gap: 16px;
    font-size: 0.82rem;
    font-family: 'Sohne Mono', 'Sohne', monospace;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.account-card-stats .stat-income { color: var(--income); }
.account-card-stats .stat-expense { color: var(--expense); }

.account-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .account-cards { grid-template-columns: 1fr 1fr; }
}

/* Date group header */
.date-group-header {
    padding: 16px 16px 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: 'Sohne Mono', 'Sohne', monospace;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.date-group-header + .list-card { border-top: none; }

/* ========================================
   Transaction Table — shadcn data table
   ======================================== */
.txn-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.txn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.txn-table thead th {
    padding: 10px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--bg-surface-hover);
    position: sticky;
    top: 0;
    z-index: 1;
}

.txn-table tbody td {
    padding: 10px 14px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.txn-table tbody tr:last-child td { border-bottom: none; }

/* Date separator row */
.txn-date-row td {
    padding: 12px 14px 6px !important;
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: 'Sohne Mono', 'Sohne', monospace;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border) !important;
}

/* Column widths */
.txn-col-status { width: 28px; text-align: center; }
.txn-col-desc { min-width: 160px; }
.txn-col-cat { min-width: 100px; }
.txn-col-account { min-width: 110px; }
.txn-col-attach { width: 36px; text-align: center; color: var(--text-muted); }
.txn-col-amount { min-width: 90px; text-align: right; white-space: nowrap; font-weight: 500; }
.txn-col-actions { width: 110px; text-align: right; white-space: nowrap; }

/* Description cell */
.txn-desc-text {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    display: inline-block;
    vertical-align: middle;
}

.txn-notes-hint {
    display: inline-flex;
    color: var(--text-muted);
    vertical-align: middle;
    margin-left: 4px;
    cursor: help;
}

/* Category badge */
.txn-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface-hover);
    border-radius: 999px;
    white-space: nowrap;
}

.txn-badge-muted {
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
}

/* Account cell */
.txn-account-name {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.88rem;
    line-height: 1.3;
}

.txn-account-type {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Dot inside table */
.txn-col-status .list-card-dot {
    display: inline-block;
}

/* Actions — show on hover */
.txn-row .txn-col-actions { opacity: 0; transition: opacity var(--transition); }
.txn-row:hover .txn-col-actions { opacity: 1; }
.txn-row:hover { background: var(--bg-surface-hover); }

/* Mobile: card-style transaction rows */
@media (max-width: 767px) {
    .txn-table thead { display: none; }
    .txn-table { display: block; }
    .txn-table tbody { display: block; }
    .txn-date-row { display: block; }
    .txn-date-row td {
        display: block;
        padding: 14px 14px 4px !important;
        border-bottom: none !important;
    }

    /* Each transaction = flex card */
    .txn-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px 8px;
        padding: 12px 14px;
        border-bottom: 1px solid var(--border);
    }
    .txn-row td {
        display: block;
        width: auto;
        padding: 0 !important;
        border: none !important;
    }

    /* Row 1: dot | description | amount */
    .txn-col-status { flex-shrink: 0; order: 1; }
    .txn-col-desc { flex: 1; min-width: 0; order: 2; }
    .txn-desc-text { max-width: none; font-size: 0.86rem; }
    .txn-col-amount { order: 3; margin-left: auto; font-size: 0.86rem; font-weight: 600; }

    /* Row 2: category badge + account (visible on mobile) */
    .txn-col-cat {
        order: 4;
        margin-left: 16px;
        padding-top: 2px !important;
    }
    .txn-col-cat .txn-badge { font-size: 0.7rem; padding: 1px 6px; }
    .txn-col-account {
        order: 5;
        padding-top: 2px !important;
    }
    .txn-col-account .txn-account-name { font-size: 0.72rem; color: var(--text-muted); }
    .txn-col-account .txn-account-type { display: none; }

    /* Hide attachment on mobile */
    .txn-col-attach { display: none; }

    /* Row 3: actions */
    .txn-col-actions {
        width: 100%;
        order: 6;
        display: flex;
        gap: 6px;
        padding-top: 6px !important;
        opacity: 0.7;
    }
    .txn-col-actions .btn { padding: 4px 8px; font-size: 0.72rem; }
}

/* ========================================
   Badges
   ======================================== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-income { background: var(--income-subtle); color: var(--income); }
.badge-expense { background: var(--expense-subtle); color: var(--expense); }
.badge-transfer { background: var(--accent-subtle); color: var(--accent); }
.badge-paid { background: var(--income-subtle); color: var(--income); }
.badge-unpaid { background: var(--expense-subtle); color: var(--expense); }
.badge-lent { background: var(--warning-subtle); color: var(--warning); }
.badge-borrowed { background: var(--accent-subtle); color: var(--accent); }
.badge-monthly { background: var(--accent-subtle); color: var(--accent); }
.badge-weekly { background: var(--info-subtle); color: var(--info); }
.badge-yearly { background: var(--warning-subtle); color: var(--warning); }

/* ========================================
   Progress Bars
   ======================================== */
.progress {
    height: 6px;
    background: var(--bg-surface-hover);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-bar.green { background: var(--text-primary); }
.progress-bar.yellow { background: var(--text-muted); }
.progress-bar.red { background: var(--text-muted); }

/* Over-budget pulse */
@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.progress-bar.red.over-budget { animation: pulse-red 2s ease infinite; }

/* ========================================
   Color Dot
   ======================================== */
.color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

/* ========================================
   FAB
   ======================================== */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--accent);
    color: #fff;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
    z-index: 900;
    transition: all var(--transition);
}

.fab:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}

/* ========================================
   Bottom Tab Bar (Mobile)
   ======================================== */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--tab-bar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(8, 12, 21, 0.88);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.tab-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0;
    flex: 1;
    color: var(--text-primary);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.2px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--transition);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.tab-bar-item svg {
    transition: transform var(--transition);
}

.tab-bar-item.active,
.tab-bar-item.more-active {
    color: var(--text-primary);
    font-weight: 700;
}

.tab-bar-item.active svg {
    transform: scale(1.08);
}

.tab-bar-item:active {
    opacity: 0.7;
}

/* Center Add Button */
.tab-bar-add {
    position: relative;
}

.tab-bar-add-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
    margin-top: -20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform var(--transition), box-shadow var(--transition);
}

.tab-bar-add:active .tab-bar-add-btn {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tab-bar-add span {
    color: var(--text-primary);
    font-weight: 600;
}

/* ========================================
   "More" Bottom Sheet (Mobile)
   ======================================== */
.more-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.more-sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

.more-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    z-index: 1200;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.more-sheet.open {
    transform: translateY(0);
}

.more-sheet-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
}

.more-sheet-handle span {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--text-muted);
    opacity: 0.3;
}

.more-sheet-header {
    padding: 8px 20px 12px;
}

.more-sheet-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.more-sheet-items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 0 12px;
}

.more-sheet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 12px;
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.more-sheet-item svg {
    opacity: 1;
    transition: opacity var(--transition);
}

.more-sheet-item:active {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.more-sheet-item:active svg {
    opacity: 0.9;
}

.more-sheet-item.active {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    font-weight: 700;
}

.more-sheet-item.active svg {
    opacity: 1;
}

.more-sheet-footer {
    padding: 12px 20px 16px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
}

.more-sheet-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.more-sheet-theme-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bg-surface-hover);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background var(--transition);
}

.theme-toggle-btn:active {
    background: var(--accent-subtle);
}

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

.login-container { width: 100%; max-width: 400px; }

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 28px;
}

.login-header { text-align: center; margin-bottom: 28px; }

.login-header h1 {
    font-family: 'Sohne Breit', 'Sohne', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ========================================
   Modal
   ======================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-backdrop.show { display: flex; }

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.modal-body { padding: 22px; }

.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 0.92rem;
    margin-bottom: 16px;
}

/* ========================================
   Tabs — shadcn underline style
   ======================================== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0;
}

.tab {
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover { color: var(--text-primary); }
.tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

/* ========================================
   Segmented Control — shadcn toggle group
   ======================================== */
.segmented-control {
    display: inline-flex;
    background: var(--bg-surface-hover);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}

.segment {
    padding: 6px 16px;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    background: transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.segment:hover { color: var(--text-primary); }
.segment.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ========================================
   Stat Row — inline summary
   ======================================== */
.stat-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 14px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-align: center;
}

.stat-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-separator {
    width: 1px;
    height: 28px;
    background: var(--border);
    flex-shrink: 0;
}

/* ========================================
   Filter Row — shadcn inline
   ======================================== */
.filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filter-row .form-control {
    flex: 1;
    min-width: 110px;
    padding: 6px 10px;
    font-size: 0.8rem;
    height: 34px;
}

.filter-row select.form-control {
    padding-right: 30px;
}

.filter-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-preset {
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: var(--transition);
}

.filter-preset:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-surface-hover);
}

/* Large form control */
.form-control-lg {
    font-size: 1.2rem !important;
    font-weight: 600 !important;
    padding: 12px 14px !important;
    letter-spacing: -0.3px;
}

/* ========================================
   Filters (legacy)
   ======================================== */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filters .form-control { flex: 1; min-width: 120px; }

/* ========================================
   Charts
   ======================================== */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 200px;
    max-height: 300px;
}

.chart-doughnut {
    max-height: 240px;
    display: flex;
    justify-content: center;
}

/* ========================================
   Receipt
   ======================================== */
.receipt-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-top: 8px;
}

/* ========================================
   Utilities
   ======================================== */
.text-success { color: var(--income) !important; }
.text-danger { color: var(--expense) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* ========================================
   DESKTOP (768px+)
   ======================================== */
@media (min-width: 768px) {
    .mobile-header { display: none; }

    .sidebar { left: 0; }

    .sidebar-overlay { display: none !important; }

    .main-content {
        margin-top: 12px;
        margin-left: calc(var(--sidebar-width) + 12px);
        margin-right: 12px;
        margin-bottom: 12px;
        padding: 32px 36px;
        min-height: calc(100vh - 24px);
        border-radius: var(--radius-lg);
    }

    .summary-cards {
        grid-template-columns: repeat(4, 1fr);
    }

    .summary-card {
        padding: 22px 24px;
    }

    .summary-card .amount {
        font-size: 1.55rem;
        letter-spacing: -0.5px;
    }

    .fab { display: none; }

    /* Hide mobile tab bar and more sheet on desktop */
    .tab-bar { display: none !important; }
    .more-sheet { display: none !important; }
    .more-sheet-overlay { display: none !important; }

    .form-row {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* ========================================
   LARGE DESKTOP (1200px+)
   ======================================== */
@media (min-width: 1200px) {
    .main-content {
        padding: 36px 48px;
    }
}

/* ========================================
   Bento Grid (Dashboard)
   ======================================== */
.bento-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr 1fr;
    }
    .bento-grid .bento-full {
        grid-column: 1 / -1;
    }
}

/* ========================================
   Scrollbar (webkit)
   ======================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }
