/* ═══════════════════════════════════════════════
   Money Flow - Design System v2.0
   Light/Dark Theme with Premium Glassmorphism
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── Dark Theme (Default) ─── */
:root,
[data-theme="dark"] {
    --bg-primary: #0c0c1d;
    --bg-secondary: #111128;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --bg-card-solid: #161638;
    --bg-glass: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(255, 255, 255, 0.08);
    --bg-sidebar: rgba(12, 12, 32, 0.97);

    --border-color: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.06);

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-white: #ffffff;

    --accent: #7c3aed;
    --accent-light: #a78bfa;
    --accent-dark: #6d28d9;
    --accent-glow: rgba(124, 58, 237, 0.35);

    --gradient-primary: linear-gradient(135deg, #7c3aed, #a78bfa);
    --gradient-income: linear-gradient(135deg, #10b981, #34d399);
    --gradient-expense: linear-gradient(135deg, #ef4444, #f97316);
    --gradient-reserve: linear-gradient(135deg, #3b82f6, #818cf8);
    --gradient-bg: linear-gradient(180deg, #0c0c1d 0%, #111128 50%, #181842 100%);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.12);

    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.2);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.25);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;

    color-scheme: dark;
}

/* ─── Light Theme ─── */
[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --bg-card-solid: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-input: rgba(0, 0, 0, 0.04);
    --bg-sidebar: rgba(255, 255, 255, 0.97);

    --border-color: rgba(0, 0, 0, 0.1);
    --border-light: rgba(0, 0, 0, 0.06);

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-white: #0f172a;

    --accent: #7c3aed;
    --accent-light: #6d28d9;
    --accent-dark: #5b21b6;
    --accent-glow: rgba(124, 58, 237, 0.2);

    --gradient-primary: linear-gradient(135deg, #7c3aed, #a78bfa);
    --gradient-income: linear-gradient(135deg, #059669, #10b981);
    --gradient-expense: linear-gradient(135deg, #dc2626, #ef4444);
    --gradient-reserve: linear-gradient(135deg, #2563eb, #3b82f6);
    --gradient-bg: linear-gradient(180deg, #f0f2f5 0%, #e8eaef 50%, #f5f6fa 100%);

    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.1);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.08);
    --warning: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --info: #2563eb;
    --info-bg: rgba(37, 99, 235, 0.08);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.1);
    --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.06), 0 2px 12px rgba(0, 0, 0, 0.04);

    color-scheme: light;
}

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

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gradient-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.4s ease, color 0.3s ease;
}

a {
    color: var(--accent-light);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--text-white);
}

[data-theme="light"] a:hover {
    color: var(--accent-dark);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.25);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.4);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ═══ LAYOUT ═══ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

[data-theme="light"] .sidebar {
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: var(--gradient-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-glow);
}

.sidebar-brand .brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.5px;
}

.sidebar-brand .brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    position: relative;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-white);
}

[data-theme="light"] .nav-item:hover {
    background: rgba(124, 58, 237, 0.06);
    color: var(--accent-dark);
}

.nav-item.active {
    background: rgba(124, 58, 237, 0.12);
    color: var(--accent-light);
    font-weight: 600;
}

[data-theme="light"] .nav-item.active {
    background: rgba(124, 58, 237, 0.1);
    color: var(--accent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--gradient-primary);
    border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-user:hover {
    background: var(--bg-card-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.user-info {
    flex: 1;
}

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

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ─── Main Content ─── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.main-header {
    height: var(--header-height);
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
}

[data-theme="light"] .main-header {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white);
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

/* ─── Theme Toggle ─── */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    color: var(--warning);
    border-color: var(--warning);
    transform: rotate(15deg);
}

.page-content {
    padding: 28px;
}

/* ═══ CARDS ═══ */

.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

[data-theme="light"] .card {
    background: var(--bg-card-solid);
}

.card:hover {
    border-color: rgba(124, 58, 237, 0.15);
}

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-white);
}

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

