/* The tote, in the racecard language.
   The board leads, not the word "Tote": the odds column carries the largest
   figures on the page and the heading stays out of its way. Boxes are gone;
   sections open with a solid band and are ruled apart. */

.tote-page {
  min-height: 100vh;
  background: var(--card-night);
  color: var(--card-rail);
  font-family: var(--font-ui);
  font-size: 15px;
}

/* ---- the rail across the top ---- */

.tote-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 max(20px, calc((100vw - 1344px) / 2));
  border-bottom: 1px solid var(--card-rule-strong);
  background-color: var(--card-night);
}

.tote-brand {
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 0;
  color: var(--card-rail);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.005em;
  text-decoration: none;
}

.tote-topbar nav { display: flex; gap: 18px; }

.tote-topbar nav a,
.tote-card a {
  padding: 2px 0;
  border-bottom: 2px solid var(--card-rule-strong);
  color: var(--card-chalk);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.tote-topbar nav a:hover,
.tote-card a:hover { border-bottom-color: var(--card-silk); color: var(--card-rail); }

.tote-page :is(a, button, input, select):focus-visible {
  outline: 2px solid var(--card-flood);
  outline-offset: 2px;
}

/* ---- the head of the page ---- */

.tote-shell { width: min(1344px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0 60px; }

.tote-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(460px, 0.75fr);
  gap: 34px;
  align-items: end;
}

.tote-intro h1 {
  margin: 3px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(30px, 3.4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.tote-intro > div > p:last-child { max-width: 62ch; margin: 0; color: var(--card-chalk); }

/* Four figures, ruled apart. No box, no gold cap. */
.tote-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--card-rule-strong);
}

.tote-summary div {
  min-width: 0;
  padding: 11px 14px 11px 0;
  border-right: 1px solid var(--card-rule);
  background: none;
}

.tote-summary div + div { padding-left: 14px; }
.tote-summary div:last-child { border-right: 0; padding-right: 0; }
.tote-summary dt { color: var(--card-chalk); font-size: 13px; }

.tote-summary dd {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--card-rail);
  font: 600 17px var(--font-ui);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.tote-status { min-height: 21px; margin: 24px 0 14px; color: var(--card-flood); font-size: 14px; }
.tote-status:empty { display: none; }

/* ---- the sheet ---- */

.tote-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 34px; align-items: start; min-width: 0; }

.tote-card {
  min-width: 0;
  padding: 0 0 22px;
  border: 0;
  border-top: 1px solid var(--card-rule);
  background: none;
}

.tote-grid > .tote-card { border-top: 0; }
.tote-card h2, .tote-card p { margin-top: 0; }

.tote-card h2 {
  margin-bottom: 5px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tote-card-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.tote-card-head h2 { margin-bottom: 0; }

.tote-card input,
.tote-card select {
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--card-chalk);
  border-radius: 0;
  background: var(--card-night);
  color: var(--card-rail);
  font: inherit;
}

/* Placing the bet and refreshing the board are the two real actions. */
.tote-card button {
  min-height: 40px;
  padding: 10px 16px;
  border: 1px solid var(--card-flood);
  border-radius: 0;
  background: var(--card-night);
  color: var(--card-rail);
  font: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
}

.tote-card button:hover { background: var(--card-band); }

.tote-card button:disabled {
  border-color: var(--card-rule-strong);
  background: none;
  color: var(--card-chalk);
  cursor: not-allowed;
  opacity: 0.6;
}

.tote-card input:disabled,
.tote-card select:disabled {
  border-color: var(--card-rule-strong);
  background: var(--card-band);
  color: var(--card-chalk);
  cursor: not-allowed;
  opacity: 0.6;
}

#refreshButton {
  background: none;
  border: 1px solid var(--card-rule-strong);
  color: var(--card-rail);
}

#refreshButton:hover { background: none; border: 1px solid var(--card-rail); }

/* ---- the board ---- */

.tote-table-wrap { margin: 14px 0 0; overflow-x: auto; }
.tote-board table { width: 100%; border-collapse: collapse; white-space: nowrap; }

.tote-board th,
.tote-board td { padding: 13px 16px 13px 0; border-top: 1px solid var(--card-rule); text-align: right; }

.tote-board th { color: var(--card-chalk); font-size: 13px; font-weight: 500; }
.tote-board th:nth-child(2), .tote-board td:nth-child(2) { width: 100%; text-align: left; }

