:root {
    color-scheme: light;
    --bg: #eef3f7;
    --bg-strong: #dbe6ef;
    --surface: rgba(255, 255, 255, 0.86);
    --surface-strong: #ffffff;
    --text: #102030;
    --muted: #5c6c7d;
    --primary: #1d6f8f;
    --primary-strong: #15536c;
    --accent: #f4b942;
    --accent-strong: #d99314;
    --success: #1f8a5b;
    --danger: #b54444;
    --border: rgba(16, 32, 48, 0.12);
    --shadow: 0 18px 45px rgba(15, 35, 55, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(29, 111, 143, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(244, 185, 66, 0.18), transparent 24%),
        linear-gradient(180deg, var(--bg), var(--bg-strong));
}

body {
    padding: 32px 18px 56px;
}

.page-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
}

.hero {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.hero h1 {
    margin: 6px 0 10px;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 700;
}

.hero-copy {
    margin: 0;
    max-width: 66ch;
    color: var(--muted);
    font-size: 1.02rem;
}

.user-card,
.summary-card,
.panel {
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    background: var(--surface);
    backdrop-filter: blur(12px);
}

.user-card {
    min-width: 220px;
    border-radius: 18px;
    padding: 18px 20px;
}

.user-card span,
.summary-card span,
.period-values span,
.movement-meta span,
.panel-text,
.empty-state,
.movement p,
label {
    color: var(--muted);
}

.user-card strong {
    display: block;
    margin-top: 6px;
    font-size: 1.2rem;
}

.alert {
    border-radius: 16px;
    padding: 14px 18px;
    margin: 0 0 18px;
    border: 1px solid transparent;
}

.alert-error {
    color: #6f1717;
    background: rgba(181, 68, 68, 0.14);
    border-color: rgba(181, 68, 68, 0.22);
}

.alert-success {
    color: #135338;
    background: rgba(31, 138, 91, 0.14);
    border-color: rgba(31, 138, 91, 0.22);
}

.auth-grid,
.summary-grid,
.period-grid,
.actions-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.auth-grid,
.actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-grid {
    grid-template-columns: 1.35fr 1fr 1fr;
}

.period-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.summary-card {
    border-radius: 24px;
    padding: 22px;
}

.panel-accent {
    background: linear-gradient(180deg, rgba(29, 111, 143, 0.08), rgba(244, 185, 66, 0.09));
}

.summary-total {
    background: linear-gradient(135deg, rgba(29, 111, 143, 0.12), rgba(29, 111, 143, 0.03));
}

.summary-card strong {
    display: block;
    margin-top: 10px;
    font-size: clamp(1.8rem, 2.8vw, 2.7rem);
}

.summary-card small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.period-card h2,
.panel h2,
.history-panel h2 {
    margin: 0 0 16px;
    font-size: 1.2rem;
}

.period-values {
    display: grid;
    gap: 12px;
}

.period-values div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.62);
}

.form-stack {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

input,
textarea {
    width: 100%;
    border: 1px solid rgba(16, 32, 48, 0.18);
    border-radius: 14px;
    padding: 13px 14px;
    font: inherit;
    color: var(--text);
    background: rgba(255, 255, 255, 0.96);
    outline: none;
}

input:focus,
textarea:focus {
    border-color: rgba(29, 111, 143, 0.45);
    box-shadow: 0 0 0 4px rgba(29, 111, 143, 0.11);
}

textarea {
    resize: vertical;
    min-height: 110px;
}

.btn {
    border: 0;
    border-radius: 14px;
    padding: 13px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    box-shadow: 0 10px 20px rgba(29, 111, 143, 0.22);
}

.btn-secondary {
    color: #1f1605;
    background: linear-gradient(135deg, #f7d98d, var(--accent));
    box-shadow: 0 10px 20px rgba(244, 185, 66, 0.22);
}

.btn-ghost {
    color: var(--text);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 16px;
}

.history-panel {
    margin-top: 4px;
}

.history-list {
    display: grid;
    gap: 12px;
}

.months-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.month-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.year-filter {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
}

select {
    width: 100%;
    border: 1px solid rgba(16, 32, 48, 0.18);
    border-radius: 14px;
    padding: 13px 14px;
    font: inherit;
    color: var(--text);
    background: rgba(255, 255, 255, 0.96);
}

.movement-actions {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.btn-danger {
    color: #ffffff;
    background: linear-gradient(135deg, #c94d4d, #922f2f);
    box-shadow: 0 10px 20px rgba(181, 68, 68, 0.22);
}

.movement-meta details {
    margin-top: 12px;
}

.movement-meta summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--primary-strong);
    list-style: none;
}

.edit-form {
    margin-top: 12px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(16, 32, 48, 0.08);
}

.edit-form select,
.edit-form input {
    background: #ffffff;
}

.movement {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(16, 32, 48, 0.08);
}

.movement strong,
.movement p {
    margin: 0;
}

.movement p {
    margin-top: 6px;
}

.movement-meta {
    text-align: right;
    min-width: 150px;
}

.movement-meta strong {
    display: block;
    margin-top: 6px;
    font-size: 1.05rem;
}

.is-saving {
    border-left: 5px solid var(--success);
}

.is-expense {
    border-left: 5px solid var(--danger);
}

.empty-state {
    margin: 0;
}

@media (max-width: 980px) {

    .auth-grid,
    .actions-grid,
    .summary-grid,
    .period-grid,
    .months-grid,
    .hero {
        grid-template-columns: 1fr;
        display: grid;
    }

    .section-head,
    .movement {
        flex-direction: column;
        align-items: flex-start;
    }

    .movement-meta {
        text-align: left;
        min-width: 0;
    }
}

@media (max-width: 640px) {
    body {
        padding: 16px 12px 32px;
    }

    .panel,
    .summary-card,
    .user-card {
        border-radius: 18px;
        padding: 18px;
    }

    .btn {
        width: 100%;
    }

    .month-card-head,
    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }
}