/* Deckside base styles. Team colours arrive as CSS variables on <body> (teams/theme.py). */
:root {
  --bg: #F4F4F1;
  --surface: #FFFFFF;
  --surface-2: #FAFAF8;
  --text: #1B1B1A;
  --muted: #5F6368;
  --faint: #8C8F94;
  --border: #E3E3DF;
  --border-strong: #CFCFCA;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .05);
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 6px 20px rgb(0 0 0 / .05);
  --danger: #B3261E;
  --success: #1E6B3A;
  --warn-bg: #FBE7C6;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}
body { --tint: color-mix(in srgb, var(--team-primary) 10%, white);
  --tint-strong: color-mix(in srgb, var(--team-primary) 22%, white); }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); line-height: 1.45; }
a { color: inherit; }
h1 { font-size: 1.65rem; margin: 0 0 1rem; letter-spacing: -.01em; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .75rem; }
h2:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar: secondary colour, primary accent stripe below. */
.topbar {
  display: flex; align-items: center; gap: 1.75rem;
  padding: .55rem 1.5rem; position: sticky; top: 0; z-index: 20;
  background: var(--team-secondary); color: var(--team-on-secondary);
}
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; }
.brand-logo { height: 38px; width: 38px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-team { font-weight: 700; font-size: 1.05rem; }
.brand-app { font-size: .68rem; opacity: .75; letter-spacing: .1em; text-transform: uppercase; }
.nav { display: flex; align-items: center; gap: .15rem; white-space: nowrap; }
.nav > a, .nav .menu > summary { text-decoration: none; padding: .45rem .7rem; border-radius: 8px;
  opacity: .85; font-weight: 500; font-size: .95rem; }
.nav > a:hover, .nav .menu > summary:hover { opacity: 1; background: rgb(255 255 255 / .08); }
.nav > a.active, .nav .menu.active > summary { opacity: 1; background: rgb(255 255 255 / .12);
  box-shadow: inset 0 -2px 0 var(--team-primary); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: .9rem; font-size: .9rem; }
.team-switch select { padding: .3rem 1.7rem .3rem .5rem; background-position: right .5rem center; border-radius: 6px; border: 0; width: auto; }
.accent-stripe { height: 4px; background: var(--team-primary); position: sticky; top: 0; }
.count { display: inline-block; min-width: 1.35em; padding: 0 .35em; border-radius: 999px;
  background: var(--team-primary); color: var(--team-on-primary); font-size: .72rem; font-weight: 700;
  text-align: center; line-height: 1.5; }

/* Drop-down menus (<details class="menu">) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .35rem; }
.menu > summary::-webkit-details-marker { display: none; }
.nav .menu > summary::after { content: ""; width: .4rem; height: .4rem; margin-left: .15rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .7; }
.menu-panel { position: absolute; top: calc(100% + .4rem); left: 0; min-width: 13rem; z-index: 30;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgb(0 0 0 / .15); padding: .35rem; display: flex; flex-direction: column; }
.menu-right .menu-panel { left: auto; right: 0; }
.menu-panel a { padding: .5rem .7rem; border-radius: 6px; text-decoration: none; display: flex;
  justify-content: space-between; align-items: center; gap: 1rem; }
.menu-panel a:hover { background: var(--bg); }
.menu-label { padding: .45rem .7rem .15rem; font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); }
.export-menu .menu-panel { min-width: 18.5rem; }
.export-menu .menu-panel a .small { white-space: nowrap; }
.export-menu > summary::after { content: ""; width: .35rem; height: .35rem; margin-left: .2rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .6; }
.menu-note { padding: .5rem .7rem .6rem; font-size: .82rem; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.avatar { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--team-primary); color: var(--team-on-primary); font-weight: 700; font-size: .9rem; }

@media (max-width: 1000px) {
  .topbar { flex-wrap: wrap; gap: .4rem 1rem; padding: .5rem 1rem; }
  .nav { order: 3; width: 100%; flex-wrap: wrap; margin: 0 -.3rem; }
  .user-email { display: none; }
}
.container { max-width: 1200px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }
.container.wide { max-width: 1500px; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.message { padding: .7rem 1rem; border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--team-primary); margin-bottom: .5rem; box-shadow: var(--shadow-sm); }
.message-error { border-left-color: var(--danger); }
.message-success { border-left-color: var(--success); }

/* Page header: title + meta on the left, actions on the right */
.crumbs { font-size: .88rem; margin: 0 0 .5rem; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs a + a::before { content: "/"; margin: 0 .45rem; color: var(--faint); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: .75rem 1.5rem; margin: 0 0 1.25rem; }
.page-head p { margin: .3rem 0 0; }
.page-head h1, .title-row h1, .home-head h1, .card-head h1 { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin: .35rem 0 0; color: var(--muted); font-size: .92rem; }
.meta > * + *::before { content: "·"; margin-right: .5rem; color: var(--faint); }
.meta { column-gap: .5rem; }
.section { margin-top: 1.75rem; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  margin: 0 0 .6rem; font-weight: 700; }

/* Cards and layout */
.hero { margin-bottom: 1.75rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.card p { margin: 0; }
.card p + p { margin-top: .5rem; }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; align-items: start; }
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .two-col, .split-2 { grid-template-columns: 1fr; } }
.empty { text-align: center; padding: 2.5rem 1.5rem; }
.empty h2 { margin-bottom: .4rem; }

/* Stat tiles and link tiles (home, reports) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .85rem 1rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: .15rem; }
.stat-label { font-size: .78rem; color: var(--muted); }
.stat-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-sub { font-size: .8rem; color: var(--muted); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.tile { display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.1rem; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: border-color .12s, box-shadow .12s; }
.tile:hover { border-color: var(--team-primary); box-shadow: var(--shadow); }
.tile .muted { font-size: .9rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th, .table td { text-align: left; padding: .6rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th { font-weight: 600; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.table.hover tbody tr:hover { background: var(--surface-2); }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 1.25rem; }
.card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 1.25rem; }
.card.flush .table thead th { background: var(--surface-2); }
.th-sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .25rem; }
.th-sort:hover { color: var(--text); }
.th-sort.on { color: var(--text); }
.th-sort.on::after { content: "▾"; font-size: .7rem; }
.th-sort.on.asc::after { content: "▴"; }
.row-link { font-weight: 600; text-decoration: none; }
.row-link:hover { text-decoration: underline; }
.badge { font-size: .72rem; padding: .12rem .5rem; border-radius: 999px; background: var(--border); font-weight: 600;
  white-space: nowrap; display: inline-block; line-height: 1.4; }
.badge.accent { background: var(--team-primary); color: var(--team-on-primary); }
.badge.soft { background: var(--tint); color: var(--text); }
.badge.live { background: #DCEFE2; color: var(--success); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1.25rem;
  border-top: 1px solid var(--border); font-size: .9rem; }
.pager a { text-decoration: none; font-weight: 600; }

/* Toolbars: search + filters above a list */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 1rem; }
.toolbar input[type=search] { flex: 1 1 18rem; max-width: 26rem; }
.toolbar select { width: auto; }
.toolbar .spacer { flex: 1; }
input[type=search].search-input { padding-left: 2.2rem !important; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238C8F94' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") no-repeat .75rem center; }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.segmented a { padding: .38rem .8rem; border-radius: 7px; text-decoration: none; font-size: .9rem; color: var(--muted); font-weight: 500; }
.segmented a.active { background: var(--team-secondary); color: var(--team-on-secondary); }
.segmented a:not(.active):hover { color: var(--text); background: var(--bg); }
/* The same control as radio buttons inside a form (report filters). */
fieldset.segmented { margin: 0; min-width: 0; }
.segmented label { position: relative; display: inline-flex; margin: 0; font-weight: 500; }
.segmented label input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented label span { padding: .38rem .8rem; border-radius: 7px; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.segmented label input:checked + span { background: var(--team-secondary); color: var(--team-on-secondary); }
.segmented label input:not(:checked):hover + span { color: var(--text); background: var(--bg); }
.segmented label input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--team-primary) 55%, transparent); outline-offset: 1px; }
.toolbar .segmented { align-self: stretch; align-items: center; }

