/* HuronXC — mobile-first. Athletes log runs on a phone; everything else follows. */

/* Themes. Three states: no data-theme on <html> follows the device; the theme
   cookie sets data-theme="light" or "dark" to pin one. The dark tokens appear
   twice — once for "device is dark and nothing pinned", once for "pinned dark" —
   and tests.ThemeTokenTests fails if the two copies drift apart.

   Every text token clears WCAG AA (4.5:1) on bg, surface and surface-2, and the
   same test checks it. Never dim text with `opacity`: it multiplies with an
   already-dim colour and lands near 2:1, which is what made empty days and
   zero cells unreadable. Use --text-dim instead.

   --accent, --accent-soft and --accent-text are per school, so they're not
   here: base.html writes them from settings (see tracker/branding.py). */

:root {
  color-scheme: light;
  --bg: #f8f6f6;
  --surface: #ffffff;
  --surface-2: #f1eded;
  --border: #e0d9d9;
  --text: #1f1717;
  --text-dim: #6b5e5e;
  --warn: #a64d08;
  --warn-soft: #fdf3e3;
  --danger: #8a1c14;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(24 16 16 / 6%), 0 4px 14px rgb(24 16 16 / 5%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141010;
    --surface: #1d1818;
    --surface-2: #272020;
    --border: #3a3131;
    --text: #ede8e8;
    --text-dim: #a89a9a;
    --warn: #e0a355;
    --warn-soft: #2a2116;
    --danger: #f35d5d;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 14px rgb(0 0 0 / 30%);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141010;
  --surface: #1d1818;
  --surface-2: #272020;
  --border: #3a3131;
  --text: #ede8e8;
  --text-dim: #a89a9a;
  --warn: #e0a355;
  --warn-soft: #2a2116;
  --danger: #f35d5d;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 14px rgb(0 0 0 / 30%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 64px;
}
.wrap--wide { max-width: 1180px; }

/* --- Header --------------------------------------------------------------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar__brand {
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
  margin-right: auto;
}
.topbar__brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 14px; align-items: center; }
.topbar nav a { font-size: 14px; text-decoration: none; color: var(--text-dim); }
.topbar nav a:hover { color: var(--text); }
/* A coach's bar is brand + three links + two buttons; on the narrowest phones
   (320px) the default gaps push it past the edge. */
@media (max-width: 379px) {
  .topbar__inner { gap: 10px; }
  .topbar nav { gap: 8px; }
}

/* Cycles device → light → dark. Each icon shows for its own state, keyed off
   the attribute the server already rendered, so nothing flickers on load. */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { display: none; width: 16px; height: 16px; }
:root:not([data-theme]) .theme-toggle [data-icon="auto"],
:root[data-theme="light"] .theme-toggle [data-icon="light"],
:root[data-theme="dark"] .theme-toggle [data-icon="dark"] { display: block; }

/* Account menu: a <details>, so it opens without JS; app.js closes it on an
   outside click or Esc. */
.menu { position: relative; }
.menu__button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
}
.menu__button::-webkit-details-marker { display: none; }
.menu__button svg { width: 16px; height: 16px; }
.menu__button:hover, .menu[open] .menu__button { color: var(--text); }
.menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 190px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 20;
}
.menu__who {
  padding: 6px 10px 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}
.topbar nav .menu__panel a,
.menu__panel button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  text-align: left;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.topbar nav .menu__panel a:hover,
.menu__panel button:hover { background: var(--surface-2); }

/* Messages after a redirect ("Saved Avery"). */
.flash { max-width: 720px; margin: 14px auto 0; padding: 0 16px; }
.flash .toast { margin: 0 0 8px; }
.toast--error { background: var(--warn-soft); color: var(--warn); }

/* --- Cards ---------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 18px;
}
.card__title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* --- Today's workout ------------------------------------------------------ */

