/* DeckPro GUI — see product-planning/DESIGN.md.
   One accent (garnet). No gradients, glow, glass, or nested cards.
   Status color goes on the glyph; words stay in the text color. */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-sunken: #f5f5f5;
  --bg-hover: #ececec;
  --bg-selected: #fff2e3;
  --bg-raised: #ffffff;

  --text: #000000;
  --text-muted: #5c5c5c;
  --text-meta: #676156;

  --border: #c7c7c7;
  --border-control: #767676;

  --accent: #73000a;
  --accent-hover: #570008;
  --accent-text: #73000a;
  --on-accent: #ffffff;

  --danger: #cc2e40;
  --success: #65780b;
  --warning: #a49137;
  --info: #466a9f;
  --focus: #466a9f;

  --energy-RECOVERY: #363636;
  --energy-TECHNIQUE: #c7c7c7;
  --energy-AEROBIC: #ffffff;
  --energy-DISTANCE: #f4a3b4;
  --energy-THRESHOLD: #cc2e40;
  --energy-RACE_PACE: #466a9f;
  --energy-SPRINT: #5b2c83;
  --energy-NONE: transparent;
  --energy-outline: var(--border-control);

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --radius: 4px;
  --row-compact: 36px;
  --control-h: 32px;
  --shadow-raised: 0 8px 24px rgb(0 0 0 / 0.18);
  --gutter: 24px;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 8'%3E%3Cpath d='M1 4l3 3 5-6' fill='none' stroke='%23fff' stroke-width='1.8'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --bg-sunken: #1c1c1c;
    --bg-hover: #262626;
    --bg-selected: #2b1a1c;
    --bg-raised: #1c1c1c;
    --text: #ececec;
    --text-muted: #a2a2a2;
    --text-meta: #a2a2a2;
    --border: #363636;
    --border-control: #8a8a8a;
    --accent: #a01c2a;
    --accent-hover: #b3242f;
    --accent-text: #f08a93;
    --danger: #f26b7a;
    --success: #a3b84a;
    --warning: #d1bd5e;
    --info: #8fb0e0;
    --focus: #8fb0e0;
    --shadow-raised: 0 8px 24px rgb(0 0 0 / 0.6);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23ececec' stroke-width='1.6'/%3E%3C/svg%3E");
  }
}

@media (pointer: coarse) {
  :root { --control-h: 44px; --row-compact: 48px; }
}

/* ---- Base ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/20px var(--font-ui);
}

h1, h2, h3, p, ul, ol, dl, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1:focus, h1:focus-visible { outline: none; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; line-height: 16px; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.num, .time { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--bg); padding: 8px 12px; }
.skip-link:focus { left: 8px; }
[hidden] { display: none !important; }

/* ---- Top bar ----------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; gap: var(--space-5);
  min-height: 56px; padding: 0 var(--gutter);
  max-width: 1440px; margin: 0 auto;
}
.brand { display: flex; align-items: baseline; gap: var(--space-3); color: var(--text); text-decoration: none; white-space: nowrap; }
.wordmark { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; color: var(--text); }
.club-name { color: var(--text-muted); }
.sections { display: flex; gap: var(--space-1); flex: 1; min-width: 0; }
.section-link {
  display: flex; align-items: center; height: 56px; padding: 0 var(--space-3);
  color: var(--text); text-decoration: none; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.section-link:hover { color: var(--accent-text); }
.section-link[aria-current="page"] { color: var(--accent-text); border-bottom-color: var(--accent-text); }
.topbar-menus { display: flex; gap: var(--space-2); align-items: center; margin-left: auto; }
.menu-wrap { position: relative; }
.menu-button {
  font: inherit; font-weight: 600; color: var(--text); background: none; border: 0;
  height: 40px; padding: 0 var(--space-2); cursor: pointer; border-radius: var(--radius);
}
.menu-button:hover { background: var(--bg-hover); }
.menu-button.is-current { color: var(--accent-text); }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 200px;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-raised); padding: var(--space-2) 0;
}
.menu a { display: block; padding: var(--space-2) var(--space-4); color: var(--text); text-decoration: none; }
.menu a:hover, .menu a:focus-visible { background: var(--bg-hover); }
.menu-account { padding: var(--space-3) var(--space-4); }
.menu-note { color: var(--text-muted); margin-bottom: var(--space-2); }

/* ---- Sub-tabs ------------------------------------------------------------------ */

