:root {
    color-scheme: light dark;
    --accent: #e8622c;
    --text: #1a1a1a;
    --muted: #5a5a5a;
    --border: #d8d8d8;
    --bg: #ffffff;
    --bg-alt: #f6f6f6;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text: #e8e8e8;
        --muted: #a8a8a8;
        --border: #3a3a3a;
        --bg: #181818;
        --bg-alt: #222222;
    }
}

* { box-sizing: border-box; }

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

.site-header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    /* Fixed light color, not var(--bg): the logo's wordmark uses fixed
       brand colors (dark gray + orange) that need a light background to
       stay legible, but pure white reads as a jarring bar against the
       dark-mode page, so a soft off-white instead of #fff. */
    background: #f0ede8;
}

.brand {
    display: inline-block;
    line-height: 0;
}

.brand img {
    /* Roughly matches .container's text width (700px) so the logo reads
       at the same scale as the page content below it. */
    width: min(90%, 700px);
    height: auto;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.container-wide {
    max-width: 1000px;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; margin-top: 2rem; }

.lede {
    color: var(--muted);
    font-size: 1.05rem;
}

.card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 1.25rem 0;
}

label {
    display: block;
    font-weight: 600;
    margin: 1rem 0 0.25rem;
}

.hint {
    font-weight: 400;
    color: var(--muted);
    font-size: 0.85rem;
}

input[type=text],
input[type=email],
input[type=tel],
input[type=password],
input[type=date],
select,
textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
}

textarea { resize: vertical; }

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 1.25rem 0;
}

.checkbox-row input { margin-top: 0.3rem; }

#card-container {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.7rem;
    background: var(--bg);
    min-height: 3.5rem;
}

.waiver-text {
    white-space: pre-wrap;
    max-height: 22rem;
    overflow-y: auto;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
}

button, .button {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    margin-top: 1.5rem;
}

button:hover, .button:hover { opacity: 0.92; }

.error-list {
    background: #fdecea;
    border: 1px solid #f2b8b5;
    color: #7d1f1a;
    border-radius: 6px;
    padding: 0.75rem 1.25rem;
    margin: 1rem 0;
}

@media (prefers-color-scheme: dark) {
    .error-list {
        background: #3a1a18;
        border-color: #6b2b26;
        color: #f2b8b5;
    }
}

.site-footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 2rem 1.5rem;
}

.site-footer a { color: var(--muted); }

/* --- Admin --- */

.admin-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-nav-right {
    color: var(--muted);
    font-size: 0.9rem;
}

.admin-nav-right a { color: var(--accent); }

.status-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0 1.5rem;
}

.status-tabs a {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
}

.status-tabs a.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.admin-table th, .admin-table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-table tr:hover td { background: var(--bg-alt); }

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bg-alt);
    border: 1px solid var(--border);
}

.status-badge.status-applied { color: #8a6300; border-color: #e0c15c; }
.status-badge.status-active { color: #1a7d3f; border-color: #6bbf8e; }
.status-badge.status-past_due { color: #b04a00; border-color: #e0955c; }
.status-badge.status-denied { color: #7d1f1a; border-color: #d98d88; }
.status-badge.status-cancelled { color: var(--muted); }

.charge-status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bg-alt);
    border: 1px solid var(--border);
}

.charge-status.charge-status-succeeded { color: #1a7d3f; border-color: #6bbf8e; }
.charge-status.charge-status-failed { color: #7d1f1a; border-color: #d98d88; }

.panel-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 700px) {
    .panel-columns { grid-template-columns: 1fr; }
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 1.5rem;
}

.detail-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
}

.detail-row dt {
    flex: 0 0 11rem;
    color: var(--muted);
    font-weight: 600;
}

.detail-row dd { margin: 0; }

.activity-item {
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
}

.activity-item:last-child { border-bottom: none; }

.activity-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.activity-detail {
    white-space: pre-wrap;
    margin-top: 0.25rem;
}