/* Forms (also used by allauth's plain markup inside .auth-card) */
.auth-card { max-width: 440px; margin: 2rem auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem;
  border-top: 4px solid var(--team-primary); box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 1rem; }
.auth-card form p, .form > div { display: flex; flex-direction: column; gap: .3rem; margin: 0 0 1rem; }
.auth-card form p:has(input[type=checkbox]) { flex-direction: row; align-items: center; gap: .5rem; }
label { font-weight: 600; font-size: .9rem; }
input[type=email], input[type=password], input[type=text], input[type=search], input[type=date], input[type=file], select, textarea {
  font: inherit; padding: .5rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; width: 100%; color: var(--text);
}
/* One look for every dropdown: no native chrome, our own chevron, the same height as a button. */
select { appearance: none; -webkit-appearance: none; padding-right: 2rem; line-height: 1.3; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%235F6368' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2.5 4.5 3.5 3.5 3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; background-size: 12px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--team-primary) 55%, transparent); outline-offset: 1px;
}
.auth-card form p span, .helptext { font-size: .8rem; color: var(--muted); font-weight: 400; }
.errorlist { list-style: none; padding: 0; margin: 0 0 .4rem; color: var(--danger); font-size: .9rem; }
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: .5rem 1rem; background: var(--team-primary); color: var(--team-on-primary);
  text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; line-height: 1.3; white-space: nowrap;
}
button:hover, .btn:hover { filter: brightness(.95); }
button:disabled { opacity: .55; cursor: default; }
.btn-secondary, button.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); filter: none; border-color: var(--faint); }
.btn-ghost { background: none; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); filter: none; }
.btn-sm { padding: .3rem .65rem; font-size: .85rem; }
.btn-link { background: none; color: var(--danger); padding: 0; font-weight: 500; border: 0; }
.btn-link:hover { text-decoration: underline; filter: none; }
.icon-btn { background: none; border: 0; color: var(--faint); padding: .3rem .4rem; border-radius: 6px; font-size: 1.05rem; line-height: 1; }
.icon-btn:hover { background: var(--bg); color: var(--danger); filter: none; }
.auth-card a[href]:not(.btn) { color: var(--text); }

/* Phase 2: imports, review, meets */
h3 { font-size: .95rem; margin: 1rem 0 .4rem; color: var(--muted); }
.card h2 a { text-decoration: none; }
.nav .count { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 999px;
  background: var(--team-primary); color: var(--team-on-primary); font-size: .75rem; text-align: center; }
