/* ================= FLASH PREVENTION ================= */
/* Runs before full page renders to prevent dark mode flash */

html.dark,
html.dark body {
    background: #0f172a !important;
    color: #e2e8f0 !important;
}

html.dark .card {
    background: #1e293b !important;
    border-color: #334155 !important;
}

html.dark .navbar {
    background: #0a0f1a !important;
}

html.dark .form-card {
    background: #1e293b !important;
}

html.dark .confirm-modal {
    background: #1e293b !important;
}

html.dark .auth-page {
    background: #0f172a !important;
}

html.dark .auth-card {
    background: #1e293b !important;
}

/* ================= TABLE ================= */

.budget-table {
    width: 95%;
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    table-layout: fixed;
    font-size: 14px;
}

/* Sticky header */
.budget-table thead th {
    position: sticky;
    top: 0;
    background: #f0f2f5;
    z-index: 1;
}

/* Zebra rows */
.budget-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.budget-table tbody tr:hover {
    background: #f3f4f6;
}

/* Cells */
.budget-table th,
.budget-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    word-wrap: break-word;
}

/* Narrow numeric columns */
.budget-table th:nth-child(3),
.budget-table td:nth-child(3),
.budget-table th:nth-child(4),
.budget-table td:nth-child(4),
.budget-table th:nth-child(5),
.budget-table td:nth-child(5) {
    width: 70px;
    text-align: right;
}

/* Action column */
.actions {
    white-space: nowrap;
    width: 130px;
}

/* Healthy labels */
.healthy-yes {
    color: #15803d;
    font-weight: 600;
}

.healthy-no {
    color: #b91c1c;
}

/* Vertical column separators */
.budget-table th {
    border-right: 1px solid #d1d5db;
}

.budget-table td {
    border-right: 1px solid #e5e7eb;
}

/* Remove right border from last column */
.budget-table th:last-child,
.budget-table td:last-child {
    border-right: none;
}

/* Income table — auto layout so columns size to content */
.income-table {
    table-layout: auto;
}

/* ================= FILTERS ================= */

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.filter-form select {
    max-width: 160px;
}

/* ================= BUTTONS ================= */

