:root {
    --ink: #171923;
    --ink-2: #2d3342;
    --muted: #687083;
    --line: #dfe3ea;
    --panel: #ffffff;
    --bg: #f4f5f8;
    --accent: #c7a15a;
    --accent-dark: #9e7631;
    --accent-soft: #f6eedf;
    --success: #147a54;
    --success-soft: #eaf7f1;
    --danger: #b52d36;
    --danger-soft: #fff0f1;
    --blue: #355781;
    --radius: 22px;
    --shadow: 0 18px 45px rgba(23, 25, 35, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
}
button, input { font: inherit; }
a { color: inherit; }

.page-shell { min-height: 100vh; padding: 26px 18px; }
.public-container { width: min(100%, 1040px); margin: 0 auto; }
.hero { display: flex; align-items: center; gap: 22px; padding: 18px 4px 26px; }
.brand-mark {
    flex: 0 0 auto;
    width: 86px;
    height: 86px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--ink);
    border: 4px solid var(--accent);
    font-weight: 800;
    font-size: 28px;
    letter-spacing: -1px;
    box-shadow: 0 10px 28px rgba(23,25,35,.14);
}
.hero-copy { min-width: 0; }
.eyebrow { display: inline-block; color: var(--accent-dark); font-size: 13px; font-weight: 800; letter-spacing: .18em; }
h1, h2, h3, p { margin-top: 0; }
.hero h1 { margin: 7px 0 4px; font-size: clamp(38px, 7vw, 62px); line-height: .98; letter-spacing: -.045em; }
.lead { margin: 0; color: var(--muted); font-size: clamp(17px, 2.2vw, 21px); }

.event-details { display: grid; grid-template-columns: 1.25fr .65fr 1.1fr; gap: 14px; margin-bottom: 16px; }
.event-details article { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; }
.event-details span, .metric span { display: block; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-size: 12px; font-weight: 700; }
.event-details strong { display: block; margin-top: 5px; font-size: 17px; }