.tabs { display: flex; gap: .25rem; margin: 0 0 1rem; border-bottom: 1px solid var(--border); }
.tabs a { padding: .5rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--team-primary); font-weight: 600; }
.status-completed { background: #DCEFE2; }
.status-failed { background: #F6D7D5; }
.status-needs_review { background: #FBE7C6; }
.warning-list { margin: 0; padding-left: 1.1rem; font-size: .9rem; }
.warning-list li { margin-bottom: .35rem; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 900px) { .compare { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; }
code { font-size: .85em; background: var(--bg); padding: .05rem .3rem; border-radius: 4px; }
.choice-list { display: flex; flex-direction: column; gap: .6rem; margin-top: 1rem; }
.choice { display: flex; flex-direction: column; gap: .2rem; text-align: left; background: var(--surface);
  color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--team-primary); }
.choice:hover { background: var(--bg); filter: none; }
.choice-new { border-left-color: var(--team-secondary); }
.choice span { font-weight: 400; font-size: .9rem; }
.event { margin-bottom: 1rem; }
.results .num { text-align: right; font-variant-numeric: tabular-nums; width: 5rem; }
.results .num:first-child { width: 2.5rem; }
.legs { font-size: .8rem; }
.card + .card { margin-top: 1rem; }
.two-col .card + .card, .compare .card + .card { margin-top: 0; }

/* Phase 3: decisions */
.decide textarea { margin: .3rem 0 .8rem; }
.decide-buttons { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.small { font-size: .85rem; margin: 0; }
tr.undone td { opacity: .55; }
tr.undone td:last-child { opacity: 1; }
.compact { margin: 0; padding-left: 1.1rem; font-size: .9rem; }
.compact li { margin-bottom: .2rem; }

/* Splits */
.split-toggle { font: inherit; font-size: .8rem; padding: .15rem .55rem; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; }
.split-toggle[aria-expanded="true"] { background: var(--team-primary); color: var(--team-on-primary);
  border-color: var(--team-primary); }
.split-row td { padding-top: 0; background: var(--bg); }
.splits { list-style: none; margin: 0; padding: .5rem 0; display: grid; gap: .35rem;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); font-variant-numeric: tabular-nums; }
.split { display: flex; flex-direction: column; padding: .3rem .45rem; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border); line-height: 1.25; }
.split-dist { font-size: .72rem; color: var(--muted); }
.split-time { font-weight: 600; }
.split-lap { font-size: .8rem; color: var(--muted); min-height: 1em; }
.split.fastest { border-color: var(--success); box-shadow: inset 3px 0 0 var(--success); }
.split.slowest { border-color: var(--danger); box-shadow: inset 3px 0 0 var(--danger); }
.split.exchange { margin-left: .25rem; border-left: 3px solid var(--team-primary); }

/* Relay legs & race summary */
.legs { list-style: none; margin: .2rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .1rem 1rem;
  font-size: .85rem; color: var(--muted); }
.legs a { color: inherit; }
.leg-split { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.small { font-size: .78rem; }
.race-summary { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin: .55rem 0 0; font-variant-numeric: tabular-nums; }
.race-summary dt { font-size: .72rem; color: var(--muted); }
.race-summary dd { margin: 0; font-weight: 600; }
.neg-split { color: var(--success); }
.results a, .table a { color: var(--text); }

/* Athlete split comparison */
.viz-root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card-head h2 { margin: 0; }
.card + .card, .card + form.card, form.card { margin-top: 1rem; }
.chart-note { font-size: .85rem; margin: .2rem 0 .6rem; }
.legend { list-style: none; padding: 0; margin: 0 0 .5rem; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem;
  font-size: .85rem; }
.swatch { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; margin-right: .4rem;
  vertical-align: -1px; }
.swatch.s1, .viz-root .series.s1 { background: var(--s1); stroke: var(--s1); fill: var(--s1); }
.swatch.s2, .viz-root .series.s2 { background: var(--s2); stroke: var(--s2); fill: var(--s2); }
.swatch.s3, .viz-root .series.s3 { background: var(--s3); stroke: var(--s3); fill: var(--s3); }
.swatch.s4, .viz-root .series.s4 { background: var(--s4); stroke: var(--s4); fill: var(--s4); }
form.card { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; }
.chart-wrap { position: relative; }
.pace-chart { width: 100%; height: auto; display: block; font-variant-numeric: tabular-nums; }
.pace-chart .grid { stroke: var(--border); stroke-width: 1; }
.pace-chart .tick { font-size: 11px; fill: var(--muted); }
.pace-chart .series path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pace-chart .series circle { stroke: var(--surface); stroke-width: 2; }
.pace-chart .end-label { stroke: none; fill: var(--text); font-size: 11px; }
.pace-chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.pace-chart .hit { fill: transparent; cursor: crosshair; }
.chart-tip { position: absolute; top: .5rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .4rem .6rem; font-size: .8rem; box-shadow: 0 4px 14px rgb(0 0 0 / .08);
  pointer-events: none; font-variant-numeric: tabular-nums; min-width: 12rem; }
.chart-tip div { display: flex; align-items: center; gap: .3rem; }
.chart-tip strong { margin-left: auto; padding-left: .8rem; }
.tip-head { font-weight: 600; color: var(--muted); }
.table-scroll { overflow-x: auto; }
.splits-table { font-variant-numeric: tabular-nums; white-space: nowrap; }
.splits-table td { vertical-align: top; }
.splits-table .lap-cell.fastest { box-shadow: inset 0 -2px 0 var(--success); }
.splits-table .lap-cell.slowest { box-shadow: inset 0 -2px 0 var(--danger); }
.gap.ahead { color: var(--success); }
.gap.behind { color: var(--muted); }
.best-row { background: color-mix(in srgb, var(--team-primary) 7%, transparent); }
.badge.best { background: var(--team-primary); color: var(--team-on-primary); }
.pick { display: inline-flex; align-items: center; gap: .3rem; }
.pick .swatch { margin: 0; }
.splits-table .num, .table th.num, .table td.num { text-align: right; }
.export-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin: 0 0 1rem; }
.export-bar select { font: inherit; padding: .4rem 1.8rem .4rem .5rem; border: 1px solid var(--border); border-radius: 8px; background-color: var(--surface); }
.export-bar label { font-size: .85rem; color: var(--muted); }
.export-bar a { color: var(--text); }
.export-bar select { width: auto; margin: 0; } .export-bar label { display: inline; margin: 0; }

/* Rosters and entries */
.check { display: flex; flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; }
.check input { width: auto; }
.small { font-size: .8rem; }
.narrow { max-width: 460px; }
.legend-line { font-size: .85rem; margin: 0 0 .6rem; }
.matrix-wrap { overflow: auto; max-height: calc(100vh - 220px); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); border-top: 4px solid var(--team-primary); }
.matrix { border-collapse: separate; border-spacing: 0; font-size: .85rem; font-variant-numeric: tabular-nums; }
.matrix th, .matrix td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 0; }
.matrix thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; font-weight: 600;
  color: var(--muted); padding: .35rem .4rem; text-align: center; white-space: nowrap; }
