:root {
  color-scheme: light;
  --red: #e60005;
  --navy: #002d55;
  --ink: #334155;
  --muted: #64748b;
  --line: #dfdfdf;
  --bg: #eff2f5;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; min-height: 4rem; padding: .5rem 1.5rem; border-bottom: 1px solid var(--line); background: #fff; }
.brand { display: flex; align-items: center; gap: .75rem; color: var(--ink); font-size: 1.1rem; font-weight: 700; text-decoration: none; }
.brand img { display: block; width: auto; height: 2rem; }
.brand span { border-left: 1px solid var(--line); padding-left: .75rem; }
.top-nav { display: flex; flex: 1; flex-wrap: wrap; gap: .25rem; }
.top-nav a, .admin-tabs a { padding: .35rem .7rem; border-radius: 8px; color: var(--ink); font-weight: 500; text-decoration: none; }
.top-nav a { padding: .35rem .5rem; font-size: .9rem; white-space: nowrap; }
.top-nav a:hover, .admin-tabs a:hover { background: #fff2eb; color: var(--navy); }
.logout { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 0; }
.who { color: var(--muted); font-size: .9rem; }
button.link { padding: 0; background: none; color: #1d71cc; font-weight: 400; text-decoration: underline; }
main { max-width: 1180px; margin: 2rem auto; padding: 0 1rem 3rem; }
h1, h2, h3 { color: var(--navy); }
h1 { margin: .25rem 0; font-size: 2rem; letter-spacing: -.02em; }
h2 { margin-top: 2rem; font-size: 1.2rem; }
h3 { margin: .6rem 0; font-size: 1.15rem; }
p { margin: .5rem 0; }
.eyebrow { color: var(--red); font-weight: 700; }
.lead { max-width: 45rem; font-size: 1.1rem; }
.notice { margin: 1.5rem 0; padding: .9rem 1rem; border: 1px solid #b6d3f3; border-radius: 10px; background: #e6f0fb; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 1rem; }
.card { display: flex; flex-direction: column; min-height: 13rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.tag { align-self: flex-start; padding: .15rem .55rem; border-radius: 99px; background: var(--bg); color: var(--muted); font-size: .8rem; }
.unavailable { margin-top: auto; padding-top: 1rem; color: var(--muted); font-weight: 600; }
footer { padding: 1rem; text-align: center; color: var(--muted); font-size: .85rem; }
a { color: #1d71cc; }
.btn, button { display: inline-block; padding: .6rem 1rem; border: 0; border-radius: 8px; background: var(--red); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
label { display: block; margin: .5rem 0; }
input, select, textarea { display: block; width: 100%; max-width: 40rem; margin-top: .2rem; padding: .55rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
input[type=checkbox], input[type=radio] { display: inline; width: auto; }
.sigbox { margin: 1rem 0; }
.sigbox canvas { display: block; width: 100%; max-width: 600px; height: auto; border: 1px dashed #64748b; border-radius: 8px; background: #fff; touch-action: none; }
.sigbox button { margin-top: .5rem; }
.secondary { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.muted { color: var(--muted); }
.admin-tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: 1rem 0 1.5rem; }
.admin-tabs a[aria-current=page] { background: var(--navy); color: #fff; }
.inline { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; margin: 1rem 0; }
.inline label { margin: 0; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
th, td { padding: .5rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--bg); color: var(--muted); font-size: .8rem; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
td input:not([type=checkbox]), td select { min-width: 10rem; margin: 0; }
.actions { min-width: 8rem; }
.actions form { margin-top: .35rem; }
.role-picker { min-width: 13rem; }
.role-picker summary { padding: .5rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.role-picker fieldset { margin: .25rem 0; padding: .5rem; }
.role-picker .check { display: flex; align-items: center; gap: .4rem; }
.role-picker .check input { margin: 0; }
.inline-action { display: inline-block; }
.warn { color: #b80000; }
.sr { position: absolute; left: -9999px; }
button.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; padding: .5rem; vertical-align: middle; }
.action-icon { display: block; width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
button.danger { background: #fff; color: #b80000; border: 1px solid #b80000; }
button.danger:hover { background: #fff2eb; }
.users-table th:nth-child(2) { width: 30%; }
.users-table td:nth-child(2) input { min-width: 12rem; }
.users-table .actions { min-width: 6rem; white-space: nowrap; }
.users-table .actions form { margin: 0; }
.role-picker { min-width: 12rem; }
.role-picker summary { padding: .5rem .7rem; }
.role-picker fieldset { margin: .25rem 0 0; padding: .4rem .7rem; }
.role-picker label { display: flex; align-items: center; gap: .4rem; }
#memberships.card, #users .card, #centers .card { display: block; min-height: 0; padding: 1rem; margin: 1rem 0; }
#users label { font-size: .9rem; font-weight: 500; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.filters select { width: auto; margin: 0; }
.badge { padding: .1rem .55rem; border-radius: 99px; font-size: .8rem; background: #eee; }
.badge.pending { background: #fef3c6; }
.badge.sending { background: #e6f0fb; }
.badge.failed { background: #ffe4e6; }
[data-request-row] { cursor: pointer; }
[data-request-row] > td:first-child > a { color: inherit; text-decoration: none; }
[data-request-row]:hover, [data-request-row]:focus-within { background: #fff2eb; }
.request-table td { overflow-wrap: anywhere; }
.request-table td:first-child, .request-table td:nth-last-child(2) { white-space: nowrap; }
.request-table [hidden] { display: none; }
fieldset { margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
legend { color: var(--navy); font-weight: 700; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #4b8dd7; outline-offset: 3px; }
@media (max-width: 600px) {
  .top { padding: .5rem 1rem; }
  .top-nav { flex-basis: 100%; }
  .logout { width: 100%; justify-content: space-between; }
  h1 { font-size: 1.6rem; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters select { width: 100%; }
  .request-table { display: block; border: 0; background: transparent; }
  .request-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .request-table tbody { display: grid; gap: .75rem; }
  .request-table tr { display: grid; padding: .75rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
  .request-table td { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: .5rem; min-width: 0; padding: .35rem 0; border: 0; }
  .request-table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; }
  .request-table td > .warn { grid-column: 2; }
  .request-table td:first-child, .request-table td:nth-last-child(2) { white-space: normal; }
}

[data-membership-wizard] [hidden] { display: none; }
.membership-original .declaration-text { overflow-wrap: anywhere; }
.membership-original .declaration-text p { margin: .65rem 0; }
.membership-original { margin: 1rem 0; padding: 1rem; border-left: 3px solid var(--line); background: #f8fafc; }
[data-guardian-page] { overflow-wrap: anywhere; }
[data-guardian-form] fieldset { min-width: 0; }
[data-guardian-form] legend { max-width: 100%; }
[data-membership-wizard] .wizard-navigation { display: flex; gap: .75rem; margin: 1rem 0; }
[data-membership-wizard] .wizard-progress { font-weight: 600; color: var(--navy); }