.plan {
  /* Accent edge marks this as coach-authored, not the athlete's own data. */
  border-left: 3px solid var(--accent);
  padding-top: 14px;
}
.plan--empty { border-left-color: var(--border); }
.plan__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.plan__eyebrow {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  white-space: nowrap;
}
.plan__select {
  width: auto;
  max-width: 60%;
  padding: 8px 32px 8px 10px;
  border-radius: 8px;
  font-weight: 600;
}
.plan__title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.plan__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.plan__meta:empty { display: none; }
.plan__loc {
  display: inline-block;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 650;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
}
.plan__desc {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-dim);
  /* Coaches type one interval per line; keep the breaks they typed. */
  white-space: pre-line;
}
.plan__none { font-size: 15px; color: var(--text-dim); }

/* --- Entry form ----------------------------------------------------------- */

.entry { padding-bottom: 20px; }
.entry__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.entry__grid .full { grid-column: 1 / -1; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="password"],
input[type="url"],
input[type="email"],
input[type="tel"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 12px;
  font-size: 16px; /* 16px prevents iOS zoom-on-focus. */
  font-family: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  appearance: none;
}
/* appearance: none drops the native arrow, so draw one. Mid-grey reads on
   both themes, since a data URI can't follow currentColor. */
select {
  padding-right: 34px;
  background-image: 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='%238a7d7d' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
textarea { resize: vertical; }

.miles-input input { font-size: 24px; font-weight: 650; padding: 14px 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 18px;
  min-height: 46px; /* Thumb-sized tap target. */
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn--block { width: 100%; }
.btn--ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}
.btn--link {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 4px 6px;
  min-height: 0;
  font-size: 13px;
  text-decoration: underline;
}
.btn--danger { color: var(--danger); }

.errors {
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  color: var(--warn);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 12px;
}
.errors ul { margin: 0; padding-left: 18px; }

.field-error { color: var(--danger); font-size: 13px; margin-top: 4px; }

/* --- Week strip ----------------------------------------------------------- */

.weeknav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}
.weeknav__label { font-weight: 650; font-size: 15px; }
.weeknav__total {
  font-size: 13px;
  color: var(--text-dim);
}
.weeknav__btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 40px;
  min-height: 40px;
  font-size: 18px;
  color: var(--text);
  cursor: pointer;
}
/* No surface fill marks it as inert; the arrow itself stays legible. */
.weeknav__btn[disabled] {
  background: transparent;
  border-style: dashed;
  color: var(--text-dim);
  cursor: default;
}
/* The coach week view navigates with links, not HTMX buttons. */
a.weeknav__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.total-banner {
  display: flex;
  padding: 15px 18px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 14px;
}
.stat { flex: 1; min-width: 0; }
.stat + .stat {
  border-left: 1px solid var(--border);
  padding-left: 18px;
  margin-left: 18px;
}
.stat__num {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1.1;
}
.stat--muted .stat__num { color: var(--text-dim); }
.stat__label { font-size: 13px; color: var(--text-dim); }

.day {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.day:last-child { border-bottom: none; }
.day__date {
  width: 62px;
  flex: none;
  font-size: 13px;
  color: var(--text-dim);
}
.day__date b { display: block; font-size: 15px; color: var(--text); font-weight: 650; }
/* An empty day steps its weekday down to the dim colour; today's stays accent. */
.day--empty .day__date b { color: var(--text-dim); font-weight: 500; }
.day--today .day__date b { color: var(--accent); font-weight: 650; }
.day__runs { flex: 1; min-width: 0; }
.run {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 2px 0;
}
.run__miles { font-weight: 650; }
.run__meta { font-size: 13px; color: var(--text-dim); }
.run__notes { font-size: 13px; color: var(--text-dim); width: 100%; }
.run__actions { margin-left: auto; display: flex; gap: 2px; }

.tag {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-dim);
}
.tag--race { background: var(--accent-soft); color: var(--accent); }
.tag--workout { background: var(--warn-soft); color: var(--warn); }
.tag--flag { background: var(--warn-soft); color: var(--warn); text-transform: none; }