.subtabs { position: sticky; top: 57px; z-index: 15; background: var(--bg-sunken); border-bottom: 1px solid var(--border); }
.subtabs-inner { display: flex; gap: var(--space-1); padding: 0 var(--gutter); max-width: 1440px; margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
.subtab {
  display: flex; align-items: center; height: 44px; padding: 0 var(--space-3); white-space: nowrap;
  color: var(--text); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtab:hover { color: var(--accent-text); }
.subtab[aria-current="page"] { color: var(--accent-text); border-bottom-color: var(--accent-text); font-weight: 600; }

/* ---- Page ---------------------------------------------------------------------- */

.page { max-width: 1440px; margin: 0 auto; padding: var(--space-5) var(--gutter) var(--space-8); }
.page-header { margin-bottom: var(--space-5); }
.back-link { display: inline-block; margin-bottom: var(--space-2); text-decoration: none; }
.page-header-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.page-heading h1 { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -0.01em; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.page-note { color: var(--text-muted); margin: 0 0 var(--space-4); max-width: 80ch; }
.action-reason { color: var(--text-muted); font-size: 12px; flex-basis: 100%; text-align: right; }

.section { margin-top: var(--space-6); }
.section:first-of-type { margin-top: 0; }
.section-tight { margin-top: var(--space-5); }
.section-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3);
  padding-bottom: var(--space-2); margin-bottom: var(--space-3); border-bottom: 1px solid var(--border);
}
.section-head h2, .section > h2, .section-tight > h2 { font-size: 17px; line-height: 24px; font-weight: 600; }
.section-tight > h2 { padding-bottom: var(--space-2); margin-bottom: var(--space-2); }
.section-meta { color: var(--text-muted); margin-left: auto; }
.section-head .section-meta + .btn { margin-left: 0; }
.section-head > .btn, .section-head > .inline-filter { margin-left: auto; }
.section-foot { margin-top: var(--space-3); display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; }

.empty { color: var(--text-muted); padding: var(--space-4) 0; max-width: 70ch; }
.empty .btn { margin-left: var(--space-2); }
.table-note { margin-top: var(--space-2); color: var(--text-muted); font-size: 12px; line-height: 16px; }

/* Two related lists side by side (Setup › Workspace: sites and staff). */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 var(--space-6); margin-top: var(--space-6); }
.split > .section { margin-top: 0; }
.workspace-facts, .import-facts { margin-bottom: var(--space-5); }

