/* Enspire Clubs - admin area, staff portal and parent account */

:root {
  --ink: #1b1530;
  --ink-2: #2b2347;
  --ink-3: #3b3260;
  --bg: #f6f2ec;
  --panel: #ffffff;
  --line: #e7e0d6;
  --line-2: #f0eae2;
  --text: #1b1530;
  --muted: #6b6478;
  --coral: #ff5a4e;
  --coral-d: #e5433a;
  --sun: #ffc43d;
  --teal: #10a594;
  --sky: #3d7cf2;
  --ok-bg: #dcf5ec; --ok: #0a6b55;
  --warn-bg: #fff1c9; --warn: #7a5600;
  --bad-bg: #ffe1de; --bad: #a3271d;
  --info-bg: #e5edff; --info: #23439a;
  --radius: 14px;
  --font-head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --side-w: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font-body); }
a { color: #2a54c9; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-head); letter-spacing: -.01em; line-height: 1.15; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fi { display: inline-flex; line-height: 1; vertical-align: -0.12em; }
code { background: var(--line-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--bad); font-weight: 600; }
.text-warn { color: var(--warn); }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* Brand */
.brand-word { font: 800 1.5rem/1 var(--font-head); letter-spacing: -.04em; }
.brand-mark { position: relative; display: inline-block; flex: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; vertical-align: middle; margin-right: 8px; }
.brand-mark::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--sun); }
.brand-mark::after { content: ""; position: absolute; width: 8px; height: 8px; top: 2px; right: 2px; border-radius: 50%; background: var(--coral); }
.side-brand, .auth-brand { display: inline-flex; align-items: center; }
.brand-tag { font: 700 .66rem/1 var(--font-body); text-transform: uppercase; letter-spacing: .18em; background: var(--sun); color: var(--ink); padding: 4px 7px; border-radius: 6px; margin-left: 8px; }

