:root {
    --bg: #f6f8fb;
    --panel: #ffffff;
    --line: #dbe3ef;
    --text: #172033;
    --muted: #667085;
    --blue: #2563eb;
    --green: #16a34a;
    --red: #dc2626;
    --amber: #d97706;
    --cyan: #0891b2;
    --shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

* {
    letter-spacing: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
}

.navbar {
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.navbar-brand {
    font-weight: 700;
    color: var(--text);
}

.brand-mark,
.metric-icon {
    align-items: center;
    border-radius: 8px;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.brand-mark {
    background: #eaf1ff;
    color: var(--blue);
}

.brand-mark svg,
.metric-icon svg,
.icon-only svg,
.icon-text svg {
    height: 18px;
    width: 18px;
}

.nav-link {
    border-radius: 6px;
    color: #475569;
    font-weight: 600;
}

.nav-link.active,
.nav-link:hover {
    background: #eef4ff;
    color: var(--blue);
}

.auth-body main {
    min-height: calc(100vh - 66px);
}

.auth-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 130px);
}

.auth-panel,
.panel,
.metric-card,
.goal-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-panel {
    max-width: 440px;
    padding: 28px;
    width: 100%;
}

.auth-panel h1,
.page-header h1 {
    font-size: clamp(1.55rem, 2vw, 2rem);
    font-weight: 750;
    margin: 0;
}

.page-header {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 24px;
}

.month-switcher,
.month-form,
.action-buttons,
.filter-actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.month-form {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.month-form .form-select {
    width: auto;
}

.summary-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 24px;
}

.metric-card {
    align-items: center;
    display: flex;
    gap: 14px;
    min-height: 112px;
    padding: 18px;
}

.metric-card p {
    color: var(--muted);
    font-size: 0.86rem;
    margin: 0 0 6px;
}

.metric-card strong {
    display: block;
    font-size: clamp(1.05rem, 1.4vw, 1.35rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.metric-card.income .metric-icon {
    background: #e8f7ee;
    color: var(--green);
}

.metric-card.expense .metric-icon {
    background: #fff0f0;
    color: var(--red);
}

.metric-card.balance .metric-icon {
    background: #eaf1ff;
    color: var(--blue);
}

.metric-card.savings .metric-icon {
    background: #fff7e6;
    color: var(--amber);
}

.metric-card.transactions .metric-icon {
    background: #e8f8fb;
    color: var(--cyan);
}

.panel {
    padding: 20px;
}

.panel-heading {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.panel-heading h2 {
    font-size: 1rem;
    font-weight: 750;
    margin: 0;
}

.stacked-form {
    display: grid;
    gap: 14px;
}

.filter-grid {
    align-items: end;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(150px, 1fr)) auto;
}

.reports-filter {
    grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(140px, 1fr)) auto;
}

.form-label {
    color: #334155;
    font-size: 0.88rem;
    font-weight: 700;
}

.form-control,
.form-select {
    border-color: #cbd5e1;
    border-radius: 6px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.14);
}

.btn {
    border-radius: 6px;
    font-weight: 700;
}

.btn-primary {
    background: var(--blue);
    border-color: var(--blue);
}

.icon-only,
.icon-text {
    align-items: center;
    display: inline-flex;
    justify-content: center;
}

.icon-only {
    height: 38px;
    padding: 0;
    width: 38px;
}

.icon-text {
    gap: 8px;
}

.action-buttons {
    justify-content: flex-end;
}

.action-buttons form {
    display: inline-flex;
}

.chart-box {
    height: 300px;
    min-height: 300px;
    position: relative;
}

.chart-box-wide {
    height: 340px;
}

.list-stack,
.goal-grid {
    display: grid;
    gap: 14px;
}

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

.goal-card {
    box-shadow: none;
    padding: 16px;
}

.goal-card h3 {
    font-size: 1rem;
    font-weight: 750;
    margin: 0 0 4px;
}

.goal-card p {
    color: var(--muted);
    margin: 0;
}

.progress-row {
    display: grid;
    gap: 8px;
}

.progress {
    background: #e8edf5;
    border-radius: 999px;
    height: 10px;
}

.budget-progress {
    min-width: 180px;
}

.table {
    margin-bottom: 0;
}

.table th {
    color: #475569;
    font-size: 0.78rem;
    text-transform: uppercase;
}

.table td,
.table th {
    vertical-align: middle;
}

.empty-state {
    align-items: center;
    display: grid;
    gap: 12px;
    justify-items: center;
    margin: 10vh auto;
    max-width: 520px;
    text-align: center;
}

.empty-state svg {
    color: var(--blue);
    height: 44px;
    width: 44px;
}

@media (max-width: 1200px) {
    .summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filter-grid,
    .reports-filter {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-actions {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    main.container-fluid {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .month-switcher,
    .month-form {
        justify-content: flex-start;
    }

    .summary-grid,
    .filter-grid,
    .reports-filter,
    .goal-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        grid-column: auto;
    }

    .metric-card {
        min-height: 96px;
    }

    .panel {
        padding: 16px;
    }

    .chart-box,
    .chart-box-wide {
        height: 280px;
        min-height: 280px;
    }
}