/* ─── Stat Cards ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

[data-theme="light"] .stat-card {
    background: var(--bg-card-solid);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(124, 58, 237, 0.2);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.income::before { background: var(--gradient-income); }
.stat-card.expense::before { background: var(--gradient-expense); }
.stat-card.balance::before { background: var(--gradient-primary); }
.stat-card.reserve::before { background: var(--gradient-reserve); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}

.stat-card.income .stat-icon { background: var(--success-bg); }
.stat-card.expense .stat-icon { background: var(--danger-bg); }
.stat-card.balance .stat-icon { background: rgba(124, 58, 237, 0.1); }
.stat-card.reserve .stat-icon { background: var(--info-bg); }

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

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -1px;
    line-height: 1.2;
}

.stat-card.income .stat-value { color: var(--success); }
.stat-card.expense .stat-value { color: var(--danger); }

.stat-change {
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ═══ GRID LAYOUTS ═══ */

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* ═══ CHART CONTAINER ═══ */

.chart-container {
    position: relative;
    width: 100%;
    height: 280px;
    max-height: 320px;
}

.chart-container canvas {
    max-height: 100%;
}

/* ═══ TABLES ═══ */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

table tbody tr {
    transition: var(--transition-fast);
}

table tbody tr:hover {
    background: var(--bg-card-hover);
}

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

/* ═══ BUTTONS ═══ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

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

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
    transform: translateY(-1px);
    color: white;
}

.btn-success {
    background: var(--gradient-income);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
    color: white;
}

.btn-danger {
    background: var(--gradient-expense);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
    color: white;
}

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

.btn-outline:hover {
    background: var(--bg-card-hover);
    color: var(--text-white);
    border-color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--bg-card-hover);
    color: var(--text-white);
}

[data-theme="light"] .btn-ghost:hover {
    color: var(--accent-dark);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* ═══ FORMS ═══ */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

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

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-card-hover);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
}

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

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

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ═══ BADGES ═══ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

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

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-secondary);
}

.badge-income {
    background: var(--success-bg);
    color: var(--success);
}

.badge-expense {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ═══ MODALS ═══ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-white);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-white);
}

.modal-body {
    padding: 24px;
}

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

/* ═══ PROGRESS BAR ═══ */