.empty { color: var(--text-dim); font-size: 14px; padding: 8px 0; }

.toast {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* --- Tables (coach) ------------------------------------------------------- */

/* Bleeds to the card's edge. The 18px inset lives on the end cells rather than
   on this box: padding here would sit outside the sticky column's pinned edge,
   leaving a strip the scrolled cells show through. */
.scroller { overflow-x: auto; margin: 0 -18px; }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td {
  padding: 9px 10px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 650;
}
th:last-child, td:last-child { padding-right: 28px; }
th:first-child, td:first-child {
  /* 28px = the card's 18px inset plus the usual 10px cell padding. */
  padding-left: 28px;
  text-align: left;
  position: sticky;
  left: 0;
  /* Keeps the pinned name above cells scrolling underneath it, so they can't
     paint over the column or swallow clicks on the link inside it. */
  z-index: 1;
  background: var(--surface);
}
tbody tr:hover td { background: var(--surface-2); }
tbody tr:hover td:first-child { background: var(--surface-2); }
td.zero { color: var(--text-dim); }
tfoot td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: none; }
.col-total { font-weight: 700; }

.rowlink { color: var(--text); text-decoration: none; font-weight: 600; }
.rowlink:hover { color: var(--accent); }

/* Week headers drill into that week's day-by-day grid. */
.collink {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--text-dim);
}
.collink:hover { color: var(--accent); border-bottom-color: var(--accent); }

.gridnote { color: var(--text-dim); font-size: 13px; margin: 18px 0 0; }

/* --- Weekly plan (coach) -------------------------------------------------- */

.plantools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.plantools .gridnote { margin: 0; }
.plantoast { margin: 14px 0 0; }

.btn--small { min-height: 36px; padding: 7px 14px; font-size: 14px; }

/* Desktop: the seven days share the card's width, so the week never scrolls
   sideways and needs no pinned column. Titles wrap; long ones clamp. */
.plangrid { table-layout: fixed; }
.plangrid__group { width: 84px; }
.plangrid__total { width: 64px; }
.plangrid th,
.plangrid td {
  position: static;
  padding: 8px 3px;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  background: none;
}
.plangrid th:first-child, .plangrid td:first-child { padding-left: 0; }
.plangrid th:last-child, .plangrid td:last-child { padding-right: 0; text-align: right; }
.plangrid th { padding-left: 9px; }
.plangrid tbody tr:hover td,
.plangrid tbody tr:hover td:first-child { background: none; }
.plangrid tbody tr:last-child td { border-bottom: none; }
.plangrid .is-today { background: var(--accent-soft); }
.plangrid th.is-today { color: var(--accent); border-radius: 8px 8px 0 0; }
.plangrid .plangrid__name,
.plangrid .plangrid__sum { padding-top: 15px; font-weight: 650; }

.plancell__btn {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 76px;
  padding: 6px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.plancell__btn:hover,
.plancell__btn:focus-visible { background: var(--surface-2); border-color: var(--border); }
.plancell__btn--empty { display: flex; align-items: center; justify-content: center; }
.plancell__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.3;
}
.plancell__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-dim);
}
.plancell__meta .tag { font-size: 10px; padding: 1px 6px; }
.plancell__loc {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plancell__add { font-size: 13px; color: var(--text-dim); }

/* Phones and narrow windows: a section per day instead of seven columns. */
.planlist { display: none; }
.plantotals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}
.plantotals b { color: var(--text); font-weight: 650; }
.planday { padding: 12px 0 6px; border-bottom: 1px solid var(--border); }
.planday:last-child { border-bottom: none; padding-bottom: 0; }
.planday__head {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.planday--today .planday__head { color: var(--accent); }
.planday__row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
  gap: 6px;
}
.planday__group { padding-top: 7px; font-size: 13px; font-weight: 650; }
.planday .plancell__btn { min-height: 0; padding: 6px 8px; }
.planday .plancell__btn--empty { justify-content: flex-start; }
.planday .plancell__title { -webkit-line-clamp: 2; font-size: 14px; }