.add-product {
    padding: 10px 18px;
    font-size: 16px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.add-product:hover {
    background: #4338ca;
}

button {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover {
    background: #f3f4f6;
}

/* ================= FOOTER ================= */

.footer {
    width: 95%;
    margin: 15px auto;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

/* ================= MODAL ================= */

#delete-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
}

#delete-modal > div {
    background: #fff;
    max-width: 320px;
    width: 90%;
    margin: auto;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

/* ================= MONTH BAR ================= */

.month-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 15px auto 20px;
    flex-wrap: wrap;
}

.month-bar a {
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: #374151;
    border: 1px solid #d1d5db;
    background: #fff;
    font-size: 14px;
    transition: background 0.2s;
}

.month-bar a:hover {
    background: #f3f4f6;
}

.month-bar a.active {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

.reset-month {
    font-weight: 600;
}

/* ===== GLOBAL ===== */

body {
    background: #f5f6fa;
    color: #111827;
    transition: background 0.3s, color 0.3s;
}

/* ===== DASHBOARD ===== */

.page-title {
    text-align: center;
    margin: 20px 0;
}

.summary-cards {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.card {
    background: white;
    padding: 18px 20px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    text-align: center;
    min-width: 150px;
    transition: background 0.3s, border-color 0.3s;
}

.chart-container {
    width: 90%;
    max-width: 500px;
    margin: 0 auto 20px auto;
    height: 280px;
}

/* ===== NAVBAR ===== */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111827;
    padding: 14px 28px;
    color: #fff;
    border-bottom: 1px solid #1f2937;
    letter-spacing: 0.3px;
}

.navbar a {
    color: #e5e7eb;
    text-decoration: none;
    margin-right: 15px;
    font-size: 14px;
    transition: color 0.2s;
}

.navbar a:hover {
    color: #fff;
}

.logo {
    font-weight: bold;
    margin-right: 20px;
}

.username {
    margin-right: 10px;
    font-size: 14px;
    color: #9ca3af;
}

/* ===== DARK MODE TOGGLE ===== */

.dark-toggle {
    background: #1f2937;
    border: 1.5px solid #374151;
    border-radius: 50px;
    padding: 6px 14px;
    color: #e5e7eb;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
    margin-left: 16px;
    white-space: nowrap;
}

.dark-toggle:hover {
    background: #374151;
    border-color: #4f46e5;
    color: #fff;
}

.dark-toggle .toggle-icon {
    font-size: 15px;
    line-height: 1;
}

/* ===== PAGE WRAPPER ===== */

.page {
    padding: 20px 0 40px;
}

.welcome-card {
    max-width: 600px;
    margin: 0 auto 25px;
    font-size: 18px;
    text-align: center;
    border-left: 4px solid #4f46e5;
    padding: 16px 24px;
}

/* ===== BALANCE CARD ===== */

.balance-card h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #6b7280;
    margin-bottom: 8px;
}

.balance-card p {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.balance-card.positive p {
    color: #15803d;
}

.balance-card.negative p {
    color: #b91c1c;
}

/* ===== DASHBOARD CHARTS GRID ===== */

.dashboard-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 50px;
    margin: 20px auto;
    width: 92%;
}

.chart-card {
    width: 100%;
    max-width: 100%;
    padding: 20px 30px;
    margin: 0 auto;
    text-align: center;
}

@media (min-width: 769px) {

    .dashboard-charts {
        grid-template-columns: repeat(3, minmax(300px, 320px));
        justify-content: center;
    }

    .chart-card {
        max-width: 300px;
    }

    .chart-card:nth-child(1) {
        grid-row: 1;
        grid-column: 1;
    }

    .chart-card:nth-child(3) {
        grid-row: 1;
        grid-column: 2 / 4;
        max-width: 100%;
    }

    .chart-card:nth-child(2) {
        grid-row: 2;
        grid-column: 1;
    }

    .chart-card:nth-child(4) {
        grid-row: 2;
        grid-column: 2;
    }

    .chart-card:nth-child(5) {
        grid-row: 2;
        grid-column: 3;
    }
}

.chart-card h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: #6b7280;
    margin-bottom: 18px;
}

/* ===== LEGEND ===== */

.custom-legend {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 320px;
    margin: 4px auto;
    font-size: 14px;
}

.legend-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-text {
    text-align: right;
    font-weight: 500;
    white-space: nowrap;
}

/* ===== RECENT TRANSACTIONS ===== */

.recent-card {
    margin-bottom: 30px;
}

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

.view-all {
    font-size: 14px;
    text-decoration: none;
    color: #4f46e5;
    font-weight: 500;
}