/* Meets: the next meet leads the page. */
.next-meet { display: flex; flex-direction: column; gap: var(--space-3); max-width: 80ch; }
.next-meet .section-head { margin-bottom: 0; }
.next-meet .notice { margin: 0; padding: 0; border: 0; }
.next-meet-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.notice {
  display: flex; gap: var(--space-2); align-items: baseline;
  padding: var(--space-3) 0; margin-bottom: var(--space-4);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.notice .status-glyph { font-weight: 700; }
.notice[data-tone="success"] .status-glyph { color: var(--success); }
.notice[data-tone="danger"] .status-glyph { color: var(--danger); }
.notice[data-tone="info"] .status-glyph { color: var(--info); }
.notice[data-tone="warning"] .status-glyph { color: var(--warning); }

.form-error { color: var(--danger); font-weight: 600; margin-bottom: var(--space-3); }

/* ---- Buttons ---------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: var(--control-h); padding: 0 var(--space-3);
  font: inherit; font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer;
  color: var(--text); background: transparent;
  border: 1px solid var(--border-control); border-radius: var(--radius);
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--bg-hover); }
.btn-sm { height: 28px; padding: 0 var(--space-2); font-size: 13px; }
.btn:disabled, .btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn-text, .link-button {
  font: inherit; color: var(--accent-text); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none;
}
.btn-text:hover, .link-button:hover { text-decoration: underline; }
.link-button { color: var(--text); font-weight: 600; text-align: left; }
.btn-text-danger { color: var(--danger); }
.btn-icon {
  font: inherit; font-size: 22px; line-height: 1; width: 36px; height: 36px; border-radius: var(--radius);
  background: none; border: 0; color: var(--text); cursor: pointer;
}
.btn-icon:hover { background: var(--bg-hover); }
.row-actions { display: inline-flex; gap: var(--space-2); }

/* ---- Forms ------------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.field > label, .label-like, .fieldset legend, .pane-label {
  font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-muted);
}
.optional { font-weight: 400; }
.field input, .field select, .field textarea, select, .workout-text {
  font: inherit; color: var(--text); background-color: var(--bg);
  border: 1px solid var(--border-control); border-radius: var(--radius);
  min-height: var(--control-h); padding: 0 var(--space-2);
}
.field textarea, .workout-text { padding: var(--space-2); resize: vertical; line-height: 20px; }
select, .field select {
  appearance: none; -webkit-appearance: none; padding-right: 28px;
  background-image: var(--chevron); background-repeat: no-repeat;
  background-position: right 9px center; background-size: 12px 8px;
}
.field input:hover, .field textarea:hover, select:hover, .workout-text:hover { border-color: var(--text-muted); }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.7; }
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; width: 16px; height: 16px; min-height: 0; padding: 0;
  border: 1px solid var(--border-control); background: var(--bg); cursor: pointer;
}
input[type="checkbox"] { border-radius: 3px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:checked {
  background: var(--accent) var(--check) no-repeat center / 10px 8px; border-color: var(--accent);
}
input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--bg); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: 0.5; cursor: not-allowed; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field-short input { max-width: 12ch; }
.field-wide { grid-column: span 2; }
.hint { font-size: 12px; line-height: 16px; color: var(--text-muted); }
.hint[data-tone="danger"], .field-error { color: var(--danger); }
.field-error { font-size: 12px; line-height: 16px; font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.field-row-3 { grid-template-columns: repeat(3, 1fr); }
.check { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control-h); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.fieldset legend { padding: 0; margin-bottom: var(--space-1); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0 var(--space-3); }
.check-with-select { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.check-with-select select { min-height: 28px; }
.field-checks { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 0 var(--space-4); }

.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.filters .field { min-width: 140px; }
.filters .field input[type="search"] { min-width: 200px; }
.filters .btn-text { height: var(--control-h); display: inline-flex; align-items: center; }
.filters-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.filters-row .filters { margin-bottom: 0; }
.inline-filter .field { flex-direction: row; align-items: center; gap: var(--space-2); }
.inline-form { display: flex; align-items: flex-end; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.inline-form .field { min-width: 280px; }
.week-nav { display: inline-flex; align-items: center; gap: var(--space-2); font-variant-numeric: tabular-nums; }
.week-nav .btn-text { font-size: 20px; padding: 0 var(--space-2); }
.field-nav .week-nav { min-height: var(--control-h); }

/* ---- Tables ------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  position: sticky; top: 101px; z-index: 1;
  background: var(--bg-sunken); color: var(--text-muted);
  font-size: 12px; line-height: 16px; font-weight: 600; text-align: left;
  padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table-wrap table.data th { position: static; }
table.data td {
  height: var(--row-compact); padding: var(--space-1) var(--space-3);
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
table.data th.num, table.data td.num { text-align: right; }
table.data td.cell-primary { font-weight: 600; }
table.data td.cell-primary .muted { font-weight: 400; }
table.data td.cell-primary a { color: var(--text); text-decoration: none; }
table.data td.cell-primary a:hover { color: var(--accent-text); text-decoration: underline; }
tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: var(--bg-hover); }
tr.row-saved td { background: var(--bg-selected); }
tr.is-past td { color: var(--text-muted); }
.th-sort { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.th-sort:hover { color: var(--text); }
table.data tfoot td { border-bottom: 0; }
.cell-error { color: var(--danger); font-weight: 600; }

/* ---- Status labels, energy swatches ------------------------------------------------ */

.status { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.status-glyph { font-weight: 700; }
.status[data-tone="success"] .status-glyph { color: var(--success); }
.status[data-tone="warning"] .status-glyph { color: var(--warning); }
.status[data-tone="danger"] .status-glyph { color: var(--danger); }
.status[data-tone="info"] .status-glyph { color: var(--info); }
.status[data-tone="muted"] .status-glyph { color: var(--text-muted); }

.energy { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 12px; }
.swatch {
  display: inline-block; width: 12px; height: 12px; border-radius: 2px;
  border: 1px solid var(--energy-outline); background: var(--swatch);
}
[data-energy="RECOVERY"] { --swatch: var(--energy-RECOVERY); }
[data-energy="TECHNIQUE"] { --swatch: var(--energy-TECHNIQUE); }
[data-energy="AEROBIC"] { --swatch: var(--energy-AEROBIC); }
[data-energy="DISTANCE"] { --swatch: var(--energy-DISTANCE); }
[data-energy="THRESHOLD"] { --swatch: var(--energy-THRESHOLD); }
[data-energy="RACE_PACE"] { --swatch: var(--energy-RACE_PACE); }
[data-energy="SPRINT"] { --swatch: var(--energy-SPRINT); }
[data-energy="NONE"] { --swatch: repeating-linear-gradient(45deg, transparent 0 3px, var(--border) 3px 4px); }

.intensity { display: inline-flex; flex-direction: column; gap: 2px; vertical-align: middle; min-width: 140px; }
.intensity-bar {
  display: flex; height: 8px; width: 160px; border: 1px solid var(--energy-outline); border-radius: 2px; overflow: hidden;
}
.intensity-seg { background: var(--swatch); min-width: 2px; }
.intensity-seg + .intensity-seg { border-left: 1px solid var(--bg); }
.intensity-legend { font-size: 12px; line-height: 16px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.intensity-large { display: flex; margin-top: var(--space-3); }
.intensity-large .intensity-bar { width: 100%; height: 16px; }
.practice-line .intensity { display: inline-flex; margin-left: var(--space-2); min-width: 0; }
.practice-line .intensity-bar { width: 120px; }

/* ---- Segmented control ------------------------------------------------------------------ */

.seg, .view-toggle { display: inline-flex; }
.seg-option {
  font: inherit; font-size: 13px; height: 32px; padding: 0 var(--space-3); cursor: pointer;
  display: inline-flex; align-items: center; text-decoration: none;
  color: var(--text); background: var(--bg); border: 1px solid var(--border-control);
}
.seg-option + .seg-option { margin-left: -1px; }
.seg-option:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.seg-option:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.seg-option[aria-checked="true"], .seg-option[aria-current="page"] { background: var(--text); color: var(--bg); border-color: var(--text); position: relative; }
.seg-compact .seg-option { height: 28px; padding: 0 var(--space-2); }
.view-toggle { margin-bottom: var(--space-4); }
.filters-row .view-toggle { margin-bottom: 0; }

/* ---- Drawer ------------------------------------------------------------------------------ */

.drawer-layer { position: fixed; inset: 0; z-index: 40; display: flex; justify-content: flex-end; }
.drawer-backdrop { position: absolute; inset: 0; background: transparent; }
.drawer {
  position: relative; display: flex; flex-direction: column;
  width: min(440px, 100vw); height: 100%;
  background: var(--bg-raised); border-left: 1px solid var(--border); box-shadow: var(--shadow-raised);
  animation: drawer-in 160ms ease-out;
}
.drawer-wide { width: min(560px, 100vw); }
.drawer-form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.drawer-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5); border-bottom: 1px solid var(--border);
}
.drawer-header h2 { font-size: 17px; line-height: 24px; font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.drawer-footer {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border);
}
.save-state { color: var(--text-muted); font-size: 12px; }
.drawer-footer .save-state { margin-left: auto; }
.drawer-bottom { align-items: flex-end; justify-content: center; }
.drawer-bottom .drawer-backdrop { background: rgb(0 0 0 / 0.4); }
.drawer-bottom .drawer {
  width: min(640px, 100vw); height: auto; max-height: 85vh;
  border-left: 0; border-top: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0;
  animation-name: sheet-in;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }

.sheet-heading { font-size: 14px; font-weight: 600; margin-top: var(--space-2); }
.facts { display: grid; grid-template-columns: 1fr; gap: var(--space-1) 0; }
.facts dt { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-muted); margin-top: var(--space-3); }
.facts dt:first-child { margin-top: 0; }
.facts dd { margin: 0; }
.facts-inline { grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); }
.facts-inline dt { margin-top: 0; }
.contact-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.btn-call { height: 48px; }