@media (max-width: 879px) {
  .plangrid { display: none; }
  .planlist { display: block; }
}

/* The workout editor. A centred dialog on desktop, a bottom sheet on phones. */
.editor {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.editor::backdrop { background: rgb(0 0 0 / 45%); }
.editor__body { padding: 18px; }
.editor__eyebrow {
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.editor__title { margin: 2px 0 14px; font-size: 18px; font-weight: 700; }
.editor__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.editor__grid .full { grid-column: 1 / -1; }
.editor__check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}
.editor__check input { width: 18px; height: 18px; accent-color: var(--accent); }
.editor__hint { margin: 12px 0 0; font-size: 13px; color: var(--text-dim); }
.editor__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

@media (max-width: 639px) {
  .editor {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
  }
  .editor__body { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .editor__actions .btn { flex: 1; }
}

.alert {
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 18px;
}
.alert__title { font-weight: 650; color: var(--warn); margin: 0 0 8px; font-size: 14px; }
.alert ul { margin: 0; padding-left: 18px; font-size: 14px; }
.alert li { margin-bottom: 3px; }

.muted { color: var(--text-dim); font-size: 13px; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 5px;
  word-break: break-all;
}

/* --- Season progress chart ------------------------------------------------ */

/* Chart.js sizes to the parent, so the parent is what sets the height. */
.chart {
  position: relative;
  height: 260px;
  margin-top: 4px;
}

.chart__delta {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 8px;
}
.chart__delta--ahead { color: var(--accent); background: var(--accent-soft); }
.chart__delta--behind { color: var(--warn); background: var(--warn-soft); }

.chart__note { color: var(--text-dim); font-size: 13px; margin: 12px 0 0; }

@media (min-width: 640px) {
  .chart { height: 320px; }
}

/* --- Centered auth pages -------------------------------------------------- */

.narrow { max-width: 400px; margin: 48px auto; padding: 0 16px; }
.narrow h1 { font-size: 22px; letter-spacing: -0.02em; }

.htmx-request .btn { opacity: 0.6; pointer-events: none; }

/* --- Roster and accounts ------------------------------------------------- */

.pagehead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.pagehead h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.pagehead .muted { margin: 2px 0 0; }
.pagehead__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tag--joined { background: var(--surface-2); color: var(--text-dim); }
.tag--invited,
.tag--reset { background: var(--accent-soft); color: var(--accent); }
.tag--expired { background: var(--warn-soft); color: var(--warn); }

.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.formgrid .full { grid-column: 1 / -1; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.helptext { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* A one-time link: the code to scan beside the URL to text. */
.linkbox { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.qr {
  flex: none;
  align-self: flex-start;
  width: 132px;
  /* QR codes must stay dark-on-light to scan, whatever the theme. */
  background: #ffffff;
  border-radius: 8px;
  line-height: 0;
}
.qr svg { width: 100%; height: auto; }
.linkbox__body { flex: 1; min-width: 200px; }
.linkbox__url { display: block; margin: 6px 0 10px; }

.inlineform { display: inline; }
table.roster th, table.roster td { text-align: left; vertical-align: middle; }

/* Join slips: a sheet to print and cut. Two across on paper. */
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 18px; }
.slip {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  break-inside: avoid;
}
.slip .qr { width: 120px; }
.slip__name { font-weight: 700; font-size: 16px; }
.slip__meta { font-size: 13px; color: var(--text-dim); margin: 2px 0 8px; }
.slip__steps { margin: 0; padding-left: 18px; font-size: 13px; }
.slip code { font-size: 11px; }

@media print {
  .topbar, .btn, .no-print { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
  .flash { display: none; }
  /* Paper is white whatever the screen theme; force the light palette. */
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
    --bg: #ffffff; --surface: #ffffff; --surface-2: #f1eded; --border: #b8adad;
    --text: #1f1717; --text-dim: #4d4242;
  }
  body { background: #ffffff; }
  .slips { grid-template-columns: 1fr 1fr; gap: 0; }
  .slip { border-radius: 0; border-color: #9a8f8f; }
}

@media (max-width: 479px) {
  .formgrid { grid-template-columns: 1fr; }
}

@media (min-width: 640px) {
  .entry__grid { grid-template-columns: repeat(4, 1fr); }
  .entry__grid .full { grid-column: 1 / -1; }
  .entry__grid .span2 { grid-column: span 2; }
}

/* --- Seasons -------------------------------------------------------------- */

.seasonpicker { display: flex; gap: 6px; align-items: center; }
.seasonpicker select { width: auto; padding: 7px 34px 7px 10px; font-size: 14px; font-weight: 600; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.pastnote {
  margin-top: 14px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-dim);
  background: var(--surface-2);
  border-radius: 10px;
}
.carrylist { list-style: none; margin: 0; padding: 0; columns: 2 260px; column-gap: 24px; }
.carrylist li { break-inside: avoid; padding: 4px 0; }
.carrylist .check { font-size: 14px; }
.carrylist .muted { font-size: 12px; }
.charthead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.charthead .card__title { margin-bottom: 10px; }

/* --- Assignments ---------------------------------------------------------- */

.assign { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.assign__box {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: transparent;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
span.assign__box { width: 22px; height: 22px; border-radius: 6px; cursor: default; }
.assign__box svg { width: 16px; height: 16px; }
button.assign__box:hover { border-color: var(--accent); }
.assign--done .assign__box { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.assign__body { flex: 1; min-width: 0; padding-top: 3px; }
.assign__note { font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.assign--done .assign__note { color: var(--text-dim); text-decoration: line-through; }
.assign__link { display: inline-block; margin-top: 4px; font-size: 14px; font-weight: 600; }
.plan__assigned { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--border); }
.plan__assigned .plan__eyebrow { margin-bottom: 4px; }
.day__runs .assign { padding: 4px 0 2px; }
.day__runs .assign__note { font-size: 14px; }

.batch { border-bottom: 1px solid var(--border); }
.batch:last-child { border-bottom: none; }
.batch summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 10px 0;
  cursor: pointer;
}
.batch__date { font-weight: 650; font-size: 14px; white-space: nowrap; }
.batch__note { flex: 1; min-width: 160px; font-size: 14px; }
.batch__body { padding: 0 0 12px; }
.batch__people { margin: 8px 0; padding-left: 18px; font-size: 14px; }

/* --- Athlete picker -------------------------------------------------------- */

.picker__quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.picker__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-right: 2px;
}
.chip {
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.picker__section { border: none; margin: 0 0 8px; padding: 0; min-width: 0; }
.picker__section legend {
  padding: 8px 0 4px;
  font-size: 13px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.picker__section legend .btn--link { text-transform: none; letter-spacing: 0; }
.picker__rows { list-style: none; margin: 0; padding: 0; columns: 2 240px; column-gap: 20px; }
.picker__rows--times { columns: 1; }
.picker__row { break-inside: avoid; padding: 3px 0; }
.picker__row .check { font-size: 15px; min-height: 36px; }
.picker__rows--times .picker__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  align-items: center;
  gap: 4px 10px;
  border-bottom: 1px solid var(--border);
}
.picker__rows--times .picker__row .field-error { grid-column: 1 / -1; }
.picker__time { padding: 8px 10px; font-size: 16px; text-align: center; }
.picker__submit { align-items: center; position: sticky; bottom: 0; padding: 12px 0 4px; background: var(--surface); }
.formgrid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 639px) { .formgrid--4 { grid-template-columns: 1fr 1fr; } }