.countdown-card { display: flex; align-items: center; justify-content: space-between; gap: 22px; border-radius: 24px; padding: 22px 24px; background: var(--ink); color: #fff; box-shadow: var(--shadow); }
.countdown-card.is-closed { opacity: .88; }
.countdown-kicker { display: block; color: #d9dee8; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.deadline-text { display: block; margin: 4px 0 3px; font-size: 17px; }
.countdown-card small { color: #aeb7c8; }
.countdown { display: grid; grid-template-columns: repeat(4, minmax(68px, 1fr)); gap: 8px; }
.countdown > div { min-width: 72px; padding: 10px 12px; text-align: center; border: 1px solid rgba(255,255,255,.1); border-radius: 15px; background: rgba(255,255,255,.08); }
.countdown strong { display: block; font-size: 28px; line-height: 1; }
.countdown span { display: block; margin-top: 5px; color: #d7dce5; font-size: 10px; text-transform: uppercase; }

.form-card, .closed-card { margin-top: 28px; padding: 34px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-heading { display: flex; gap: 15px; align-items: flex-start; margin-bottom: 26px; }
.section-heading h2 { margin: 2px 0 5px; font-size: 23px; }
.section-heading p { margin: 0; color: var(--muted); }
.step-number { flex: 0 0 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 800; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field > span { font-weight: 700; color: var(--ink-2); }
.field b { color: var(--danger); }
.field input { width: 100%; min-width: 0; padding: 15px 16px; border: 1px solid #cfd5df; border-radius: 14px; background: #fff; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.field input:focus { border-color: var(--accent-dark); box-shadow: 0 0 0 4px rgba(158,118,49,.12); }
.field small, .submit-zone small { color: #8790a2; font-size: 12px; }
.lookup-message { min-height: 0; margin-top: -8px; padding: 0; font-size: 13px; color: var(--muted); }
.lookup-message.found, .lookup-message.new, .lookup-message.error, .lookup-message.loading { padding: 11px 13px; border-radius: 12px; }
.lookup-message.found { background: var(--success-soft); color: var(--success); }
.lookup-message.new { background: var(--accent-soft); color: #79581f; }
.lookup-message.error { background: var(--danger-soft); color: var(--danger); }
.lookup-message.loading { background: #eef3f9; color: var(--blue); }

.submit-zone { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 13px; }
.consent-row { display: flex; align-items: flex-start; gap: 10px; color: var(--ink-2); }
.consent-row input { margin-top: 3px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 11px 18px; border: 1px solid transparent; border-radius: 13px; text-decoration: none; font-weight: 750; cursor: pointer; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #292d3a; }
.btn-light { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-danger-outline { background: transparent; border-color: #d9a5aa; color: #8f2730; }
.btn-small { min-height: 39px; padding: 8px 13px; font-size: 13px; }
.alert { margin-top: 20px; padding: 14px 16px; border-radius: 14px; font-weight: 650; }
.alert.success { color: var(--success); background: var(--success-soft); border: 1px solid #cceadc; }
.alert.error { color: var(--danger); background: var(--danger-soft); border: 1px solid #f2cbd0; }
.closed-card { text-align: center; }
.closed-icon { width: 58px; height: 58px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); font-size: 28px; font-weight: 800; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 26px 4px 4px; color: var(--muted); font-size: 13px; }
footer a { text-decoration: none; }

/* Admin */
.admin-body { background: #f1f3f6; }
.admin-topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 12px max(18px, calc((100vw - 1240px) / 2)); background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.admin-brand { display: flex; align-items: center; gap: 11px; }
.admin-brand strong, .admin-brand span { display: block; }
.admin-brand span { color: var(--muted); font-size: 12px; }
.admin-mark { width: 42px; height: 42px; border-radius: 13px; border-width: 2px; font-size: 14px; box-shadow: none; }
.admin-actions { display: flex; gap: 8px; }
.admin-container { width: min(100% - 32px, 1240px); margin: 0 auto; padding: 28px 0 50px; }
.admin-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 22px; }
.admin-heading h1 { margin: 5px 0; font-size: clamp(30px, 5vw, 44px); letter-spacing: -.03em; }
.admin-heading p { margin: 0; color: var(--muted); }
.status-badge, .record-status { display: inline-flex; align-items: center; border-radius: 999px; font-weight: 750; white-space: nowrap; }
.status-badge { padding: 8px 12px; font-size: 12px; }
.status-badge.open { color: var(--success); background: var(--success-soft); }
.status-badge.closed { color: var(--danger); background: var(--danger-soft); }
.metrics-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.metric.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.metric.primary span, .metric.primary small { color: #cfd5df; }
.metric strong { display: block; margin: 8px 0 4px; font-size: 31px; line-height: 1; }
.metric small { color: var(--muted); }
.insights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.dashboard-card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px; }
.card-heading { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.card-heading h2 { margin: 0; font-size: 18px; }
.card-heading span { color: var(--muted); font-size: 12px; }
.bar-list { display: grid; gap: 13px; }
.bar-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 13px; }
.bar-track { height: 10px; overflow: hidden; border-radius: 999px; background: #eceff3; }
.bar-track span { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: var(--accent-dark); }
.hour-chart { height: 150px; display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); align-items: end; gap: 3px; padding-top: 10px; border-bottom: 1px solid var(--line); }
.hour-column { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 5px; min-width: 0; }
.hour-bar { display: block; width: 100%; min-height: 2px; border-radius: 5px 5px 0 0; background: var(--ink); }
.hour-column small { min-height: 15px; text-align: center; color: var(--muted); font-size: 9px; }
.chart-summary { display: flex; justify-content: space-between; gap: 16px; margin-top: 13px; color: var(--muted); font-size: 12px; }
.chart-summary strong { color: var(--ink); }
.roster-card { padding: 0; overflow: hidden; }
.roster-toolbar { display: flex; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.roster-toolbar h2 { margin: 0 0 4px; font-size: 19px; }
.roster-toolbar p { margin: 0; color: var(--muted); font-size: 12px; }
.roster-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.search-input { min-width: 260px; padding: 10px 12px; border: 1px solid #cfd5df; border-radius: 12px; outline: none; }
.search-input:focus { border-color: var(--accent-dark); box-shadow: 0 0 0 3px rgba(158,118,49,.1); }
.filter-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: #eef0f4; }
.filter-btn { border: 0; padding: 8px 10px; border-radius: 9px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.filter-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.filter-btn span { font-weight: 800; }
.table-wrap { overflow-x: auto; }
.roster-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.roster-table th, .roster-table td { padding: 13px 14px; text-align: left; border-bottom: 1px solid #edf0f3; white-space: nowrap; }
.roster-table th { color: var(--muted); background: #fafbfc; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.roster-row[hidden] { display: none; }
.record-status { padding: 5px 8px; font-size: 10px; }
.record-status.new { color: #725620; background: var(--accent-soft); }
.record-status.updated { color: var(--blue); background: #edf3fa; }
.empty-row td { padding: 40px; text-align: center; color: var(--muted); }

/* Login */
.login-body { min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 420px); padding: 34px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.login-mark { width: 66px; height: 66px; margin: 0 auto 18px; border-radius: 19px; font-size: 20px; }
.login-card h1 { margin: 7px 0 3px; }
.login-card > p { color: var(--muted); }
.login-form { display: grid; gap: 16px; margin-top: 24px; text-align: left; }
.login-form .btn { width: 100%; margin-top: 4px; }
.back-link { display: inline-block; margin-top: 20px; color: var(--muted); text-decoration: none; font-size: 13px; }

@media (max-width: 1050px) {
    .metrics-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
    .page-shell { padding: 14px 12px; }
    .hero { gap: 13px; padding: 12px 2px 18px; align-items: center; }
    .brand-mark { width: 60px; height: 60px; border-radius: 18px; border-width: 3px; font-size: 20px; }
    .hero h1 { font-size: clamp(34px, 11vw, 48px); }
    .eyebrow { font-size: 10px; letter-spacing: .13em; }
    .lead { font-size: 15px; }
    .event-details { grid-template-columns: 1fr 1fr; gap: 9px; }
    .event-details article { padding: 14px; border-radius: 15px; }
    .event-details article:last-child { grid-column: 1 / -1; }
    .event-details strong { font-size: 15px; }
    .countdown-card { flex-direction: column; align-items: stretch; padding: 17px; border-radius: 18px; }
    .countdown { gap: 6px; }
    .countdown > div { min-width: 0; padding: 9px 5px; }
    .countdown strong { font-size: 22px; }
    .form-card, .closed-card { margin-top: 18px; padding: 20px 16px; border-radius: 18px; }
    .section-heading { gap: 11px; margin-bottom: 20px; }
    .step-number { flex-basis: 38px; height: 38px; border-radius: 12px; }
    .section-heading h2 { font-size: 19px; }
    .section-heading p { font-size: 13px; }
    .form-grid { grid-template-columns: 1fr; gap: 16px; }
    .field-full { grid-column: auto; }
    .field input { padding: 14px; }
    .submit-zone .btn { width: 100%; }
    footer { padding-top: 20px; }

    .admin-topbar { position: static; padding: 10px 12px; align-items: flex-start; }
    .admin-brand span { display: none; }
    .admin-actions { flex-direction: column; }
    .admin-actions .btn { min-height: 34px; padding: 6px 9px; }
    .admin-container { width: min(100% - 20px, 1240px); padding-top: 20px; }
    .admin-heading { align-items: flex-start; flex-direction: column; }
    .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .metric { padding: 14px; }
    .metric strong { font-size: 27px; }
    .insights-grid { grid-template-columns: 1fr; }
    .dashboard-card { padding: 17px; }
    .roster-card { padding: 0; }
    .roster-toolbar { flex-direction: column; padding: 16px; }
    .roster-actions { justify-content: stretch; }
    .search-input { min-width: 0; width: 100%; }
    .filter-tabs { width: 100%; overflow-x: auto; }
    .filter-btn { flex: 1 0 auto; }
    .roster-actions > .btn { width: 100%; }
    .hour-chart { height: 125px; gap: 2px; }
    .chart-summary { flex-direction: column; gap: 4px; }
}

@media (max-width: 420px) {
    .event-details { grid-template-columns: 1fr; }
    .event-details article:last-child { grid-column: auto; }
    .countdown > div { padding-inline: 3px; }
    .countdown strong { font-size: 20px; }
    .metrics-grid { grid-template-columns: 1fr 1fr; }
    .metric span { font-size: 10px; }
    .metric small { font-size: 10px; }
}
