/* ========================================
   Finances Page + Overview Dashboard
   ======================================== */

.finances-page {
    position: relative;
    width: 100%;
    max-width: none;
    padding-bottom: 48px;
}

.finances-page-header {
    align-items: flex-start;
}

.finances-title {
    font-weight: 800;
    letter-spacing: 0.4px;
    color: var(--rr-text-strong);
    margin-bottom: 2px;
}

.finances-muted {
    color: var(--rr-text-secondary);
    line-height: 1.4;
}

/* ---------- Tabs ---------- */

.finances-tabs {
    width: 100%;
    border-radius: var(--rr-radius-lg);
}

    .finances-tabs .mud-tabs-toolbar {
        border-radius: var(--rr-radius-lg);
    }

    .finances-tabs .mud-tab {
        font-weight: 700;
        letter-spacing: 0.3px;
        color: var(--rr-text-secondary);
    }

        .finances-tabs .mud-tab:hover {
            color: var(--rr-text-strong);
        }

        .finances-tabs .mud-tab.mud-tab-active {
            font-weight: 800;
            color: var(--rr-text-strong);
        }

/* ---------- Full Width Fix for Finance Child Components ---------- */

.finances-page ::deep .mud-tabs,
.finances-page ::deep .mud-tabs-panels,
.finances-page ::deep .mud-tab-panel,
.finances-page ::deep .mud-tab-panel-content {
    width: 100%;
    max-width: none;
}

.finances-page ::deep .mud-grid {
    width: 100%;
}

.finances-page ::deep .finances-card {
    width: 100%;
    max-width: none;
}

/* ---------- Shared Card Base ---------- */

.finances-page ::deep .finances-card,
.finances-page ::deep .finance-result-card,
.finances-page ::deep .finance-status-card,
.finances-page ::deep .finance-info-card,
.finances-page ::deep .finance-data-card {
    border-radius: var(--rr-radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.10);
    background: var(--rr-surface);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.10);
    overflow: hidden;
}

.finances-page ::deep .finances-card-content {
    width: 100%;
    padding: 20px;
}

.finances-page ::deep .finances-section-title,
.finances-page ::deep .finance-card-title {
    font-weight: 800;
    color: var(--rr-text-strong);
    line-height: 1.25;
}

/* ---------- Header inside Finance Components ---------- */

.finances-page ::deep .finances-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.finances-page ::deep .finance-overview-actions {
    flex-shrink: 0;
}

.finances-page ::deep .finance-year-select {
    min-width: 120px;
}

    .finances-page ::deep .finance-year-select .mud-input-root,
    .finances-page ::deep .finance-refresh-btn {
        border-radius: 12px;
    }

/* ---------- Inputs / Buttons ---------- */

.finances-page ::deep .mud-input-root {
    border-radius: var(--rr-radius-md);
}

.finances-page ::deep .finances-btn-primary,
.finances-page ::deep .finances-btn-outline {
    border-radius: 12px;
    text-transform: none;
    font-weight: 600;
    min-height: 40px;
    box-shadow: none;
}

/* ---------- Hero ---------- */

.finances-page ::deep .finance-hero-grid {
    margin-top: 12px !important;
}

