:root {
    color-scheme: light;
    --background: #f4f6f8;
    --surface: #ffffff;
    --surface-alt: #eef2f6;
    --text: #172033;
    --muted: #667085;
    --border: #dfe4ea;
    --primary: #0f172a;
    --primary-soft: #e8edf5;
    --positive: #087a55;
    --positive-soft: #e8f7f1;
    --negative: #b42318;
    --negative-soft: #fff0ee;
    --transfer: #5b4bc4;
    --transfer-soft: #f0edff;
    --radius: 18px;
    --shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--background);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding:
        max(10px, env(safe-area-inset-top))
        18px
        10px;
    background: rgba(244, 246, 248, 0.94);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.brand {
    font-size: 18px;
    font-weight: 800;
}

.topbar-user {
    color: var(--muted);
    font-size: 13px;
}

.page-container {
    width: min(100%, 920px);
    margin: 0 auto;
    padding: 24px 16px 110px;
}

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

.page-header h1 {
    margin: 3px 0 0;
    font-size: clamp(26px, 8vw, 38px);
    letter-spacing: -0.04em;
}

.eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
}

.section {
    margin-top: 30px;
}

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

.section-heading h2 {
    margin: 0;
    font-size: 18px;
}

.section-heading a {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 54px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    font-weight: 700;
}

.quick-action span {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 10px;
}

.quick-action.expense span {
    color: var(--negative);
    background: var(--negative-soft);
}

.quick-action.income span {
    color: var(--positive);
    background: var(--positive-soft);
}

.quick-action.transfer span {
    color: var(--transfer);
    background: var(--transfer-soft);
}

.summary-grid,
.net-worth-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.summary-card,
.net-worth-card,
.account-card,
.form-card,
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.summary-card {
    padding: 18px;
}

.summary-currency {
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.summary-list {
    margin: 0;
}

.summary-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
}

.summary-list dt {
    color: var(--muted);
}

.summary-list dd {
    margin: 0;
    font-weight: 750;
}

.summary-list .summary-total {
    margin-top: 5px;
    padding-top: 13px;
    border-top: 1px solid var(--border);
}

.net-worth-card {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 18px;
}

.net-worth-card span {
    color: var(--muted);
    font-weight: 700;
}

.net-worth-card strong {
    font-size: 24px;
}

.account-list,
.movement-list {
    display: grid;
    gap: 10px;
}

.account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px;
}

.account-card div {
    display: grid;
    gap: 4px;
}

.account-card span {
    color: var(--muted);
    font-size: 13px;
}

.account-balance {
    text-align: right;
}

.movement-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.movement-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.movement-main > div:last-child {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.movement-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.movement-main span {
    color: var(--muted);
    font-size: 12px;
}

.movement-symbol {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 800;
}

.movement-income {
    color: var(--positive);
    background: var(--positive-soft);
}

.movement-expense {
    color: var(--negative);
    background: var(--negative-soft);
}

.movement-transfer {
    color: var(--transfer);
    background: var(--transfer-soft);
}

.movement-amount {
    flex: 0 0 auto;
    text-align: right;
    font-size: 14px;
    font-weight: 800;
}

.amount-positive {
    color: var(--positive);
}

.amount-negative {
    color: var(--negative);
}

.filter-chips {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    padding-bottom: 4px;
    overflow-x: auto;
}

.filter-chips a {
    flex: 0 0 auto;
    padding: 9px 13px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.filter-chips a.active {
    color: white;
    background: var(--primary);
    border-color: var(--primary);
}

.form-card {
    max-width: 620px;
    padding: 20px;
}

.stack-form,
.field {
    display: grid;
    gap: 8px;
}

.stack-form {
    gap: 18px;
}

.field {
    margin-bottom: 18px;
}

.field label {
    font-size: 14px;
    font-weight: 750;
}

.field input,
.field select,
.field textarea,
.auth-card input {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    color: var(--text);
    background: white;
    border: 1px solid #cbd2da;
    border-radius: 12px;
    outline: none;
}

.field textarea {
    min-height: 90px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.auth-card input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.field-error,
.form-errors {
    color: var(--negative);
    font-size: 13px;
}

.form-errors {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--negative-soft);
    border-radius: 12px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 750;
}

.button-primary {
    color: white;
    background: var(--primary);
}

.button-secondary {
    color: var(--text);
    background: var(--surface-alt);
}

.button-block {
    width: 100%;
}

.empty-state {
    padding: 24px;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed #cbd2da;
    border-radius: 16px;
    text-align: center;
}

.messages {
    margin-bottom: 18px;
}

.message {
    padding: 13px 15px;
    color: #075940;
    background: var(--positive-soft);
    border: 1px solid #b5e3d1;
    border-radius: 13px;
}

.auth-wrapper {
    display: grid;
    min-height: calc(100vh - 130px);
    place-items: center;
}

.auth-card {
    width: min(100%, 420px);
    padding: 28px;
}

.auth-card h1 {
    margin: 14px 0 4px;
}

.auth-logo {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    color: white;
    background: var(--primary);
    border-radius: 17px;
    font-weight: 850;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 20px;
    color: var(--muted);
    font-size: 14px;
}

.pagination a {
    color: var(--text);
    font-weight: 700;
}

.bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: 70px;
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.bottom-nav a,
.bottom-nav button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    min-height: 68px;
    padding: 7px 4px;
    color: var(--muted);
    background: transparent;
    border: 0;
    font-size: 11px;
    cursor: pointer;
}

.bottom-nav .nav-add {
    color: var(--primary);
    font-weight: 800;
}

.nav-icon {
    font-size: 21px;
    line-height: 1;
}

.nav-form {
    margin: 0;
}

@media (min-width: 620px) {
    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }

    .summary-grid,
    .net-worth-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-container {
        padding-right: 24px;
        padding-left: 24px;
    }
}
