:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --text: #1a2332;
    --text-muted: #5c6b7a;
    --primary: #1565c0;
    --primary-hover: #0d47a1;
    --primary-soft: #e3f2fd;
    --border: #d8dee6;
    --warning-bg: #fff8e1;
    --warning-border: #ffcc02;
    --warning-text: #6d4c00;
    --shadow: 0 2px 8px rgba(26, 35, 50, 0.08);
    --radius: 12px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: min(960px, 100% - 2rem);
    margin-inline: auto;
}

.header {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    color: #fff;
    padding: 2rem 0 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.header h1 {
    margin: 0 0 0.35rem;
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
    max-width: 42rem;
}

main.container {
    flex: 1;
    padding-bottom: 2rem;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.form-card {
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.field input[type="date"],
.field input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    width: 100%;
    min-height: 2.65rem;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.checkbox-field {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
    user-select: none;
}

.checkbox-field input {
    margin-top: 0.25rem;
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.summary {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.summary-item {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.summary-item strong {
    color: var(--text);
}

.summary-warning {
    margin-top: 0.35rem;
    padding: 0.75rem 1rem;
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    border-radius: 8px;
    color: var(--warning-text);
    font-size: 0.9rem;
}

.results {
    display: grid;
    gap: 0.85rem;
}

.year-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.15rem 1.35rem;
    display: grid;
    gap: 0.5rem;
    border-left: 4px solid var(--primary);
}

.year-card h2 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--primary);
}

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

.year-card .amount {
    font-size: 1.05rem;
    color: var(--text);
}

.year-card strong {
    color: var(--text);
}

.empty-state {
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state p {
    margin: 0;
}

.footer {
    padding: 1.25rem 0 1.75rem;
    text-align: center;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.footer a:hover {
    text-decoration: underline;
}

@media (max-width: 520px) {
    .form-card {
        padding: 1.15rem;
    }

    .field-action {
        grid-column: 1 / -1;
    }
}
