:root {
  --navy: #0b243d;
  --navy-deep: #061727;
  --navy-soft: #183a58;
  --gold: #c59a4b;
  --gold-pale: #f2e8d4;
  --canvas: #f6f5f1;
  --paper: #ffffff;
  --ink: #172a3a;
  --muted: #5c6a75;
  --line: #d8dedf;
  --success: #18704b;
  --warning: #986a14;
  --danger: #a13d34;
  --shadow: 0 18px 45px rgba(10, 34, 56, .12);
}

* { box-sizing: border-box; }
html { color: var(--ink); background: var(--canvas); font-family: Arial, Helvetica, sans-serif; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a { color: inherit; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 20; padding: .8rem 1rem; background: #fff; border: 2px solid var(--navy); }
.skip-link:focus { top: 1rem; }
.site-header { min-height: 80px; padding: 13px clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid var(--gold); background: var(--navy-deep); color: #fff; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--gold); color: var(--gold); font-size: .78rem; font-weight: 800; letter-spacing: .12em; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(1.1rem, 2vw, 1.4rem); }
.brand small { margin-top: 3px; color: #d5dee5; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }

.button { min-height: 46px; padding: .7rem 1.05rem; border: 1px solid transparent; border-radius: 2px; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none; transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--gold); border-color: var(--gold); color: #18263b; }
.button-primary:hover { background: #d7ad61; border-color: #d7ad61; }
.button-secondary { background: var(--navy); border-color: var(--navy); color: #fff; }
.button-secondary:hover { background: var(--navy-soft); }
.button-quiet { background: transparent; border-color: currentColor; color: inherit; }
.button-full { width: 100%; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--navy); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.eyebrow { margin: 0 0 .45rem; color: #80622d; font-size: .74rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.auth-shell { max-width: 1220px; min-height: calc(100vh - 80px); margin: 0 auto; padding: clamp(36px, 7vw, 96px) clamp(20px, 5vw, 72px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(330px, .8fr); gap: clamp(40px, 9vw, 140px); align-items: center; }
.auth-intro h1 { max-width: 680px; margin: 0; color: var(--navy); font-family: Georgia, 'Times New Roman', serif; font-size: clamp(2.25rem, 5vw, 4.5rem); line-height: 1.06; }
.auth-intro > p:not(.eyebrow) { max-width: 610px; margin: 1.5rem 0; color: var(--muted); font-size: 1.18rem; line-height: 1.65; }
.auth-intro ul { padding: 0; margin: 1.5rem 0 0; list-style: none; columns: 2; column-gap: 2rem; }
.auth-intro li { position: relative; break-inside: avoid; padding: .65rem 0 .65rem 1.5rem; border-top: 1px solid #d8d6cc; color: var(--ink); font-weight: 600; }
.auth-intro li::before { content: ''; position: absolute; left: .1rem; top: 1.02rem; width: 7px; height: 7px; background: var(--gold); }
.auth-card { background: var(--paper); border: 1px solid #cdd5d7; box-shadow: var(--shadow); }
.auth-tabs { display: flex; border-bottom: 1px solid var(--line); }
.auth-tab { flex: 1; min-height: 58px; padding: .85rem; border: 0; border-bottom: 4px solid transparent; background: #f2f3f1; color: #485665; font-size: .94rem; font-weight: 700; }
.auth-tab.is-active { border-bottom-color: var(--gold); background: #fff; color: var(--navy); }
.auth-card form { padding: clamp(24px, 4vw, 40px); }
.auth-card h2 { margin: 0; color: var(--navy); font-family: Georgia, 'Times New Roman', serif; font-size: 1.65rem; }
.form-hint { margin: .7rem 0 1.4rem; color: var(--muted); line-height: 1.55; }
label { display: grid; gap: .48rem; color: var(--ink); font-weight: 700; }
input, select, textarea { width: 100%; min-height: 44px; padding: .68rem .76rem; border: 1px solid #aebbc0; border-radius: 2px; background: #fff; color: var(--ink); }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(197,154,75,.65); outline-offset: 2px; }
.auth-card label { margin: 0 0 1rem; }
.auth-action-link { display: block; margin: 1.15rem auto 0; }
.message { min-height: 1.2rem; margin: -1rem clamp(24px,4vw,40px) 1.4rem; color: var(--danger); font-size: .94rem; font-weight: 700; line-height: 1.45; }
.message.is-success { color: var(--success); }

.app-shell { max-width: 1500px; padding: clamp(26px, 4vw, 58px) clamp(18px, 4vw, 52px) 70px; margin: 0 auto; }
.dashboard-heading { display: flex; gap: 24px; justify-content: space-between; align-items: end; margin-bottom: 28px; }
.dashboard-heading h1 { margin: 0; color: var(--navy); font-family: Georgia, 'Times New Roman', serif; font-size: clamp(2rem, 3.5vw, 3rem); }
.dashboard-heading p:not(.eyebrow) { margin: .55rem 0 0; color: var(--muted); }
.dashboard-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 26px; border: 1px solid #cfd8da; background: #fff; }
.metrics article { min-height: 137px; padding: 21px; border-right: 1px solid #d8dfe0; }
.metrics article:last-child { border-right: 0; }
.metrics span, .metrics small { display: block; color: var(--muted); font-size: .86rem; }
.metrics span { font-weight: 700; }
.metrics strong { display: block; margin: 7px 0 3px; color: var(--navy); font-family: Georgia, 'Times New Roman', serif; font-size: 2.4rem; line-height: 1; }
.dashboard-grid { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(0, 1.35fr); gap: 24px; align-items: start; }
.panel { border: 1px solid #cfd8da; background: var(--paper); box-shadow: 0 8px 25px rgba(9,36,61,.05); }
.team-panel { grid-column: 1 / -1; }
.panel-heading { min-height: 94px; padding: 20px 22px; display: flex; justify-content: space-between; gap: 15px; align-items: center; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; color: var(--navy); font-family: Georgia, 'Times New Roman', serif; font-size: 1.5rem; }
.team-help { max-width: 440px; margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.clinic-list { display: grid; }
.clinic-card { position: relative; padding: 21px 22px; border-bottom: 1px solid var(--line); }
.clinic-card:last-child { border-bottom: 0; }
.clinic-card h3 { margin: 0 0 .35rem; color: var(--navy); font-family: Georgia, 'Times New Roman', serif; font-size: 1.25rem; }
.clinic-card p { margin: .35rem 0; color: var(--muted); line-height: 1.45; }
.clinic-date { color: #725422 !important; font-weight: 700; }
.capacity-row { display: flex; flex-wrap: wrap; gap: .45rem .8rem; margin: 13px 0 0 !important; color: var(--ink) !important; font-size: .87rem; }
.capacity-row span { display: inline-flex; align-items: center; gap: 5px; }
.capacity-row span::before { content: ''; width: 7px; height: 7px; background: var(--gold); }
.clinic-actions { margin-top: 16px; display: flex; gap: 13px; }
.clinic-actions button { padding: 0; border: 0; background: transparent; color: var(--navy); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.clinic-actions .delete-action { color: var(--danger); }
.text-button.delete-action { color: var(--danger); }
td .text-button + .text-button { margin-left: 14px; }

.registrations-heading { align-items: end; }
.table-controls { display: flex; gap: 10px; align-items: end; }
.filter-label { min-width: 130px; color: var(--muted); font-size: .77rem; font-weight: 700; }
.filter-label input, .filter-label select { min-height: 38px; padding: .48rem .55rem; font-size: .9rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 690px; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid #e1e5e5; text-align: left; vertical-align: middle; }
th { background: #f6f7f6; color: #425464; font-size: .74rem; letter-spacing: .07em; text-transform: uppercase; }
td { color: #263845; font-size: .93rem; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.table-select { min-height: 34px; padding: .26rem .3rem; border-color: #c6d0d2; font-size: .84rem; }
.inline-select { min-height: 34px; min-width: 120px; padding: .26rem 1.6rem .26rem .5rem; border-color: #c6d0d2; font-size: .84rem; }
.row-action { padding: .3rem .2rem; border: 0; background: transparent; color: var(--navy); font-weight: 700; text-decoration: underline; }
.empty-state { margin: 0; padding: 26px 22px; color: var(--muted); text-align: center; }
.empty-cell { padding: 28px 16px; color: var(--muted); text-align: center; }
.status { display: inline-block; padding: .28rem .46rem; border-radius: 2px; background: #e8edef; color: #31475a; font-size: .78rem; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.status-working, .status-paid, .status-confirmed { background: #e1f0e7; color: #17623f; }
.status-audit, .status-partial { background: #f7efd9; color: #755111; }
.status-waitlist, .status-unpaid { background: #eef1f3; color: #465969; }
.status-cancelled, .status-refunded { background: #f8e2df; color: #8a352e; }

.modal { position: fixed; inset: 0; z-index: 30; padding: 20px; display: grid; place-items: center; background: rgba(4, 19, 33, .68); overflow-y: auto; }
.modal-card { position: relative; width: min(700px, 100%); max-height: calc(100vh - 40px); padding: clamp(24px,4vw,38px); overflow-y: auto; background: #fff; border-top: 5px solid var(--gold); box-shadow: 0 22px 60px rgba(0,0,0,.3); }
.modal-card h2 { margin: 0 0 1.4rem; color: var(--navy); font-family: Georgia, 'Times New Roman', serif; font-size: 1.8rem; }
.modal-close { position: absolute; top: 14px; right: 16px; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--navy); font-size: 1.5rem; line-height: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: end; gap: 10px; margin-top: 8px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 40; max-width: min(420px, calc(100vw - 44px)); padding: 14px 18px; border-left: 5px solid var(--gold); background: var(--navy); box-shadow: var(--shadow); color: #fff; font-weight: 700; }
.toast.is-error { border-left-color: #ef887e; background: #6f2925; }

.welcome-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, rgba(6,23,39,.96), rgba(19,58,88,.94)), var(--navy); }
.welcome-card { width: min(650px, 100%); padding: clamp(36px, 8vw, 78px); border-top: 5px solid var(--gold); background: #fff; box-shadow: 0 25px 80px rgba(0,0,0,.24); text-align: center; }
.welcome-card h1 { margin: 0; color: var(--navy); font-family: Georgia, 'Times New Roman', serif; font-size: clamp(2.1rem, 6vw, 4rem); }
.welcome-card > p:not(.eyebrow) { margin: 1.25rem auto 1.8rem; max-width: 510px; color: var(--muted); font-size: 1.1rem; line-height: 1.6; }
.welcome-note { margin: 1.4rem 0 0; color: var(--muted); font-size: .88rem; }

[hidden] { display: none !important; }

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; gap: 36px; }
  .auth-intro ul { columns: 1; max-width: 600px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics article:nth-child(2) { border-right: 0; }
  .metrics article:nth-child(-n+2) { border-bottom: 1px solid #d8dfe0; }
}
@media (max-width: 680px) {
  .site-header { min-height: 70px; padding: 10px 16px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand small { display: none; }
  .auth-shell { padding: 34px 18px 48px; }
  .auth-intro h1 { font-size: 2.45rem; }
  .app-shell { padding: 25px 14px 50px; }
  .dashboard-heading, .panel-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-actions { width: 100%; }
  .dashboard-actions .button { flex: 1; }
  .metrics article { min-height: 122px; padding: 16px; }
  .registrations-heading { align-items: stretch; }
  .table-controls { width: 100%; flex-direction: column; align-items: stretch; }
  .filter-label { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { width: 100%; }
}