.transaction-list {
    list-style: none;
    padding: 0;
    margin-top: 15px;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.transaction-item.income .amount {
    color: #16a34a;
    font-weight: 600;
}

.transaction-item.expense .amount {
    color: #dc2626;
    font-weight: 600;
}

/* ===== MONTH NAVIGATOR ===== */

.month-navigator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.nav-arrow {
    font-size: 18px;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 50px;
    background: white;
    color: #4f46e5;
    border: 1.5px solid #e0e0f0;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
    transition: all 0.2s ease;
    font-weight: 600;
}

.nav-arrow:hover {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
    transform: scale(1.05);
}

.current-month {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: 600;
}

/* ===== RANGE DROPDOWN ===== */

.range-dropdown {
    appearance: none;
    -webkit-appearance: none;
    background-color: #f5f6fa;
    border: 1.5px solid #e0e0f0;
    border-radius: 50px;
    padding: 6px 32px 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #4f46e5;
    cursor: pointer;
    letter-spacing: 0.4px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234f46e5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}

.range-dropdown:hover {
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.range-dropdown:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

body.dark .range-dropdown {
    background-color: #1e293b;
    border-color: #334155;
    color: #818cf8;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23818cf8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    box-shadow: none;
}

body.dark .range-dropdown:hover {
    border-color: #818cf8;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* ================= MOBILE ================= */
@media (max-width: 768px) {

    body {
        font-size: 15px;
    }

    h2 {
        text-align: center;
        font-size: 20px;
    }

    .filter-form {
        flex-direction: column;
        align-items: stretch;
        padding: 0 10px;
    }

    .filter-form select,
    .filter-form button,
    .add-product {
        width: 100%;
        max-width: 100%;
    }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 10px;
    }

    .budget-table {
        width: 100%;
        min-width: 900px;
        font-size: 14px;
    }

    .budget-table td.actions {
        display: flex;
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
        white-space: normal;
    }

    /* Income table override — fewer columns, no forced width */
    .income-table {
        min-width: unset !important;
        width: 100%;
    }

    .income-table td.actions {
        display: flex;
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }

    .footer {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }

    .form-card {
        padding: 24px 20px;
    }

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

/* ================= DARK MODE ================= */

body.dark {
    background: #0f172a;
    color: #e2e8f0;
}

body.dark .card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.4);
}

body.dark .navbar {
    background: #0a0f1a;
    border-bottom-color: #1e293b;
}

body.dark .balance-card h3 {
    color: #94a3b8;
}

body.dark .chart-card h3 {
    color: #94a3b8;
}

body.dark .welcome-card {
    border-left-color: #6366f1;
}

body.dark .transaction-item {
    border-bottom-color: #334155;
}

body.dark .nav-arrow {
    background: #1e293b;
    color: #818cf8;
    border-color: #334155;
}

body.dark .nav-arrow:hover {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

body.dark .current-month {
    color: #e2e8f0;
}

body.dark .budget-table {
    background: #1e293b;
    color: #e2e8f0;
}

body.dark .budget-table thead th {
    background: #0f172a;
    color: #94a3b8;
}

body.dark .budget-table tbody tr:nth-child(even) {
    background: #162032;
}

body.dark .budget-table tbody tr:hover {
    background: #243447;
}

body.dark .budget-table th,
body.dark .budget-table td {
    border-bottom-color: #334155;
}

body.dark .budget-table th {
    border-right-color: #334155;
}

body.dark .budget-table td {
    border-right-color: #334155;
}

body.dark .month-bar a {
    background: #1e293b;
    color: #cbd5e1;
    border-color: #334155;
}

body.dark .month-bar a:hover {
    background: #243447;
}

body.dark .month-bar a.active {
    background: #4f46e5;
    color: #fff;
}

body.dark button {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}

body.dark button:hover {
    background: #243447;
}

body.dark #delete-modal > div {
    background: #1e293b;
    color: #e2e8f0;
}

body.dark .dark-toggle {
    background: #374151;
    border-color: #4f46e5;
    color: #fff;
}

/* ===== HAMBURGER BUTTON ===== */

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-right: 12px;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #e5e7eb;
    border-radius: 2px;
    transition: all 0.2s ease;
}

/* ===== DRAWER ===== */

.drawer {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100%;
    background: #111827;
    z-index: 2000;
    transition: left 0.3s ease;
    padding: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
}

.drawer.open {
    left: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid #1f2937;
}

.drawer-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.drawer-close:hover {
    background: #1f2937;
    color: #fff;
}

.drawer-links {
    display: flex;
    flex-direction: column;
    padding: 16px 0;
}

.drawer-links a {
    color: #e5e7eb;
    text-decoration: none;
    padding: 14px 24px;
    font-size: 15px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.drawer-links a:hover {
    background: #1f2937;
    border-left-color: #4f46e5;
    color: #fff;
}

/* ===== DRAWER OVERLAY ===== */

.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
    backdrop-filter: blur(2px);
}

.drawer-overlay.open {
    display: block;
}

/* ===== LOGOUT BUTTON ===== */