/* ---- Dialog ------------------------------------------------------------------------------ */

.dialog {
  width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-raised); color: var(--text); box-shadow: var(--shadow-raised);
}
.dialog::backdrop { background: rgb(0 0 0 / 0.5); }
.dialog-form { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.dialog-title { font-size: 17px; line-height: 24px; font-weight: 600; }
.dialog-actions { display: flex; align-items: center; gap: var(--space-4); }

/* ---- Today ---------------------------------------------------------------------------------- */

.practice-list > li { border-bottom: 1px solid var(--border); }
.practice-row { display: grid; grid-template-columns: 150px 1fr auto; gap: var(--space-4); padding: var(--space-3) 0; align-items: start; }
.practice-when { font-weight: 600; font-variant-numeric: tabular-nums; }
.practice-body { display: flex; flex-direction: column; gap: 2px; }
.practice-line { color: var(--text); }
.practice-actions { align-self: center; }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.week-day { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: var(--space-2) var(--space-3) var(--space-3); min-height: 120px; }
.week-day.is-today { background: var(--bg-selected); }
.week-date { font-weight: 600; margin-bottom: var(--space-2); font-variant-numeric: tabular-nums; }
.week-date span { color: var(--text-muted); font-weight: 400; }
.week-day.is-today .week-date span { color: var(--text); font-weight: 600; }
.week-items { display: flex; flex-direction: column; gap: var(--space-2); font-size: 13px; line-height: 18px; }
.week-items a { color: var(--text); }
.week-empty { font-size: 13px; }

/* ---- Profile ---------------------------------------------------------------------------------- */

.profile { display: grid; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); gap: var(--space-6); }
.profile-facts { border-left: 1px solid var(--border); padding-left: var(--space-5); }
.note-list li { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); max-width: 80ch; }
.note-meta { color: var(--text-muted); font-size: 12px; margin-bottom: 2px; }

