:root {
    /* Elite Obsidian Palette */
    --bg-main: #0b0f19;
    --bg-sidebar: #0f1423;
    --bg-card: rgba(17, 24, 39, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    
    --accent: #2dd4bf;
    --accent-glow: rgba(45, 212, 191, 0.3);
    --income: #10b981;
    --expense: #f43f5e;
    --warning: #fbbf24;
    --info: #3b82f6;
    
    --bg-mesh: radial-gradient(at 0% 0%, rgba(45, 212, 191, 0.05) 0px, transparent 50%),
               radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.05) 0px, transparent 50%),
               radial-gradient(at 100% 100%, rgba(167, 139, 250, 0.05) 0px, transparent 50%);

    
    --text-title: #ffffff;
    --text-body: #e2e8f0;
    --text-muted: #cbd5e1; 
    --text-dim: #94a3b8;

    
    --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);

    --inner-glow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.05);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

body.light-mode {
    --bg-main: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.08);
    --accent: #0d9488;
    --income: #059669;
    --expense: #dc2626;
    --text-title: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}


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

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

::selection {
    background: var(--accent-glow);
    color: var(--accent);
}

body:not(.light-mode) .text-muted {
    color: #94a3b8 !important;
}

body:not(.light-mode) .small.text-muted {
    color: #cbd5e1 !important; /* Force labels to be brighter */
}

body {
    margin: 0;
    background: var(--bg-main);
    color: var(--text-body);
    font-family: var(--font-body);
    font-weight: 400;
    transition: background 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
    line-height: 1.6;
}


body:not(.light-mode) {
    background: var(--bg-main);
    background-image: var(--bg-mesh);
}


/* SIDEBAR ELITE */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--bg-sidebar);
    padding: 20px 15px;

    position: fixed;
    left: 0; top: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid var(--glass-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding: 0 5px;

}

.sidebar-header-icon {
    width: 44px; height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #3b82f6);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: white;
    box-shadow: 0 8px 16px var(--accent-glow);
}

.sidebar-header-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-title);
    letter-spacing: -0.01em;
}

.sidebar-menu { flex: 1; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 14px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 8px;
    border: 1px solid transparent;
}

.menu-item i { font-size: 1.1rem; opacity: 0.7; }

.menu-item:hover {
    background: var(--glass-bg);
    color: var(--text-title);
    transform: translateX(4px);
}

.menu-item.active {
    background: rgba(45, 212, 191, 0.08);
    color: var(--accent);
    border-color: rgba(45, 212, 191, 0.15);
}
.menu-item.active i { opacity: 1; }

.sidebar-footer {
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
}

/* CONTENT AREA */
.content {
    margin-left: 260px;
    padding: 24px 40px;
    min-height: 100vh;

    animation: fadeIn 0.6s ease-out;
}

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

/* CARDS & CONTAINERS */
.card-box, .form-card, .table-wrapper {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px;
    border-radius: 20px;

    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

.card-box::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 100%);
    pointer-events: none;
}

.card-title, .card-box .text-muted {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1 !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}


.card-value {
    font-family: var(--font-heading);
    font-size: 1.8rem;

    font-weight: 700;
    color: var(--text-title);
    letter-spacing: -0.02em;
}

.value-income { color: var(--income); }
.value-expense { color: var(--expense); }

/* TABLES ELITE */
.table-dark-custom {
    --bs-table-bg: transparent;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: -8px;
}

.table-dark-custom thead th {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #cbd5e1; /* Using brighter muted color */
    border: none;
    padding: 16px 20px;
}


.table-dark-custom tbody tr {
    transition: all 0.2s ease;
}

.table-dark-custom tbody td {
    background: rgba(255,255,255,0.02);
    padding: 18px 20px;
    border: none;
    font-size: 0.9rem;
    color: var(--text-body);
}

.table-dark-custom tbody td:first-child { border-radius: 12px 0 0 12px; }
.table-dark-custom tbody td:last-child { border-radius: 0 12px 12px 0; }

.table-dark-custom tbody tr:hover td {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-title);
    transform: scale(1.005);
}