.finances-page ::deep .finance-result-card {
    position: relative;
    min-height: 100%;
    padding: 22px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.86));
}

    .finances-page ::deep .finance-result-card::before {
        content: "";
        position: absolute;
        left: 0;
        top: 18px;
        bottom: 18px;
        width: 5px;
        border-radius: 999px;
        background: linear-gradient(180deg, var(--rr-primary), #555555);
    }

    .finances-page ::deep .finance-result-card.negative::before {
        background: linear-gradient(180deg, #555555, #1A1A1A);
    }

.finances-page ::deep .finance-result-head {
    position: relative;
    z-index: 1;
}

.finances-page ::deep .finance-eyebrow {
    color: var(--rr-text-secondary);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.finances-page ::deep .finance-result-value {
    font-weight: 900;
    color: var(--rr-text-strong);
    line-height: 1.05;
    margin-top: 4px;
}

.finances-page ::deep .finance-result-subtitle {
    color: var(--rr-text-secondary);
    margin-top: 4px;
}

.finances-page ::deep .finance-result-icon {
    font-size: 46px;
    color: rgba(0, 0, 0, 0.38);
}

.finances-page ::deep .finance-result-breakdown {
    position: relative;
    z-index: 1;
    margin-top: 18px !important;
}

.finances-page ::deep .finance-breakdown-card {
    height: 100%;
    border-radius: 16px;
    padding: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.74);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

    .finances-page ::deep .finance-breakdown-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
    }

.finances-page ::deep .finance-breakdown-label {
    color: var(--rr-text-secondary);
    font-weight: 700;
}

.finances-page ::deep .finance-breakdown-value {
    font-weight: 900;
    color: var(--rr-text-strong);
    line-height: 1.2;
}

.finances-page ::deep .finance-breakdown-meta {
    color: var(--rr-text-secondary);
}

.finances-page ::deep .finance-breakdown-card.income {
    border-color: rgba(0, 0, 0, 0.22);
}

.finances-page ::deep .finance-breakdown-card.expense {
    border-color: rgba(0, 0, 0, 0.18);
}

.finances-page ::deep .finance-breakdown-card.warning {
    border-color: rgba(0, 0, 0, 0.26);
}

/* ---------- Status Card ---------- */

.finances-page ::deep .finance-status-card {
    min-height: 100%;
    padding: 18px;
}

.finances-page ::deep .finance-status-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.finances-page ::deep .finance-status-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

    .finances-page ::deep .finance-status-line:last-child {
        border-bottom: none;
    }

.finances-page ::deep .finance-status-value {
    font-weight: 900;
    color: var(--rr-text-strong);
    line-height: 1.2;
}

/* ---------- Summary Cards ---------- */

.finances-page ::deep .finance-summary-grid {
    margin-top: 10px !important;
}

.finances-page ::deep .finance-info-card {
    height: 100%;
    padding: 16px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

    .finances-page ::deep .finance-info-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.14);
    }

.finances-page ::deep .finance-info-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .finances-page ::deep .finance-info-icon.warning {
        background: rgba(0, 0, 0, 0.14);
        color: #555555;
    }

    .finances-page ::deep .finance-info-icon.info {
        background: rgba(0, 0, 0, 0.12);
        color: var(--rr-primary);
    }

/* ---------- Data Cards / Tables ---------- */

.finances-page ::deep .finance-data-grid {
    margin-top: 16px !important;
}

.finances-page ::deep .finance-data-card {
    height: 100%;
    padding: 18px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

    .finances-page ::deep .finance-data-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.14);
    }

.finances-page ::deep .finances-table,
.finances-page ::deep .finance-table {
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

    .finances-page ::deep .finances-table .mud-table-head,
    .finances-page ::deep .finance-table .mud-table-head {
        background: rgba(0, 0, 0, 0.06);
    }

        .finances-page ::deep .finances-table .mud-table-head .mud-table-cell,
        .finances-page ::deep .finance-table .mud-table-head .mud-table-cell {
            font-weight: 800;
            color: var(--rr-text-strong);
            white-space: nowrap;
        }

    .finances-page ::deep .finances-table .mud-table-cell,
    .finances-page ::deep .finance-table .mud-table-cell {
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        vertical-align: middle;
    }

    .finances-page ::deep .finances-table .mud-table-row:hover,
    .finances-page ::deep .finance-table .mud-table-row:hover {
        background: rgba(0, 0, 0, 0.045);
    }

.finances-page ::deep .finance-chip,
.finances-page ::deep .finances-chip {
    border-radius: var(--rr-radius-pill);
    font-weight: 700;
}

/* ---------- Loading ---------- */

.finances-page ::deep .finance-loading-state {
    min-height: 220px;
    justify-content: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
    .finances-page ::deep .finances-head-row,
    .finances-page ::deep .finance-result-head {
        flex-direction: column;
        align-items: stretch !important;
    }

    .finances-page ::deep .finance-overview-actions {
        width: 100%;
        justify-content: space-between;
    }

    .finances-page ::deep .finance-year-select {
        flex: 1;
    }

    .finances-page ::deep .finance-result-icon {
        display: none;
    }

    .finances-page ::deep .finances-card {
        overflow-x: auto;
    }

    .finances-page ::deep .finances-table,
    .finances-page ::deep .finance-table {
        min-width: 900px;
    }
}

@media (max-width: 600px) {
    .finances-page {
        padding-bottom: 32px;
    }

        .finances-page ::deep .finances-card-content,
        .finances-page ::deep .finance-result-card,
        .finances-page ::deep .finance-status-card,
        .finances-page ::deep .finance-info-card,
        .finances-page ::deep .finance-data-card {
            padding: 14px;
        }

        .finances-page ::deep .finance-result-value {
            font-size: 2rem;
        }

    .finances-tabs .mud-tab {
        min-width: auto;
    }
}
