:root {
    color-scheme: only light;
    --navy: #16191d;
    --navy-dark: #090b0d;
    --blue: #d86100;
    --blue-pale: #fff1e5;
    --orange: #f57c00;
    --orange-dark: #c55200;
    --orange-pale: #fff4e8;
    --teal: #147d73;
    --amber: #a35c00;
    --amber-pale: #fff3d6;
    --red: #a52a2a;
    --red-pale: #fdeaea;
    --ink: #1f2937;
    --muted: #5c6878;
    --line: #cfd8e2;
    --surface: #ffffff;
    --background: #f5f5f3;
    --radius: 12px;
    --shadow: 0 8px 24px rgba(15, 39, 69, 0.08);
}

* { box-sizing: border-box; }

html { color-scheme: only light; font-family: Aptos, "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--background); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--background); color: var(--ink); }
a { color: var(--navy); }

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem clamp(1rem, 4vw, 3rem);
    background: #101214;
    color: #fff;
    border-bottom: 4px solid var(--orange);
}

.brand { display: flex; align-items: center; gap: 0.75rem; color: #fff; text-decoration: none; font-weight: 750; font-size: 1.05rem; }
.brand-logo { width: 58px; height: 58px; object-fit: contain; flex: 0 0 auto; border-radius: 50%; background: #fff; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-size: 1rem; }
.brand-copy small { margin-top: 0.2rem; color: #ffb36f; font-size: 0.78rem; font-weight: 750; letter-spacing: 0.04em; }
.site-header nav { display: flex; align-items: center; gap: 0.85rem; }
.site-header form { margin: 0; }
.signed-in { color: #dbe7f3; font-size: 0.88rem; }
.environment-banner { padding: 0.45rem 1rem; background: #272b30; color: #fff; text-align: center; font-size: 0.86rem; font-weight: 700; }

.page-shell { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2rem, 5vw, 4.5rem) 0; flex: 1; }
.site-footer { padding: 1.5rem; color: var(--muted); text-align: center; font-size: 0.84rem; }

h1, h2 { color: #111315; line-height: 1.15; }
h1 { margin: 0 0 1rem; font-size: clamp(2rem, 6vw, 3.7rem); }
h2 { margin: 0 0 0.65rem; font-size: 1.25rem; }
p { line-height: 1.55; }
.lead { max-width: 760px; font-size: clamp(1.05rem, 2.5vw, 1.3rem); color: #3f4d5d; }
.eyebrow { margin: 0 0 0.65rem; color: var(--orange-dark); font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.78rem; }

.hero { padding: clamp(2rem, 6vw, 4rem); border-radius: 20px; background: linear-gradient(145deg, #fff, var(--orange-pale)); box-shadow: var(--shadow); border: 1px solid #e5d8ca; }
.hero-branded { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 340px); align-items: center; gap: clamp(1.5rem, 4vw, 3rem); }
.hero-logo { width: 100%; max-width: 340px; justify-self: end; object-fit: contain; }
.notice-card, .action-panel, .table-card { margin-top: 1.5rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.page-heading { margin-bottom: 1.6rem; }
.page-heading h1 { font-size: clamp(2rem, 5vw, 3rem); }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.feature-card { min-height: 190px; padding: 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.feature-card p { margin-bottom: 0; color: var(--muted); }
.card-action { margin-top: 1.1rem; }
.status { display: inline-block; margin-bottom: 1rem; padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.76rem; font-weight: 800; }
.status-ready { color: #095f58; background: #d8f2ef; }
.status-next { color: #783500; background: #ffe2c2; }
.status-planned { color: #67531a; background: #f4ebc9; }

.warning-banner { margin-bottom: 1.25rem; padding: 1rem 1.15rem; background: var(--amber-pale); border-left: 5px solid var(--amber); border-radius: 8px; line-height: 1.5; }
.alert { margin-bottom: 1rem; padding: 1rem; border-radius: 8px; font-weight: 650; }
.alert-error { background: var(--red-pale); color: #7c1f1f; border: 1px solid #efbaba; }
.alert-info { background: var(--blue-pale); color: var(--navy-dark); border: 1px solid #c4daea; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 0.72rem 1.1rem; border: 0; border-radius: 8px; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
.button-primary { color: #17191c; background: var(--orange); }
.button-primary:hover { color: #fff; background: var(--orange-dark); }
.button-secondary { color: #17191c; background: #fff; border: 2px solid var(--orange); }
.button-quiet { color: #fff; background: transparent; border: 1px solid #8ca2bb; }
.button-full { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.text-link { display: inline-block; margin-top: 1.5rem; font-weight: 750; }
.page-return-top { margin: 0 0 1rem; }
.admin-return-nav .page-return-top { display: inline-flex; min-height: 44px; align-items: center; padding: 0.45rem 0.7rem; border-radius: 8px; }
.admin-return-nav .page-return-top:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.page-return-bottom { margin-top: 1.5rem; }

.auth-card, .error-card { width: min(480px, 100%); margin: 0 auto; padding: clamp(1.5rem, 5vw, 2.5rem); background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--orange); border-radius: 16px; box-shadow: var(--shadow); }
.login-logo { display: block; width: min(210px, 58vw); height: auto; margin: -0.25rem auto 1.25rem; }
.club-endorsement { margin: 1rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); color: #505b68; text-align: center; font-size: 0.82rem; font-weight: 750; }
.auth-card h1, .error-card h1 { font-size: 2.25rem; }
.field { margin: 1.2rem 0; }
.field label { display: block; margin-bottom: 0.45rem; font-weight: 750; }
.field input, .field select, .field textarea, .compact-field input, .compact-field select { width: 100%; min-height: 48px; padding: 0.75rem; border: 1px solid #9baabb; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.field textarea { resize: vertical; }
.checkbox-field { display: flex; align-items: center; gap: 0.65rem; }
.checkbox-field input { width: 1.25rem; min-height: 1.25rem; }
.checkbox-field label { margin: 0; }
.conditional-details[hidden] { display: none; }
.conditional-details { padding-left: 1rem; border-left: 4px solid var(--orange); }
.file-field input { padding: 0.65rem; background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus, .compact-field input:focus, .compact-field select:focus { outline: 3px solid #ffd1a6; border-color: var(--orange-dark); }
.field-error { display: block; margin-top: 0.35rem; color: var(--red); font-size: 0.87rem; }
.field-hint { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.84rem; }
.form-footnote { margin: 1.2rem 0 0; color: var(--muted); font-size: 0.88rem; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.72rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: #181b1f; color: #fff; border-bottom-color: var(--orange); }
.panel-first { margin-top: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(5, minmax(90px, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.summary-grid div { padding: 0.85rem; border: 1px solid var(--line); border-radius: 8px; background: #fafafa; text-align: center; }
.summary-grid strong, .summary-grid span { display: block; }
.summary-grid strong { font-size: 1.45rem; }
.summary-grid span { margin-top: 0.2rem; color: var(--muted); font-size: 0.83rem; }
.summary-grid .summary-error { border-color: #df9b9b; background: var(--red-pale); }
.import-preview { max-height: 520px; border: 1px solid var(--line); }
.import-preview thead th { position: sticky; top: 0; z-index: 1; }
.import-action { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 999px; font-size: 0.76rem; font-weight: 800; }
.action-new { color: #095f58; background: #d8f2ef; }
.action-update { color: #783500; background: #ffe2c2; }
.action-unchanged { color: #425466; background: #e8edf2; }
.action-error { color: #7c1f1f; background: var(--red-pale); }
.row-error td { background: #fff7f7; }
.validation-cell { white-space: normal; min-width: 260px; }
.confirm-form { margin-top: 1.25rem; padding: 1rem; border-left: 5px solid var(--orange); background: var(--orange-pale); }
.heading-with-actions, .section-heading-row, .danger-panel { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }
.heading-with-actions > div:first-child { min-width: 0; }
.section-heading-row { margin-bottom: 1rem; }
.section-heading-row h2 { margin-bottom: 0; }
.result-count { color: var(--muted); font-size: 0.9rem; }
.filter-form { display: grid; grid-template-columns: minmax(190px, 1.5fr) repeat(3, minmax(145px, 1fr)) auto; align-items: end; gap: 0.9rem; }
.compact-field { margin: 0; }
.compact-field label { display: block; margin-bottom: 0.45rem; font-weight: 750; }
.filter-actions { display: flex; gap: 0.5rem; padding-bottom: 0.05rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; }
.field-wide { grid-column: 1 / -1; }
.form-actions { margin-top: 1.25rem; }
.record-status { display: grid; grid-template-columns: auto auto; gap: 0.25rem 0.8rem; min-width: 220px; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.record-status span { color: var(--muted); font-size: 0.84rem; }
.account-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 0; }
.account-summary div { padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: #fafafa; }
.account-summary dt { color: var(--muted); font-size: 0.88rem; font-weight: 750; }
.account-summary dd { margin: 0.35rem 0 0; color: var(--ink); font-size: 1.1rem; font-weight: 800; }
.member-status { display: inline-block; padding: 0.25rem 0.55rem; border-radius: 999px; font-size: 0.78rem; font-weight: 750; }
.status-pending-activation { color: #783500; background: #ffe2c2; }
.status-admin-managed { color: #095f58; background: #d8f2ef; }
.status-active { color: #095f58; background: #d8f2ef; }
.status-inactive { color: #6b2630; background: #f3dadd; }
.table-action { font-weight: 750; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; }
.pagination-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.35rem; }
.pagination-page { display: inline-flex; min-width: 2.4rem; min-height: 2.4rem; align-items: center; justify-content: center; padding: 0.35rem 0.55rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font-weight: 750; text-decoration: none; }
.pagination-page:hover { border-color: var(--orange); }
.pagination-page.is-current { border-color: var(--orange); background: var(--orange); color: #17191c; }
.pagination-ellipsis { padding: 0 0.2rem; color: var(--muted); }
.pagination-step { flex: 0 0 auto; }
.pagination .is-disabled { opacity: 0.45; cursor: not-allowed; }
.danger-panel { margin-top: 1.5rem; padding: 1.25rem 1.5rem; border: 1px solid #df9b9b; border-radius: var(--radius); background: #fff8f8; }
.danger-panel h2, .danger-panel p { margin-top: 0; }
.danger-panel p { margin-bottom: 0; }
.button-danger { color: #fff; background: var(--red); }
.button-danger:hover { background: #7c1f1f; }
.confirmation-panel { border-top: 5px solid var(--red); }
.paa-card { box-shadow: none; }
.paa-grid { display: grid; grid-template-columns: 1fr; gap: 0.35rem; }
.paa-dimension { min-width: 0; margin: 0.65rem 0; padding: 0; border: 0; }
.paa-dimension legend { margin-bottom: 0.55rem; font-weight: 800; }
.paa-options { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.5rem; }
.paa-option { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem; min-height: 104px; margin: 0; padding: 0.75rem; border: 2px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; text-align: center; overflow-wrap: anywhere; }
.paa-option:hover { border-color: var(--orange); }
.paa-option:has(input:checked) { border-color: var(--orange-dark); background: var(--orange-pale); box-shadow: inset 0 0 0 1px var(--orange-dark); }
.paa-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.paa-option:has(input:focus-visible) { outline: 3px solid #214f94; outline-offset: 2px; }
.paa-option:has(input:checked) .paa-score::before { content: '✓ '; }
.paa-score { font-size: 1.6rem; font-weight: 850; }
.paa-meaning { color: var(--muted); font-size: 0.8rem; line-height: 1.3; }
.paa-option:has(input:disabled) { cursor: default; opacity: 0.78; }
.checklist { margin: 1.25rem 0; padding: 1.25rem; border: 1px solid var(--line); border-radius: 8px; }
.checklist legend { padding: 0 0.4rem; font-weight: 800; }
.check-option { display: flex; align-items: center; gap: 0.7rem; margin: 0.7rem 0; }
.check-option input { width: 1.25rem; height: 1.25rem; }

@media (max-width: 760px) {
    .site-header { align-items: flex-start; flex-direction: column; }
    .site-header nav { width: 100%; justify-content: space-between; }
    .signed-in { max-width: 65%; }
    .card-grid { grid-template-columns: 1fr; }
    .hero-branded { grid-template-columns: 1fr; text-align: center; }
    .hero-branded .lead { margin-left: auto; margin-right: auto; }
    .hero-logo { max-width: 250px; justify-self: center; grid-row: 1; }
    .feature-card { min-height: 0; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .heading-with-actions, .danger-panel { align-items: stretch; flex-direction: column; }
    .filter-form, .form-grid { grid-template-columns: 1fr; }
    .field-wide { grid-column: auto; }
    .filter-actions { flex-wrap: wrap; }
    .pagination { align-items: stretch; flex-direction: column; }
    .pagination-step { width: 100%; }
    .record-status { width: 100%; }
    .account-summary { grid-template-columns: 1fr; }
    .paa-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page-shell { width: min(100% - 1rem, 1120px); padding: 1.25rem 0 2rem; }
    .hero { border-radius: 12px; }
}
@media (min-width: 761px) and (max-width: 1050px) { .paa-options { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 360px) { .paa-options { grid-template-columns: 1fr; } }
.status-current { border-left: 4px solid #3c8355; }
.about-g3d { display: block; max-width: 180px; max-height: 90px; object-fit: contain; filter: grayscale(1); }
.affiliation-list { display: flex; flex-wrap: wrap; gap: 1rem; }
.affiliation { border: 1px solid var(--line); border-left: 4px solid #3c8355; border-radius: 8px; padding: 0.7rem 1rem; }
.affiliation summary { cursor: pointer; font-weight: 700; }

/* Card actions align independently of description length. */
.card-grid .feature-card { display: flex; flex-direction: column; }
.card-actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: .65rem; margin-top: auto; padding-top: 1.2rem; }
.card-actions .button { margin: 0; text-align: center; }
.admin-row-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.admin-row-actions form { margin: 0; }
.affiliation { border-left: 1px solid var(--line); padding: .7rem; }
.affiliation summary { list-style: none; }
.affiliation summary::-webkit-details-marker { display: none; }
.affiliation-logo { position: relative; display: grid; place-items: center; width: 145px; height: 105px; padding: .6rem; border-radius: 8px; background: white; }
.affiliation-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.affiliation-logo-bmmc { padding: 1.1rem 1.5rem 1.3rem; }
.affiliation-logo-bmmc img { object-position: center; transform: translateY(-12px); }
.affiliation-tick { position: absolute; bottom: 2px; right: 2px; background: #256b3a; color: white; border-radius: 50%; width: 1.5rem; height: 1.5rem; text-align: center; font-weight: bold; }
.affiliation[open] p { margin: .6rem 0 0; }
.affiliation summary:focus-visible { outline: 3px solid #d66b00; outline-offset: 3px; }
@media (max-width: 600px) { .card-actions { flex-direction: column; } .card-actions .button { width: 100%; } }
.catalogue-logo { max-width: 100px; max-height: 65px; object-fit: contain; vertical-align: middle; }
.event-grid .feature-card { min-width: 0; }
.event-grid .feature-card p { overflow-wrap: anywhere; }
/* Event editor follows the portal's existing panel and field treatment. */
.event-section { padding: clamp(1.2rem, 3vw, 1.7rem); }
.event-section h2 { padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
.event-form-grid { column-gap: 1.5rem; row-gap: .1rem; }
.event-form-grid .field { min-width: 0; margin: .65rem 0; }
.event-form-grid .field input[hidden] { display: none; }
.event-form-grid .field input:not([hidden]) + input:not([hidden]) { margin-top: .65rem; }
.event-date-list { display: grid; gap: .7rem; margin: 1.1rem 0; }
.event-date-row { display: flex; align-items: end; gap: 1rem; padding: .7rem 1rem; background: #fafafa; border: 1px solid var(--line); border-radius: 8px; }
.event-date-row .field { width: min(290px, 100%); margin: 0; }
.event-date-row input[type=date] { max-width: 290px; }
.event-date-display { display: block; min-height: 1.3em; margin-top: .35rem; font-weight: 700; color: var(--ink); }
.event-date-remove[hidden] { display: none; }
.event-form-actions { margin: 1.5rem 0; }
@media (max-width: 600px) { .event-date-row { align-items: stretch; flex-direction: column; } .event-date-row .field, .event-date-row input[type=date] { width: 100%; max-width: none; } .event-date-row .button { align-self: flex-start; } }

/* Marshal event calendar */
.marshal-calendar { min-width: 0; }
.calendar-navigation { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }
.calendar-navigation h2 { margin: 0; text-align: center; font-size: clamp(1.1rem, 3vw, 1.6rem); }
.calendar-navigation .button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .35rem; }
.calendar-weekday { text-align: center; font-weight: 700; padding: .4rem 0; }
.weekday-short { display: none; }
.calendar-day { min-width: 0; min-height: 76px; border: 1px solid var(--line); border-radius: 8px; }
.calendar-day.has-events { border-color: var(--orange); background: var(--orange-pale); }
.calendar-day.calendar-today { background: #dceeff; border-color: #3977a6; }
.calendar-day.calendar-today.has-events { background: #dceeff; border-color: var(--orange); }
.marshal-events-entry .button { margin-top: .55rem; max-width: 100%; text-align: center; }
.calendar-pending { display: inline-block; color: #263b50; background: #e8ebef; border: 1px solid #909ca9; border-radius: 5px; font-size: .72rem; font-weight: 700; padding: .1rem .25rem; }
.attendance-pending { padding: .8rem; border: 1px solid #909ca9; border-radius: 8px; background: #f1f3f5; line-height: 1.5; }
.calendar-event-detail form .button { max-width: 100%; min-height: 48px; }
.pending-request-list { display: grid; gap: .75rem; padding: 0; list-style: none; }
.pending-request-list li { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; overflow-wrap: anywhere; }
.calendar-day-button { width: 100%; height: 100%; min-height: 76px; padding: .4rem; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: .3rem; overflow-wrap: anywhere; }
.calendar-day-button:hover, .calendar-day-button:focus-visible { outline: 3px solid var(--orange-dark); outline-offset: -3px; border-radius: 8px; }
.calendar-event-count { font-size: .78rem; font-weight: 700; color: var(--orange-dark); }
.calendar-state-short { display: none; }
.calendar-day-empty { display: block; padding: .4rem; }
.calendar-empty { color: var(--muted); margin: 1rem 0 0; }
.calendar-dialog { width: min(620px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); padding: clamp(1rem, 3vw, 1.5rem); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-y: auto; overflow-x: hidden; }
.calendar-dialog::backdrop { background: rgba(10, 15, 20, .65); }
.calendar-dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.calendar-dialog-header h2 { margin: 0; overflow-wrap: anywhere; }
.calendar-close { min-height: 44px; flex: 0 0 auto; }
.calendar-event-detail { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; overflow-wrap: anywhere; }
.calendar-event-detail h3 { margin: 0 0 1rem; }
.calendar-details { margin: 0; }
.calendar-details div { margin: 0 0 .8rem; }
.calendar-details dt { font-weight: 700; }
.calendar-details dd { margin: .2rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.calendar-organiser-logo { max-width: min(100%, 240px); max-height: 100px; width: auto; height: auto; object-fit: contain; }
@media (max-width: 600px) {
  .calendar-grid { gap: .18rem; }
  .calendar-day, .calendar-day-button { min-height: 58px; }
  .calendar-day-button { padding: .2rem; align-items: center; text-align: center; }
  .calendar-day-empty { padding: .25rem; text-align: center; }
  .calendar-event-count { font-size: .65rem; line-height: 1.1; }
  .calendar-pending { font-size: .6rem; line-height: 1.1; }
  .weekday-full { display: none; }
  .weekday-short { display: inline; }
  .calendar-navigation .button { padding: .45rem; font-size: .8rem; }
  .calendar-dialog-header { flex-wrap: wrap; }
}
@media (max-width: 360px) { .calendar-event-count { font-size: .58rem; } }
@media (max-width: 600px) {
  .marshal-calendar { padding: .75rem; }
  .calendar-navigation { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .calendar-navigation h2 { grid-column: 1 / -1; grid-row: 1; }
  .calendar-navigation .button { min-width: 0; text-align: center; }
  .calendar-navigation .button:last-child { grid-column: 2; }
  .calendar-grid { gap: .12rem; }
  .calendar-day { min-height: 64px; }
  .calendar-day-button { min-height: 64px; gap: .08rem; padding: .15rem .05rem; }
  .calendar-day-button strong { line-height: 1; }
  .calendar-event-count { font-size: .58rem; white-space: nowrap; }
  .calendar-day-button .calendar-status { font-size: .63rem; line-height: 1; padding: .1rem; white-space: nowrap; }
  .calendar-state-label { display: none; }
  .calendar-state-short { display: inline; }
  .calendar-dialog { width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); padding: .85rem; }
  .calendar-dialog-header { align-items: stretch; }
  .calendar-dialog-header h2 { font-size: 1.15rem; }
  .calendar-close { margin-left: auto; }
  .calendar-event-detail form .button, .calendar-event-detail > .button { width: 100%; }
  .action-panel, .notice-card, .table-card { padding: 1rem; }
  .button-row .button { max-width: 100%; }
}
@media (max-width: 380px) {
  .calendar-day-button .calendar-status { font-size: .56rem; }
  .calendar-event-count { font-size: .52rem; }
  .calendar-day-empty { padding: .15rem; }
}
@media (min-width: 601px) and (max-width: 1050px) {
  .table-scroll { max-width: 100%; }
  .button-row { flex-wrap: wrap; }
}

/* Attendance decisions and calendar status */
.booking-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.booking-actions .button { min-height: 44px; }
.calendar-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: 1rem 0 0; }
.calendar-status, .calendar-today-legend { display: inline-block; border: 1px solid #8894a1; border-radius: 5px; padding: .1rem .3rem; font-size: .72rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.calendar-status-pending { background: #e8ebef; color: #263b50; }
.calendar-status-confirmed { background: #d8f2ef; color: #095f58; }
.calendar-status-reserve { background: #fff0d9; color: #783500; }
.calendar-status-declined { background: #f3dadd; color: #6b2630; }
.calendar-today-legend { background: #dceeff; color: #263b50; border-color: #3977a6; }
@media (max-width: 600px) { .calendar-status { font-size: .59rem; padding: .08rem .12rem; } .booking-actions .button { flex: 1 1 120px; } }

.calendar-status-withdrawn { background: #e9e1f3; color: #4a2866; border-color: #7b5795; }
.staffing-row { display:flex; align-items:end; gap:1rem; flex-wrap:wrap; padding:1rem 0; border-bottom:1px solid #ddd; }
.staffing-row label { flex:1 1 13rem; }
.staffing-row input { width:100%; }
.staffing-row label:nth-of-type(2) { flex:0 1 7rem; }
@media(max-width:700px) { .staffing-row label { flex:1 1 100%; } .staffing-row label:nth-of-type(2) { flex:1 1 7rem; } }
/* Event date staffing summaries and manual allocations */
.staffing-tiles { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:.55rem; margin:.8rem 0; }
.staffing-tile { background:#f7f0e6; border:1px solid #ead9c5; border-radius:.6rem; padding:.55rem .7rem; min-width:0; }
.staffing-tile span { display:block; font-size:.82rem; }
.staffing-tile strong { display:block; font-size:1.15rem; }
.event-date-summary { border-top:1px solid #ddd; padding:.8rem 0; }
.event-date-summary .staffing-tile { padding:.35rem .45rem; }
.event-date-summary .staffing-tile strong { font-size:1rem; }
.allocation-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,19rem),1fr)); gap:1rem; }
.allocation-card { border:1px solid #ddd; border-radius:.7rem; padding:1rem; min-width:0; }
.allocation-card h3 { margin-top:0; }
.allocation-metrics { display:flex; flex-wrap:wrap; gap:.4rem; margin:.7rem 0; }
.allocation-metrics span { background:#f7f0e6; padding:.4rem .55rem; border-radius:.4rem; }
.allocation-person { border-top:1px solid #ddd; padding:.75rem 0; }
.allocation-person small { display:block; }
.allocation-controls { display:flex; flex-wrap:wrap; align-items:end; gap:.5rem; margin:.6rem 0; }
.allocation-controls label { flex:1 1 10rem; }
.allocation-controls select { width:100%; }
.staffing-warning { display:block; color:#782536; background:#fbe5e8; padding:.5rem; border-radius:.4rem; margin:.5rem 0; }
@media(max-width:740px) { .staffing-tiles { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:420px) { .staffing-tiles { grid-template-columns:repeat(2,minmax(0,1fr)); } }

/* Wider event summaries with legible metric labels. */
.event-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.event-grid .staffing-tiles { grid-template-columns:repeat(5,minmax(0,1fr)); }
.event-grid .staffing-tile { overflow-wrap:anywhere; }
.event-grid .staffing-tile span { font-size:.76rem; }
@media(max-width:1000px) { .event-grid { grid-template-columns:1fr; } }
@media(max-width:590px) { .event-grid .staffing-tiles { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:400px) { .event-grid .staffing-tiles { grid-template-columns:repeat(2,minmax(0,1fr)); } }

/* Date staffing: two roomy cards and responsive summary tiles. */
.event-staffing-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.event-staffing-grid .feature-card { min-width:0; }
.event-staffing-grid .staffing-tile { overflow-wrap:normal; }
.event-staffing-grid .staffing-tile span { font-size:.9rem; }
.event-staffing-grid .staffing-tile strong { font-size:1.2rem; }
.inline-form { display:inline-block; margin-left:.5rem; }
.booking-select { display:block; margin-bottom:.5rem; }
@media(max-width:1100px) { .event-staffing-grid { grid-template-columns:1fr; } }
@media(max-width:620px) { .event-staffing-grid .staffing-tiles { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:420px) { .event-staffing-grid .staffing-tiles { grid-template-columns:repeat(2,minmax(0,1fr)); } }

.impersonation-banner {background:#fff0ca;border:3px solid #ac5300;color:#30200a;padding:1rem;display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap} .impersonation-banner form{margin:0} 

.mfa-card{max-width:36rem}.mfa-qr{display:block;width:170px;height:170px;max-width:100%;margin:1rem auto}.mfa-form{display:grid;gap:1rem;max-width:32rem}.mfa-form .field{display:grid;gap:.4rem}.mfa-form input:not([type=checkbox]){width:100%;box-sizing:border-box;padding:.75rem;border:1px solid #999;border-radius:.4rem;font:inherit}.mfa-card #code{max-width:19rem}.mfa-form .button{min-height:2.75rem}.mfa-admin{padding:1rem 0;border-top:1px solid #ddd}
.mfa-manual { margin: 1.25rem 0; padding: 1rem; border: 1px solid #d7d7d7; border-radius: .65rem; }
.mfa-manual h2 { font-size: 1.15rem; margin-top: 0; }
.mfa-setup-key { display: block; overflow-wrap: anywhere; letter-spacing: .12em; font-size: 1.05rem; padding: .8rem; margin: .7rem 0; background: #f5f5f5; user-select: all; }