/* Shell: menu left, content right */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #d9d4e6; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.side-top { padding: 22px 22px 14px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.side-brand { color: #fff; text-decoration: none; white-space: nowrap; flex: none; }
.side-area { text-align: right; line-height: 1.3; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--sun); font-weight: 700; }
.side-nav { padding: 6px 12px 18px; flex: 1; }
.side-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: #8c84a6; padding: 16px 12px 6px; font-weight: 700; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: #e6e1f1; text-decoration: none; font-weight: 500; transition: background .15s; }
.side-nav a:hover { background: var(--ink-2); }
.side-nav a.is-active { background: var(--coral); color: #fff; font-weight: 600; }
.side-nav a .fi { font-size: 1.02rem; opacity: .9; }
.side-badge { margin-left: auto; background: var(--sun); color: var(--ink); font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.side-nav a.is-active .side-badge { background: #fff; }
.side-user { border-top: 1px solid var(--ink-3); padding: 14px 22px 20px; font-size: .9rem; display: grid; gap: 6px; }
.side-user-name { color: #fff; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.side-user a { color: #bdb6d1; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; }
.side-user a:hover { color: #fff; }

.main { min-width: 0; }
.topbar { display: none; }
.content { padding: 30px 36px 60px; max-width: 1180px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); z-index: 60; transform: translateX(-100%); visibility: hidden; transition: transform .25s ease, visibility .25s; }
  body.side-open .side { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.side-open::after { content: ""; position: fixed; inset: 0; background: rgba(27,21,48,.45); z-index: 50; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 40; }
  .menu-btn { background: transparent; border: 0; color: #fff; font-size: 1.3rem; padding: 6px; cursor: pointer; }
  .topbar-title { font-weight: 700; }
  .content { padding: 20px 16px 50px; }
}

/* Page header */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 1.85rem; margin: 2px 0 0; }
.page-sub { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.back-link { text-decoration: none; color: var(--muted); font-size: .9rem; display: inline-flex; gap: 4px; align-items: center; }
.back-link:hover { color: var(--text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); font: 600 .92rem/1.2 var(--font-body); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: #cfc5b8; background: #fbf8f4; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn-primary:hover { background: var(--coral-d); border-color: var(--coral-d); }
.btn-quiet { background: #fff; }
.btn-danger { background: var(--bad-bg); border-color: #f5c1bb; color: var(--bad); }
.btn-danger-quiet { color: var(--bad); }
.btn-danger-quiet:hover { background: var(--bad-bg); border-color: #f5c1bb; }
.btn-small { padding: 6px 11px; font-size: .84rem; }
.btn-icon { padding: 7px 9px; }
.btn-block { width: 100%; padding: 12px; font-size: 1rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }
.chip-btn { border: 0; background: transparent; color: var(--muted); font: 600 .75rem var(--font-body); cursor: pointer; padding: 2px 4px; text-decoration: underline; }

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.panel-title { font-size: 1.12rem; margin: 0 0 14px; display: flex; align-items: center; gap: 9px; }
.panel-head .panel-title { margin-bottom: 4px; }
.panel-title .fi { color: var(--coral); }
.sub-title { font-size: 1rem; margin: 22px 0 10px; }
.danger-zone { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.prose-panel .prose p, .prose-panel .prose li { max-width: 72ch; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--text); display: grid; gap: 2px; border-left: 5px solid var(--teal); }
a.tile:hover { border-color: #cfc5b8; border-left-color: var(--teal); }
.tile:nth-child(2) { border-left-color: var(--sky); }
.tile:nth-child(3) { border-left-color: var(--sun); }
.tile:nth-child(4) { border-left-color: var(--coral); }
.tile-alert { background: #fff6f5; border-left-color: var(--coral) !important; }
.tile-num { font: 800 1.6rem/1.1 var(--font-head); }
.tile-label { color: var(--muted); font-size: .88rem; }

.callout { display: flex; gap: 12px; align-items: flex-start; background: var(--info-bg); color: var(--info); border-radius: 12px; padding: 13px 16px; margin-bottom: 16px; }
.callout .fi { margin-top: 3px; }
.callout a { color: inherit; font-weight: 700; }
.callout-danger { background: var(--bad-bg); color: var(--bad); }
.callout-warn { background: var(--warn-bg); color: var(--warn); }
ul.tight { margin: 4px 0 0; padding-left: 18px; }

.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; word-break: break-word; }
.flash .fi { margin-top: 3px; }
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--bad-bg); color: var(--bad); }
.flash-warning { background: var(--warn-bg); color: var(--warn); }

.empty { text-align: center; padding: 50px 20px; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty > .fi { font-size: 2.2rem; color: var(--coral); }
.empty p { margin: 10px 0 16px; }

.checklist { margin: 0; padding-left: 18px; display: grid; gap: 6px; }

/* Description lists */
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 8px 18px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; }
@media (max-width: 600px) { .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 8px; } }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table-wrap .table { min-width: 640px; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-wrap .table th:first-child, .table-wrap .table td:first-child { padding-left: 18px; }
.table .num { text-align: right; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * { margin-left: 4px; }
.table-click tbody tr[data-href] { cursor: pointer; }
.table-click tbody tr[data-href]:hover td { background: #fbf8f3; }
.table a { font-weight: 600; text-decoration: none; }
.table a:hover { text-decoration: underline; }
tr.is-muted td { opacity: .55; }
tr.is-unread td { font-weight: 600; }
tr.is-unread td:first-child { box-shadow: inset 4px 0 0 var(--coral); }
tr.is-paid td { background: #f6fcf9; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--line-2); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-soon { background: var(--warn-bg); color: var(--warn); }
.badge-urgent, .badge-expired { background: var(--bad-bg); color: var(--bad); }
.badge-st-pending { background: var(--info-bg); color: var(--info); }
.badge-st-trial { background: #efe5ff; color: #5b2bb3; }
.badge-st-active, .badge-st-paid { background: var(--ok-bg); color: var(--ok); }
.badge-st-notice, .badge-st-part_paid { background: var(--warn-bg); color: var(--warn); }
.badge-st-waitlist { background: #ffe9d6; color: #8a4a0f; }
.badge-st-sent { background: var(--info-bg); color: var(--info); }
.badge-st-void, .badge-st-left { background: var(--line-2); color: var(--muted); text-decoration: line-through; }
.badge-result-distinction { background: #fff0c2; color: #6d4c00; }
.badge-result-merit { background: #e4ecff; color: #23439a; }
.badge-result-pass { background: var(--ok-bg); color: var(--ok); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; }
.form-grid-tight { gap: 0 14px; }
.field { margin-bottom: 14px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
.req { color: var(--coral); }
.help { display: block; color: var(--muted); font-size: .82rem; margin-top: 5px; }
/* Every text box and dropdown in the portals shares one look */
select, textarea,
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=url], input[type=search], input:not([type]) {
  max-width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid #d9d0c4; border-radius: 9px;
  font: 400 .95rem/1.35 var(--font-body); background-color: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
select { cursor: pointer; padding-right: 8px; }
textarea { min-height: 0; }
select:hover, input:hover:not([type=checkbox]):not([type=radio]):not([type=file]):not([readonly]), textarea:hover { border-color: #c4b8a8; }
select:focus, textarea:focus, input:focus:not([type=checkbox]):not([type=radio]):not([type=file]) {
  border-color: var(--sky); outline: none; box-shadow: 0 0 0 3px rgba(61,124,242,.18);
}
select:disabled, input:disabled, textarea:disabled { background-color: var(--line-2); color: var(--muted); cursor: not-allowed; }
input[type=file] { font: 400 .9rem var(--font-body); max-width: 100%; }
input[type=file]::file-selector-button { margin-right: 10px; padding: 7px 12px; border: 1px solid #d9d0c4; border-radius: 8px; background: #fff; font: 600 .86rem var(--font-body); color: var(--text); cursor: pointer; }
input[type=file]::file-selector-button:hover { background: #fbf8f4; }
/* Full width inside form fields and line editors; elsewhere controls size to their content */
.field select, .field textarea, .field input:not([type=checkbox]):not([type=radio]),
.add-line input, .lines-table input, .media-alt input, .table td > select { width: 100%; }
.table td > select { min-width: 170px; }
.field textarea { resize: vertical; }
.field input[readonly] { background: var(--line-2); }
.field-check label { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; font-size: .95rem; cursor: pointer; }
.field-check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--coral); flex: none; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 0; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span { display: flex; align-items: center; padding: 0 11px; background: var(--line-2); border: 1px solid #d9d0c4; border-right: 0; border-radius: 9px 0 0 9px; color: var(--muted); }
.input-prefix input { border-radius: 0 9px 9px 0 !important; }
.input-small input { width: 90px !important; }
.input-s { max-width: 140px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.form-stack .field { margin-bottom: 14px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

.check-list { display: grid; gap: 8px; margin-bottom: 12px; }
.check-list label, .inline-check { display: inline-flex; align-items: center; gap: 7px; font-size: .9rem; cursor: pointer; }
.inline-check input { accent-color: var(--coral); }
.choice-list { display: grid; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--coral); background: #fff7f6; }
.choice input { accent-color: var(--coral); width: 18px; height: 18px; }

/* Toolbars */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar-note { margin-left: auto; color: var(--muted); }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search .fi { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; padding-left: 34px !important; }
.inline-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .88rem; }
.bulk-bar { display: flex; gap: 14px; align-items: center; padding: 10px 14px; background: var(--warn-bg); border-radius: 12px; margin-bottom: 12px; }

/* Rich text editor */
.rte-wrap { border: 1px solid #d9d0c4; border-radius: 9px; background: #fff; overflow: hidden; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: #fbf8f4; }
.rte-bar button { border: 0; background: transparent; padding: 6px 9px; border-radius: 7px; cursor: pointer; font: 600 .85rem var(--font-body); color: var(--text); }
.rte-bar button:hover { background: var(--line-2); }
.rte-area { min-height: 160px; padding: 12px 14px; outline: none; line-height: 1.6; }
.rte-area:focus { box-shadow: inset 0 0 0 2px rgba(61,124,242,.25); }
.rte-area h2 { font-size: 1.3rem; } .rte-area h3 { font-size: 1.1rem; }
.rte-area p { margin: 0 0 .8em; }

/* Image picker */
.image-pick { display: grid; gap: 8px; }
.image-pick-preview { width: 220px; aspect-ratio: 16/10; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

/* Pages: section list */
.section-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; counter-reset: sec; }
.section-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.section-list li.is-hidden { opacity: .6; border-style: dashed; }
.section-list-main { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.section-list-main a { text-decoration: none; color: var(--text); }
.section-list-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.add-section { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line-2); }

/* Media */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.media-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.media-thumb { aspect-ratio: 16/10; background: var(--line-2); display: flex; align-items: center; justify-content: center; font-size: 2.4rem; color: var(--coral); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-body { padding: 10px 12px 12px; display: grid; gap: 8px; }
.media-alt { display: flex; gap: 6px; }
.media-actions { display: flex; justify-content: space-between; gap: 6px; }

/* Clubs and registers */
.session-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.session-term { width: 100%; font-size: .9rem; margin: 12px 0 2px; color: var(--muted); }
.session-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .86rem; background: #fff; }
.session-chip.is-past { background: var(--line-2); }
.session-chip.is-cancelled span:first-child { text-decoration: line-through; color: var(--bad); }
.session-chip .fi { color: var(--teal); }

.reg-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.reg-info-grid .label { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.reg-table td { font-size: .9rem; }
.reg-person { white-space: normal; }
.reg-table td:nth-child(3) { min-width: 170px; }
.reg-group + .reg-group { margin-top: 6px; }
.reg-group .label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.reg-person a { font-weight: 500; }
.health-flag { color: var(--bad); font-weight: 700; display: flex; gap: 5px; align-items: baseline; }
.att-cell { white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 11px; font-weight: 600; font-size: .84rem; border-right: 1px solid var(--line); }
.seg label:last-child span { border-right: 0; }
.seg-present input:checked + span { background: var(--teal); color: #fff; }
.seg-absent input:checked + span { background: var(--coral); color: #fff; }
.seg-late input:checked + span { background: var(--sun); color: var(--ink); }
.seg input:focus-visible + span { outline: 3px solid var(--sky); outline-offset: -3px; }

.enrol-row { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.enrol-row-fields { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.enrol-add { margin-top: 10px; }
.row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.club-list { display: grid; gap: 10px; }
.club-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); flex-wrap: wrap; }
.club-row:hover { border-color: #cfc5b8; }
.club-row.is-today { border-left: 5px solid var(--teal); }
.club-row-meta { display: flex; gap: 12px; align-items: center; color: var(--muted); }
.enrol-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.enrol-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; background: #fbf8f4; border-radius: 10px; flex-wrap: wrap; }
.places { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.places-open { background: var(--ok-bg); color: var(--ok); }
.places-few { background: var(--warn-bg); color: var(--warn); }
.places-full { background: var(--bad-bg); color: var(--bad); }

/* Compliance */
.comp-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 16px; }
.comp-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; border-top: 4px solid var(--teal); }
.comp-item.comp-soon, .comp-item.comp-nodate { border-top-color: var(--sun); }
.comp-item.comp-urgent, .comp-item.comp-expired, .comp-item.comp-missing { border-top-color: var(--coral); }
.comp-label { font-weight: 700; }
.doc-upload { margin-top: 4px; }

/* Invoices */
.lines-table td { padding: 6px 8px; }
.lines-table td:first-child { width: 60%; }
.add-line { display: grid; grid-template-columns: 1fr 90px 120px auto; gap: 8px; margin-top: 12px; }
@media (max-width: 700px) { .add-line { grid-template-columns: 1fr 1fr; } }
.invoice-preview { border: 1px solid var(--line); border-radius: 12px; padding: 26px; background: #fff; }
.sp-table td { vertical-align: middle; }
.tick input { width: 20px; height: 20px; accent-color: var(--teal); }
.message-body { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-2); max-width: 70ch; }

/* Login and password pages */
body.auth { background: var(--ink); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 16px; gap: 22px; }
.auth-brand { color: #fff; text-decoration: none; }
.auth-brand .brand-word { font-size: 2rem; }
.auth-card { background: #fff; border-radius: 20px; padding: 32px; width: min(480px, 100%); box-shadow: 0 30px 60px -30px rgba(0,0,0,.5); }
.auth-card h1 { font-size: 1.7rem; margin: 0 0 6px; }
.auth-card .muted { margin-top: 0; }
.auth-links { text-align: center; margin: 18px 0 0; line-height: 1.9; }
.auth-card .form-grid { grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .auth-card { padding: 24px 18px; } .auth-card .form-grid { grid-template-columns: 1fr; } }

/* Pop-up confirmations, bottom right */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 10px; width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; position: relative; overflow: hidden; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  background: #fff; color: var(--text); border-radius: 14px; padding: 14px 14px 16px 16px; box-shadow: 0 18px 40px -12px rgba(27,21,48,.35), 0 0 0 1px rgba(27,21,48,.06);
  border-left: 6px solid var(--teal); animation: toast-in .35s cubic-bezier(.2,.8,.2,1) both; }
.toast-error { border-left-color: var(--coral); }
.toast-warning { border-left-color: var(--sun); }
.toast-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--ok-bg); color: var(--ok); font-size: 1.05rem; }
.toast-error .toast-icon { background: var(--bad-bg); color: var(--bad); }
.toast-warning .toast-icon { background: var(--warn-bg); color: var(--warn); }
.toast-title { display: block; font-family: var(--font-head); font-size: 1.02rem; margin-bottom: 1px; }
.toast-msg { font-size: .92rem; color: #3d3650; word-break: break-word; }
.toast-link { font-weight: 600; }
.toast-copy { margin-top: 8px; }
.toast-close { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; font-size: .9rem; }
.toast-close:hover { background: var(--line-2); color: var(--text); }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--teal); transform-origin: left; opacity: .5; }
.toast-warning .toast-timer { background: var(--sun); }
.toast.is-leaving { animation: toast-out .3s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }
@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (max-width: 600px) { .toasts { right: 16px; left: 16px; bottom: 16px; width: auto; } }

/* After saving, briefly highlight the part of the page that changed */
.panel:target, section:target { animation: target-glow 2.2s ease-out; scroll-margin-top: 20px; }
@keyframes target-glow { 0%, 35% { box-shadow: 0 0 0 3px var(--sun); } 100% { box-shadow: 0 0 0 3px transparent; } }

/* Buttons while a form is being saved */
.btn.is-busy { opacity: .75; cursor: progress; }
.btn.is-busy .fi { animation: busy-spin 1s linear infinite; }
@keyframes busy-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .toast, .toast.is-leaving, .panel:target, section:target, .btn.is-busy .fi { animation: none; }
}

/* Spreadsheet import */
.map-table td { vertical-align: top; }
.map-table select, .map-table input[type=text] { width: 100%; min-width: 150px; }
.map-sub { margin-top: 6px; }
.map-new { display: grid; gap: 6px; min-width: 200px; }
.map-new .input-small input { width: 100% !important; }
.map-new[hidden], .map-sub[hidden] { display: none; }
.import-table td { font-size: .88rem; }
.import-table td > div + div { margin-top: 3px; }
details.skipped { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
details.skipped summary { cursor: pointer; color: var(--muted); font-weight: 600; }
details.skipped ul { margin-top: 8px; }

/* Ticking families */
.select-col { width: 42px; }
.select-col input { width: 18px; height: 18px; accent-color: var(--coral); cursor: pointer; }
tr.is-selected td { background: #fff7f6; }
.select-bar { position: sticky; top: 10px; z-index: 30; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px;
  background: var(--ink); color: #fff; border-radius: 12px; box-shadow: 0 12px 30px -16px rgba(27,21,48,.6); }
.select-bar[hidden] { display: none; }
.select-bar .btn-quiet { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
@media (max-width: 900px) { .select-bar { top: 64px; } }
.filter-bar select { max-width: 230px; }

/* Writing emails */
.field-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.chip { border: 1px solid #d9d0c4; background: #fbf8f4; border-radius: 999px; padding: 4px 10px; font: 600 .78rem var(--font-body); color: var(--text); cursor: pointer; }
.chip:hover { background: #fff; border-color: var(--sky); color: var(--sky); }
details.recipients summary { cursor: pointer; font-weight: 600; color: var(--muted); margin-top: 6px; }
.recipient-list { list-style: none; padding: 0; margin: 10px 0 0; max-height: 280px; overflow: auto; font-size: .88rem; display: grid; gap: 4px; }
.recipient-list li.is-missing { color: var(--warn); }
.email-preview { border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; background: #fff; max-width: 680px; line-height: 1.6; }
.email-preview h3 { font-size: 1.05rem; margin: 18px 0 6px; }
.email-preview-subject { font-weight: 800; font-family: var(--font-head); font-size: 1.1rem; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); margin-top: 0; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; z-index: 20; border-top: 1px solid var(--line); }

/* Sending progress */
.progress { height: 14px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width .4s ease; }
.progress-label { margin: 10px 0 0; }

/* Live filters */
form.toolbar.is-loading ~ * { opacity: .55; transition: opacity .15s; }
.row-menu { display: inline-block; position: relative; }
.row-menu > summary { list-style: none; cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 40px -18px rgba(27,21,48,.45); padding: 12px; display: grid; gap: 10px; min-width: 300px; text-align: left; }
.link-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.link-row select { max-width: 340px; }
.issue-badges { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: 4px; }
tr.has-issue td:first-child { box-shadow: inset 4px 0 0 var(--sun); }

/* Money owed and sign-ups waiting */
tr.is-owed td:first-child { box-shadow: inset 4px 0 0 var(--sun); }
tr.is-overdue td { background: #fff6f5; }
tr.is-overdue td:first-child { box-shadow: inset 4px 0 0 var(--coral); }
.panel-alert { border: 2px solid var(--coral); }
.callout-link { text-decoration: none; }
.callout-link:hover { filter: brightness(.98); }
.signup-actions { margin-top: 6px; }
.next-steps ol { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; }

/* Announcements */
.announcement-list { display: grid; gap: 12px; margin-bottom: 18px; }
.announcement { display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--sky); border-radius: var(--radius); padding: 16px 18px; animation: annIn .35s ease both; }
.announcement-important { border-left-color: var(--coral); background: linear-gradient(90deg, #fff4f2, var(--panel) 40%); }
.announcement-celebrate { border-left-color: var(--sun); background: linear-gradient(90deg, #fff8e3, var(--panel) 40%); }
.announcement-icon { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--info-bg); color: var(--sky); font-size: 17px; }
.announcement-icon .fi { line-height: 1; display: flex; }
.announcement-important .announcement-icon { background: var(--coral); color: #fff; }
.announcement-celebrate .announcement-icon { background: var(--sun); color: var(--ink); }
.announcement-main { min-width: 0; flex: 1; }
.announcement-meta { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.announcement-meta .fi { font-size: 11px; }
.announcement-title { font: 800 18px/1.25 var(--font-head); margin: 4px 0 6px; }
.announcement.is-new .announcement-title::after { content: "New"; font: 700 10px/1 var(--font-body); text-transform: uppercase; letter-spacing: .08em; background: var(--coral); color: #fff; padding: 3px 6px; border-radius: 5px; margin-left: 8px; vertical-align: 3px; }
.announcement-body > :first-child { margin-top: 0; }
.announcement-body > :last-child { margin-bottom: 0; }
.announcement-actions { margin-top: 10px; }
@keyframes annIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.badge-ann-live { background: var(--ok-bg); color: var(--ok); }
.badge-ann-waiting { background: var(--info-bg); color: var(--info); }
.badge-ann-ended { background: var(--line-2); color: var(--muted); }

/* Parent LAMDA results */
.lamda-panel .panel-title .fi { color: var(--coral); }
.lamda-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.lamda-card { border: 1px solid var(--line); border-top: 5px solid var(--teal); border-radius: 12px; padding: 14px 16px; background: #fffdf9; }
.lamda-distinction { border-top-color: var(--sun); background: linear-gradient(180deg, #fff6d9, #fffdf9 60%); }
.lamda-merit { border-top-color: var(--sky); }
.lamda-pass { border-top-color: var(--teal); }
.lamda-waiting { border-top-color: var(--line); border-style: dashed; border-top-style: solid; }
.lamda-exam { font-weight: 700; }
.lamda-exam span { color: var(--muted); font-weight: 600; }
.lamda-result { font: 800 22px/1.2 var(--font-head); margin: 4px 0 8px; }
.lamda-distinction .lamda-result { color: #8a6100; }
.lamda-merit .lamda-result { color: #23439a; }
.lamda-pass .lamda-result { color: var(--ok); }
.lamda-waiting .lamda-result { font-size: 16px; color: var(--muted); }
.lamda-facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: 13px; }
.lamda-facts dt { color: var(--muted); white-space: nowrap; }
.lamda-facts dd { margin: 0; }
.sub-title a { font-family: var(--font-body); font-weight: 600; margin-left: 6px; }
@media (max-width: 600px) { .announcement { padding: 14px; } .announcement-icon { display: none; } }
