: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; }

/* Main Menu: the spec's three columns, stacking on narrow screens. */
.menu-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.menu-column { padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.menu-column h2 { margin-top: 0; font-size: 1.1rem; }
.menu-column ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.menu-column .soon { color: var(--muted); }

.brand { display: inline-flex; align-items: center; gap: 0.5rem; }
.brand-logo { height: 2rem; width: auto; }
.header-search input { padding: 0.3rem 0.5rem; font: inherit; border: 1px solid var(--border); border-radius: 4px; width: 11rem; }

.site-footer { border-top: 1px solid var(--border); }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin-top: 0.5rem; }

.club-about { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; }
.club-about h2 { margin-top: 0; }
.club-logo { max-height: 6rem; max-width: 12rem; width: auto; }
textarea { padding: 0.5rem; font: inherit; border: 1px solid var(--border); border-radius: 4px; }
input[type=url] { padding: 0.5rem; font: inherit; border: 1px solid var(--border); border-radius: 4px; }

/* Club Self-Check */
.sc-action { background: var(--err-bg); color: var(--err-text); }
.sc-warning { background: #fff4e5; color: #7a4a00; }
.sc-info { background: var(--info-bg); color: var(--info-text); }
.self-check-summary { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.self-check-item h3 { margin-top: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.self-check-item ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }

/* E-mail templates */
.template-form { max-width: 48rem; }
.template-form textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9rem; }
.email-preview { white-space: pre-wrap; background: var(--bg); padding: 1rem; border: 1px solid var(--border); border-radius: 4px; }

/* Reports */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.report-grid .panel { margin-top: 0; }
.report-table td.num, .report-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.report-table tr.total td { font-weight: 700; border-top: 2px solid var(--border); }

.message-body { white-space: normal; overflow-wrap: anywhere; }

/* Newsletters and announcements */
.tabs { display: flex; flex-wrap: wrap; gap: 1rem; }
.post-summary h2 { margin: 0 0 0.25rem; font-size: 1.2rem; }
.post-body { max-width: 46rem; overflow-wrap: anywhere; }
.attachments { padding-left: 1.25rem; }
.attachments li { margin-bottom: 0.35rem; }

/* Calendar */
.calendar-filter { margin-bottom: 1rem; }
.calendar-day { font-size: 1.05rem; margin: 1.25rem 0 0.25rem; border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; }
.calendar-item { padding: 0.35rem 0; display: flex; flex-wrap: wrap; gap: 0 0.75rem; align-items: baseline; }
.month-nav { display: flex; flex-wrap: wrap; gap: 1rem; align-items: baseline; }
.month-grid { table-layout: fixed; width: 100%; min-width: 42rem; }
.month-grid td { vertical-align: top; height: 5.5rem; padding: 0.25rem; border: 1px solid var(--border); }
.month-grid td.other-month { opacity: 0.45; }
.month-grid td.today .day-number { font-weight: bold; text-decoration: underline; }
.day-number { display: block; font-size: 0.85rem; }
.month-event { display: block; font-size: 0.8rem; line-height: 1.25; margin-top: 0.2rem; overflow-wrap: anywhere; }
.occurrence-list { padding-left: 1.25rem; columns: 2 16rem; }
.occurrence-list li { margin-bottom: 0.25rem; break-inside: avoid; }
.occurrence-list li.skipped { text-decoration: line-through; }
.occurrence-list li.skipped form, .occurrence-list li.skipped .muted { text-decoration: none; display: inline-block; }
.badge-cancelled { color: #b00020; font-weight: bold; }
.js .no-js-only { display: none; }

/* Attendance */
.attendance-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0.25rem 1rem; max-height: 60vh; overflow-y: auto; }
.attendance-list label[hidden] { display: none; }
.copy-field { width: 100%; max-width: 46rem; font-family: ui-monospace, monospace; font-size: 0.85rem; }

/* Skills */
.skill-form label.wide { flex: 1 1 18rem; }
.skill-form label.wide input { width: 100%; }
.role-row.retired { opacity: 0.6; }
a.expired { text-decoration: line-through; }
.skills-grid th { font-size: 0.8rem; }
.skills-grid td.has-skill { text-align: center; white-space: nowrap; }
.skills-grid td.expired { color: var(--err-text); }
.inline-note { padding-bottom: 0.5rem; }

/* Polls */
.poll-list { padding-left: 1.25rem; }
.poll-list li { margin-bottom: 0.5rem; }
.poll-results td.bar { width: 40%; }
.poll-results progress { width: 100%; height: 1rem; }

/* Elections */
.election-question { margin-bottom: 1rem; }
.election-question h3 { margin-bottom: 0.25rem; }
.candidate { padding: 0.5rem 0; border-top: 1px solid var(--border); }
.state-draft, .state-voided, .candidate-declined, .candidate-withdrawn { background: var(--border); color: var(--text, inherit); }
.state-nominations, .state-scheduled, .candidate-nominated { background: var(--info-bg); color: var(--info-text); }
.state-open, .state-certified, .candidate-accepted { background: var(--ok-bg); color: var(--ok-text); }
.state-closed { background: var(--err-bg); color: var(--err-text); }
.ok-text { color: var(--ok-text); }
.err-text { color: var(--err-text); }
.ballot-question .candidate-choice { align-items: flex-start; }
.ballot-question .statement { display: block; font-size: 0.9rem; color: var(--muted); margin-top: 0.25rem; white-space: normal; }
.ballot-review dd { font-weight: 600; }
.survey-questions li { margin-bottom: 0.5rem; }
.survey-texts { padding-left: 1.25rem; }
.survey-texts li { margin-bottom: 0.5rem; }

/* Assets */
.asset-in_service { background: var(--ok-bg); color: var(--ok-text); }
.asset-on_loan { background: var(--info-bg); color: var(--info-text); }
.asset-in_repair { background: var(--err-bg); color: var(--err-text); }
.asset-retired { background: var(--border); }
input.narrow-wide { width: 8rem; }
.packing-list td.tick { font-size: 1.3rem; text-align: center; width: 3rem; }
@media print { .site-header, .site-footer, .tabs, .filters, form { display: none; } }