.attendance-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }

/* ---- Workout editor ------------------------------------------------------------------------------ */

.workout-form { display: flex; flex-direction: column; gap: var(--space-5); }
.workout-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); align-items: end; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: var(--space-5); }
.editor-pane { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.workout-text { font-family: var(--font-mono); font-size: 14px; line-height: 22px; min-height: 360px; width: 100%; }
.parsed { border-top: 1px solid var(--border); }
.parsed-table td { height: 30px; }
.parsed-label td { font-weight: 600; color: var(--text-muted); }
.parsed-note td { color: var(--text-muted); font-style: italic; }
.parsed-issue td { height: auto; padding-top: var(--space-1); padding-bottom: var(--space-2); }
.parsed-issue .status { white-space: normal; }
.guide summary { cursor: pointer; font-weight: 600; color: var(--accent-text); }
.guide-table { margin: var(--space-3) 0; }
.guide-table td { height: auto; padding: var(--space-2) var(--space-3); }
.print-sheet { display: none; }

/* ---- Imports ---------------------------------------------------------------------------------- */

.steps { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin-bottom: var(--space-2); }
.steps li { display: flex; align-items: center; gap: var(--space-2); }
.steps strong { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--border-control); border-radius: 50%; font-size: 12px; }
.issue-block { margin-bottom: var(--space-5); }
.issue-heading { font-size: 14px; font-weight: 600; margin-bottom: var(--space-2); }
.issue-block summary { cursor: pointer; font-weight: 600; margin-bottom: var(--space-2); }
.issue-table td { height: auto; padding: var(--space-2) var(--space-3); }
.changes-line { font-size: 15px; }
tr.row-error td:first-child { color: var(--danger); font-weight: 600; }