.logout-btn {
    background: none !important;
    border: 1px solid #6b7280;
    color: #e5e7eb !important;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #1f2937 !important;
    border-color: #4f46e5;
    color: #fff !important;
}

/* ===== MOBILE NAVBAR ===== */

@media (max-width: 768px) {

    .hamburger {
        display: flex;
    }

    .nav-links {
        display: none;
    }

    .navbar {
        padding: 12px 16px;
    }

    .username {
        display: none;
    }

    .toggle-label {
        display: none;
    }

    .dark-toggle {
        padding: 6px 10px;
        margin-left: 8px;
    }
}

/* ===== DARK MODE DRAWER ===== */

body.dark .drawer {
    background: #0f172a;
    border-right: 1px solid #1e293b;
}

body.dark .drawer-header {
    border-bottom-color: #1e293b;
}

body.dark .drawer-links a:hover {
    background: #1e293b;
}

/* ================= ADD ENTRY FORM ================= */

.form-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 16px 60px;
}

.form-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    padding: 36px 40px;
    width: 100%;
    max-width: 620px;
}

.form-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 28px;
    color: #111827;
    border-left: 4px solid #4f46e5;
    padding-left: 12px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.form-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #6b7280;
}

.form-card input[type="text"],
.form-card input[type="number"],
.form-card input[type="date"],
.form-card select,
.form-card textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #f9fafb;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
}

.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
    outline: none;
    border-color: #4f46e5;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.form-card select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234f46e5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.form-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #4f46e5;
    cursor: pointer;
    border-radius: 4px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    align-items: center;
}

.btn-save {
    padding: 11px 28px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
    letter-spacing: 0.3px;
}

.btn-save:hover {
    background: #4338ca;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.btn-cancel {
    padding: 11px 24px;
    background: transparent;
    color: #6b7280;
    border: 1.5px solid #e5e7eb;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    border-color: #d1d5db;
    color: #374151;
    background: #f9fafb;
}

/* ===== DARK MODE — FORM ===== */

body.dark .form-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark .form-title {
    color: #e2e8f0;
}

