/*
 * 2026 interface refresh
 * A calm Saratoga analyst's desk layered over the original component skin.
 * The legacy stylesheet still supplies specialized layout mechanics; this file
 * owns the visual system and responsive composition.
 */

:root {
  --bg: #f1f0e8;
  --surface: #fffdf8;
  --panel: #f7f7f1;
  --ink: #17231e;
  --muted: #64716a;
  --line: #d7dcd4;
  --line-strong: #bcc6bd;
  --primary: #a65b1a;
  --primary-strong: #7f3f0d;
  --stable: #123b2b;
  --stable-deep: #08261c;
  --stable-soft: #e5eee8;
  --saddle: #8e4a16;
  --success: #2e7b55;
  --warning: #9a601d;
  --white: #fff;
  --shadow: 0 18px 50px rgb(21 42 32 / 0.10);
  --soft-shadow: 0 8px 24px rgb(21 42 32 / 0.07);
  --radius: 10px;
  --radius-lg: 14px;
  --font-ui: Aptos, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --font-brand: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

html {
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgb(199 124 51 / 0.35);
  outline-offset: 2px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.nav-link svg,
.mobile-tab svg,
.sidebar-actions svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-link[data-view="dashboard"] svg,
.mobile-tab[data-view="dashboard"] svg {
  fill: currentColor;
  stroke: none;
}

.nav-link:nth-child(4) svg,
.mobile-tab[data-view="rankings"] svg {
  fill: none;
  stroke: currentColor;
}

.kicker,
.eyebrow,
.form-label,
.dashboard-kicker,
.ticket-label {
  color: var(--primary);
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.095em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

/* Login */

.login-shell {
  grid-template-columns: minmax(0, 1.16fr) minmax(440px, 0.84fr);
  min-height: 100svh;
  background: var(--stable-deep);
}

.login-media,
.login-media picture,
.login-media img {
  min-height: 100svh;
}

.login-media::after {
  background: none;
  animation: none;
}

.login-media img {
  object-position: 62% center;
  animation: none;
  filter: saturate(0.88) contrast(1.03);
}

.media-scrim {
  background: rgb(4 28 20 / 0.48);
  box-shadow: inset -80px 0 120px rgb(4 24 17 / 0.34);
}

.login-copy {
  left: clamp(28px, 5vw, 76px);
  bottom: clamp(36px, 7vw, 82px);
  max-width: 650px;
}

.login-copy .kicker,
.login-copy h1,
.login-copy .login-subcopy,
.login-panel > .brand-lockup,
.auth-card,
.auth-card > * {
  animation: none;
}

.login-copy .kicker {
  color: #e5a35e;
}

.login-copy h1 {
  max-width: 11ch;
  padding: 0;
  font-family: var(--font-brand);
  font-size: clamp(2.85rem, 5vw, 4.9rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.login-subcopy {
  max-width: 29rem;
  margin-top: 20px;
  color: rgb(255 255 255 / 0.82);
  font-size: 1.02rem;
}

.login-panel {
  position: relative;
  display: grid;
  align-content: center;
  gap: 28px;
  min-width: 0;
  padding: clamp(30px, 5vw, 72px);
  overflow: hidden;
  background: var(--stable-deep);
}

.login-panel::before {
  inset: 0;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: url("assets/login-stencil-decals.webp") center top / cover no-repeat;
  mask-image: none;
  opacity: 0.62;
  transform: none;
  animation: none;
}

.login-panel::after {
  display: none;
}

.login-panel > .brand-lockup {
  align-self: auto;
  gap: 13px;
}

.login-panel > .brand-lockup .brand-mark,
.login-panel > .brand-lockup .brand-logo {
  width: 54px;
  height: 48px;
}

.login-panel > .brand-lockup strong {
  color: #fff;
  font-size: 1.5rem;
}

.brand-descriptor {
  margin-top: 4px;
  color: rgb(255 255 255 / 0.6) !important;
  font-size: 0.73rem !important;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.auth-card {
  width: min(100%, 430px);
  max-width: none;
  gap: 17px;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: var(--radius-lg);
  background: #fbfaf4;
  box-shadow: 0 26px 70px rgb(0 0 0 / 0.24);
  padding: clamp(24px, 3vw, 34px);
}

.auth-card h2 {
  max-width: 13ch;
  font-family: var(--font-brand);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.025em;
}

.auth-card input,
.auth-card .password-control {
  background: #fff;
}

.auth-card input,
input,
select,
textarea,
.custom-select-trigger {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}

.auth-card input:hover,
input:hover,
select:hover,
textarea:hover,
.custom-select-trigger:hover {
  border-color: #98a79d;
}

.auth-card input:focus,
input:focus,
select:focus,
textarea:focus,
.custom-select.is-open .custom-select-trigger {
  border-color: var(--stable);
  box-shadow: 0 0 0 3px rgb(18 59 43 / 0.10);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.remove-btn,
.ranking-sort,
.whiteboard-actions button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 750;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.primary-btn,
.login-submit {
  border: 1px solid var(--primary-strong);
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}

.primary-btn::before,
.login-submit::before {
  display: none;
}

.primary-btn:hover,
.login-submit:hover {
  background: var(--primary-strong);
  box-shadow: 0 6px 16px rgb(127 63 13 / 0.18);
  transform: translateY(-1px);
}

.primary-btn:active,
.login-submit:active {
  transform: translateY(0);
}

.secondary-btn,
.remove-btn,
.whiteboard-actions button {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--stable);
}

.secondary-btn:hover,
.remove-btn:hover,
.whiteboard-actions button:hover {
  border-color: var(--stable);
  background: var(--stable-soft);
  color: var(--stable-deep);
}

.legal-login-link {
  position: static;
  width: fit-content;
  justify-self: start;
  color: rgb(255 255 255 / 0.66);
  font-size: 0.78rem;
  text-decoration: none;
  transform: none;
}

.legal-login-link:hover,
.legal-login-link:focus-visible {
  color: #fff;
}

/* App chrome */

.app-shell {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100svh;
  background: var(--bg);
}

.sidebar {
  width: 228px;
  min-height: 100svh;
  padding: 22px 16px 18px;
  border-right: 1px solid rgb(255 255 255 / 0.08);
  background: var(--stable-deep);
  box-shadow: none;
}

.sidebar::before {
  display: block;
  inset: 0;
  height: auto;
  background: url("assets/sidebar-decal.webp") right top / auto 100% no-repeat;
  opacity: 0.46;
}

.sidebar .brand-lockup.compact {
  gap: 11px;
  padding: 0 6px 18px;
  border-bottom: 1px solid rgb(255 255 255 / 0.1);
}

.sidebar .brand-lockup .brand-mark,
.sidebar .brand-lockup .brand-logo {
  width: 48px;
  height: 44px;
}

.sidebar .brand-lockup .wordmark {
  color: #fff;
  font-size: 1.45rem;
}

.track-picker {
  gap: 5px;
  margin-top: 9px;
}

.track-picker > span {
  color: rgb(255 255 255 / 0.5);
  font-size: 0.61rem;
  letter-spacing: 0.09em;
}

.track-select-button {
  width: 136px;
  min-height: 36px;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 7px;
  background: rgb(255 255 255 / 0.06);
  color: #fff;
  padding: 6px 10px;
  box-shadow: none;
}

.track-select-button:hover,
.track-picker.is-open .track-select-button {
  border-color: rgb(255 255 255 / 0.34);
  background: rgb(255 255 255 / 0.1);
}

.track-menu {
  margin-top: 6px;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 8px;
  background: #164532;
  box-shadow: 0 14px 30px rgb(0 0 0 / 0.25);
}

.track-option {
  background: transparent;
  color: rgb(255 255 255 / 0.8);
}

.track-option:hover,
.track-option:focus-visible,
.track-option[aria-selected="true"] {
  background: rgb(255 255 255 / 0.1);
  color: #fff;
}

.nav-list {
  display: grid;
  gap: 4px;
  margin-top: 20px;
}

.nav-link {
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgb(255 255 255 / 0.67);
  padding: 9px 11px;
  font-size: 0.9rem;
  font-weight: 700;
}

.nav-link::before {
  display: none;
}

.nav-link:hover {
  border-color: rgb(255 255 255 / 0.08);
  background: rgb(255 255 255 / 0.055);
  color: #fff;
}

.nav-link.active {
  border-color: rgb(217 145 75 / 0.3);
  background: #fff;
  color: var(--stable-deep);
  padding-left: 11px;
  box-shadow: 0 5px 15px rgb(0 0 0 / 0.16);
}

.nav-link.active svg {
  color: var(--primary);
}

.sidebar-actions {
  gap: 8px;
  margin-top: auto;
}

.sidebar .ghost-btn,
.settings-btn {
  border: 1px solid rgb(255 255 255 / 0.14);
  background: transparent;
  color: rgb(255 255 255 / 0.72);
}

.sidebar .ghost-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sidebar .ghost-btn:hover,
.settings-btn:hover,
.settings-btn.is-open,
.settings-btn.active {
  border-color: rgb(255 255 255 / 0.3);
  background: rgb(255 255 255 / 0.08);
  color: #fff;
}

.settings-btn {
  display: grid;
  place-items: center;
}

.settings-menu {
  position: static;
}

.settings-popover {
  width: min(220px, 100%);
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.settings-popover button {
  background: transparent;
  color: var(--ink);
}

.settings-popover button:hover,
.settings-popover button:focus-visible {
  background: var(--stable-soft);
}

.workspace {
  grid-column: 2;
  justify-self: stretch;
  width: 100%;
  max-width: 1560px;
  min-width: 0;
  margin: 0 auto;
  padding: 22px clamp(18px, 2.5vw, 36px) 48px;
}

.topbar {
  position: relative;
  min-height: 86px;
  margin: 0;
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: var(--radius-lg);
  background: var(--stable);
  color: #fff;
  padding: 19px 22px;
  box-shadow: var(--soft-shadow);
}

.topbar::after {
  position: absolute;
  inset: 0 0 0 auto;
  width: 220px;
  border-radius: inherit;
  background: url("assets/dashboard-lab-decals.webp") center / cover no-repeat;
  content: "";
  opacity: 0.08;
  pointer-events: none;
}

.topbar .eyebrow {
  margin-bottom: 5px;
  color: #d79a5a;
}

.topbar h1,
.topbar-title-row h1 {
  max-width: 30ch;
  color: #fff;
  font-size: clamp(1.35rem, 2.1vw, 1.75rem);
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.topbar-title-row {
  align-items: center;
  gap: 9px;
}

.control-row {
  display: grid;
  grid-template-columns: minmax(250px, 1.45fr) minmax(210px, 1fr) minmax(190px, 0.9fr) 116px;
  gap: 0;
  margin: 12px 0 18px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: none;
}

.select-wrap {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-radius: 0 !important;
  background: transparent;
  padding: 11px 12px 12px;
}

.select-wrap:first-child {
  grid-column: auto;
}

.select-wrap .field-label {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.custom-select-trigger {
  min-height: 42px;
  border-color: transparent;
  background: var(--panel);
  padding: 9px 11px;
}

.custom-select-menu {
  z-index: 45;
  margin-top: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow);
}

.custom-select-option {
  min-height: 40px;
  background: #fff;
  color: var(--ink);
}

.custom-select-option:hover,
.custom-select-option:focus-visible,
.custom-select-option.is-selected {
  background: var(--stable-soft);
  color: var(--stable-deep);
}

.context-cap {
  min-width: 0;
  border-radius: 0 10px 10px 0 !important;
  background: var(--stable-deep);
  color: #fff;
  padding: 12px 14px;
}

.context-cap span,
.context-cap small {
  color: rgb(255 255 255 / 0.58);
}

.context-cap strong {
  color: #fff;
  font-size: 1.2rem;
}

.workspace-view.is-active {
  animation: none;
}

.page-view {
  min-width: 0;
}

/* Shared content system */

.panel,
.dashboard-panel,
.metric-panel,
.settings-status-card,
.settings-card,
.legal-card {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: none;
}

.panel,
.page-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: none;
}

.section-head {
  gap: 16px;
  align-items: flex-start;
}

.section-head h2 {
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.section-note,
.fine-print,
.metric-panel p {
  color: var(--muted);
}

.pill,
.score-tag,
.value-tag,
.confidence-tag,
.stage-tag,
.use-tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: #44554b;
  box-shadow: none;
}

.info-tip,
.info-tip.inverse {
  width: 19px;
  height: 19px;
  min-width: 19px;
  min-height: 19px;
  border: 1px solid #aab7ad;
  border-radius: 50%;
  background: transparent;
  color: #5b6d62;
  font-size: 0.68rem;
  line-height: 1;
  box-shadow: none;
}

.info-tip.inverse {
  border-color: rgb(255 255 255 / 0.35);
  color: rgb(255 255 255 / 0.8);
}

.info-tip::after {
  display: none;
}

.info-tip:hover,
.info-tip:focus-visible,
.info-tip.is-active {
  border-color: var(--primary);
  background: #fff7ed;
  color: var(--primary-strong);
  transform: none;
}

.info-tip.inverse:hover,
.info-tip.inverse:focus-visible,
.info-tip.inverse.is-active {
  border-color: #e3a35f;
  background: rgb(255 255 255 / 0.12);
  color: #fff;
}

.tooltip-layer {
  max-width: min(300px, calc(100vw - 24px));
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 8px;
  background: #0c2e21;
  color: #fff;
  box-shadow: 0 12px 30px rgb(0 0 0 / 0.22);
  padding: 9px 11px;
  font-size: 0.78rem;
}

/* Dashboard */

.dashboard-board {
  gap: 16px;
}

.dashboard-board::before {
  display: none;
}

.setup-panel {
  display: block;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #c7d1c8;
  border-radius: 11px;
  background: #eef3ee;
  box-shadow: none;
  padding: 0;
}

.setup-panel::before,
.setup-panel::after {
  display: none;
}

.setup-summary {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
}

.setup-summary::-webkit-details-marker {
  display: none;
}

.setup-summary:hover {
  background: #e7eee8;
}

.setup-summary-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--stable);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 850;
}

.setup-summary .eyebrow {
  display: block;
  margin: 0 0 2px;
}

.setup-summary strong {
  display: block;
  color: var(--ink);
  font-size: 0.98rem;
}

.setup-summary small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.setup-summary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--stable);
  font-size: 0.78rem;
  font-weight: 800;
}

.setup-summary-action::after {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.setup-panel[open] .setup-summary-action::after {
  transform: rotate(225deg) translate(-1px, -1px);
}

.setup-body {
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) minmax(0, 1.28fr);
  gap: 22px;
  border-top: 1px solid #c7d1c8;
  background: var(--surface);
  padding: 20px;
}

.setup-copy h2 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1.65rem;
  font-weight: 700;
}

.setup-copy p:not(.eyebrow) {
  max-width: 38ch;
  color: var(--muted);
  font-size: 0.9rem;
}

.setup-cues {
  gap: 7px;
}

.setup-cues span {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
}

.setup-cues strong {
  background: var(--primary);
}

.setup-form {
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.setup-form input,
.setup-form select {
  min-height: 42px;
}

.dashboard-hero {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
  padding: clamp(22px, 3vw, 34px);
}

.dashboard-hero::before {
  inset: 0 0 0 auto;
  width: 48%;
  height: 100%;
  background: url("assets/dashboard-lab-decals.webp") center / cover no-repeat;
  opacity: 0.08;
  mask-image: none;
}

.dashboard-hero::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  background: var(--primary);
  content: "";
}

.dashboard-kicker {
  color: var(--primary);
}

.dashboard-hero h2 {
  max-width: 15ch;
  color: var(--ink);
  font-family: var(--font-brand);
  font-size: clamp(2.3rem, 4vw, 3.6rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.dashboard-hero-main > p:not(.dashboard-kicker) {
  color: var(--muted);
}

.dashboard-signal-row span {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  box-shadow: none;
}

.dashboard-signal-row strong {
  color: var(--stable-deep);
}

.score-dial {
  width: 190px;
  min-width: 190px;
  min-height: 142px;
  border: 1px solid #1f563f;
  border-radius: 12px;
  background: var(--stable);
  color: #fff;
  box-shadow: none;
}

.score-dial span,
.score-dial em {
  color: rgb(255 255 255 / 0.68);
}

.score-dial strong {
  color: #fff;
  font-family: var(--font-brand);
  font-size: 4.2rem;
  line-height: 0.86;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.dashboard-panel {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 20px;
}

.contender-panel {
  grid-column: span 5;
}

.factor-panel {
  grid-column: span 3;
}

.discipline-panel {
  grid-column: span 4;
  border-right: 0;
}

.checklist-panel {
  grid-column: span 8;
  border-bottom: 0;
}

.timeline-panel {
  grid-column: span 4;
  border-right: 0;
  border-bottom: 0;
}

.contender-row,
.discipline-stack > div,
.checklist-item,
.race-timeline span {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: none;
}

.contender-row {
  padding: 10px 11px;
}

.contender-rank,
.race-timeline strong {
  background: var(--stable-deep);
  color: #fff;
}

.contender-row em {
  color: var(--primary-strong);
}

.factor-meter div,
.edge-meter span {
  background: #dfe7e1;
}

.factor-meter i,
.edge-meter i {
  background: var(--primary);
}

.checklist-item > span {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--muted);
}

.checklist-item.is-done > span {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.summary-grid.compact-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.compact-summary .metric-panel {
  min-height: 116px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 15px;
}

.compact-summary .metric-panel:first-child {
  border-left: 0;
}

.metric-panel::after {
  display: none;
}

.metric-panel:hover {
  transform: none;
}

.metric-panel strong {
  color: var(--stable-deep);
  font-size: 1.25rem;
}

.metric-panel.risk {
  background: #faf2e7;
}

/* Race card */

.race-slip-panel,
.race-ticket-stack {
  overflow: hidden;
  background: var(--surface);
}

.race-slip-panel::before,
.race-slip-panel::after,
.race-ticket-stack::before,
.race-entry-row::before {
  display: none;
}

.race-slip-panel > .section-head {
  min-height: 0;
  border-bottom: 1px solid var(--line);
  background: var(--stable);
  color: #fff;
  padding: 18px 20px;
}

.race-slip-panel > .section-head h2,
.race-slip-panel > .section-head .section-note {
  color: #fff;
}

.race-slip-panel > .section-head .section-note {
  opacity: 0.7;
}

.race-slip-panel > .section-head .secondary-btn {
  border-color: rgb(255 255 255 / 0.3);
  background: transparent;
  color: #fff;
}

.race-slip-meta {
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: #eef3ee;
  padding: 9px 18px;
}

.race-slip-meta span {
  border-color: #cfd8d1;
  background: #fff;
  color: var(--stable);
}

.race-slip-panel .horse-form {
  gap: 13px;
  border: 0;
  background: transparent;
  padding: 18px;
}

.race-slip-panel input,
.race-slip-panel select {
  min-height: 42px;
  background: #fff;
}

.race-roster-panel {
  margin-top: 16px;
}

.race-ticket-stack > .section-head {
  border-bottom: 1px solid var(--line);
  padding: 17px 20px;
}

.race-card-list {
  background: transparent;
}

.race-entry-row {
  border-top: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
}

.race-entry-row:first-child {
  border-top: 0;
}

.race-entry-post {
  border-radius: 8px;
  background: var(--stable);
  color: #fff;
}

.race-entry-post span,
.race-entry-score span {
  color: var(--muted);
}

.race-entry-post span {
  color: rgb(255 255 255 / 0.65);
}

.race-entry-score {
  border-color: var(--line);
  background: var(--panel);
}

/* Rankings */

.two-column {
  grid-template-columns: minmax(0, 1.65fr) minmax(290px, 0.65fr);
  gap: 16px;
}

.rankings-board-panel {
  overflow: hidden;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0;
}

.rankings-board-panel::before,
.rankings-board-panel::after {
  display: none;
}

.rankings-board-panel > .section-head {
  min-height: 0;
  border-bottom: 1px solid var(--line);
  background: var(--stable);
  color: #fff;
  padding: 18px 20px;
}

.rankings-board-panel .section-head h2,
.rankings-board-panel .section-head .eyebrow {
  color: #fff;
}

.rankings-board-panel .section-head .eyebrow {
  opacity: 0.58;
}

.rankings-board-panel .section-head .pill {
  border-color: rgb(255 255 255 / 0.25);
  background: rgb(255 255 255 / 0.08);
  color: #fff;
}

.ranking-board-meta {
  gap: 7px;
  border-bottom: 1px solid var(--line);
  background: #eef3ee;
  padding: 10px 18px;
}

.ranking-board-meta span {
  border-color: #ccd7cf;
  background: #fff;
  color: var(--stable);
}

.ranking-toolbar {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 18px;
}

.rankings-board-panel .ranking-toolbar {
  border-radius: 0;
}

.ranking-sort {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.ranking-sort:hover,
.ranking-sort:focus-visible,
.ranking-sort.is-active {
  border-color: var(--stable);
  background: var(--stable);
  color: #fff;
}

.ranking-summary-strip {
  border-bottom: 1px solid var(--line);
  background: #eef3ee;
}

.ranking-summary-strip div {
  border-color: #cfd8d1;
  background: transparent;
}

.ranking-summary-strip span,
.ranking-summary-strip strong,
.ranking-summary-strip em {
  color: var(--ink);
}

.ranking-summary-strip span,
.ranking-summary-strip em {
  color: var(--muted);
}

.ranking-head {
  border-bottom: 1px solid var(--line);
  background: #fafaf6;
  color: var(--muted);
  padding-inline: 18px;
}

.horse-list {
  display: grid;
  gap: 0;
}

.horse-card {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
  padding: 17px 18px;
}

.rankings-board-panel .horse-card,
.rankings-board-panel .horse-card.is-top-ranked,
.rankings-board-panel .horse-card.is-value-runner:not(.is-top-ranked) {
  background: #fff;
  color: var(--ink);
}

.horse-card:last-child {
  border-bottom: 0;
}

.horse-card::before {
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 4px;
  height: auto;
  border-radius: 0 3px 3px 0;
  background: transparent;
}

.horse-card.is-top-ranked::before {
  background: var(--primary);
}

.horse-card.is-value-runner:not(.is-top-ranked)::before {
  background: var(--success);
}

.horse-card:hover {
  background: #fcfcf8;
  transform: none;
}

.horse-rank {
  border-radius: 8px;
  background: var(--stable-deep);
  color: #fff;
}

.horse-rank span,
.horse-board-label,
.horse-scoreboard span,
.horse-scoreboard em {
  color: var(--muted);
}

.horse-rank span {
  color: rgb(255 255 255 / 0.6);
}

.horse-main h3,
.horse-main p {
  color: var(--ink);
}

.rankings-board-panel .horse-main h3 {
  color: var(--ink);
}

.horse-main .horse-note,
.horse-line {
  color: var(--muted);
}

.rankings-board-panel .horse-main .horse-line,
.rankings-board-panel .horse-main .horse-note,
.rankings-board-panel .horse-board-label,
.rankings-board-panel .horse-scoreboard span,
.rankings-board-panel .horse-scoreboard em {
  color: var(--muted);
}

.rankings-board-panel .horse-meta .pill,
.rankings-board-panel .horse-meta .confidence-tag,
.rankings-board-panel .horse-meta .value-tag,
.rankings-board-panel .horse-meta .stage-tag,
.rankings-board-panel .use-tag {
  border-color: var(--line);
  background: var(--panel);
  color: #44554b;
}

.horse-scoreboard {
  border: 1px solid #cbd7ce;
  border-radius: 9px;
  background: var(--stable-soft);
  color: var(--stable-deep);
}

.rankings-board-panel .horse-scoreboard {
  border-color: #cbd7ce;
  background: var(--stable-soft);
}

.rankings-board-panel .horse-actions .secondary-btn,
.rankings-board-panel .horse-actions .remove-btn {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--stable);
}

.rankings-board-panel .horse-actions .secondary-btn:hover,
.rankings-board-panel .horse-actions .remove-btn:hover {
  border-color: var(--stable);
  background: var(--stable-soft);
}

.horse-scoreboard strong {
  color: var(--stable-deep);
  font-family: var(--font-brand);
}

.weights-panel,
.connections-intel-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: none;
}

.weights-panel .section-head,
.connections-intel-panel .section-head {
  border-bottom-color: var(--line);
}

.weights-form label,
.connection-note,
.idea {
  border-color: var(--line);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: none;
}

input[type="range"] {
  accent-color: var(--primary);
}

/* Bankroll */

.bankroll-panel {
  overflow: hidden;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: none;
  padding: 0;
}

.bankroll-panel::before,
.bankroll-panel::after {
  display: none;
}

.bankroll-head {
  border-bottom: 1px solid var(--line);
  background: var(--stable);
  color: #fff;
  padding: 19px 20px;
}

.bankroll-head h2,
.bankroll-head .section-note {
  color: #fff;
}

.bankroll-head .section-note {
  opacity: 0.68;
}

.bankroll-ticket-stamp {
  border-color: rgb(255 255 255 / 0.24);
  background: rgb(255 255 255 / 0.08);
  color: #fff;
}

.bankroll-slip-grid {
  gap: 0;
}

.bankroll-ticket,
.bankroll-controls {
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.bankroll-ticket {
  border-right: 1px solid var(--line);
}

.bankroll-ticket-main,
.bankroll-ticket-metrics > div,
.bankroll-rule-strip,
.bankroll-idea {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: none;
}

.bankroll-ticket-main {
  color: var(--ink);
}

.bankroll-ticket-main span {
  color: var(--brass);
}

.bankroll-ticket-main strong {
  color: var(--ink);
  font-size: clamp(2.2rem, 4vw, 3.3rem);
  line-height: 1;
}

.bankroll-ticket-main p {
  color: var(--muted);
}

.bankroll-idea::after {
  display: none;
}

/* Calendar */

body[data-active-view] .app-shell {
  background: var(--canvas);
}

body[data-active-view="calendar"] .control-row {
  display: none;
}

.calendar-panel {
  overflow: hidden;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: none;
  padding: 0;
}

.calendar-panel::before,
.calendar-panel::after,
.calendar-month::before,
.calendar-month::after {
  display: none;
}

.calendar-panel > .section-head {
  border-bottom: 1px solid var(--line);
  padding: 20px;
}

.calendar-panel > .section-head h2,
.calendar-panel > .section-head .eyebrow,
.calendar-month h3,
.calendar-month .eyebrow {
  color: var(--ink);
}

.calendar-toolbar,
.calendar-summary,
.calendar-grid,
.calendar-detail,
.calendar-source {
  margin-right: 20px;
  margin-left: 20px;
}

.calendar-toolbar {
  margin-top: 14px;
}

.calendar-toolbar .pill,
.calendar-nav {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  box-shadow: none;
}

.calendar-panel > .section-head .calendar-toolbar .pill {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.calendar-nav span,
.calendar-nav-btn,
.calendar-card-nav-btn {
  color: var(--ink);
}

.calendar-card-nav {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: none;
}

.calendar-nav-btn:hover:not(:disabled),
.calendar-nav-btn:focus-visible:not(:disabled),
.calendar-card-nav-btn:hover:not(:disabled),
.calendar-card-nav-btn:focus-visible:not(:disabled) {
  background: var(--stable-soft);
  color: var(--stable);
}

.calendar-summary {
  margin-top: 16px;
}

.calendar-detail {
  display: block;
  overflow: hidden;
  margin-top: 16px;
  padding: 0;
  scroll-margin-top: 18px;
}

.calendar-detail:focus {
  outline: 3px solid rgb(172 89 24 / 0.24);
  outline-offset: 3px;
}

.calendar-detail-header,
.calendar-race-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.calendar-detail-header {
  border-bottom: 1px solid var(--line);
  padding: 17px 20px;
}

.calendar-detail .calendar-detail-header > div > span,
.calendar-race-card-head > div > span {
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.calendar-detail .calendar-detail-header strong,
.calendar-race-card-head strong {
  margin-top: 3px;
}

.calendar-detail-header p {
  margin-top: 4px;
}

.calendar-race-card {
  background: #fff;
}

.calendar-race-card-head {
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
}

.calendar-race-card-head a,
.calendar-day-entries-link a {
  color: var(--stable);
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: rgb(17 64 47 / 0.3);
  text-underline-offset: 3px;
}

.calendar-race-list {
  display: grid;
}

.calendar-race-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  padding: 9px 20px;
  text-decoration: none;
}

.calendar-race-row:hover,
.calendar-race-row:focus-visible {
  background: var(--stable-soft);
}

.calendar-detail .calendar-race-number {
  color: var(--stable);
  font-size: 0.78rem;
  font-weight: 850;
}

.calendar-race-copy {
  min-width: 0;
}

.calendar-detail .calendar-race-copy strong {
  margin: 0;
  font-size: 0.86rem;
}

.calendar-race-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.calendar-race-row time {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.calendar-race-card-foot,
.calendar-day-entries-link {
  margin: 0;
  padding: 13px 20px;
}

.calendar-detail .calendar-race-card-foot {
  max-width: none;
  margin: 0;
  font-size: 0.72rem;
}

.calendar-detail {
  border-top: 3px solid var(--primary);
}

.calendar-detail:focus {
  outline: none;
}

.calendar-detail:focus-visible {
  outline: 3px solid rgb(172 89 24 / 0.24);
  outline-offset: 3px;
}

.calendar-detail-header {
  min-height: 112px;
  background:
    linear-gradient(90deg, rgb(17 64 47 / 0.055), transparent 52%),
    var(--panel);
  padding: 18px 22px;
}

.calendar-detail .calendar-detail-header > div:first-child > strong {
  display: block;
  font-size: 1.28rem;
  line-height: 1.2;
}

.calendar-detail-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
}

.calendar-back-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--stable);
  padding: 7px 12px;
  font-size: 0.73rem;
  font-weight: 800;
}

.calendar-back-button:hover,
.calendar-back-button:focus-visible {
  border-color: rgb(17 64 47 / 0.3);
  background: var(--stable-soft);
}

.calendar-card-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.calendar-card-facts > span {
  display: grid;
  min-height: 68px;
  align-content: center;
  gap: 3px;
  border-right: 1px solid var(--line);
  padding: 10px 20px;
}

.calendar-card-facts > span:last-child {
  border-right: 0;
}

.calendar-card-facts small {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.calendar-detail .calendar-card-facts strong {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.25;
}

.calendar-race-card-head {
  min-height: 66px;
  padding: 12px 20px;
}

.calendar-detail .calendar-race-card-head strong {
  display: block;
  font-size: 1rem;
}

.calendar-detail .calendar-race-instruction {
  max-width: none;
  margin: 3px 0 0;
  font-size: 0.68rem;
  line-height: 1.3;
}

.calendar-race-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.calendar-race-card-head a,
.calendar-race-card-actions button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 7px 12px;
  color: var(--stable);
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
}

.calendar-race-card-head a:hover,
.calendar-race-card-head a:focus-visible,
.calendar-race-card-actions button:hover,
.calendar-race-card-actions button:focus-visible {
  border-color: rgb(17 64 47 / 0.3);
  background: var(--stable-soft);
}

.calendar-race-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.calendar-race-row {
  width: 100%;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 11px;
  min-height: 76px;
  border-top: 0;
  border-left: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  font: inherit;
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
}

.calendar-race-row:nth-child(even) {
  border-right: 0;
}

.calendar-race-row:hover,
.calendar-race-row:focus-visible {
  background:
    linear-gradient(90deg, rgb(17 64 47 / 0.075), transparent 68%),
    var(--stable-soft);
}

.calendar-race-row.is-selected {
  background:
    linear-gradient(90deg, rgb(17 64 47 / 0.12), transparent 72%),
    #f6faf7;
  box-shadow: inset 4px 0 0 var(--primary);
}

.calendar-race-row.is-selected .calendar-race-number {
  background: var(--primary);
}

.calendar-detail .calendar-race-number {
  display: grid;
  width: 42px;
  height: 48px;
  align-content: center;
  justify-items: center;
  border-radius: 5px;
  background: var(--stable);
  color: #fff;
  line-height: 1;
}

.calendar-detail .calendar-race-number small {
  color: rgb(255 255 255 / 0.68);
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-detail .calendar-race-number strong {
  margin: 3px 0 0;
  color: #fff;
  font-size: 1.08rem;
}

.calendar-detail .calendar-race-copy strong {
  display: block;
  overflow: hidden;
  font-size: 0.82rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-race-copy small i {
  font-style: normal;
}

.calendar-race-post {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.calendar-surface {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  padding: 3px 7px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.calendar-surface.is-turf {
  border-color: rgb(17 103 69 / 0.22);
  background: rgb(223 242 231 / 0.7);
  color: #185d41;
}

.calendar-surface.is-dirt {
  border-color: rgb(172 89 24 / 0.2);
  background: #fbf0e3;
  color: #995018;
}

.calendar-race-row time {
  font-size: 0.72rem;
}

.calendar-race-field {
  background: #fff;
  scroll-margin-top: 18px;
}

.calendar-race-field:focus {
  outline: none;
}

.calendar-race-field:focus-visible {
  outline: 3px solid rgb(172 89 24 / 0.24);
  outline-offset: -3px;
}

.calendar-race-field-summary {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgb(17 64 47 / 0.075), transparent 58%),
    var(--panel);
  padding: 15px 20px;
}

.calendar-field-race-number {
  display: grid;
  width: 52px;
  height: 58px;
  align-content: center;
  justify-items: center;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  line-height: 1;
}

.calendar-field-race-number small {
  color: rgb(255 255 255 / 0.72);
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.calendar-detail .calendar-field-race-number strong {
  margin: 4px 0 0;
  color: #fff;
  font-size: 1.4rem;
}

.calendar-race-field-summary > div:nth-child(2) > span {
  color: var(--primary);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-race-field-summary h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.2;
}

.calendar-detail .calendar-race-field-summary p {
  max-width: none;
  margin: 4px 0 0;
  font-size: 0.72rem;
}

.calendar-field-count {
  display: grid;
  min-width: 88px;
  justify-items: end;
  color: var(--muted);
}

.calendar-detail .calendar-field-count strong {
  margin: 0;
  color: var(--stable);
  font-size: 1.35rem;
  line-height: 1;
}

.calendar-field-count span,
.calendar-field-count small {
  font-size: 0.62rem;
  font-weight: 750;
}

.calendar-field-count small {
  margin-top: 3px;
  color: var(--primary);
}

.calendar-bet-plan {
  border-bottom: 1px solid var(--line);
  background: #fffaf1;
}

.calendar-bet-plan-head {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--stable-deep);
  color: #fff;
  padding: 11px 20px;
}

.calendar-bet-plan-head > div {
  display: grid;
  gap: 2px;
}

.calendar-bet-plan-head span,
.calendar-bet-plan-grid > div > span {
  color: #e4a15f;
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.calendar-detail .calendar-bet-plan-head strong {
  margin: 0;
  color: #fff;
  font-size: 0.9rem;
}

.calendar-bet-plan-head em {
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.08);
  color: rgb(255 255 255 / 0.78);
  padding: 5px 9px;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
  text-transform: uppercase;
}

.calendar-bet-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.calendar-bet-plan-grid > div {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 5px;
  border-right: 1px solid #eadfce;
  padding: 14px 16px;
}

.calendar-bet-plan-grid > div:last-child {
  border-right: 0;
}

.calendar-detail .calendar-bet-plan-grid strong {
  margin: 0;
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.3;
}

.calendar-detail .calendar-bet-plan-grid p,
.calendar-detail .calendar-bet-plan-foot {
  max-width: none;
  margin: 0;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.4;
}

.calendar-detail .calendar-bet-plan-foot {
  border-top: 1px solid #eadfce;
  padding: 9px 16px;
}

.calendar-wager-slip {
  position: relative;
  width: min(calc(100% - 40px), 820px);
  margin: 18px auto 20px;
  overflow: hidden;
  border: 1px solid #b8b3a7;
  border-radius: 3px;
  background:
    repeating-linear-gradient(0deg, transparent 0 27px, rgb(48 57 52 / 0.045) 27px 28px),
    #f8f6ee;
  color: #202923;
  box-shadow: 0 10px 24px rgb(28 38 32 / 0.12);
  font-family: var(--font-ui);
}

.calendar-wager-slip::before,
.calendar-wager-slip::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  background: radial-gradient(circle, var(--surface) 0 3px, transparent 3.5px) center 2px / 8px 18px repeat-y;
  content: "";
  pointer-events: none;
  z-index: 2;
}

.calendar-wager-slip::before {
  left: -4px;
}

.calendar-wager-slip::after {
  right: -4px;
}

.wager-slip-top {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid #213d31;
  background: #e9e5d9;
  padding: 11px 20px;
}

.wager-slip-top > div {
  display: grid;
  gap: 1px;
}

.wager-slip-top span,
.wager-slip-meta small,
.wager-slip-line small,
.wager-slip-order span,
.wager-slip-total span {
  color: #667068;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-detail .wager-slip-top strong {
  margin: 0;
  color: #173d2e;
  font-family: var(--font-brand);
  font-size: 1.08rem;
}

.wager-slip-top em {
  border: 1px solid #b9b4a8;
  border-radius: 3px;
  background: #f8f6ee;
  color: #5f6862;
  padding: 5px 8px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wager-slip-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px dashed #aaa79e;
}

.wager-slip-meta > span {
  display: grid;
  min-width: 0;
  gap: 3px;
  border-right: 1px solid #cbc6ba;
  padding: 10px 14px;
}

.wager-slip-meta > span:last-child {
  border-right: 0;
}

.calendar-detail .wager-slip-meta strong,
.calendar-detail .wager-slip-line strong {
  overflow-wrap: anywhere;
  margin: 0;
  color: #202923;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.3;
}

.wager-slip-lines {
  display: grid;
}

.wager-slip-columns,
.wager-slip-line {
  display: grid;
  grid-template-columns: 42px 112px minmax(0, 1fr) 88px;
  align-items: center;
  gap: 10px;
}

.wager-slip-columns {
  min-height: 29px;
  border-bottom: 1px solid #cbc6ba;
  background: rgb(33 61 49 / 0.055);
  color: #687169;
  padding: 5px 14px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wager-slip-line {
  min-height: 64px;
  border-bottom: 1px solid #cbc6ba;
  padding: 9px 14px;
}

.wager-slip-line > span:not(.wager-slip-mark) {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.wager-slip-mark {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 2px solid #27533f;
  border-radius: 50%;
  color: #174b35;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9rem;
  font-weight: 900;
  transform: rotate(-6deg);
}

.wager-slip-total {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  border-bottom: 1px dashed #aaa79e;
  background: #efecdf;
  padding: 9px 20px;
}

.calendar-detail .wager-slip-total strong {
  margin: 0;
  color: #143f2e;
  font-family: Consolas, "Courier New", monospace;
  font-size: 1.35rem;
}

.wager-slip-order {
  display: grid;
  gap: 5px;
  padding: 14px 20px;
}

.calendar-detail .wager-slip-order strong {
  margin: 0;
  color: #17231e;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.86rem;
  line-height: 1.45;
}

.calendar-detail .calendar-wager-slip > p {
  max-width: none;
  margin: 0;
  border-top: 1px solid #cbc6ba;
  background: rgb(255 255 255 / 0.42);
  color: #6a716c;
  padding: 9px 20px 11px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.58rem;
  line-height: 1.45;
}

.calendar-wager-slip.is-pass .wager-slip-mark {
  border-color: #a65b1a;
  color: #8d4814;
}

.calendar-wager-slip.is-pass .wager-slip-total strong {
  color: #8d4814;
}

.calendar-runner-table {
  display: grid;
}

.calendar-runner-columns,
.calendar-runner-row {
  display: grid;
  grid-template-columns: 56px minmax(150px, 1.35fr) minmax(130px, 1fr) minmax(130px, 1fr) 62px;
  align-items: center;
  gap: 12px;
}

.calendar-runner-columns {
  min-height: 34px;
  border-bottom: 1px solid var(--line);
  background: #f7f7f3;
  color: var(--muted);
  padding: 6px 20px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.calendar-runner-row {
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  padding: 9px 20px;
}

.calendar-runner-row:last-child {
  border-bottom: 0;
}

.calendar-runner-row:hover {
  background: #fbfbf8;
}

.calendar-runner-row.is-scratched {
  background: #faf8f5;
  color: var(--muted);
}

.calendar-runner-post {
  display: grid;
  width: 38px;
  height: 42px;
  align-content: center;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--stable);
  color: #fff;
}

.calendar-runner-post small,
.calendar-runner-odds small,
.calendar-runner-person small {
  color: var(--muted);
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.calendar-runner-post small {
  color: rgb(255 255 255 / 0.68);
}

.calendar-detail .calendar-runner-post strong {
  margin: 2px 0 0;
  color: #fff;
  font-size: 1rem;
}

.calendar-runner-horse,
.calendar-runner-person,
.calendar-runner-odds {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.calendar-detail .calendar-runner-horse strong,
.calendar-detail .calendar-runner-person strong,
.calendar-detail .calendar-runner-odds strong {
  overflow: hidden;
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-runner-horse small {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 650;
}

.calendar-runner-odds {
  justify-items: end;
}

.calendar-runner-row.is-scratched .calendar-runner-post {
  background: #8e918b;
}

.calendar-runner-row.is-scratched .calendar-runner-horse strong {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.calendar-runner-row.is-scratched .calendar-runner-odds strong {
  border-radius: 999px;
  background: #f1e3d7;
  color: #94501f;
  padding: 3px 7px;
}

.calendar-scratch-badge {
  cursor: help;
}

.calendar-scratch-badge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.calendar-detail .calendar-race-card-foot {
  border-top: 0;
  background: var(--panel);
  padding: 12px 20px;
}

.calendar-day-entries-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.calendar-day-entries-link p {
  margin: 0;
}

.calendar-note,
.calendar-detail {
  border-color: var(--line);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: none;
}

.calendar-note {
  max-width: none;
  color: var(--ink);
}

.calendar-note strong,
.calendar-detail strong {
  color: var(--ink);
}

.calendar-note p,
.calendar-detail p,
.calendar-source {
  color: var(--muted);
}

.calendar-verified span,
.calendar-update-link,
.calendar-detail em {
  border-color: var(--line);
  background: #fff;
  color: var(--stable);
}

.calendar-verified span:last-child {
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
}

.calendar-grid {
  margin-top: 16px;
  grid-template-columns: minmax(0, 1fr);
}

body[data-active-view="calendar"] .calendar-month {
  min-height: 0;
  border-color: var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
  padding: 16px;
}

.calendar-month .section-head {
  margin-bottom: 6px;
}

.calendar-month .eyebrow {
  margin-bottom: 0;
  font-size: 0.82rem;
}

.calendar-month h3 {
  display: none;
}

.calendar-legend {
  gap: 6px;
  margin: 6px 0 9px;
}

.calendar-legend-item {
  border-color: var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 3px 7px;
}

.calendar-legend-item:hover,
.calendar-legend-item:focus-visible,
.calendar-legend-item.is-active {
  border-color: rgb(172 89 24 / 0.42);
  background: #fff;
  color: var(--ink);
}

.calendar-legend i {
  width: 20px;
  height: 20px;
}

.calendar-weekdays span {
  color: var(--muted);
}

.calendar-day {
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
}

.calendar-day:hover,
.calendar-day.is-selected {
  border-color: var(--stable);
  background: var(--stable-soft);
}

.calendar-day.is-race-day {
  border-color: #d7b68f;
  background: #fbf3e8;
  color: var(--ink);
}

.calendar-day.is-highlight {
  border-color: var(--brass);
  background: var(--brass-soft);
  color: var(--ink);
}

.calendar-day-status {
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
}

.calendar-day-icon {
  border-color: var(--line);
  background: #fff;
  color: var(--stable);
}

.calendar-source a {
  color: var(--stable);
}

/* Notes */

.whiteboard-page {
  min-height: 0;
  padding: 4px;
}

.whiteboard-shell {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 18px;
  overflow: hidden;
  border: 8px solid #707b75;
  outline: 1px solid #3f4a44;
  border-radius: 13px;
  background: #fcfefb;
  box-shadow:
    0 16px 36px rgb(21 42 32 / 0.13),
    inset 0 0 28px rgb(47 84 68 / 0.055);
  padding: 22px 24px 0;
}

.whiteboard-shell::before,
.whiteboard-shell::after,
.whiteboard-field::before,
.whiteboard-field::after {
  display: none;
}

.whiteboard-toolbar {
  grid-column: 1 / -1;
  border-bottom: 1px dashed #bfcac4;
  padding-bottom: 13px;
}

.whiteboard-toolbar h2 {
  color: #123b2b;
  font-family: "Segoe Print", "Bradley Hand ITC", "Marker Felt", cursive;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  transform: rotate(-0.25deg);
}

.whiteboard-save-state {
  border-color: #b8c8bf;
  background: #eef5f0;
  box-shadow: inset 0 -2px 0 rgb(18 59 43 / 0.08);
  color: var(--stable);
}

.whiteboard-prompts {
  align-self: center;
}

.whiteboard-prompts button {
  min-height: 38px;
  border: 1px solid #bdc9c2;
  border-radius: 7px;
  background: #fff;
  color: var(--stable);
  box-shadow: inset 0 -3px 0 #2e7b55, 0 3px 8px rgb(21 42 32 / 0.06);
}

.whiteboard-prompts button:nth-child(2) {
  box-shadow: inset 0 -3px 0 #b26422, 0 3px 8px rgb(21 42 32 / 0.06);
}

.whiteboard-prompts button:nth-child(3) {
  box-shadow: inset 0 -3px 0 #315f7d, 0 3px 8px rgb(21 42 32 / 0.06);
}

.whiteboard-prompts button:nth-child(4) {
  box-shadow: inset 0 -3px 0 #5c526f, 0 3px 8px rgb(21 42 32 / 0.06);
}

.whiteboard-prompts button:nth-child(5) {
  box-shadow: inset 0 -3px 0 #8a6a26, 0 3px 8px rgb(21 42 32 / 0.06);
}

.whiteboard-prompts button:hover,
.whiteboard-prompts button:focus-visible {
  border-color: var(--stable);
  background: var(--stable-soft);
}

.whiteboard-actions {
  align-self: center;
  margin-top: 0;
}

.whiteboard-actions button {
  min-height: 38px;
  border-color: #bdc9c2;
  background: #fff;
  box-shadow: 0 3px 8px rgb(21 42 32 / 0.06);
}

.whiteboard-field {
  grid-column: 1 / -1;
}

.whiteboard-field .field-label {
  color: #355b4d;
  font-family: "Segoe Print", "Bradley Hand ITC", "Marker Felt", cursive;
  font-size: 0.84rem;
  letter-spacing: 0.01em;
  text-transform: none;
}

.whiteboard-field textarea {
  min-height: 520px;
  border: 0;
  border-top: 1px solid #d8e0db;
  border-radius: 0;
  background: transparent;
  color: #173f34;
  box-shadow: inset 0 10px 18px rgb(47 84 68 / 0.025);
  font-family: "Segoe Print", "Bradley Hand ITC", "Marker Felt", cursive;
  font-size: 1.14rem;
  line-height: 1.75;
  padding: 20px 18px;
  text-shadow: 0.02em 0.01em 0 rgb(18 59 43 / 0.1);
}

.whiteboard-field textarea::placeholder {
  color: rgb(38 92 73 / 0.64);
  font-family: "Segoe Print", "Bradley Hand ITC", "Marker Felt", cursive;
  font-size: 1.2rem;
  font-style: normal;
}

.whiteboard-field textarea:focus {
  background: rgb(229 238 232 / 0.32);
  box-shadow:
    0 0 0 3px rgb(18 59 43 / 0.09),
    inset 0 10px 18px rgb(47 84 68 / 0.025);
}

.marker-tray {
  grid-column: 1 / -1;
  display: flex;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 4px -24px 0;
  border-top: 4px solid #68736d;
  border-radius: 0;
  background: #d7ddd9;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / 0.7);
  padding: 0 20px;
}

.marker-tray span {
  width: 88px;
  max-width: 25%;
  height: 9px;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgb(23 35 30 / 0.24);
}

.marker-tray span:nth-child(1) {
  background: #174e3a;
}

.marker-tray span:nth-child(2) {
  background: #b05d1d;
}

.marker-tray span:nth-child(3) {
  background: #2e4d68;
}

/* Requests */

.request-page {
  overflow: hidden;
  padding: 0;
}

.request-page > .section-head {
  border-bottom: 1px solid var(--line);
  padding: 19px 20px;
}

.sticky-workspace {
  gap: 0;
}

.sticky-pile {
  border-right: 1px solid var(--line);
  background: #f7f5ed;
  padding: 20px;
}

.request-form {
  border-color: var(--line);
  background: #fff;
  box-shadow: none;
}

.request-form::before {
  display: none;
}

.request-board {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: none;
}

.request-board::before {
  display: none;
}

.request-board-head {
  position: relative;
  z-index: 1;
  color: var(--ink);
}

.request-board-head p {
  color: var(--muted);
}

.request-board-head span {
  background: var(--stable-soft);
  color: var(--stable);
}

.request-board-head .info-tip.inverse {
  border-color: var(--line);
  background: #fff;
  color: var(--stable);
}

.sticky-canvas {
  min-height: max(680px, 72vh);
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: #fff;
  box-shadow: none;
}

body[data-active-view="requests"] .sticky-canvas {
  background: #fff;
}

.sticky-canvas.is-drag-over {
  border-color: var(--stable);
  background: var(--stable-soft);
  box-shadow: inset 0 0 0 2px rgb(18 79 57 / 0.12);
}

.pile-stack span {
  border-color: #d9c982;
  background: #fff3b5;
  box-shadow: 0 6px 12px rgb(45 36 5 / 0.1);
}

.sticky-note,
.sticky-empty {
  border-color: #ddcf8b;
  background: #fff7cc;
  box-shadow: 0 6px 14px rgb(45 36 5 / 0.1);
}

.sticky-note.board-sticky {
  animation: none;
  backface-visibility: hidden;
  contain: layout style;
  transform-origin: 0 0;
  transition: box-shadow 140ms ease, opacity 140ms ease;
}

.sticky-note.board-sticky,
.sticky-note.board-sticky:hover,
.sticky-note.board-sticky:focus-within {
  transform: translate3d(var(--note-x, 24px), var(--note-y, 24px), 0) rotate(var(--note-rotate, 0deg));
}

.sticky-note.board-sticky.is-lifting,
.sticky-note.board-sticky.is-lifting:hover,
.sticky-note.board-sticky.is-lifting:focus-within {
  cursor: grabbing;
  opacity: 1;
  filter: none;
  pointer-events: auto;
  user-select: none;
  animation: none;
  transition: none;
  transform: translate3d(var(--note-x, 24px), var(--note-y, 24px), 0) rotate(var(--note-rotate, 0deg));
  box-shadow: 0 20px 36px rgb(23 35 30 / 0.2);
}

.sticky-note::before,
.sticky-note::after {
  display: none;
}

.sticky-note.is-resolved {
  border-color: var(--line);
  background: var(--panel);
}

.request-board-tip {
  color: var(--muted);
}

.resolved-strip {
  position: relative;
  z-index: 1;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: none;
}

body[data-active-view="requests"] .resolved-strip {
  background: var(--surface);
}

.resolved-strip .request-board-head,
.resolved-strip .request-board-head h3 {
  border: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.resolved-strip .request-board-head span {
  background: var(--stable-soft);
  color: var(--stable);
}

.resolved-strip .info-tip.inverse {
  border-color: var(--line);
  background: #fff;
  color: var(--stable);
  box-shadow: none;
}

/* Settings and legal */

.legal-panel {
  padding: 20px;
}

.settings-status-grid,
.settings-grid,
.legal-grid {
  gap: 12px;
}

.settings-status-card,
.settings-card,
.legal-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: none;
}

.settings-status-card::after,
.settings-card::after {
  display: none;
}

.settings-divider::before,
.settings-divider::after {
  background: var(--line);
}

.legal-body {
  background: var(--bg);
}

.legal-shell {
  width: min(100% - 36px, 980px);
  padding: 28px 0 48px;
}

.legal-hero {
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: var(--radius-lg);
  background: var(--stable);
  color: #fff;
  box-shadow: var(--soft-shadow);
  padding: clamp(24px, 5vw, 48px);
}

.legal-hero h1 {
  max-width: 17ch;
  color: #fff;
  font-family: var(--font-brand);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1;
}

.legal-hero p:not(.eyebrow) {
  color: rgb(255 255 255 / 0.72);
}

.legal-hero .secondary-link {
  color: #fff;
}

.legal-index {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: none;
}

.legal-index a {
  color: var(--stable);
}

.legal-doc-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: none;
}

.legal-doc-card > span {
  background: var(--stable);
  color: #fff;
}

.legal-data-table {
  border-color: var(--line);
  background: #fff;
}

.legal-data-table th,
.legal-data-table td {
  border-color: var(--line);
}

.legal-data-table th {
  background: var(--stable-soft);
  color: var(--stable-deep);
}

.toast {
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 9px;
  background: var(--stable-deep);
  color: #fff;
  box-shadow: 0 12px 30px rgb(0 0 0 / 0.2);
}

.mobile-tabbar {
  display: none;
}

@media (min-width: 1500px) {
  .app-shell {
    grid-template-columns: 244px minmax(0, 1fr);
  }

  .sidebar {
    width: 244px;
    padding-inline: 18px;
  }

  .workspace {
    padding-top: 26px;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .sidebar {
    width: 210px;
  }

  .control-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .select-wrap:nth-child(2) {
    border-right: 0;
  }

  .select-wrap:nth-child(3) {
    border-top: 1px solid var(--line);
  }

  .context-cap {
    border-top: 1px solid var(--line);
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contender-panel,
  .factor-panel,
  .discipline-panel,
  .checklist-panel,
  .timeline-panel {
    grid-column: auto;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .contender-panel {
    grid-column: 1 / -1;
  }

  .factor-panel,
  .checklist-panel {
    border-right: 1px solid var(--line);
  }

  .discipline-panel,
  .timeline-panel {
    border-right: 0;
  }

  .checklist-panel,
  .timeline-panel {
    border-bottom: 0;
  }

  .summary-grid.compact-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .compact-summary .metric-panel:nth-child(4) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .compact-summary .metric-panel:nth-child(5) {
    border-top: 1px solid var(--line);
  }

  .setup-body {
    grid-template-columns: 1fr;
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  body {
    font-size: 14px;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-media,
  .login-media picture,
  .login-media img {
    height: 32svh;
    min-height: 280px;
    max-height: 360px;
  }

  .login-media img {
    object-position: 64% 46%;
  }

  .login-copy {
    right: 24px;
    bottom: 26px;
    left: 24px;
  }

  .login-copy h1 {
    max-width: 15ch;
    font-size: clamp(2.15rem, 9vw, 3.2rem);
    line-height: 1;
  }

  .login-subcopy {
    display: none;
  }

  .login-panel {
    min-height: 68svh;
    align-content: start;
    gap: 20px;
    padding: 24px max(20px, env(safe-area-inset-left)) calc(26px + env(safe-area-inset-bottom));
  }

  .login-panel > .brand-lockup {
    display: none;
  }

  .auth-card {
    width: min(100%, 520px);
    justify-self: center;
  }

  .legal-login-link {
    justify-self: center;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 35;
    display: grid;
    width: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    border-right: 0;
    border-bottom: 1px solid rgb(255 255 255 / 0.1);
    padding: 10px 12px;
  }

  .sidebar::before {
    display: none;
  }

  .sidebar .brand-lockup.compact {
    min-width: 0;
    gap: 9px;
    border-bottom: 0;
    padding: 0;
  }

  .sidebar .brand-lockup .brand-mark,
  .sidebar .brand-lockup .brand-logo {
    width: 31px;
    height: 29px;
  }

  .sidebar .brand-lockup .wordmark {
    font-size: 1.05rem;
  }

  .track-picker {
    margin-top: 4px;
  }

  .track-picker > span {
    display: none;
  }

  .track-select-button {
    width: min(148px, 46vw);
    min-height: 34px;
  }

  .nav-list {
    display: none;
  }

  .sidebar-actions {
    grid-template-columns: auto 40px;
    margin-top: 0;
  }

  .sidebar .ghost-btn {
    width: 42px;
    min-height: 40px;
    padding: 0;
  }

  .sidebar .ghost-btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .settings-btn {
    width: 40px;
    min-height: 40px;
  }

  .settings-menu {
    position: relative;
  }

  .settings-popover {
    width: min(220px, calc(100vw - 24px));
    max-width: none;
  }

  .workspace {
    grid-column: auto;
    width: 100%;
    padding: 12px 12px calc(82px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 0;
    border-radius: 11px;
    padding: 15px 16px;
  }

  .topbar::after {
    width: 120px;
  }

  .topbar h1,
  .topbar-title-row h1 {
    font-size: 1.3rem;
  }

  .control-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 9px 0 12px;
  }

  .select-wrap {
    border-top: 0;
    padding: 9px;
  }

  .select-wrap:first-child {
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .select-wrap:nth-child(2) {
    border-right: 1px solid var(--line);
  }

  .select-wrap:nth-child(3) {
    border-top: 0;
    border-right: 0;
  }

  .context-cap {
    grid-column: 1 / -1;
    grid-template-columns: 1fr auto;
    border-top: 1px solid var(--line);
    border-radius: 0 0 10px 10px !important;
    padding: 10px 12px;
  }

  .context-cap strong {
    grid-row: 1 / span 2;
    grid-column: 2;
  }

  .dashboard-board {
    gap: 12px;
  }

  .setup-summary {
    grid-template-columns: 34px minmax(0, 1fr);
    min-height: 66px;
    padding: 10px 12px;
  }

  .setup-summary-mark {
    width: 32px;
    height: 32px;
  }

  .setup-summary small {
    display: none;
  }

  .setup-summary-action {
    grid-column: 2;
    width: fit-content;
    margin-top: -3px;
  }

  .setup-body {
    gap: 16px;
    padding: 16px;
  }

  .setup-form {
    grid-template-columns: 1fr;
  }

  .dashboard-hero {
    grid-template-columns: minmax(0, 1fr) 108px;
    min-height: 150px;
    gap: 14px;
    padding: 18px;
  }

  .dashboard-hero h2 {
    font-size: clamp(2rem, 9vw, 2.65rem);
  }

  .dashboard-signal-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .dashboard-signal-row span {
    flex: 0 0 auto;
  }

  .score-dial {
    width: 108px;
    min-width: 108px;
    min-height: 116px;
    padding: 12px;
  }

  .score-dial strong {
    font-size: 3.3rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .contender-panel,
  .factor-panel,
  .discipline-panel,
  .checklist-panel,
  .timeline-panel {
    grid-column: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .timeline-panel {
    border-bottom: 0;
  }

  .summary-grid.compact-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-summary .metric-panel,
  .compact-summary .metric-panel:nth-child(4),
  .compact-summary .metric-panel:nth-child(5) {
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }

  .compact-summary .metric-panel:nth-child(-n+2) {
    border-top: 0;
  }

  .compact-summary .metric-panel:nth-child(odd) {
    border-left: 0;
  }

  .compact-summary .metric-panel:last-child {
    grid-column: 1 / -1;
  }

  .race-slip-panel > .section-head,
  .bankroll-head,
  .calendar-panel > .section-head,
  .request-page > .section-head {
    padding: 15px 16px;
  }

  .race-slip-panel > .section-head {
    min-height: 0;
  }

  .race-slip-panel .horse-form,
  .race-ticket-stack > .section-head {
    padding: 15px;
  }

  .horse-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .horse-form .wide {
    grid-column: 1 / -1;
  }

  .rankings-board-panel > .section-head {
    padding: 15px 16px;
  }

  .horse-card {
    grid-template-columns: 52px minmax(0, 1fr);
    padding: 15px;
  }

  .horse-scoreboard {
    grid-column: 1 / -1;
    width: fit-content;
  }

  .horse-actions {
    grid-column: 1 / -1;
  }

  .whiteboard-shell {
    grid-template-columns: 1fr;
    gap: 12px;
    border-width: 6px;
    padding: 15px 14px 0;
  }

  .whiteboard-prompts,
  .whiteboard-actions {
    grid-column: 1;
  }

  .whiteboard-actions {
    justify-content: flex-start;
  }

  .whiteboard-toolbar h2 {
    font-size: 1.6rem;
  }

  .whiteboard-field textarea {
    min-height: 430px;
    padding: 17px 12px;
  }

  .marker-tray {
    margin-right: -14px;
    margin-left: -14px;
  }

  .sticky-workspace {
    grid-template-columns: 1fr;
  }

  .sticky-pile {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 16px;
  }

  .request-board {
    min-width: 0;
  }

  .settings-status-grid,
  .settings-grid,
  .legal-grid {
    grid-template-columns: 1fr;
  }

  .mobile-tabbar {
    position: fixed;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    z-index: 50;
    display: grid;
    grid-auto-columns: minmax(62px, 1fr);
    grid-auto-flow: column;
    grid-template-columns: none;
    gap: 3px;
    overflow-x: auto;
    border: 1px solid rgb(255 255 255 / 0.12);
    border-radius: 13px;
    background: var(--stable-deep);
    box-shadow: 0 12px 30px rgb(0 0 0 / 0.25);
    padding: 5px;
    scrollbar-width: none;
  }

  .mobile-tabbar::-webkit-scrollbar {
    display: none;
  }

  .mobile-tab {
    display: grid;
    min-height: 51px;
    place-items: center;
    align-content: center;
    gap: 3px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: rgb(255 255 255 / 0.58);
    padding: 5px 7px;
    font-size: 0.62rem;
    font-weight: 750;
    text-decoration: none;
  }

  .mobile-tab svg {
    width: 18px;
    height: 18px;
  }

  .mobile-tab.active {
    border-color: #e2c09d;
    background: #fff;
    color: var(--stable-deep);
  }
}

@media (max-width: 520px) {
  .auth-card {
    padding: 22px;
  }

  .auth-card h2 {
    font-size: 1.75rem;
  }

  .workspace {
    padding-inline: 10px;
  }

  .topbar-title-row {
    grid-template-columns: minmax(0, 1fr) 24px;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .score-dial {
    width: 100%;
    min-height: 86px;
    grid-template-columns: 1fr auto;
    align-items: center;
    justify-items: start;
  }

  .score-dial strong {
    grid-row: 1 / span 2;
    grid-column: 2;
    font-size: 3.1rem;
  }

  .score-dial em {
    text-align: left;
  }

  .dashboard-panel {
    padding: 16px;
  }

  .horse-form {
    grid-template-columns: 1fr;
  }

  .horse-form .wide {
    grid-column: auto;
  }

  .section-head,
  .race-slip-panel > .section-head,
  .bankroll-head {
    display: grid;
  }

  .calendar-toolbar,
  .calendar-summary,
  .calendar-grid,
  .calendar-detail,
  .calendar-source {
    margin-right: 14px;
    margin-left: 14px;
  }

  .calendar-panel > .section-head {
    padding: 16px;
  }

  .calendar-month {
    overflow-x: auto;
  }

  .calendar-weekdays,
  .calendar-days {
    min-width: 320px;
  }

  .calendar-detail-header,
  .calendar-race-card-head {
    display: grid;
    align-items: start;
  }

  .calendar-detail-header {
    min-height: 0;
    padding: 16px;
  }

  .calendar-detail-actions {
    width: 100%;
    justify-content: space-between;
  }

  .calendar-card-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-card-facts > span {
    min-height: 62px;
    padding: 9px 14px;
  }

  .calendar-card-facts > span:nth-child(2) {
    border-right: 0;
  }

  .calendar-card-facts > span:last-child {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  .calendar-race-card-head {
    grid-template-columns: 1fr;
    padding: 12px 14px;
  }

  .calendar-race-card-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .calendar-race-list {
    grid-template-columns: 1fr;
  }

  .calendar-race-row,
  .calendar-race-row:nth-child(even) {
    border-right: 0;
  }

  .calendar-race-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    min-height: 72px;
    padding: 9px 12px;
  }

  .calendar-detail .calendar-race-number {
    width: 40px;
    height: 46px;
  }

  .calendar-detail .calendar-race-copy strong {
    white-space: normal;
  }

  .calendar-race-field-summary {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 11px;
    padding: 13px 14px;
  }

  .calendar-field-race-number {
    width: 46px;
    height: 52px;
  }

  .calendar-field-count {
    grid-column: 1 / -1;
    grid-template-columns: auto auto 1fr;
    align-items: baseline;
    justify-items: start;
    gap: 5px;
    border-top: 1px solid var(--line);
    padding-top: 9px;
  }

  .calendar-field-count small {
    justify-self: end;
  }

  .calendar-bet-plan-head {
    align-items: flex-start;
    padding: 11px 14px;
  }

  .calendar-bet-plan-grid {
    grid-template-columns: 1fr;
  }

  .calendar-bet-plan-grid > div {
    border-right: 0;
    border-bottom: 1px solid #eadfce;
    padding: 12px 14px;
  }

  .calendar-bet-plan-grid > div:last-child {
    border-bottom: 0;
  }

  .calendar-detail .calendar-bet-plan-foot {
    padding: 9px 14px;
  }

  .calendar-runner-columns {
    display: none;
  }

  .calendar-runner-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: start;
    gap: 7px 10px;
    min-height: 0;
    padding: 11px 12px;
  }

  .calendar-runner-post {
    grid-row: 1 / span 4;
  }

  .calendar-runner-horse {
    grid-column: 2;
  }

  .calendar-runner-person {
    grid-column: 2 / -1;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: baseline;
    gap: 6px;
  }

  .calendar-runner-odds {
    grid-row: 1;
    grid-column: 3;
  }

  .calendar-detail .calendar-runner-person strong {
    white-space: normal;
  }

  .calendar-detail .calendar-race-card-foot {
    padding: 11px 14px;
  }

  .legal-shell {
    width: min(100% - 20px, 980px);
    padding-top: 10px;
  }

  .legal-doc-card {
    grid-template-columns: 1fr;
  }

  .legal-data-table {
    display: block;
    overflow-x: auto;
  }
}

/*
 * Mobile audit follow-up
 * Keep the phone experience touch-first instead of compressing desktop
 * interactions into a narrow viewport.
 */
@media (max-width: 820px) {
  html {
    scroll-padding-top: 78px;
  }

  body {
    overflow-x: clip;
  }

  input,
  select,
  textarea,
  .custom-select-trigger {
    font-size: 16px;
  }

  .sidebar {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .track-menu {
    width: 100%;
    min-width: 0;
  }

  .workspace {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .horse-form,
  .calendar-detail,
  .calendar-race-field {
    scroll-margin-top: 82px;
  }

  .section-actions {
    max-width: 100%;
  }

  .mobile-tabbar {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-columns: auto;
    grid-auto-flow: row;
    overflow: visible;
  }

  .mobile-tab {
    min-width: 0;
    min-height: 52px;
    padding-inline: 3px;
  }

  .mobile-tab span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .toast {
    right: 12px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 12px;
    max-width: none;
    text-align: center;
  }

  .calendar-day-icon.info-tip {
    display: grid;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--stable);
    font-size: initial;
  }

  .calendar-day-icon.info-tip::before {
    inset: -9px;
  }

  .calendar-day-icon.info-tip::after {
    display: none;
  }

  .calendar-day-icon.info-tip svg {
    width: 14px;
    height: 14px;
  }

  .calendar-wager-slip {
    width: calc(100% - 24px);
    margin: 14px auto 16px;
  }

  .wager-slip-columns,
  .wager-slip-line {
    grid-template-columns: 38px 96px minmax(0, 1fr) 76px;
    gap: 8px;
  }

  .pile-stack,
  .request-board-tip {
    display: none;
  }

  .sticky-pile {
    position: static;
  }

  .sticky-canvas {
    display: grid;
    min-height: 0;
    gap: 12px;
    overflow: visible;
    padding: 12px;
  }

  .sticky-note.board-sticky,
  .sticky-note.board-sticky:hover,
  .sticky-note.board-sticky:focus-within,
  .sticky-note.board-sticky.is-lifting {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    max-width: none;
    cursor: default;
    contain: none;
    touch-action: pan-y;
    transform: none;
  }

  .sticky-empty.board-empty {
    position: static;
  }

  .mobile-move-btn {
    display: none;
  }

  .sticky-delete-btn {
    width: 40px;
    height: 40px;
  }

  .resolved-notes {
    scroll-snap-type: x proximity;
  }

  .resolved-note {
    scroll-snap-align: start;
  }
}

@media (max-width: 520px) {
  .login-media,
  .login-media picture,
  .login-media img {
    height: 28svh;
    min-height: 190px;
    max-height: 240px;
  }

  .login-panel {
    min-height: 72svh;
    padding: 20px max(16px, env(safe-area-inset-right)) calc(22px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .login-copy {
    right: 18px;
    bottom: 20px;
    left: 18px;
  }

  .login-copy h1 {
    max-width: 13ch;
    font-size: clamp(1.9rem, 10vw, 2.65rem);
  }

  .auth-card {
    padding: 20px;
  }

  .workspace {
    padding-top: 9px;
    padding-right: max(8px, env(safe-area-inset-right));
    padding-left: max(8px, env(safe-area-inset-left));
  }

  .topbar {
    padding: 14px;
  }

  .control-row {
    grid-template-columns: 1fr;
  }

  .select-wrap:first-child,
  .select-wrap:nth-child(2),
  .select-wrap:nth-child(3) {
    grid-column: 1;
    border-top: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .context-cap {
    grid-column: 1;
    border-top: 0;
  }

  .custom-select-trigger {
    min-height: 46px;
  }

  .dashboard-signal-row {
    flex-wrap: wrap;
    overflow: visible;
  }

  .section-head,
  .section-actions {
    width: 100%;
  }

  .section-actions {
    display: grid;
    justify-content: stretch;
  }

  .section-actions > *,
  .section-actions .action-with-help,
  .section-actions .secondary-btn,
  .section-actions .secondary-link {
    width: 100%;
  }

  .section-actions .action-with-help {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .race-slip-meta {
    gap: 5px;
    padding: 8px 12px;
  }

  .race-slip-meta span {
    padding: 4px 7px;
    font-size: 0.66rem;
  }

  .horse-form-actions,
  .race-entry-actions,
  .horse-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .horse-form-actions button,
  .race-entry-actions button,
  .horse-actions button {
    width: 100%;
    min-width: 0;
  }

  .ranking-toolbar,
  .rankings-board-panel .ranking-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ranking-sort {
    width: 100%;
  }

  .calendar-toolbar,
  .calendar-summary,
  .calendar-grid,
  .calendar-detail,
  .calendar-source {
    margin-right: 8px;
    margin-left: 8px;
  }

  .calendar-panel > .section-head {
    padding: 14px;
  }

  .calendar-toolbar {
    gap: 8px;
  }

  .calendar-month {
    overflow: visible;
    padding: 10px;
  }

  .calendar-weekdays,
  .calendar-days {
    min-width: 0;
    gap: 3px;
  }

  .calendar-weekdays span {
    font-size: 0.62rem;
  }

  .calendar-day {
    min-width: 0;
    min-height: 56px;
    gap: 3px;
    padding: 5px 3px;
  }

  .calendar-day strong {
    font-size: 0.86rem;
  }

  .calendar-day-status,
  .calendar-day-event {
    display: none;
  }

  .calendar-day-icon.info-tip {
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
  }

  .calendar-day-icon.info-tip svg {
    width: 12px;
    height: 12px;
  }

  .calendar-detail-header,
  .calendar-detail-actions,
  .calendar-race-card-head,
  .calendar-race-card-actions {
    display: grid;
    width: 100%;
    justify-content: stretch;
  }

  .calendar-detail-actions {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .calendar-detail-actions em {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .calendar-back-button {
    min-height: 44px;
  }

  .calendar-race-card-actions {
    grid-template-columns: repeat(2, minmax(0, auto));
    justify-content: start;
  }

  .calendar-race-card-actions > * {
    min-height: 44px;
    justify-content: center;
  }

  .calendar-bet-plan-head {
    display: grid;
    justify-items: start;
  }

  .calendar-bet-plan-head em {
    white-space: normal;
  }

  .wager-slip-top {
    display: grid;
    align-items: start;
    padding: 10px 14px;
  }

  .wager-slip-top em {
    width: fit-content;
  }

  .wager-slip-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wager-slip-meta > span:nth-child(2) {
    border-right: 0;
  }

  .wager-slip-meta > span:nth-child(-n+2) {
    border-bottom: 1px solid #cbc6ba;
  }

  .wager-slip-columns {
    display: none;
  }

  .wager-slip-line {
    grid-template-columns: 34px minmax(0, 0.62fr) minmax(0, 1.38fr);
    align-items: start;
    gap: 8px 10px;
    padding: 11px 12px;
  }

  .wager-slip-line > span:last-child {
    grid-column: 2 / -1;
    grid-template-columns: auto 1fr;
    align-items: baseline;
  }

  .wager-slip-line > span:last-child strong {
    justify-self: end;
  }

  .wager-slip-total,
  .wager-slip-order,
  .calendar-detail .calendar-wager-slip > p {
    padding-right: 14px;
    padding-left: 14px;
  }

  .wager-slip-order {
    overflow-wrap: anywhere;
  }

  .calendar-race-row {
    min-height: 78px;
  }

  .calendar-race-post {
    align-self: stretch;
    align-content: space-between;
  }

  .calendar-runner-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .calendar-detail .calendar-race-card-foot,
  .calendar-detail .calendar-bet-plan-foot {
    overflow-wrap: anywhere;
  }

  .whiteboard-prompts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .whiteboard-prompts button:last-child {
    grid-column: 1 / -1;
  }

  .whiteboard-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .whiteboard-prompts button,
  .whiteboard-actions button {
    width: 100%;
  }

  .whiteboard-field textarea {
    min-height: min(54svh, 480px);
    line-height: 1.55;
  }

  .request-page > .section-head,
  .sticky-pile,
  .request-board {
    padding-right: 12px;
    padding-left: 12px;
  }

  .request-form {
    padding: 12px;
  }

  .sticky-note.board-sticky {
    padding: 14px;
  }

  .sticky-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .legal-panel {
    padding: 14px;
  }

  .legal-card,
  .settings-card,
  .settings-status-card {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 360px) {
  .sidebar {
    gap: 7px;
    padding-block: 8px;
  }

  .sidebar .brand-lockup.compact {
    gap: 6px;
  }

  .sidebar .brand-lockup .brand-mark,
  .sidebar .brand-lockup .brand-logo {
    width: 28px;
    height: 27px;
  }

  .sidebar .brand-lockup .wordmark {
    font-size: 0.98rem;
  }

  .track-select-button {
    width: min(126px, 43vw);
  }

  .summary-grid.compact-summary {
    grid-template-columns: 1fr;
  }

  .compact-summary .metric-panel,
  .compact-summary .metric-panel:nth-child(-n+2),
  .compact-summary .metric-panel:nth-child(odd) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .compact-summary .metric-panel:first-child {
    border-top: 0;
  }

  .calendar-month {
    overflow-x: auto;
  }

  .calendar-weekdays,
  .calendar-days {
    min-width: 300px;
  }

  .mobile-tabbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .workspace {
    padding-bottom: calc(137px + env(safe-area-inset-bottom));
  }

  .toast {
    bottom: calc(133px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 820px) and (orientation: landscape) {
  .login-media,
  .login-media picture,
  .login-media img {
    height: 42svh;
    min-height: 170px;
    max-height: 220px;
  }

  .login-panel {
    min-height: 58svh;
  }
}

@media (min-width: 821px) and (max-width: 1180px) and (any-pointer: coarse) and (any-hover: none) {
  .pile-stack,
  .request-board-tip {
    display: none;
  }

  .sticky-pile {
    position: static;
  }

  .sticky-canvas {
    display: grid;
    min-height: 0;
    gap: 12px;
    overflow: visible;
    padding: 12px;
  }

  .sticky-note.board-sticky,
  .sticky-note.board-sticky:hover,
  .sticky-note.board-sticky:focus-within,
  .sticky-note.board-sticky.is-lifting {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    max-width: none;
    cursor: default;
    contain: none;
    touch-action: pan-y;
    transform: none;
  }

  .sticky-empty.board-empty {
    position: static;
  }

  .mobile-move-btn {
    display: none;
  }
}

@media (hover: none) {
  .primary-btn:hover,
  .login-submit:hover,
  .calendar-day-icon:hover,
  .calendar-race-row:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