.danger-section { max-width: 72ch; display: flex; flex-direction: column; gap: var(--space-3); align-items: flex-start; }
.danger-section h2 { font-size: 17px; }

.message-body { white-space: pre-wrap; max-width: 64ch; }
.recipients summary { cursor: pointer; color: var(--accent-text); }
.recipients ul { margin-top: var(--space-2); max-height: 200px; overflow-y: auto; }
.recipients li { padding: 2px 0; }

/* ---- Chart ------------------------------------------------------------------------------------ */

.chart { margin: 0 0 var(--space-5); }
.chart-svg { width: 100%; max-width: 900px; height: auto; display: block; font: 12px var(--font-ui); }
.chart-grid line { stroke: var(--border); stroke-width: 1; }
.chart-grid text, .chart-axis { fill: var(--text-muted); font-variant-numeric: tabular-nums; }
.chart-standard line { stroke: var(--text-muted); stroke-dasharray: 4 4; }
.chart-standard text { fill: var(--text-muted); }
.chart-line { fill: none; stroke: var(--accent-text); stroke-width: 2; }
.chart-dot { fill: var(--bg); stroke: var(--accent-text); stroke-width: 2; }
.chart-dot.is-best { fill: var(--accent-text); }
.chart-best { fill: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- Login --------------------------------------------------------------------------------------- */

.layout-login { min-height: 100vh; }
.login-header {
  display: flex; align-items: center; gap: var(--space-5);
  min-height: 56px; padding: 0 var(--gutter); border-bottom: 1px solid var(--border);
}
.login-about { margin-left: auto; font-weight: 600; }
.login { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-8) var(--gutter); }
.login > * { max-width: 480px; }
.login-title { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -0.01em; }
.login-copy, .login-help { color: var(--text-muted); }
.google-button { min-height: 44px; margin-top: var(--space-2); }
.google-button:empty { display: none; }
.login-status { min-height: 20px; }
.login-status[data-tone="danger"] .status-glyph { color: var(--danger); }
.login-help { margin-top: var(--space-3); }

/* ---- Deck mode --------------------------------------------------------------------------------- */