/* FORMS ELITE */
.form-label {
    font-weight: 500;
    color: #e2e8f0; /* Brighter for better visibility in forms */
    font-size: 0.85rem;
    margin-bottom: 10px;
}


.form-control, .form-select {
    background: rgba(13, 17, 23, 0.8) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 14px !important;
    padding: 12px 18px !important;
    color: var(--text-body) !important;
    font-size: 0.9rem !important;
    font-family: var(--font-body) !important;
    transition: all 0.3s ease !important;
}

body.light-mode .form-control, 
body.light-mode .form-select {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

.form-control:focus, .form-select:focus {
    background: #0d1117 !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 4px var(--accent-glow) !important;
}

body.light-mode .form-control:focus, 
body.light-mode .form-select:focus {
    background: #ffffff !important;
    border-color: var(--accent) !important;
}


.form-select option { background: #0f172a; }

/* BUTTONS ELITE */
.btn-pill {
    border-radius: 14px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #14b8a6);
    border: none;
    color: #000 !important;
    box-shadow: 0 10px 20px -5px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px var(--accent-glow);
    filter: brightness(1.1);
}

.btn-outline-light {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--glass-border);
    color: var(--text-body);
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-muted);
}

.btn-outline-danger {
    background: rgba(251, 113, 133, 0.05);
    border-color: rgba(251, 113, 133, 0.2);
    color: var(--expense);
}

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

/* BADGES & PILLS */
.cat-badge {
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    border: 1px solid transparent;
}

