:root {
    color-scheme: light;
    --navy: #172b4d;
    --navy-deep: #10213b;
    --teal: #087e75;
    --teal-dark: #06645e;
    --ink: #243248;
    --muted: #64748b;
    --line: #dce4ec;
    --surface: #ffffff;
    --canvas: #f3f6fa;
    --green-soft: #e8f5f1;
    --shadow: 0 8px 24px rgba(23, 43, 77, 0.07);
    --shadow-hover: 0 12px 28px rgba(23, 43, 77, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--canvas);
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

header {
    padding: 22px 28px;
    color: #fff;
    text-align: left;
    background: var(--navy-deep);
    border-bottom: 3px solid var(--teal);
}

header h1 {
    max-width: 1440px;
    margin: 0 auto;
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    font-weight: 650;
    letter-spacing: -0.025em;
}

.page_layout {
    display: flex;
    align-items: stretch;
    max-width: 1440px;
    min-height: calc(100vh - 80px);
    margin: 0 auto;
}

.navigation {
    display: flex;
    flex: 0 0 220px;
    flex-direction: column;
    gap: 7px;
    padding: 28px 16px;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.navigation a {
    display: block;
    margin: 0;
    padding: 11px 14px;
    color: #46566e;
    font-weight: 600;
    text-decoration: none;
    border-radius: 9px;
    transition: color 160ms ease, background-color 160ms ease;
}

.navigation a:first-child {
    color: var(--teal-dark);
    background: var(--green-soft);
}

.navigation a:hover {
    color: var(--teal-dark);
    background: #edf5f5;
}

.main_content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 34px clamp(20px, 4vw, 54px) 48px;
    background: var(--canvas);
}

.main_content h2 {
    margin: 0 0 12px;
    color: var(--navy);
    font-size: 1.45rem;
    line-height: 1.3;
    letter-spacing: -0.025em;
}

.main_content > p {
    margin: 0 0 26px;
    color: var(--muted);
}

.dashboard_cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.card,
.form_container,
.budget_item,
.transaction_history {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 13px;
    box-shadow: var(--shadow);
}

.card {
    min-height: 132px;
    padding: 21px;
    border-top: 3px solid var(--teal);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.card:hover,
.form_container:hover,
.budget_item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.card h3,
.budget_item h3 {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 650;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.card p,
.budget_item p {
    margin: 0;
    color: var(--navy);
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    font-weight: 700;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
}

.transaction_forms {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 26px;
}

.form_container {
    padding: 22px;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.form_container form {
    display: flex;
    flex-direction: column;
}

.form_container h3 {
    margin: 0 0 18px;
    color: var(--navy);
    font-size: 1.08rem;
}

.form_container label {
    margin: 0 0 5px;
    color: #46566e;
    font-size: 0.9rem;
    font-weight: 600;
}

.form_container input {
    width: 100%;
    min-height: 43px;
    margin: 0 0 14px;
    padding: 9px 11px;
    color: var(--ink);
    font: inherit;
    background: #fbfcfe;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.form_container input:hover {
    border-color: #9aabbc;
}

.form_container input:focus {
    outline: none;
    border-color: var(--teal);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(8, 126, 117, 0.18);
}

.form_container button {
    min-height: 44px;
    margin-top: 3px;
    padding: 10px 16px;
    color: #fff;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    background: var(--teal);
    border: 1px solid var(--teal);
    border-radius: 8px;
    transition: background-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.form_container button:hover {
    background: var(--teal-dark);
    box-shadow: 0 4px 10px rgba(8, 126, 117, 0.2);
}

.form_container button:active {
    transform: translateY(1px);
}

.transaction_history,
.budget_section {
    margin-top: 28px;
}

.transaction_history {
    padding: 22px;
}

.transaction_history h2,
.budget_section > h2 {
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.table_container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 9px;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    min-width: 660px;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e8edf2;
}

th {
    color: #40516a;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    text-transform: uppercase;
    background: #f2f6f8;
}

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

tbody tr:hover {
    background: #f7fbfa;
}

.budget_info {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.budget_item {
    padding: 20px;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.budget_item:nth-child(3) {
    background: var(--green-soft);
    border-color: #c9e7df;
}

:focus-visible {
    outline: 3px solid #e8a838;
    outline-offset: 3px;
}

@media (max-width: 1100px) {
    .dashboard_cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .page_layout {
        flex-direction: column;
    }

    .navigation {
        flex: 0 0 auto;
        flex-direction: row;
        gap: 6px;
        padding: 10px 16px;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .navigation a {
        flex: 0 0 auto;
        margin: 0;
        padding: 9px 12px;
    }

    .main_content {
        padding: 26px 18px 36px;
    }

    .transaction_forms {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 480px) {
    header {
        padding: 18px;
    }

    .dashboard_cards,
    .budget_info {
        grid-template-columns: 1fr;
    }

    .card {
        min-height: 112px;
    }

    .form_container,
    .transaction_history {
        padding: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