.matrix thead tr.sessions th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.matrix thead tr + tr th { top: 1.75rem; }
.matrix .name-col { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left;
  padding: .3rem .6rem; white-space: nowrap; min-width: 12rem; font-weight: 500; }
.matrix thead .name-col { z-index: 3; }
.matrix .name-col a { text-decoration: none; }
.matrix .total-col, .matrix td.total { text-align: center; padding: .3rem .5rem; min-width: 3.2rem; }
.matrix td.total.warn { background: #FBE7C6; font-weight: 700; }
.matrix .ev { min-width: 4.6rem; }
.matrix .ev span { display: block; }
.matrix .ev-num { font-size: .7rem; font-weight: 400; }
.matrix .ev-name { color: var(--text); }
.matrix .ev-count { font-size: .75rem; font-weight: 400; margin-top: .1rem; }
.matrix .cell form { margin: 0; }
.matrix .cell-btn { display: block; width: 100%; min-height: 2.1rem; padding: .35rem .3rem; text-align: center;
  background: none; border: 0; border-radius: 0; color: #9A9A96; font: inherit; font-weight: 400; text-decoration: none; }
.matrix .cell-btn:hover { background: color-mix(in srgb, var(--team-primary) 12%, transparent); color: var(--text); filter: none; }
.matrix .cell.on { background: color-mix(in srgb, var(--team-primary) 22%, white); }
.matrix .cell.on .cell-btn { color: var(--text); font-weight: 700; }
.matrix .cell.exh { background: color-mix(in srgb, var(--team-secondary) 18%, white); }
.matrix .cell .x { font-size: .7rem; font-weight: 700; }
.matrix tbody tr:hover th, .matrix tbody tr:hover td:not(.on) { background-color: #FAFAF8; }
.entry-panel { position: fixed; right: 1rem; top: 5rem; width: min(360px, calc(100vw - 2rem)); z-index: 10;
  background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--team-primary);
  border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.panel-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.panel-head h2 { margin: 0; }
.panel-close { background: none; color: var(--muted); font-size: 1.4rem; line-height: 1; padding: 0 .2rem; }
.panel-form { margin-top: 1rem; }
.panel-form > label, .panel-form > input, .panel-form > .helptext { display: block; margin-bottom: .3rem; }

/* Relays: one compact row per relay (letter, seed, four legs, exhibition, menu) */
.relay-intro { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.relay-intro p { margin: 0; max-width: 60rem; }
.event-jump { display: flex; flex-wrap: wrap; gap: .35rem; }
.event-jump a { font-size: .82rem; padding: .25rem .6rem; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); text-decoration: none; color: var(--muted); display: inline-flex; gap: .35rem; align-items: center; }
.event-jump a:hover { color: var(--text); border-color: var(--border-strong); }
.relay-event { scroll-margin-top: 5rem; }
.relay-event + .relay-event { margin-top: 1rem; }
.relay-event .card-head h2 { font-size: 1.05rem; }
.relay-none { padding: 1rem 1.25rem; margin: 0; }
.relay-grid { display: grid; align-items: center; gap: .3rem .6rem;
  grid-template-columns: 2.2rem 8.5rem repeat(4, minmax(0, 1fr)) 2.6rem 5.5rem; }
.relay-colhead { padding: .45rem 1.25rem; background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: .76rem; font-weight: 600; color: var(--muted); }
.relay-row { padding: .65rem 1.25rem .5rem; border-bottom: 1px solid var(--border); transition: background .4s; }
.relay-row:last-child { border-bottom: 0; }
.relay-row form { margin: 0; }
.relay-row.is-exh { background: color-mix(in srgb, var(--team-secondary) 6%, white); }
.relay-row.is-saving { opacity: .7; }
.relay-row.just-saved { background: #EEF7F0; }
.relay-row.has-error { background: #FCEDEC; }
.relay-letter { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: var(--team-primary); color: var(--team-on-primary); font-weight: 700; }
.is-exh .relay-letter { background: var(--team-secondary); color: var(--team-on-secondary); }
.rc-seed { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.rc-seed .seed-input { font-variant-numeric: tabular-nums; font-weight: 700; padding: .35rem .5rem; }
.seed-note { font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: help; }
.rc-leg { min-width: 0; }
.rc-leg select, .alts-grid select { font-size: .88rem; padding: .38rem 1.6rem .38rem .5rem; text-overflow: ellipsis; }
.rc-leg select.unset, .alts-grid select.unset { color: var(--faint); border-style: dashed; }
.rc-exh { text-align: center; }
.exh-toggle { display: inline-flex; flex-direction: column; align-items: center; gap: 0; cursor: pointer; font-size: .7rem; color: var(--muted); }
.exh-toggle input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--team-secondary); }
.exh-toggle span { display: none; }
.rc-actions { display: flex; justify-content: flex-end; align-items: center; gap: .25rem; }
.relays-live .save-btn { display: none; }
.menu-btn { background: none; color: var(--text); border: 0; text-align: left; font-weight: 500; padding: .5rem .7rem; border-radius: 6px; width: 100%; }
.menu-btn:hover { background: var(--bg); filter: none; }
.menu-btn.danger { color: var(--danger); }
.rc-foot { grid-column: 3 / -1; display: flex; align-items: flex-start; gap: 1rem; min-height: 1.2rem; }
.alts { font-size: .82rem; color: var(--muted); }
.alts > summary { cursor: pointer; }
.alts[open] { flex: 1; }
.alts-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem .6rem; margin: .4rem 0 .2rem; }
.alts-grid label { font-size: .74rem; font-weight: 500; display: flex; flex-direction: column; gap: .15rem; }
.relay-status { margin-left: auto; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.relay-status.saving { color: var(--faint); }
.relay-error, .relay-status.relay-error { color: var(--danger); font-weight: 600; white-space: normal; }
@media (max-width: 860px) { .alts-grid { grid-template-columns: 1fr 1fr; } }
.warn-line { color: var(--danger); font-weight: 500; }
.warn-line[hidden] { display: none; }

/* Home */
.eyebrow { margin: 0 0 .2rem; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); }
.home-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: 1.25rem; }
.home-search { flex: 0 1 26rem; }
.home-search input { padding-top: .65rem; padding-bottom: .65rem; box-shadow: var(--shadow-sm); }
.stat-link { text-decoration: none; transition: border-color .12s; }
.stat-link:hover { border-color: var(--team-primary); }
.home-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.5rem; margin-top: 1.75rem; align-items: start; }
@media (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } }
.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.section-head a { color: var(--muted); }
.grow { flex: 1; min-width: 0; }
.meet-card { border-top: 4px solid var(--team-primary); }
.meet-card + .meet-card { margin-top: 1rem; }
.meet-card-head { display: flex; align-items: flex-start; gap: 1rem; }
.meet-card-title { margin: 0; font-size: 1.15rem; color: var(--text); }
.meet-card-title a { text-decoration: none; }
.meet-card-title a:hover { text-decoration: underline; }
.date-chip { flex: none; width: 3.2rem; border-radius: 10px; overflow: hidden; text-align: center; border: 1px solid var(--border); }
.date-chip span { display: block; background: var(--team-primary); color: var(--team-on-primary); font-size: .7rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .15rem 0; }
.date-chip strong { display: block; font-size: 1.35rem; padding: .15rem 0 .2rem; }
.entry-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: .5rem; margin: 1.1rem 0; }
.entry-stats div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .5rem .7rem; }
.entry-stats dt { font-size: .74rem; color: var(--muted); }
.entry-stats dd { margin: 0; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.meet-card-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li + li { border-top: 1px solid var(--border); }
.feed-item { display: flex; align-items: center; gap: 1rem; padding: .85rem 1.25rem; text-decoration: none; }
.feed-item:hover { background: var(--surface-2); }
.feed-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-item .meta { margin-top: .1rem; font-size: .84rem; }
.feed-date { flex: none; width: 3.2rem; font-size: .85rem; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; }

/* Meets list */
.nowrap { white-space: nowrap; }
.meets-table .row-link + .badge { margin-left: .4rem; vertical-align: 1px; }
td.empty { text-align: center; padding: 2rem 1rem; }

/* Roster */
.title-row { display: flex; align-items: center; gap: .75rem; }
.title-select { width: auto; font-size: 1.15rem; font-weight: 700; padding: .25rem 2rem .25rem .6rem; }
.title-season { font-size: 1.3rem; font-weight: 700; color: var(--muted); }
.inline-form { display: flex; gap: .4rem; align-items: center; margin: 0; }
.roster-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 1rem; align-items: start; }
@media (max-width: 520px) { .roster-grid { grid-template-columns: 1fr; } }
.card-head h2 .muted { font-weight: 500; margin-left: .2rem; }
.table.roster td { padding-top: .35rem; padding-bottom: .35rem; }
.class-cell form { margin: 0; }
.quiet-select { width: auto; border-color: transparent; background-color: transparent; padding: .25rem 1.6rem .25rem .4rem; margin-left: -.4rem; }
.quiet-select:hover { border-color: var(--border-strong); background-color: #fff; }
.popover { width: min(28rem, calc(100vw - 2rem)); padding: 1rem; gap: .6rem; max-height: 75vh; overflow: auto; }
.popover .form > div { margin-bottom: .6rem; }
.search-row { display: flex; gap: .4rem; }
.pick-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 8px; }
.pick-list li { display: flex; align-items: center; gap: .75rem; padding: .5rem .7rem; }
.pick-list li + li { border-top: 1px solid var(--border); }
.pick-list form { margin: 0; }
.pad { padding: .25rem 0; }
.subsection { border-top: 1px solid var(--border); padding-top: .6rem; }
.subsection > summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.subsection > summary + p { margin: .4rem 0 .6rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid .check { margin-bottom: .75rem; }
.removed-list { margin-top: 1rem; }
.removed-list > summary { cursor: pointer; }
.removed-list .table { margin-top: .75rem; }

/* Type-to-find pickers (static/js/picker.js) */
.picker { position: relative; }
.picker-input { font: inherit; font-size: .88rem; width: 100%; padding: .38rem 3.4rem .38rem .55rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; text-overflow: ellipsis; }
.picker.unset .picker-input { border-style: dashed; }
.picker-input::placeholder { color: var(--faint); }
.picker-time { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); font-size: .78rem;
  color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: auto; }