body.dark .form-card input[type="text"],
body.dark .form-card input[type="number"],
body.dark .form-card input[type="date"],
body.dark .form-card select,
body.dark .form-card textarea {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark .form-card input:focus,
body.dark .form-card select:focus,
body.dark .form-card textarea:focus {
    border-color: #6366f1;
    background: #0f172a;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

body.dark .form-checkbox-label {
    color: #cbd5e1;
}

body.dark .btn-cancel {
    color: #94a3b8;
    border-color: #334155;
}

body.dark .btn-cancel:hover {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #475569;
}

/* ================= CONFIRMATION MODAL ================= */

.confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.confirm-overlay.open {
    display: flex;
}

.confirm-modal {
    background: white;
    border-radius: 16px;
    padding: 36px 40px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border: 1px solid rgba(0,0,0,0.06);
    animation: modalPop 0.2s ease;
}

@keyframes modalPop {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.confirm-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.confirm-message {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-cancel-modal {
    padding: 11px 24px;
    background: transparent;
    color: #6b7280;
    border: 1.5px solid #e5e7eb;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel-modal:hover {
    border-color: #d1d5db;
    color: #374151;
    background: #f9fafb;
}

body.dark .confirm-modal {
    background: #1e293b;
    border-color: #334155;
}

body.dark .confirm-title {
    color: #e2e8f0;
}

body.dark .confirm-message {
    color: #94a3b8;
}

body.dark .btn-cancel-modal {
    color: #94a3b8;
    border-color: #334155;
}

body.dark .btn-cancel-modal:hover {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #475569;
}

/* ================= INDEX PAGE ================= */

.index-page {
    padding: 10px 20px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

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

.index-title {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}

.filter-btn {
    padding: 8px 18px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-btn:hover {
    background: #4338ca;
}

.reset-btn {
    padding: 8px 14px;
    background: transparent;
    color: #6b7280;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-block;
    text-align: center;
}

.reset-btn:hover {
    background: #f9fafb;
    color: #374151;
    border-color: #d1d5db;
}

.action-btn {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.edit-btn {
    background: #ede9fe;
    color: #4f46e5;
    margin-right: 4px;
}

.edit-btn:hover {
    background: #4f46e5;
    color: #fff;
}

.delete-btn {
    background: #fee2e2;
    color: #dc2626;
}

.delete-btn:hover {
    background: #dc2626;
    color: #fff;
}

.btn-delete-confirm {
    padding: 11px 28px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

.btn-delete-confirm:hover {
    background: #b91c1c;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
    transform: translateY(-1px);
}

/* ===== INCOME TABLE ===== */

.income-amount {
    color: #16a34a;
    font-weight: 600;
}

/* ===== DARK MODE — INDEX ===== */

body.dark .index-title {
    color: #e2e8f0;
}

body.dark .filter-btn {
    background: #4f46e5;
}

body.dark .reset-btn {
    color: #94a3b8;
    border-color: #334155;
}

body.dark .reset-btn:hover {
    background: #1e293b;
    color: #e2e8f0;
}

body.dark .edit-btn {
    background: #1e1b4b;
    color: #818cf8;
}

body.dark .edit-btn:hover {
    background: #4f46e5;
    color: #fff;
}

body.dark .delete-btn {
    background: #2d1515;
    color: #f87171;
}

body.dark .delete-btn:hover {
    background: #dc2626;
    color: #fff;
}

body.dark .footer {
    color: #e2e8f0;
}

/* ================= AUTH PAGE ================= */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f6fa;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    padding: 44px 48px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.auth-logo {
    font-size: 28px;
    font-weight: 800;
    color: #4f46e5;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 28px;
}

.auth-btn {
    width: 100%;
    margin-top: 24px;
    padding: 13px;
    font-size: 15px;
    border-radius: 10px;
    justify-content: center;
}

.auth-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 20px;
    text-align: left;
}

.auth-links {
    margin-top: 24px;
    font-size: 14px;
    color: #6b7280;
}

.auth-links p {
    margin: 8px 0;
}

.auth-links a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: underline;
}

.auth-status-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ===== DARK MODE — AUTH ===== */

body.dark .auth-page {
    background: #0f172a;
}

body.dark .auth-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark .auth-title {
    color: #e2e8f0;
}

body.dark .auth-subtitle {
    color: #94a3b8;
}

body.dark .auth-error {
    background: #2d1515;
    border-color: #7f1d1d;
    color: #f87171;
}

body.dark .auth-links {
    color: #94a3b8;
}

/* ===== FIELD ERRORS & HELP TEXT ===== */

.field-error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 5px;
    text-align: left;
}

.field-help {
    color: #6b7280;
    font-size: 12px;
    margin-top: 5px;
    text-align: left;
    line-height: 1.4;
}

body.dark .field-help {
    color: #94a3b8;
}

body.dark .field-error {
    color: #f87171;
}

/* ===== DESKTOP NAV LINKS ===== */

.nav-links-desktop {
    display: inline;
}

.nav-links-desktop a {
    color: #e5e7eb;
    text-decoration: none;
    margin-right: 15px;
    font-size: 14px;
    transition: color 0.2s;
}

.nav-links-desktop a:hover {
    color: #fff;
}

/* ===== HAMBURGER — hidden on desktop ===== */

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-right: auto;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #e5e7eb;
    border-radius: 2px;
    transition: all 0.2s ease;
}

/* ===== MOBILE NAVBAR ===== */

@media (max-width: 768px) {

    .nav-links-desktop {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .navbar {
        padding: 12px 16px;
    }

    .username {
        display: none;
    }

    .toggle-label {
        display: none;
    }

    .dark-toggle {
        padding: 6px 10px;
        margin-left: 8px;
    }
}
/* Month navigator visibility */
.mobile-only {
    display: none;
}

.desktop-only {
    display: flex;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 20px;
        margin-bottom: 16px;
    }

    .desktop-only {
        display: none;
    }
}