.layout-deck { min-height: 100vh; }
.deck { display: flex; flex-direction: column; min-height: 100vh; }
.deck-header {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-5); background: var(--bg); border-bottom: 1px solid var(--border);
}
.deck-title { font-size: 20px; line-height: 28px; font-weight: 700; flex: 1; }
.deck-header .save-state { font-size: 14px; }
.btn-deck { height: 56px; padding: 0 var(--space-5); font-size: 17px; }
.deck-tabs { display: none; }
.deck-offline { padding: var(--space-3) var(--space-5); font-weight: 600; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--space-4); }
.deck-panes { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); flex: 1; }
.deck-workout { padding: var(--space-5); border-right: 1px solid var(--border); font-size: 18px; line-height: 26px; }
.deck-workout-title { display: flex; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.deck-sets { width: 100%; border-collapse: collapse; }
.deck-sets td { padding: var(--space-2) var(--space-2) var(--space-2) 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.deck-sets td.num { text-align: right; font-variant-numeric: tabular-nums; }
.deck-set-label { color: var(--text-muted); font-size: 14px; font-weight: 600; width: 56px; }
.deck-sets .energy { font-size: 14px; }
.deck-notes-heading { font-size: 14px; color: var(--text-muted); margin-top: var(--space-5); }
.deck-swimmers { padding: var(--space-4) var(--space-5); }
.deck-counts { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; font-size: 17px; font-weight: 600; margin-bottom: var(--space-3); }
.deck-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 64px; border-bottom: 1px solid var(--border); }
.deck-name {
  font: inherit; font-size: 20px; line-height: 28px; font-weight: 600; color: var(--text);
  background: none; border: 0; padding: var(--space-3) 0; text-align: left; flex: 1; cursor: pointer; min-height: 64px;
}
span.deck-name { cursor: default; display: flex; align-items: center; }
.deck-medical { color: var(--danger); }
.att-btn {
  display: inline-flex; align-items: center; justify-content: flex-start; gap: var(--space-2);
  width: 200px; height: 56px; padding: 0 var(--space-4); flex-shrink: 0;
  font: inherit; font-size: 18px; font-weight: 600; color: var(--text); cursor: pointer;
  background: var(--bg); border: 1px solid var(--border-control); border-radius: var(--radius);
  touch-action: manipulation;
}
.att-btn .status-glyph { font-size: 20px; }
.att-btn[data-tone="success"] .status-glyph { color: var(--success); }
.att-btn[data-tone="warning"] .status-glyph { color: var(--warning); }
.att-btn[data-tone="danger"] .status-glyph { color: var(--danger); }
.att-btn[data-tone="muted"] .status-glyph { color: var(--text-muted); }
.deck-legend { padding: var(--space-3) var(--space-5); color: var(--text-muted); border-top: 1px solid var(--border); }
.deck-legend span { color: var(--danger); }
.deck-message { padding: var(--space-5); color: var(--text-muted); font-size: 17px; }

@media (max-width: 899px) {
  .deck-tabs { display: flex; border-bottom: 1px solid var(--border); }
  .deck-tab {
    flex: 1; height: 56px; font: inherit; font-size: 17px; font-weight: 600; color: var(--text);
    background: var(--bg); border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  }
  .deck-tab[aria-selected="true"] { color: var(--accent-text); border-bottom-color: var(--accent-text); }
  .deck-panes { grid-template-columns: 1fr; }
  .deck-workout { border-right: 0; }
  .deck[data-pane="swimmers"] .deck-workout { display: none; }
  .deck[data-pane="workout"] .deck-swimmers { display: none; }
  .att-btn { width: 160px; }
}

/* ---- Guardian and swimmer screens (phone-first) ------------------------------------------------ */

.family-list > li, .family-row { border-bottom: 1px solid var(--border); }
.family-list-ruled { border-top: 1px solid var(--border); }
.family-row { padding: var(--space-3) 0; display: flex; flex-direction: column; gap: 2px; max-width: 72ch; }
.family-row-action { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--space-4); }
.family-subhead { font-size: 14px; font-weight: 600; color: var(--text-muted); margin: var(--space-4) 0 var(--space-1); }
.family-meet .section-head { margin-bottom: var(--space-1); }
.family-meet > p { margin-bottom: 2px; }
.btn-family { height: 44px; padding: 0 var(--space-4); margin-top: var(--space-2); }
.family-row-action .btn-family { margin-top: 0; }

.agenda { max-width: 80ch; }
.agenda-day { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.agenda-date { font-weight: 600; font-variant-numeric: tabular-nums; }
.agenda-items { display: flex; flex-direction: column; gap: var(--space-2); }

.time-list { border-top: 1px solid var(--border); max-width: 72ch; }
.time-list li { border-bottom: 1px solid var(--border); }
.time-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--space-4);
  padding: var(--space-3) 0; color: var(--text); text-decoration: none;
}
.time-row:hover .time-event { color: var(--accent-text); text-decoration: underline; }
.time-event { font-weight: 600; }
.time-value { grid-row: span 2; align-self: center; text-align: right; font-size: 20px; line-height: 28px; font-weight: 600; }
.time-meta { color: var(--text-muted); font-size: 13px; }
.time-gap { grid-column: 1 / -1; }