.cat-default { background: rgba(148, 163, 184, 0.1); color: #94a3b8; }
.cat-salary { background: rgba(52, 211, 153, 0.1); color: #34d399; border-color: rgba(52, 211, 153, 0.2); }
.cat-investment { background: rgba(96, 165, 250, 0.1); color: #60a5fa; border-color: rgba(96, 165, 250, 0.2); }
.cat-food { background: rgba(250, 204, 21, 0.1); color: #facc15; border-color: rgba(250, 204, 21, 0.2); }
.cat-bills { background: rgba(251, 113, 133, 0.1); color: #fb7185; border-color: rgba(251, 113, 133, 0.2); }
.cat-shopping { background: rgba(167, 139, 250, 0.1); color: #a78bfa; border-color: rgba(167, 139, 250, 0.2); }

.pill {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pill-income { background: rgba(52, 211, 153, 0.1); color: #34d399; }
.pill-expense { background: rgba(251, 113, 133, 0.1); color: #fb7185; }

/* MISC */
.section { display: none; }
.section.active { display: block; animation: slideIn 0.4s ease; }

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

.pulse-dot {
    width: 10px; height: 10px;
    background: var(--accent);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px var(--accent-glow);
}
.pulse-dot::after {
    content: ""; position: absolute; width: 100%; height: 100%;
    background: inherit; border-radius: 50%;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(3); opacity: 0; }
}

/* HEALTH SCORE ORBIT */
.health-orbit {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.health-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid rgba(255, 255, 255, 0.05);
}

.health-progress {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid transparent;
    border-top-color: var(--accent);
    transform: rotate(var(--rotation, 0deg));
    filter: drop-shadow(0 0 10px var(--accent-glow));
    transition: all 1s ease-out;
}

.health-content {
    text-align: center;
    z-index: 2;
}

.health-status-label {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 5px;
}

.health-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.bg-glass-light {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
}

.badge-soft {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-title);
}

.scanner-mini {
    height: 140px;
    background: rgba(45, 212, 191, 0.03);
    border: 2px dashed rgba(45, 212, 191, 0.15);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.scanner-mini:hover {
    background: rgba(45, 212, 191, 0.08);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.scanner-glow {
    position: absolute;
    width: 60px; height: 60px;
    background: var(--accent);
    filter: blur(40px);
    opacity: 0.1;
    top: -20px; right: -20px;
}

.ocr-box-small {
    background: #0d1117;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 15px;
    height: 180px;
    font-size: 0.75rem;
    font-family: 'Monaco', 'Consolas', monospace;
    color: var(--text-dim);
    overflow-y: auto;
    position: relative;
    line-height: 1.4;
}

.category-item {
    padding: 10px 14px !important;
    margin-bottom: 8px !important;
    border-radius: 14px !important;
    background: rgba(255,255,255,0.02) !important;
}

.scanner-mini { height: 110px !important; }


.ocr-box-small::-webkit-scrollbar {
    width: 6px;
}
.ocr-box-small::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}


.text-dim { color: var(--text-dim) !important; }
.text-accent { color: var(--accent) !important; }
.uppercase { text-transform: uppercase; letter-spacing: 0.05em; }

@media (max-width: 992px) {
    .sidebar {
        width: 100%; height: auto;
        bottom: 0; top: auto;
        flex-direction: row;
        padding: 10px 20px;
        border-right: none;
        border-top: 1px solid var(--glass-border);
        border-radius: 24px 24px 0 0;
        background: rgba(15, 20, 35, 0.95);
        backdrop-filter: blur(25px);
    }
    .sidebar-header, .sidebar-footer { display: none; }
    .sidebar-menu { display: flex; justify-content: space-around; width: 100%; margin: 0; }
    .menu-item { flex-direction: column; gap: 4px; padding: 10px; font-size: 0.65rem; min-width: 65px; margin: 0; }
    .menu-item i { font-size: 1.2rem; }
    .content { margin-left: 0; padding: 24px 20px 100px 20px; }
}

/* MODERN NOTIFICATION SYSTEM */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
}

.toast-custom {
    background: rgba(20, 25, 40, 0.85);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px 24px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 300px;
    color: white;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-custom.hide {
    animation: fadeOut 0.3s forwards;
}

@keyframes fadeOut {
    to { opacity: 0; transform: scale(0.95); }
}

.toast-icon {
    width: 32px; height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.toast-success .toast-icon { background: rgba(74, 222, 128, 0.1); color: #4ade80; }
.toast-error .toast-icon { background: rgba(248, 113, 113, 0.1); color: #f87171; }
.toast-info .toast-icon { background: rgba(45, 212, 191, 0.1); color: var(--accent); }

/* CUSTOM MODAL */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-custom {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transform: scale(1);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ACHIEVEMENT BADGES */
.achievement-badge {
    padding: 10px 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.4s ease;
    filter: grayscale(1);
    opacity: 0.4;
    color: #94a3b8;
    position: relative;
    overflow: hidden;
    padding-bottom: 14px;
}

.achievement-badge.unlocked {
    filter: grayscale(0);
    opacity: 1;
    background: rgba(45, 212, 191, 0.05);
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(45, 212, 191, 0.2);
    color: white;
    animation: breathe 3s infinite ease-in-out;
}

.achievement-badge i {
    font-size: 1rem;
    color: #94a3b8;
}

.achievement-badge.unlocked i {
    color: var(--accent);
}

.achievement-badge.unlocked.gold {
    background: rgba(255, 193, 7, 0.05);
    border-color: #ffc107;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.2);
}
.achievement-badge.unlocked.gold i { color: #ffc107; }

.achievement-badge.unlocked.purple {
    background: rgba(167, 139, 250, 0.05);
    border-color: #a78bfa;
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.2);
}
.achievement-badge.unlocked.purple i { color: #a78bfa; }

.achievement-badge.unlocked.blue {
    background: rgba(59, 130, 246, 0.05);
    border-color: #3b82f6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}
.achievement-badge.unlocked.blue i { color: #3b82f6; }

.achievement-badge.unlocked.pink {
    background: rgba(244, 63, 94, 0.05);
    border-color: #f43f5e;
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.2);
}
.achievement-badge.unlocked.pink i { color: #f43f5e; }

.achievement-badge.unlocked.platinum {
    background: rgba(255, 255, 255, 0.05);
    border-color: #f8fafc;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}
.achievement-badge.unlocked.platinum i { color: #f8fafc; }

@keyframes breathe {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.03); filter: brightness(1.2); }
}

.badge-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.05);
}

.badge-progress-bar {
    height: 100%;
    width: 0%;
    background: rgba(255,255,255,0.2);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.unlocked .badge-progress-bar {
    background: currentColor;
    box-shadow: 0 0 10px currentColor;
}