.progress-bar {
    height: 6px;
    background: rgba(124, 58, 237, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

[data-theme="light"] .progress-bar {
    background: rgba(0, 0, 0, 0.06);
}

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

.progress-bar .progress-fill.success { background: var(--gradient-income); }
.progress-bar .progress-fill.danger { background: var(--gradient-expense); }
.progress-bar .progress-fill.primary { background: var(--gradient-primary); }
.progress-bar .progress-fill.warning { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

/* ═══ HEALTH SCORE ═══ */

.health-gauge {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto;
}

.health-gauge svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.health-gauge .gauge-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 8;
}

.health-gauge .gauge-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.health-gauge .gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.health-gauge .gauge-score {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1;
}

.health-gauge .gauge-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ═══ TIMELINE ═══ */

.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
}

.timeline-item.income::before { border-color: var(--success); }
.timeline-item.expense::before { border-color: var(--danger); }

.timeline-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

/* ═══ CALENDAR ═══ */

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-header-cell {
    padding: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.calendar-cell {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 8px;
    position: relative;
    cursor: pointer;
    transition: var(--transition-fast);
    min-height: 110px;
}

.calendar-cell:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: scale(1.02);
    z-index: 1;
}

.calendar-cell.today {
    border-color: var(--accent);
    border-width: 2px;
    background: rgba(124, 58, 237, 0.08);
}

[data-theme="light"] .calendar-cell.today {
    background: rgba(124, 58, 237, 0.06);
}

.calendar-cell.other-month {
    opacity: 0.3;
    pointer-events: none;
}

.calendar-day {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.calendar-cell.today .calendar-day {
    color: var(--accent-light);
    font-size: 18px;
}

.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* New event item styling */
.cal-event {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.cal-event-icon { flex-shrink: 0; font-size: 10px; }
.cal-event-name { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.cal-event-amount { flex-shrink: 0; font-weight: 700; font-size: 10px; }

.cal-income { background: var(--success-bg); color: var(--success); }
.cal-expense { background: var(--danger-bg); color: var(--danger); }

.cal-bill.paid { background: var(--success-bg); color: var(--success); }
.cal-bill.pending { background: var(--warning-bg); color: var(--warning); }
.cal-bill.partial { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.cal-bill.overdue { background: var(--danger-bg); color: var(--danger); }

.cal-more {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 4px;
    font-weight: 500;
}

/* Legacy dot (keep for backward compat) */
.calendar-dot {
    width: 100%;
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-dot.paid { background: var(--success-bg); color: var(--success); }
.calendar-dot.pending { background: var(--warning-bg); color: var(--warning); }
.calendar-dot.overdue { background: var(--danger-bg); color: var(--danger); }

/* ═══ ALERTS ═══ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid;
    animation: slideDown 0.3s ease;
}

.alert-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

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

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

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

.alert-info {
    background: var(--info-bg);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

/* ═══ MONEY DISPLAY ═══ */

.money {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.money.income, .money.in {
    color: var(--success);
}

.money.expense, .money.out {
    color: var(--danger);
}

/* ═══ EMPTY STATE ═══ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state .empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state .empty-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ═══ TOAST NOTIFICATIONS ═══ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px 18px;
    min-width: 300px;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideRight 0.3s ease;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }

.toast-message {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

/* ═══ LOGIN PAGE ═══ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-bg);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.2) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
    animation: pulse 6s ease-in-out infinite;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.1) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
    animation: pulse 8s ease-in-out infinite reverse;
}

.login-card {
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-glow);
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -1px;
}

.login-logo p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-control {
    padding: 12px 16px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .login-form .form-control {
    background: rgba(0, 0, 0, 0.04);
}

.login-form .btn-primary {
    width: 100%;
    padding: 13px;
    font-size: 15px;
    margin-top: 8px;
}

.login-error {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    animation: shake 0.3s ease;
}

/* ═══ RESERVE CARDS ═══ */

.reserve-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

[data-theme="light"] .reserve-card {
    background: var(--bg-card-solid);
}

.reserve-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.reserve-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.reserve-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.reserve-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-white);
}

.reserve-monthly {
    font-size: 12px;
    color: var(--text-muted);
}

.reserve-balance {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-white);
    margin: 12px 0;
}

/* ═══ FILTER BAR ═══ */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar .form-control {
    width: auto;
    min-width: 150px;
}

/* ═══ PAGINATION ═══ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}

.pagination .page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.pagination .page-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-white);
}

.pagination .page-btn.active {
    background: var(--gradient-primary);
    border-color: var(--accent);
    color: white;
}

/* ═══ BILL TRACKER ═══ */

.bill-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}

.bill-row:last-child {
    border-bottom: none;
}

.bill-priority {
    width: 4px;
    height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
}

.bill-priority.critical { background: var(--danger); }
.bill-priority.high { background: var(--warning); }
.bill-priority.medium { background: var(--info); }
.bill-priority.low { background: var(--success); }

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

.bill-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 4px;
}

.bill-deadline {
    font-size: 13px;
    color: var(--text-muted);
}

.bill-amount {
    font-size: 16px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.bill-actions {
    display: flex;
    gap: 6px;
}

/* ═══ PARTNER CARDS ═══ */

.partner-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

[data-theme="light"] .partner-card {
    background: var(--bg-card-solid);
}

.partner-card:hover {
    transform: translateY(-2px);
    border-color: rgba(124, 58, 237, 0.2);
    box-shadow: var(--shadow-md);
}

/* ═══ ANIMATIONS ═══ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes slideRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-in {
    animation: slideUp 0.4s ease forwards;
}

/* ═══ UTILITIES ═══ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-white { color: var(--text-white) !important; }

.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.w-100 { width: 100%; }
.hidden { display: none !important; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ═══ RESPONSIVE ═══ */

@media (max-width: 1024px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .btn-menu-toggle {
        display: block;
    }

    .page-content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 20px;
    }

    .modal {
        width: 95%;
        margin: 10px;
    }

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

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .form-control {
        width: 100%;
    }

    .calendar-cell {
        min-height: 50px;
    }

    .chart-container {
        height: 220px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 32px 24px;
        margin: 16px;
    }

    .main-header {
        padding: 0 16px;
    }
}