.picker.open .picker-time { display: none; }
.picker-list { position: absolute; z-index: 25; top: calc(100% + 3px); left: 0; min-width: 100%; width: max-content;
  max-width: 22rem; max-height: 18rem; overflow: auto; margin: 0; padding: .25rem; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 28px rgb(0 0 0 / .15); }
.picker-list li { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem; border-radius: 5px;
  font-size: .86rem; cursor: pointer; }
.picker-list li.active { background: var(--tint); }
.picker-list li[aria-selected=true] { font-weight: 600; }
.picker-list li.taken { color: var(--faint); }
.picker-opt-time { margin-left: auto; padding-left: 1rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.picker-on { font-size: .72rem; background: var(--bg); border-radius: 999px; padding: 0 .4rem; }
.picker-empty { color: var(--muted); cursor: default; }
.relay-event.card.flush { overflow: visible; }
.relay-event .relay-colhead { border-radius: 0; }
.relay-event > .relay-table > .relay-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }

/* Entries matrix refresh */
.matrix-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: 0 0 .75rem; }
.matrix-tools input[type=search] { width: 16rem; }
.matrix-tools .check { font-weight: 500; }
.matrix-tools .spacer { flex: 1; }
.matrix-tools .legend-line { margin: 0; }
#limit-warn { margin: 0 0 .75rem; padding: .5rem .8rem; background: #FCEDEC; border-radius: 8px; }
.matrix-wrap { border-top: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.matrix thead th { background: var(--surface-2); }
.matrix thead .name-col { background: var(--surface-2); }
.matrix .cell-btn { color: #B4B4AF; transition: background .1s; }
.matrix .cell:not(.on) .cell-btn:hover::before { content: "+ "; color: var(--team-primary); font-weight: 700; }
.matrix .cell.on { background: var(--tint-strong); box-shadow: inset 3px 0 0 var(--team-primary); }
.matrix .cell.on .cell-btn { color: var(--text); font-weight: 700; }
.matrix .cell.on.exh { background: color-mix(in srgb, var(--team-secondary) 16%, white); box-shadow: inset 3px 0 0 var(--team-secondary); }
.matrix td.total.warn { background: #F9D3CF; color: var(--danger); }
.matrix tbody tr:hover .name-col { background: var(--surface-2); }
.matrix tr[hidden] { display: none; }

/* Keyboard entry: a spreadsheet-style cell cursor, inline time editor, save status, help */
.matrix td.cell { position: relative; }
.matrix .cell-btn { white-space: nowrap; }
.matrix .cell-btn:focus-visible, .matrix .cell-btn:focus { outline: 2px solid var(--team-primary); outline-offset: -2px; position: relative; z-index: 1; }
.matrix tbody tr:focus-within .name-col { background: var(--surface-2); font-weight: 600; }
.matrix thead th.col-active { box-shadow: inset 0 -3px 0 var(--team-primary); color: var(--text); }
.matrix .cell.saving .cell-btn { opacity: .45; }
.matrix .cell-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; z-index: 2;
  border: 2px solid var(--team-primary); border-radius: 0; padding: 0 .3rem; text-align: center;
  font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; background: #fff; color: var(--text); }
.matrix .cell.invalid .cell-input { border-color: var(--danger); background: #FDF0EE; }
.save-status { order: 10; flex-basis: 100%; min-height: 1.2em; margin-top: -.25rem; }
.save-status.error { color: var(--danger); font-weight: 600; }
.key-help { position: relative; }
.key-help > summary { cursor: pointer; list-style: none; color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: .15rem .6rem; }
.key-help > summary::-webkit-details-marker { display: none; }
.key-help-body { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 20; width: 22rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-sm);
  padding: .75rem 1rem; }
.key-help-body p { margin: 0 0 .5rem; }
.key-help-body dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem; margin: 0 0 .5rem; }
.key-help-body dt { white-space: nowrap; }
.key-help-body dd { margin: 0; }
/* Entry checks: small flags in a cell's corners */
.matrix .cell .mark { position: absolute; pointer-events: auto; line-height: 1; font-weight: 700; z-index: 1; }
.mark-check { top: 2px; right: 3px; font-size: .68rem; color: #fff; background: var(--danger); border-radius: 999px;
  width: .9rem; height: .9rem; display: inline-flex; align-items: center; justify-content: center; }
.mark-b2b { bottom: 2px; right: 3px; font-size: .75rem; color: #B45309; }
.mark-since { top: 3px; left: 4px; width: .45rem; height: .45rem; border-radius: 999px; background: #2563EB; }
.matrix .cell.since-removed { background: repeating-linear-gradient(-45deg, transparent 0 5px, #EEF2FF 5px 7px); }
.matrix .cell.since-removed .mark-since { background: transparent; border: 1.5px solid #2563EB; }
.matrix .cell.check .cell-btn { color: var(--danger); }
.mark-key { position: static; display: inline-flex; vertical-align: middle; }
span.mark-key.mark-since { display: inline-block; }
.export-changes { color: var(--muted); display: inline-flex; align-items: center; gap: .35rem; margin-right: .25rem; }
.export-changes.has-changes { color: #1E40AF; font-weight: 600; }
.export-changes .dot { width: .5rem; height: .5rem; border-radius: 999px; background: #2563EB; display: inline-block; }
/* Limits */
.limits-prompt { margin: 0 0 .6rem; font-size: .85rem; }
.limits-prompt > summary { cursor: pointer; list-style: none; }
.limits-prompt > summary::-webkit-details-marker { display: none; }
.limits-prompt .link { color: var(--team-primary); font-weight: 600; text-decoration: underline; }
.limits-form { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; margin: .5rem 0 0; padding: .6rem .8rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: .85rem; }
.limits-form label { display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; margin: 0; }
.limits-form input[type=number] { width: 4rem; min-height: 0; padding: .25rem .4rem; }
.limits-form .helptext { flex-basis: 100%; color: var(--muted); font-size: .8rem; }
.inline-edit { display: inline; }
.inline-edit > summary { display: inline; cursor: pointer; color: var(--team-primary); text-decoration: underline; font-size: .85em; list-style: none; }
.inline-edit > summary::-webkit-details-marker { display: none; }
.inline-edit[open] .limits-form { position: absolute; z-index: 20; box-shadow: var(--shadow-sm); max-width: 32rem; }
/* Event column menu */
.matrix th.ev { position: sticky; }
.matrix .ev-menu-btn { position: absolute; top: 1px; right: 1px; padding: 0 .3rem; font-size: .85rem; line-height: 1.2;
  background: none; color: var(--faint); border: 0; border-radius: 4px; opacity: 0; }
.matrix th.ev:hover .ev-menu-btn, .matrix th.ev.col-active .ev-menu-btn, .matrix .ev-menu-btn:focus-visible,
.matrix .ev-menu-btn[aria-expanded=true] { opacity: 1; }
.matrix .ev-menu-btn:hover { background: var(--surface); color: var(--text); filter: none; }
.ev-menu { position: fixed; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-sm); padding: .6rem .75rem; font-size: .85rem; display: grid; gap: .5rem; min-width: 14rem; }
.ev-menu[hidden] { display: none; }
.ev-menu-title { margin: 0; }
.ev-menu-row { display: flex; align-items: center; gap: .3rem; }
.ev-menu-row span { margin-right: .2rem; }
.ev-menu .btn-link { justify-self: start; }
@media (pointer: coarse) { .matrix .ev-menu-btn { opacity: 1; } }
kbd { font: inherit; font-size: .8em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px;
  padding: 0 .3rem; background: var(--surface-2); }

/* Meet results */
.results-bar .export-bar { margin: 0; }
.results-bar select { width: auto; }
.event { scroll-margin-top: 5rem; }
.results tr.ours > td { background: var(--tint); }
.results tr.ours > td:first-child { box-shadow: inset 3px 0 0 var(--team-primary); }

/* Tablets and touch screens (iPad on deck): bigger targets, no hover-only affordances. */
@media (pointer: coarse) {
  button, .btn { min-height: 2.5rem; }
  .btn-sm { min-height: 2.25rem; }
  input[type=text], input[type=search], select, .picker-input { min-height: 2.6rem; font-size: 1rem; }
  .icon-btn { min-width: 2.5rem; min-height: 2.5rem; color: var(--muted); }
  .quiet-select { border-color: var(--border); background-color: #fff; }
  .matrix .cell-btn { min-height: 2.75rem; }
  .matrix .name-col { min-width: 10rem; }
  .picker-list li { padding: .6rem .6rem; font-size: .95rem; }
  .menu-panel a, .menu-btn { padding: .75rem .8rem; }
  .exh-toggle input { width: 1.4rem; height: 1.4rem; }
  .segmented a, .segmented label span { padding: .55rem .9rem; }
  .table th, .table td { padding-top: .7rem; padding-bottom: .7rem; }
}
/* iPad portrait and small laptops */
@media (max-width: 1100px) {
  .container { padding: 1.25rem 1rem 2.5rem; }
  .relay-grid { grid-template-columns: 2.2rem 7.5rem repeat(4, minmax(0, 1fr)) 2.6rem 2.8rem; }
  .relays-live .rc-actions { justify-content: center; }
}
@media (max-width: 860px) {
  /* Relay rows: letter + seed + exh + menu on one line, the four legs in a 2×2 grid below. */
  .relay-grid { grid-template-columns: 2.2rem 1fr 1fr 2.6rem 2.8rem; grid-template-areas: none; }
  .relay-grid .rc-seed { grid-column: 2 / 4; flex-direction: row; align-items: center; gap: .6rem; }
  .relay-grid .rc-seed .seed-input { width: 7rem; }
  .relay-grid .rc-leg-1, .relay-grid .rc-leg-3 { grid-column: 2 / 3; }
  .relay-grid .rc-leg-2, .relay-grid .rc-leg-4 { grid-column: 3 / 4; }
  .relay-grid .rc-leg::before { content: attr(data-label); display: block; font-size: .7rem; color: var(--muted); margin-bottom: .1rem; }
  .relay-grid .rc-exh { grid-row: 1; grid-column: 4; }
  .relay-grid .rc-actions { grid-row: 1; grid-column: 5; }
  .relay-colhead { display: none; }
  .rc-foot { grid-column: 2 / -1; }
  .roster-grid { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
  .home-search { flex-basis: 100%; }
}

/* Reports */
.report-stats { margin-bottom: 1.25rem; }
.depth-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1rem; align-items: start; margin-top: .75rem; }
.depth-grid > .card { margin: 0; }
.depth-grid .card-head h2 { font-size: .98rem; }
.table.depth td { padding: .4rem .5rem; font-size: .9rem; }
.table.depth td:first-child { width: 1.8rem; }
.table.depth a { text-decoration: none; }
.table.depth a:hover { text-decoration: underline; }
.season-strip { margin-bottom: 1rem; }
.season-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.season-cell { display: flex; flex-direction: column; gap: .1rem; padding: .8rem 1.25rem; border-right: 1px solid var(--border); }
.season-cell strong { font-size: 1.2rem; }
/* Report times open a split card (templates/reports/includes/swim_time.html). */
.time-btn { font: inherit; color: inherit; background: none; border: 0; padding: .1rem .3rem; margin: -.1rem -.3rem;
  border-radius: 6px; cursor: pointer; min-height: 0; text-decoration: underline dotted var(--faint); text-underline-offset: 3px; }
.time-btn:hover, .time-btn[aria-expanded=true] { background: var(--tint); filter: none; }
.swim-card { position: fixed; inset: auto; margin: 0; width: 15.5rem; max-height: min(70vh, 30rem); overflow: auto;
  padding: .8rem .9rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); box-shadow: 0 8px 28px rgb(0 0 0 / .14); text-align: left; font-size: .9rem; }
.swim-card-head { display: flex; align-items: baseline; gap: .4rem; margin-bottom: .15rem; }
.swim-card-head .tabular { margin-left: auto; font-weight: 700; }
.swim-card .small { margin: 0; font-size: .8rem; }
.swim-card-splits { width: 100%; border-collapse: collapse; margin-top: .55rem; font-size: .85rem; }
.swim-card-splits th, .swim-card-splits td { padding: .2rem .25rem; text-align: right; border-top: 1px solid var(--border); }
.swim-card-splits thead th { border-top: 0; color: var(--muted); font-weight: 600; font-size: .75rem; }
.swim-card-splits tbody th { text-align: left; color: var(--muted); font-weight: 500; }
.swim-card-empty { margin-top: .5rem !important; }
.table.depth td.who { line-height: 1.25; }
.table.depth .where { font-size: .76rem; margin-top: .1rem; max-width: 13rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.see-all { color: var(--muted); text-decoration: none; white-space: nowrap; }
.see-all:hover { color: var(--text); text-decoration: underline; }
.report-key { margin-bottom: .75rem; }
.event-select { width: auto; min-width: 12rem; font-weight: 600; }
.ranking { margin-bottom: 1.25rem; }
.ranking-table td { padding-top: .45rem; padding-bottom: .45rem; }
.ranking-table td.num.faint:first-child { width: 2.5rem; }
.ranking-table .who { white-space: nowrap; }
.ranking-table .who a, .quiet-link { text-decoration: none; }
.ranking-table .who a:hover, .quiet-link:hover { text-decoration: underline; }
.ranking-table tr.repeat .who a { color: var(--muted); }
.recap-meta { margin: -.25rem 0 .9rem; }
.recap-events .group-row th { background: var(--surface-2); color: var(--text); font-size: .85rem; padding-top: .5rem; padding-bottom: .5rem; }
.recap-events tbody + tbody .group-row th { border-top: 1px solid var(--border); }
.recap-legs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .15rem 1rem; font-size: .88rem; }
.recap-legs a { text-decoration: none; }
.recap-legs a:hover { text-decoration: underline; }
.card-pad { padding: 1rem 1.25rem; margin: 0; }
@media print {
  .feedback-fab, .topbar, .accent-stripe, .crumbs, .page-actions, .report-filters, .swim-card, .messages { display: none !important; }
  body, main { background: #fff; }
  .container { max-width: none; padding: 0; }
  .card, .stat { box-shadow: none; break-inside: avoid; }
  .ranking-table tr { break-inside: avoid; }
  .time-btn { text-decoration: none; padding: 0; margin: 0; }
  .depth-grid { grid-template-columns: repeat(2, 1fr); }
  a { text-decoration: none !important; }
}
.badge.warn { background: var(--warn-bg); color: #7A4B00; }

/* Feedback button and dialog (templates/feedback/_widget.html) */
.feedback-fab { position: fixed; right: 1rem; bottom: 1rem; z-index: 40; padding: .4rem .75rem; font-size: .82rem;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border-strong); border-radius: 999px;
  box-shadow: var(--shadow); opacity: .8; transition: opacity .12s, color .12s, border-color .12s; }
.feedback-fab:hover, .feedback-fab:focus-visible { opacity: 1; color: var(--text); border-color: var(--team-primary); filter: none; }
@media (max-width: 700px) { .feedback-fab span { display: none; } .feedback-fab { padding: .55rem; } }
.feedback-dialog { width: min(32rem, calc(100vw - 2rem)); padding: 0; border: 0; border-radius: var(--radius);
  border-top: 4px solid var(--team-primary); box-shadow: 0 20px 50px rgb(0 0 0 / .25); color: var(--text); }
.feedback-dialog::backdrop { background: rgb(0 0 0 / .3); }
.feedback-dialog form, .feedback-thanks { padding: 1.25rem; display: flex; flex-direction: column; gap: .6rem; }
.feedback-dialog form[hidden], .feedback-thanks[hidden] { display: none; }
.feedback-head { display: flex; justify-content: space-between; align-items: center; }
.feedback-head h2, .feedback-thanks h2 { margin: 0; }
.feedback-kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; border: 0; padding: 0; margin: 0 0 .25rem; }
.feedback-kinds label { display: flex; flex-direction: column; gap: .1rem; padding: .55rem .7rem; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.feedback-kinds label span { font-weight: 400; font-size: .78rem; color: var(--muted); }
.feedback-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.feedback-kinds label:has(input:checked) { border-color: var(--team-primary); background: var(--tint); }
.feedback-kinds label:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--team-primary) 55%, transparent); }
.feedback-selection { margin: 0; padding: .4rem .7rem; border-left: 3px solid var(--border-strong); color: var(--muted); font-size: .85rem; }
.feedback-shot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.feedback-shot label { font-weight: 600; }
.feedback-thumb { display: inline-flex; align-items: center; gap: .25rem; }
.feedback-thumb[hidden] { display: none; }
.feedback-thumb img { max-height: 3rem; max-width: 8rem; border: 1px solid var(--border); border-radius: 4px; }
.feedback-note { margin: 0; }
.feedback-error { margin: 0; color: var(--danger); font-size: .9rem; }
.feedback-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.feedback-thanks { align-items: flex-start; }

/* Feedback review */
.feedback-message { white-space: pre-wrap; font-size: 1rem; margin: 0; }
.feedback-frame { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.feedback-shot-full { max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.feedback-md { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }
.kind-bug { background: #F6D7D5; color: var(--danger); }
.kind-idea { background: #DCEFE2; color: var(--success); }
.status-new { background: var(--team-primary); color: var(--team-on-primary); }
.feedback-errors { font-size: .8rem; white-space: pre-wrap; margin: 0; }

/* Deleting a meet (site admins) */
.btn-danger, button.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-delete { color: var(--danger); }
.btn-delete:hover { background: #F6D7D5; color: var(--danger); }
.row-actions > * + * { margin-left: .35rem; }
.delete-list { margin: .25rem 0 1rem; padding-left: 1.2rem; line-height: 1.7; }
.form-actions { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; }

/* Time standards: a badge for each cut a swim made */
.badge.cut { background: var(--tint); color: var(--text); border: 1px solid var(--border); letter-spacing: .02em; }
.cut-badges { white-space: nowrap; }
.cut-badges .badge + .badge { margin-left: .2rem; }
.cuts-table td.num { width: 8rem; }
.cuts-table .group-row th { background: var(--surface-2); color: var(--text); font-size: .85rem; }
.cut-line td { padding: 0 .75rem; border-bottom: 2px dashed var(--team-primary); background: transparent; }
.cut-line td > span { display: block; font-size: .72rem; color: var(--muted); padding: .15rem 0 .15rem 2rem; white-space: nowrap; }
.cut-time { font-weight: 500; margin-left: .35rem; white-space: nowrap; }
