:root {
    --bg: #f7f7f5;
    --surface: #ffffff;
    --text: #1d1f21;
    --muted: #6b6f74;
    --border: #d9dbde;
    --accent: #1f5f99;
    --ok-bg: #e6f4ea;
    --ok-text: #1e5b2f;
    --err-bg: #fce8e6;
    --err-text: #8a1c14;
    --info-bg: #e8f0fb;
    --info-text: #1f4a7a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }

main { max-width: 60rem; margin: 0 auto; padding: 1.5rem 1rem; }
.site-footer { max-width: 60rem; margin: 0 auto; padding: 1rem; color: var(--muted); font-size: 0.875rem; }

form.inline { display: inline; margin: 0; }
button.link {
    background: none; border: 0; padding: 0;
    color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer;
}

.stack { display: flex; flex-direction: column; gap: 0.75rem; max-width: 24rem; }
.stack label { display: flex; flex-direction: column; gap: 0.25rem; }
input[type=email], input[type=password], input[type=text] {
    padding: 0.5rem; font: inherit; border: 1px solid var(--border); border-radius: 4px;
}
button:not(.link) {
    align-self: flex-start;
    padding: 0.5rem 1rem; font: inherit; color: #fff;
    background: var(--accent); border: 0; border-radius: 4px; cursor: pointer;
}

.flash { padding: 0.75rem 1rem; border-radius: 4px; }
.flash-success { background: var(--ok-bg); color: var(--ok-text); }
.flash-error { background: var(--err-bg); color: var(--err-text); }
.flash-info { background: var(--info-bg); color: var(--info-text); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 1rem; }
.card {
    display: flex; flex-direction: column; gap: 0.25rem;
    padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
}
.card-value { font-size: 1.75rem; font-weight: 700; }
.card-label { color: var(--muted); font-size: 0.875rem; }

.modules { padding-left: 1.25rem; }
.muted { color: var(--muted); font-size: 0.875rem; }

fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 1rem; margin: 0; }
legend { font-weight: 600; padding: 0 0.25rem; }
.stack label.choice { flex-direction: row; align-items: center; gap: 0.5rem; }
select, input[type=tel], input[type=number] {
    padding: 0.5rem; font: inherit; border: 1px solid var(--border); border-radius: 4px;
}
.flash ul { margin: 0.25rem 0 0; padding-left: 1.25rem; }
.flash p { margin: 0; }

/* Honeypot: off-screen for people, still filled in by naive bots. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 0.875rem; color: var(--muted); font-weight: 600; }

.panel {
    margin-top: 1.5rem; padding: 1rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
}
.panel h2 { margin-top: 0; }
button.danger { background: var(--err-text); }

a.card { text-decoration: none; color: inherit; }
a.card:hover { border-color: var(--accent); }
a.card .card-label { color: var(--accent); }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; margin-bottom: 1rem; }
.filters label { display: flex; flex-direction: column; gap: 0.25rem; }
input[type=search], input[type=date] {
    padding: 0.5rem; font: inherit; border: 1px solid var(--border); border-radius: 4px;
}

.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.8rem; white-space: nowrap; }
.badge-current, .badge-exempt { background: var(--ok-bg); color: var(--ok-text); }
.badge-due_soon { background: var(--info-bg); color: var(--info-text); }
.badge-lapsed, .badge-past_grace { background: var(--err-bg); color: var(--err-text); }

.history { padding-left: 1.25rem; }
.panel h3 { margin-bottom: 0.25rem; }

.row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.5rem 1rem; }
.checks label.choice { display: flex; align-items: center; gap: 0.5rem; }

.role-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 0.75rem; }
.inline-form label { display: flex; flex-direction: column; gap: 0.25rem; }
.inline-form label.choice { flex-direction: row; align-items: center; gap: 0.35rem; padding-bottom: 0.5rem; }
input.narrow { width: 5.5rem; }
