:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --card: #ffffff;
    --line: #d8e0ee;
    --text: #162033;
    --muted: #66748d;
    --accent: #2d6cdf;
    --accent-dark: #1f57bb;
    --accent-soft: #e8f0ff;
    --ok: #0f8a47;
    --warn: #b25f00;
    --error: #c62828;
    --shadow: 0 14px 36px rgba(20, 34, 66, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #eef3ff 0%, var(--bg) 180px);
    color: var(--text);
}

.shell {
    width: min(1100px, calc(100vw - 32px));
    margin: 32px auto 48px;
    display: grid;
    gap: 20px;
}

.hero,
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.hero {
    padding: 28px;
    display: grid;
    gap: 18px;
}

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

.hero h1,
.card h2,
.card h3 {
    margin: 0;
}

.lead {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.6;
    max-width: 72ch;
}

.hero-note {
    background: var(--accent-soft);
    border: 1px solid #cfe0ff;
    border-radius: 16px;
    padding: 14px 16px;
    color: #20345f;
    line-height: 1.5;
}

.card {
    padding: 24px;
    display: grid;
    gap: 18px;
}

.grid {
    display: grid;
    gap: 16px;
}

.two-up {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.targets-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.field {
    display: grid;
    gap: 8px;
}

.field span,
.target-card label {
    font-size: 0.95rem;
    font-weight: 600;
}

input,
select,
button,
.primary-link {
    font: inherit;
}

input,
select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
}

input:focus,
select:focus,
button:focus,
.primary-link:focus {
    outline: 3px solid rgba(45, 108, 223, 0.18);
    outline-offset: 1px;
}

.target-card {
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fbfcff;
    display: grid;
    gap: 10px;
}

.target-card strong {
    font-size: 1rem;
}

button,
.primary-link {
    border: 0;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button.primary,
.primary-link {
    background: var(--accent);
    color: white;
    font-weight: 700;
}

button.primary:hover,
.primary-link:hover {
    background: var(--accent-dark);
}

button.secondary {
    background: #eef3ff;
    color: #22438a;
    font-weight: 600;
}

button.secondary:hover {
    background: #dfe9ff;
}

button:disabled,
.primary-link.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.section-head,
.solve-bar,
.preview-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.summary {
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fbfcff;
    padding: 16px;
    line-height: 1.6;
}

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

.preview {
    display: grid;
    gap: 14px;
}

.preview-table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
    background: white;
}

.preview-table th,
.preview-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #edf1f8;
    vertical-align: top;
}

.preview-table th {
    background: #f6f8fc;
    font-size: 0.92rem;
}

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

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

.status {
    margin: 0;
    border-radius: 14px;
    padding: 14px 16px;
    background: #f6f8fc;
    border: 1px solid var(--line);
    line-height: 1.5;
}

.status.ok {
    color: var(--ok);
    background: #eefaf3;
    border-color: #cdeed9;
}

.status.warn {
    color: var(--warn);
    background: #fff7ea;
    border-color: #f2dfb2;
}

.status.error {
    color: var(--error);
    background: #fff0f0;
    border-color: #f4c8c8;
}

.warning-card {
    border-color: #f2dfb2;
    background: #fff7ea;
}

.warning-card h2 {
    color: var(--warn);
}

.spacing-top {
    margin-top: -2px;
}

.hidden {
    display: none !important;
}

.footer-note {
    padding: 0 6px 8px;
    text-align: center;
}

.footer-note .muted {
    font-size: 0.92rem;
}

@media (max-width: 720px) {
    .shell {
        width: min(100vw - 20px, 1100px);
        margin: 18px auto 28px;
    }

    .hero,
    .card {
        padding: 18px;
        border-radius: 18px;
    }

    .preview-table {
        min-width: 420px;
    }
}
