:root {
    color-scheme: light;
    --ink: #162132;
    --muted: #667085;
    --line: #dfe4ea;
    --surface: #ffffff;
    --canvas: #f5f7fa;
    --brand: #8b1e2d;
    --brand-dark: #681520;
    --success: #176b45;
    --warning: #8a5a00;
    --danger: #a22323;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--ink); line-height: 1.55; }
a { color: var(--brand); text-underline-offset: 3px; }
.container { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.site-header { background: #151b26; color: white; border-bottom: 4px solid var(--brand); }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.brand { color: white; text-decoration: none; font-weight: 800; letter-spacing: .02em; }
nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
nav a, .link-button { color: #f7f7f8; text-decoration: none; font: inherit; }
.inline-form { display: inline; margin: 0; }
.link-button { appearance: none; border: 0; background: none; cursor: pointer; padding: 0; }
.text-button { appearance: none; border: 0; background: none; color: var(--brand); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.page-shell { min-height: calc(100vh - 140px); padding-block: 2.5rem 4rem; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); padding: 1.25rem 0; font-size: .9rem; }
.page-heading { margin-bottom: 1.5rem; }
.page-heading h1, .auth-panel h1 { margin: .15rem 0 .35rem; line-height: 1.15; font-size: clamp(2rem, 5vw, 3rem); }
.eyebrow { color: var(--brand); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 800; margin: 0; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.4rem; box-shadow: 0 8px 30px rgba(17, 24, 39, .05); }
.auth-panel { width: min(480px, 100%); margin: 5vh auto; }
.stack { display: grid; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.address-locality-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(120px, .9fr) minmax(120px, 1fr); gap: 1rem; }
.address-locality-row > label { min-width: 0; }
.form-field { display: grid; gap: .4rem; }
.field-label-inline { display: flex; align-items: baseline; gap: .45rem; font-weight: 650; }
.field-label-inline a { font-size: .9rem; font-weight: 650; white-space: nowrap; }
label { display: grid; gap: .4rem; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid #bfc7d1; border-radius: 8px; background: white; color: var(--ink); padding: .72rem .8rem; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(139, 30, 45, .15); border-color: var(--brand); }
.button { display: inline-flex; justify-content: center; align-items: center; border: 1px solid var(--brand); border-radius: 8px; background: var(--brand); color: white; padding: .7rem 1rem; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--brand-dark); }
.button.secondary { background: white; color: var(--brand); }
.compact-button { padding: .4rem .7rem; font-size: .9rem; }
.field-label { display: block; font-weight: 650; }
.button-row, .split { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.split.compact { align-items: flex-start; }
.auth-links { text-align: center; margin-bottom: 0; }
.alert { border-radius: 9px; border: 1px solid currentColor; padding: .85rem 1rem; margin-bottom: 1rem; }
.alert-success { color: var(--success); background: #edf9f3; }
.alert-error { color: var(--danger); background: #fff1f1; }
.alert-warning { color: var(--warning); background: #fff8e5; }
.alert-info { color: #245b84; background: #eff7ff; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.athlete-card h2 { margin-bottom: .25rem; }
.athlete-card-identity, .athlete-table-identity { display: flex; align-items: center; gap: .8rem; }
.athlete-card-identity { margin-top: 1rem; }
.athlete-card-identity h2 { margin: 0; }
.athlete-list-photo { width: 64px; aspect-ratio: 1; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; background: #f3e7e9; color: var(--brand); font-size: 1.15rem; font-weight: 800; }
.athlete-list-photo img { width: 100%; height: 100%; object-fit: cover; }
.athlete-list-photo-small { width: 42px; font-size: .8rem; }
.status { display: inline-block; border-radius: 999px; background: #edf0f4; padding: .15rem .6rem; font-size: .82rem; font-weight: 750; }
.status-active { color: var(--success); background: #e7f7ef; }
.status-pay_per_session { color: #315a73; background: #e7f3f9; }
.status-pending, .status-pending_verification { color: var(--warning); background: #fff3d3; }
.status-disabled, .status-suspended, .status-inactive { color: var(--danger); background: #ffe8e8; }
.schema-summary-grid h2 { overflow-wrap: anywhere; }
.schema-log { margin: 1rem 0 0; padding-left: 1.35rem; }
.schema-log li + li { margin-top: .45rem; }
.schema-results { max-height: 32rem; overflow: auto; white-space: pre-wrap; border-radius: .5rem; background: #101927; color: #f3f6fa; padding: 1rem; }
.session-card-list { display: grid; gap: 1rem; }
.training-session-card h2, .admin-session-card h3 { margin: .15rem 0 .35rem; }
.session-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; color: var(--muted); font-size: .92rem; margin: .85rem 0; }
.session-athlete-list { border-top: 1px solid var(--line); margin-top: 1rem; }
.session-athlete-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.session-athlete-row:last-child { border-bottom: 0; padding-bottom: 0; }
.session-athlete-row > div:first-child { display: grid; gap: .15rem; }
.compact-actions { justify-content: flex-end; flex-wrap: wrap; }
.duration-input { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(120px, .7fr); gap: .65rem; }
.inline-fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
.inline-fieldset legend { font-weight: 650; margin-bottom: .4rem; padding: 0; }
.nested-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.roster-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .65rem; }
.roster-person { display: grid; border: 1px solid var(--line); border-radius: 9px; padding: .75rem; }
.roster-details { border-top: 1px solid var(--line); padding-top: .85rem; margin-top: .85rem; }
.roster-details summary { color: var(--brand); cursor: pointer; font-weight: 750; }
.attendance-roster { display: grid; gap: .65rem; margin-top: .85rem; }
.attendance-roster .session-athlete-row { background: #fafbfc; border: 1px solid var(--line); border-radius: 9px; padding: .85rem; }
.attendance-roster .session-athlete-row:last-child { border-bottom: 1px solid var(--line); padding-bottom: .85rem; }
.attendance-athlete-name { color: var(--ink); font-weight: 800; }
.inline-reason-form { display: flex; align-items: center; gap: .5rem; max-width: 420px; }
.admin-session-card.is-cancelled { opacity: .8; }
.danger-zone { border-color: #e4b8b8; }
.input-suffix { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .55rem; }
.input-suffix span { color: var(--muted); }
.filter-bar { display: flex; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.filter-bar label { min-width: 200px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .8rem .65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.actions { text-align: right; }
.empty-cell, .empty-state { text-align: center; color: var(--muted); padding-block: 2rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
dl { display: grid; grid-template-columns: minmax(100px, .6fr) 1.4fr; gap: .55rem 1rem; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 600; }
.notice { border-left: 4px solid var(--warning); background: #fff8e5; padding: .75rem 1rem; }
.section-space { margin-top: 1rem; }
.file-list { padding-left: 1.2rem; }
.file-list li { margin-block: .45rem; }
.compact-form { margin-bottom: 1.25rem; }
.profile-photo-panel { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 1.4rem; align-items: start; margin-bottom: 1.25rem; }
.athlete-profile-photo { width: 150px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; background: #f3e7e9; color: var(--brand); font-size: 2.4rem; font-weight: 800; }
.athlete-profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo-controls h2 { margin-top: 0; }
.profile-photo-controls .compact-form { margin-bottom: 0; }
.upload-help { margin: 0; font-size: .9rem; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.checkbox-row { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: .65rem; font-weight: 500; }
.checkbox-row input { width: auto; margin-top: .3rem; }
.legal-copy { max-width: 850px; }
.legal-copy h2, .legal-copy h3, .legal-copy h4 { line-height: 1.25; }
.legal-copy details { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.legal-copy summary, .signed-waiver-snapshot summary { color: var(--brand); cursor: pointer; font-weight: 700; }
.signed-waiver-snapshot { border-left: 3px solid var(--line); margin-top: 1rem; padding-left: 1rem; }
.waiver-signature-form { max-width: 850px; }
.signature-contact-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.signature-contact-grid .wide { grid-column: 1 / -1; }
.signature-field { display: grid; gap: .55rem; }
.signature-field-heading { align-items: end; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; }
.field-label { display: block; font-weight: 700; }
.compact-button { padding: .45rem .75rem; }
.signature-method-switch {
    align-items: center;
    background: #edf0f4;
    border: 1px solid var(--line);
    border-radius: 9px;
    display: inline-flex;
    padding: .2rem;
    width: fit-content;
}
.signature-method-button {
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: .9rem;
    font-weight: 750;
    padding: .45rem .75rem;
}
.signature-method-button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(15, 23, 42, .14); color: var(--brand); }
.signature-method-button:focus-visible { outline: 3px solid rgba(139, 30, 45, .18); outline-offset: 2px; }
.typed-signature-panel[hidden] { display: none; }
.typed-signature-input {
    font-family: "Brush Script MT", "Segoe Script", "Lucida Handwriting", cursive;
    font-size: 1.55rem;
}
.signature-pad-frame {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: .65rem;
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, .05);
    overflow: hidden;
    position: relative;
}
.signature-pad-frame:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(139, 30, 45, .14); }
.signature-pad-canvas {
    cursor: crosshair;
    display: block;
    height: 220px;
    position: relative;
    touch-action: none;
    width: 100%;
    z-index: 1;
}
.signature-pad-canvas:focus { outline: none; }
.signature-pad-canvas[aria-invalid="true"] { box-shadow: inset 0 0 0 2px #b42318; }
.signature-baseline {
    border-top: 1px solid #aeb7c5;
    bottom: 42px;
    left: 7%;
    pointer-events: none;
    position: absolute;
    right: 7%;
}
.field-error { color: #b42318; font-size: .9rem; font-weight: 700; margin: 0; }
.waiver-signature-evidence { margin: 1rem 0; }
.waiver-signature-evidence figcaption { color: var(--muted); font-size: .85rem; font-weight: 700; margin-bottom: .35rem; }
.waiver-signature-evidence img {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: .5rem;
    display: block;
    height: auto;
    max-height: 180px;
    max-width: min(100%, 520px);
}
.waiver-editor-form { max-width: 900px; }
.waiver-editor-form .note-editor { background: var(--surface); color: var(--ink); font-weight: 400; }
.waiver-editor-form .note-toolbar { background: #f4f5f7; border-bottom-color: var(--line); }
.waiver-editor-form .note-editable { background: var(--surface); color: var(--ink); line-height: 1.55; }
.waiver-editor-form .note-editor.note-airframe.fullscreen,
.waiver-editor-form .note-editor.note-frame.fullscreen {
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: var(--surface);
    box-shadow: none;
}
.waiver-editor-form .note-editor.fullscreen .note-toolbar {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    max-height: 40vh;
    overflow-y: auto;
    background: #f4f5f7;
}
.waiver-editor-form .note-editor.fullscreen .note-editing-area {
    flex: 1 1 auto;
    min-height: 0;
    background: var(--surface);
}
.waiver-editor-form .note-editor.fullscreen .note-editable {
    height: 100% !important;
    min-height: 0;
    padding: 1.5rem max(1.5rem, calc((100vw - 900px) / 2));
    overflow-y: auto;
    background: var(--surface);
}
.waiver-editor-form .note-editor.fullscreen .note-statusbar { display: none; }
body.note-fullscreen-body, html.note-fullscreen-body { overflow: hidden !important; }
.editor-help { margin: 0; font-size: .9rem; }
.card-number { font-size: 1.25rem; font-weight: 750; letter-spacing: .03em; }
.identifier { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; }
.action-panel { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.action-panel h3 { margin: 0; }
.featured-panel { border-color: rgba(139, 30, 45, .45); background: #fffafb; }
.danger-panel { border-color: rgba(162, 35, 35, .35); }
.danger-button { background: var(--danger); border-color: var(--danger); }
.danger-button:hover { background: #801b1b; }
.danger-text { color: var(--danger); }
.form-action-align { display: flex; align-items: end; }
.billing-overview-grid { align-items: stretch; }
.billing-methods-card h2 { margin: .25rem 0 .35rem; }
.billing-methods-card .split > div > .muted { margin: .25rem 0 0; }
.subscription-value-actions { align-items: center; display: flex; flex-wrap: wrap; gap: .7rem; }
.compact-action { font-size: .88rem; font-weight: 750; white-space: nowrap; }
.compact-empty-state { padding-block: 1.25rem; }
.billing-consent { border-top: 1px solid var(--line); padding-top: 1rem; }
.embedded-payment-panel { border: 1px solid rgba(139, 30, 45, .35); border-radius: 12px; background: #fffafb; margin-top: 1.25rem; padding: 1.2rem; }
.embedded-payment-panel h3 { margin: .2rem 0 0; }
.stripe-element-frame { min-height: 120px; border-radius: 10px; background: white; padding: .8rem; }
.checkout-total { color: var(--brand); font-size: 1.3rem; }
.checkout-actions { justify-content: flex-start; }
.payment-method-list { display: grid; gap: .75rem; }
.payment-method-card { align-items: center; border: 1px solid var(--line); border-radius: 10px; display: flex; justify-content: space-between; gap: 1rem; padding: 1rem; }
.payment-method-card p { margin: .25rem 0 0; }
.payment-method-title, .payment-method-actions { align-items: center; display: flex; flex-wrap: wrap; gap: .65rem; }
.stripe-billing-status { position: relative; }
.billing-dialog {
    background: var(--surface);
    border: 0;
    border-radius: 14px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .3);
    color: var(--ink);
    max-height: min(86vh, 760px);
    overflow: auto;
    padding: 1.4rem;
    width: min(560px, calc(100% - 2rem));
}
.billing-dialog:not([open]) { display: none; }
.billing-dialog::backdrop { background: rgba(15, 23, 42, .68); backdrop-filter: blur(2px); }
.billing-dialog-header { align-items: flex-start; border-bottom: 1px solid var(--line); display: flex; gap: 1rem; justify-content: space-between; margin-bottom: 1.2rem; padding-bottom: 1rem; }
.billing-dialog-header h2 { line-height: 1.2; margin: .2rem 0 0; }
.dialog-close { align-items: center; appearance: none; background: #f1f3f6; border: 0; border-radius: 50%; color: var(--ink); cursor: pointer; display: inline-flex; flex: 0 0 auto; font: inherit; font-size: 1.35rem; height: 2rem; justify-content: center; line-height: 1; width: 2rem; }
.dialog-close:hover { background: #e4e7ec; }
.dialog-close:focus-visible { outline: 3px solid rgba(139, 30, 45, .18); outline-offset: 2px; }
.billing-dialog-actions { align-items: center; display: flex; flex-wrap: wrap; gap: .75rem; justify-content: flex-end; margin-top: 1.2rem; }
.stripe-payment-dialog { width: min(640px, calc(100% - 2rem)); }
.stripe-payment-dialog .stripe-element-frame { margin-top: 1rem; }
.catalog-create, .catalog-edit { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.catalog-create { margin-top: 1rem; background: #fafbfc; }
.catalog-create > summary, .catalog-edit > summary { color: var(--primary); cursor: pointer; font-weight: 750; }
.catalog-list { display: grid; gap: 1rem; }
.catalog-item { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.catalog-item-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.catalog-item-header h3, .catalog-item-header p { margin: 0; }
.catalog-identifiers { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .35rem .8rem; margin: 1rem 0; }
.catalog-identifiers dt { font-weight: 750; }
.catalog-identifiers dd { margin: 0; overflow-wrap: anywhere; }
.catalog-edit[open] { background: #fafbfc; }
.catalog-delete-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: .8rem; align-items: end; border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.field-help { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; margin-top: .25rem; }
.credit-overview-grid { align-items: stretch; }
.credit-balance-card { background: linear-gradient(145deg, #fff 0%, #fff8f9 100%); border-color: rgba(139, 30, 45, .3); }
.credit-balance-value { color: var(--brand); font-size: clamp(2.35rem, 7vw, 4.25rem); font-weight: 850; letter-spacing: -.045em; line-height: 1; margin: .5rem 0 .75rem; }
.saved-card-fieldset { border: 0; margin: 0; min-width: 0; padding: 0; }
.saved-card-fieldset legend { font-weight: 750; margin-bottom: .45rem; }
.saved-card-option { align-items: center; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; display: flex; flex-direction: row; gap: .75rem; margin-bottom: .55rem; padding: .75rem; }
.saved-card-option:has(input:checked) { background: #fffafb; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(139, 30, 45, .08); }
.saved-card-option input { flex: 0 0 auto; margin: 0; width: auto; }
.saved-card-option span { display: grid; gap: .15rem; }
.saved-card-option small { color: var(--muted); }
button:disabled, .button:disabled { cursor: not-allowed; opacity: .55; }
hr { border: 0; border-top: 1px solid var(--line); width: 100%; }
@media (max-width: 760px) {
    .header-inner, .split, .button-row { align-items: flex-start; flex-direction: column; }
    nav { gap: .75rem; }
    .form-grid, .detail-grid { grid-template-columns: 1fr; }
    .catalog-item-header { align-items: flex-start; flex-direction: column; }
    .catalog-delete-form { grid-template-columns: 1fr; }
    .form-grid .wide { grid-column: auto; }
    .filter-bar { align-items: stretch; flex-direction: column; }
    .payment-method-card { align-items: flex-start; flex-direction: column; }
    .session-athlete-row, .inline-reason-form { align-items: stretch; flex-direction: column; }
    .nested-grid, .duration-input { grid-template-columns: 1fr; }
    .billing-dialog-actions { align-items: stretch; flex-direction: column-reverse; }
    .billing-dialog-actions .button { width: 100%; }
}
@media (max-width: 600px) {
    .address-locality-row { grid-template-columns: 1fr; }
    .profile-photo-panel { grid-template-columns: 1fr; }
    .athlete-profile-photo { width: 120px; }
    .signature-contact-grid { grid-template-columns: 1fr; }
    .signature-contact-grid .wide { grid-column: auto; }
}
