:root {
    color-scheme: light;
    --bg: #f3efe7;
    --bg-accent: #e9dcc8;
    --surface: #fffaf2;
    --text: #1e1b18;
    --muted: #6f655d;
    --accent: #2f5d50;
    --accent-strong: #214438;
    --border: rgba(30, 27, 24, 0.12);
    --shadow: 0 20px 50px rgba(30, 27, 24, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: Georgia, "Times New Roman", serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(47, 93, 80, 0.16), transparent 34%),
        radial-gradient(circle at top right, rgba(233, 220, 200, 0.8), transparent 30%),
        linear-gradient(180deg, var(--bg), var(--bg-accent));
}

.shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
}

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

.brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-strong);
    text-decoration: none;
}

.topbar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.topbar-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-strong);
    font-size: 0.95rem;
    font-weight: 700;
}

.premium-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
}

.hero {
    width: min(720px, 100%);
    padding: 48px;
    background: color-mix(in srgb, var(--surface) 88%, white 12%);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 12px;
    font-size: 0.82rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
}

h1 {
    margin: 0;
    font-size: clamp(2.6rem, 6vw, 4.8rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
    max-width: 10ch;
}

.lead {
    margin: 22px 0 0;
    max-width: 58ch;
    font-size: 1.08rem;
    line-height: 1.7;
    color: var(--muted);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}

.button-secondary {
    background: transparent;
    color: var(--accent-strong);
    border-color: var(--border);
}

.auth-card,
.dashboard-card {
    max-width: 760px;
}

.auth-form {
    display: grid;
    gap: 16px;
    margin-top: 28px;
}

.auth-form label {
    display: grid;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 700;
}

.auth-form input,
.auth-form select {
    min-height: 48px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font: inherit;
}

.notice {
    margin: 18px 0 0;
    padding: 12px 16px;
    border-radius: 14px;
    font-weight: 700;
}

.notice-error {
    background: rgba(150, 40, 40, 0.1);
    color: #8b1d1d;
}

.notice-success {
    background: rgba(47, 93, 80, 0.12);
    color: var(--accent-strong);
}

.hint {
    margin-top: 18px;
    color: var(--muted);
    font-size: 0.95rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.stat {
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat strong {
    font-size: 2rem;
    letter-spacing: -0.05em;
}

.section {
    width: min(960px, 100%);
    margin: 0 auto;
    padding: 48px 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
    margin-bottom: 32px;
}

.empty-state {
    text-align: center;
    padding: 48px 32px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    border: 1px solid var(--border);
}

.empty-state a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.account-card {
    display: flex;
    flex-direction: column;
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.7);
}

.card-header h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    letter-spacing: -0.03em;
}

.card-header p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--muted);
}

.card-body {
    flex: 1;
    margin: 18px 0;
}

.card-body dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px 18px;
    margin: 0;
    font-size: 0.95rem;
}

.card-body dt {
    font-weight: 700;
    color: var(--muted);
}

.card-body dd {
    margin: 0;
    color: var(--text);
}

.balance {
    font-weight: 700;
    color: var(--accent-strong);
}

.card-footer {
    border-top: 1px solid var(--border);
    padding-top: 18px;
}

.link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

.link:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

.show-more-wrapper {
    text-align: center;
    margin-top: 18px;
}

.show-more-wrapper .button {
    min-width: 160px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    max-width: 960px;
}

.detail-card {
    padding: 32px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.7);
}

.detail-card h2 {
    margin: 0 0 24px;
    font-size: 1.3rem;
    letter-spacing: -0.03em;
}

.detail-card.danger {
    background: rgba(150, 40, 40, 0.05);
    border-color: rgba(150, 40, 40, 0.2);
}

.detail-form {
    display: grid;
    gap: 18px;
}

.detail-form label {
    display: grid;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
}

.detail-form input,
.detail-form select,
.detail-form textarea {
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font: inherit;
    resize: vertical;
}

.auth-form select,
.detail-form select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
    background-repeat: no-repeat;
    background-size: 6px 6px, 6px 6px;
    padding-right: 42px;
    cursor: pointer;
}

.frequency-group {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(47, 93, 80, 0.04);
    border: 1px solid rgba(47, 93, 80, 0.15);
}

.frequency-group label {
    display: grid;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
}

.frequency-group [data-frequency-months] {
    transition: opacity 0.18s ease;
}

.danger-form {
    margin-top: 24px;
}

.button-danger {
    background: #8b1d1d;
    border-color: #8b1d1d;
}

.button-danger:hover {
    opacity: 0.9;
}

.forecast-table-wrap {
    overflow-x: auto;
}

.forecast-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.forecast-table th,
.forecast-table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.forecast-table th {
    color: var(--muted);
    font-weight: 700;
}

@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
    }

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

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