.tote-board td {
  color: var(--card-chalk);
  font-family: var(--font-data);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* The saddle-cloth number, on the runner's colours. */
.tote-board td:first-child {
  padding-right: 18px;
  color: var(--card-rail);
  text-align: left;
}

.tote-board tbody td:first-child::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 15px;
  margin-right: 9px;
  background: var(--card-silk);
  vertical-align: -2px;
}

.tote-board td strong {
  display: block;
  color: var(--card-rail);
  font: 600 17px var(--font-display);
  letter-spacing: -0.01em;
}

.tote-board td small { color: var(--card-chalk); font: 13px var(--font-ui); }

/* The one large figure on the page. */
.tote-board td:last-child {
  padding-right: 0;
  color: var(--card-rail);
  font-size: 21px;
  font-weight: 600;
}

.tote-board h3 { margin: 26px 0 0; color: var(--card-chalk); font-size: 14px; font-weight: 500; }

/* ---- the side column ---- */

.tote-side { display: grid; min-width: 0; gap: 0; }
.tote-side > .tote-card { padding-top: 18px; }
.tote-side > .tote-card:first-child { border-top: 0; padding-top: 0; }
.tote-side p { color: var(--card-chalk); font-size: 14px; }
.tote-side form { display: grid; gap: 8px; margin: 18px 0 12px; }
.tote-side label { color: var(--card-chalk); font-size: 13px; font-weight: 500; }
.tote-side input, .tote-side select { width: 100%; }

.tote-action-status { min-height: 20px; margin-bottom: 12px; color: var(--card-flood) !important; }
.tote-action-status:empty { display: none; }

.tote-receipts { display: grid; gap: 0; margin: 12px 0 0; padding: 0; list-style: none; }

.tote-receipts li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  padding: 9px 0;
  border-top: 1px solid var(--card-rule);
}

.tote-receipts strong { font-size: 14px; font-weight: 600; }
.tote-receipts span { color: var(--card-rail); font: 500 13px var(--font-data); font-variant-numeric: tabular-nums; }
.tote-receipts small { grid-column: 1 / -1; color: var(--card-chalk); }

.tote-empty { margin: 10px 0 0 !important; color: var(--card-chalk); font-size: 14px; }
.tote-model { margin: 5px 0 0; color: var(--card-chalk); font-size: 13px; }

.tote-side form [hidden] { display: none !important; }
.tote-side select[multiple] { min-height: 136px; padding: 4px; }
.tote-side label[for="boxToggle"] { display: flex; align-items: center; gap: 9px; }
.tote-side label[for="boxToggle"] input { width: auto; min-height: 0; margin: 0; }

.tote-preview {
  min-height: 19px;
  margin: 2px 0 4px !important;
  color: var(--card-rail) !important;
  font: 500 13px var(--font-ui);
}

.tote-markets { display: grid; gap: 0; margin: 10px 0 0; padding: 0; list-style: none; }

.tote-markets li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 9px 0;
  border-top: 1px solid var(--card-rule);
}

.tote-markets strong { font: 600 15px var(--font-display); }
.tote-markets span { color: var(--card-rail); font: 500 14px var(--font-data); font-variant-numeric: tabular-nums; }
.tote-markets small { grid-column: 1 / -1; color: var(--card-chalk); font-size: 13px; }

.tote-rules ul { display: grid; gap: 9px; margin: 12px 0 0; padding-left: 18px; }
.tote-rules li { max-width: 52ch; color: var(--card-chalk); font-size: 13px; line-height: 1.55; }
.tote-rules strong { color: var(--card-rail); font-weight: 600; }

@media (max-width: 900px) {
  .tote-intro { grid-template-columns: 1fr; gap: 22px; }
  .tote-grid { grid-template-columns: 1fr; gap: 26px; }
}

@media (max-width: 650px) {
  .tote-shell { width: min(100% - 24px, 1344px); padding-top: 24px; }
  .tote-topbar { align-items: flex-start; flex-direction: column; gap: 0; padding: 12px 12px 14px; }
  .tote-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tote-summary div:nth-child(2) { border-right: 0; }
  .tote-summary div:nth-child(n + 3) { border-top: 1px solid var(--card-rule); padding-top: 11px; }
  .tote-summary div:nth-child(3) { padding-left: 0; }
  .tote-board th, .tote-board td { padding: 11px 12px 11px 0; }
  .tote-board th:nth-child(4), .tote-board td:nth-child(4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* The kicker is chalk on the board, not an acid label. Scoped here so the
   arcade front door keeps its own. */
.tote-page .eyebrow {
  color: var(--card-chalk);
  font-size: 0.85rem;
  font-weight: 500;
}