.declare-form { display: flex; flex-direction: column; gap: var(--space-5); max-width: 560px; }
.declare-block { border: 0; border-bottom: 1px solid var(--border); margin: 0; padding: 0 0 var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.declare-block legend { font-size: 17px; line-height: 24px; font-weight: 600; padding: 0; margin-bottom: var(--space-3); }
.declare-sessions { display: flex; flex-direction: column; gap: 0; }
.declare-actions { display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.seg-radio .seg-option { height: 48px; min-width: 96px; justify-content: center; font-size: 15px; cursor: pointer; }
.seg-radio .seg-option:has(input:checked) { background: var(--text); color: var(--bg); border-color: var(--text); position: relative; }
.seg-radio .seg-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; position: relative; z-index: 1; }

.message-list { border-top: 1px solid var(--border); max-width: 80ch; }
.message-list li { border-bottom: 1px solid var(--border); padding: var(--space-3) 0; }
.message-list summary { cursor: pointer; }
.message-list .message-body { margin-top: var(--space-2); }

.check-grid-wide { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

/* ---- Responsive -------------------------------------------------------------------------------- */

@media (max-width: 1279px) {
  .hide-laptop { display: none; }
  .club-name { display: none; }
}

@media (max-width: 1023px) {
  :root { --gutter: 16px; }
  .hide-tablet { display: none; }
  .topbar-inner { flex-wrap: wrap; gap: 0 var(--space-3); }
  .sections { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .section-link { height: 44px; white-space: nowrap; }
  .subtabs { top: 101px; }
  table.data th { top: 145px; }
  .profile { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .split > .section + .section { margin-top: var(--space-6); }
  .profile-facts { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: var(--space-4); order: -1; }
  .facts { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3); }
  .facts dt { margin-top: 0; }
  .editor { grid-template-columns: 1fr; }
  .workout-meta { grid-template-columns: 1fr 1fr; }
  .week { grid-template-columns: 1fr; border-left: 0; }
  .week-day { border-right: 0; min-height: 0; display: grid; grid-template-columns: 90px 1fr; gap: var(--space-3); }
  .drawer, .drawer-wide { width: 100vw; }
  .drawer-backdrop { background: rgb(0 0 0 / 0.4); }
}

@media (max-width: 767px) {
  .topbar, .subtabs, table.data th { position: static; }
  .page { padding-top: var(--space-4); }
  .page-header-row { flex-direction: column; align-items: stretch; }
  .sections { gap: 0; }
  .section-link { padding: 0 10px; }
  .practice-row { grid-template-columns: 1fr; gap: var(--space-2); }
  .field-row, .field-row-3, .workout-meta { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .filters .field { min-width: 0; flex: 1 1 140px; }
  .filters .field input[type="search"] { min-width: 0; }
  .field input, .field select, .field textarea { font-size: 16px; }

  /* Tables become two-line list items: name, then the rest. */
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr { display: block; }
  table.data tr { padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
  table.data td { display: inline-block; height: auto; padding: 0; border: 0; margin-right: var(--space-4); }
  table.data td.cell-primary { display: block; margin: 0 0 2px; }
  table.data td[data-label]:not(.cell-primary):not(:empty)::before {
    content: attr(data-label) " "; color: var(--text-muted); font-size: 12px;
  }
  table.data td.num { text-align: left; }
  table.data td .row-actions, table.data td .seg { display: flex; margin-top: var(--space-2); }
  .guide-table td { display: block; }
  .agenda-day { grid-template-columns: 1fr; gap: var(--space-1); }
  .family-row-action { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-bottom .drawer { animation: none; }
}

/* ---- Print: the workout sheet only ------------------------------------------------------------------ */

@media print {
  :root { color-scheme: light; --text: #000; --bg: #fff; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .topbar, .subtabs, .skip-link, .page-header, .workout-form, .notice, .drawer-layer { display: none !important; }
  .page { padding: 0; }
  .print-sheet { display: block !important; }
  .print-sheet h1 { font-size: 18pt; margin-bottom: 4pt; }
  .print-sheet p { margin-bottom: 10pt; }
  .print-sheet table { width: 100%; border-collapse: collapse; font-size: 14pt; }
  .print-sheet td { padding: 5pt 8pt 5pt 0; border-bottom: 1px solid #999; vertical-align: top; }
  .print-sheet td:last-child { text-align: right; }
}
.page-heading h1 .mono { font-size: inherit; font-weight: 700; }
