:root {
  color-scheme: light;
  --ink: #111;
  --muted: #686868;
  --line: #d9d9d6;
  --soft: #f4f4f1;
  --paper: #fff;
  --green: #c91920;
  --green-dark: #99171c;
  --green-bright: #d71920;
  --green-soft: #fff1f1;
  --navy: #050505;
  --sauce: #d9322b;
  --amber: #9a561b;
  --red: #a51f24;
  --canvas: #faf9f6;
  --canvas-top: #faf9f6;
  --panel: transparent;
  --panel-solid: #fff;
  --subtle: #f6f6f3;
  --table-head: #f3f3f0;
  --row-hover: #fafafa;
  --field: #fff;
  --code-bg: #ededeb;
  --nav-surface: rgba(255,255,253,.97);
  --nav-border: #d7d7d4;
  --secondary-text: #555;
  --secondary-heading: #252525;
  --hairline: #e7e7e4;
  --quiet: #7a7a78;
  --panel-hover: #fafafa;
  --input-border: #b9b9b6;
  --radius: 4px;
  --shadow: none;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f5f5f2;
  --muted: #aaa;
  --line: #343434;
  --soft: #222;
  --paper: #171717;
  --green: #ff4f55;
  --green-dark: #ff7378;
  --green-bright: #e3262e;
  --green-soft: #2a1718;
  --navy: #050505;
  --sauce: #ff675c;
  --amber: #d9a36a;
  --red: #ff9a91;
  --canvas: #111;
  --canvas-top: #111;
  --panel: rgba(23,23,23,.97);
  --panel-solid: #171717;
  --subtle: #1d1d1d;
  --table-head: #202020;
  --row-hover: #242424;
  --field: #151515;
  --code-bg: #292929;
  --nav-surface: rgba(17,17,17,.97);
  --nav-border: #363636;
  --secondary-text: #b5b5b5;
  --secondary-heading: #e6e6e3;
  --hairline: #2a2a2a;
  --quiet: #929292;
  --panel-hover: #202020;
  --input-border: #555;
  --shadow: 0 1px 2px rgba(0,0,0,.22), 0 14px 38px rgba(0,0,0,.2);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
body::before { position: fixed; z-index: -1; inset: 0; content: ""; background: var(--canvas); }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .4rem; font-size: clamp(1.75rem, 4vw, 2.45rem); line-height: 1.05; letter-spacing: -.03em; }
h2 { margin-bottom: .25rem; font-size: 1.08rem; }
p { color: var(--muted); line-height: 1.55; }
small { color: var(--muted); font-weight: 400; }
code { padding: .12rem .35rem; border-radius: 4px; background: var(--code-bg); }

.site-header { position: sticky; top: 0; z-index: 10; min-height: 64px; padding: 0 clamp(1rem, 3vw, 2.5rem); display: flex; align-items: center; gap: 1.35rem; background: #050505; color: #fff; border-bottom: 1px solid #202020; box-shadow: 0 4px 18px rgba(0,0,0,.12); }
.brand { display: inline-flex; align-items: center; gap: .5rem; color: #fff; font-size: 1.02rem; font-weight: 850; letter-spacing: .045em; text-transform: uppercase; white-space: nowrap; }
.brand-icon { display: block; width: 34px; height: 34px; flex: 0 0 34px; object-fit: contain; }
.site-header nav { display: flex; align-items: stretch; gap: .1rem; overflow-x: auto; }
.site-header nav a { position: relative; color: #bdbdbd; padding: 1.4rem .68rem 1.25rem; font-size: .82rem; font-weight: 650; white-space: nowrap; }
.site-header nav a:hover { color: #fff; text-decoration: none; }
.site-header nav a.active { color: #fff; }
.site-header nav a.active::after { position: absolute; right: -.7rem; bottom: -.15rem; left: -.7rem; height: 28px; background: url("/static/sauce-drip-line.png") center / 100% 100% no-repeat; content: ""; }
.private-state { display: inline-flex; align-items: center; gap: .35rem; margin-left: auto; color: #bdbdbd; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.private-state > span { width: 7px; height: 7px; border-radius: 50%; background: var(--sauce); box-shadow: 0 0 0 4px rgba(215,25,32,.14); }
.logout-form { margin-left: 0; }
.site-header .button-quiet { color: #ddd; border-color: #494949; }
.theme-control { display: flex; grid-template-columns: none; align-items: center; gap: .4rem; color: #bdbdbd; font-size: .68rem; font-weight: 700; }
.theme-control select { width: auto; min-height: 34px; padding: .35rem 1.7rem .35rem .55rem; border-color: #494949; border-radius: 7px; background: #111; color: #f5f5f5; font-size: .72rem; cursor: pointer; }
.section-nav { position: sticky; top: 64px; z-index: 9; overflow-x: auto; border-bottom: 1px solid var(--nav-border); background: var(--nav-surface); box-shadow: 0 5px 18px rgba(0,0,0,.04); backdrop-filter: blur(12px); }
.section-nav > div { width: min(1500px, 100%); min-width: max-content; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2.5rem); display: flex; align-items: center; gap: .15rem; }
.section-nav a { position: relative; padding: .72rem .68rem; color: var(--secondary-text); font-size: .75rem; font-weight: 700; }
.section-nav a:hover { color: var(--ink); text-decoration: none; background: var(--soft); }
.section-nav a.active { color: var(--green-dark); }
.section-nav a.active::after { position: absolute; right: .65rem; bottom: 0; left: .65rem; height: 2px; border-radius: 2px; background: var(--green); content: ""; }
.section-nav-label { margin-right: .45rem; padding-right: .8rem; border-right: 1px solid var(--line); color: var(--secondary-heading); font-size: .68rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }

.page { width: min(1500px, 100%); margin: 0 auto; padding: clamp(1.35rem, 3vw, 2.5rem); flex: 1; }
.page-centered { width: min(1060px, 100%); display: grid; place-items: center; }
.site-footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 3vw, 2.5rem); color: var(--quiet); font-size: .74rem; border-top: 1px solid var(--line); }
.eyebrow { color: var(--green); font-size: .69rem; line-height: 1.5; font-weight: 850; letter-spacing: .14em; }
.muted { color: var(--muted); }
.heading-meta { color: var(--quiet); font-weight: 400; }

.racing-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr); align-items: center; gap: clamp(1.5rem, 4vw, 4rem); overflow: hidden; margin-bottom: 1rem; padding: clamp(1.6rem, 4vw, 3rem) 1rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); }
.racing-hero::after { display: none; }
.racing-hero .eyebrow { color: var(--muted); }
.racing-hero h1 { max-width: 720px; margin-top: .35rem; font-size: clamp(2rem, 5vw, 3.6rem); letter-spacing: -.055em; }
.racing-hero > div > p { max-width: 760px; margin: .75rem 0 0; color: var(--secondary-heading); font-size: .98rem; }
.hero-search { position: relative; z-index: 1; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-solid); }
.hero-search label { margin-bottom: .45rem; color: var(--secondary-heading); font-size: .74rem; }
.hero-search > div { display: flex; gap: .45rem; }
.hero-search input { min-width: 0; border-color: transparent; }
.hero-search small { display: block; margin-top: .55rem; color: var(--muted); font-size: .69rem; line-height: 1.4; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.page-heading p { margin-bottom: 0; }
.button-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 41px; padding: .62rem .95rem; border: 1px solid var(--green); border-radius: 4px; background: var(--green); color: #fff; font: inherit; font-size: .82rem; font-weight: 750; cursor: pointer; }
.button:hover { background: var(--green-dark); color: #fff; text-decoration: none; }
.button-secondary { color: var(--green-dark); background: var(--panel-solid); border-color: var(--input-border); box-shadow: none; }
.button-small { min-height: 34px; padding: .4rem .65rem; font-size: .74rem; }
.button-secondary:hover { color: var(--green-dark); background: var(--soft); }
.button-quiet { background: transparent; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.metrics-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.racing-metrics .metric strong { font-variant-numeric: tabular-nums; }
.metric { position: relative; display: flex; flex-direction: column; gap: .45rem; overflow: hidden; padding: 1rem; background: var(--panel); border: 0; border-top: 1px solid var(--line); border-radius: 0; color: var(--ink); }
.metric::before { display: none; }
.metric:hover { text-decoration: none; border-color: var(--input-border); }
.metric span { color: var(--muted); font-size: .78rem; }
.metric strong { font-size: 1.65rem; letter-spacing: -.03em; }
.panel { margin-bottom: 1rem; padding: 1.15rem 0; background: var(--panel); border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: .9rem; }
.panel-heading p { margin-bottom: 0; font-size: .83rem; }
.panel-heading.padded { padding: 1.15rem 1.15rem 0; }
.panel-flush .panel-heading { margin-bottom: .75rem; }
.racing-workspace-grid { display: grid; grid-template-columns: minmax(0, 2.25fr) minmax(280px, .75fr); gap: 1rem; align-items: start; }
.racing-side-stack { display: grid; gap: 1rem; }
.racing-side-stack .panel { margin: 0; }
.identity-rate { display: block; margin: .1rem 0 .5rem; font-size: 2.7rem; line-height: 1; letter-spacing: -.06em; }
.identity-card progress { width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; background: #e4e4e1; appearance: none; }
.identity-card progress::-webkit-progress-bar { background: #e4e4e1; }
.identity-card progress::-webkit-progress-value { background: var(--green); }
.identity-card progress::-moz-progress-bar { background: var(--green); }
.identity-numbers { display: flex; justify-content: space-between; gap: .5rem; margin: .55rem 0 1rem; color: var(--muted); font-size: .69rem; }
.model-callout { padding: 1.15rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-solid); color: var(--ink); }
.model-callout .eyebrow { color: var(--muted); }
.model-callout h2 { margin-top: .35rem; font-size: 1.25rem; line-height: 1.25; }
.model-callout p { color: var(--muted); font-size: .8rem; }
.model-callout .button { border-color: var(--green); background: transparent; color: var(--green-dark); }
.model-callout .button:hover { background: var(--green); color: #fff; }
.racing-lower-grid { align-items: start; }
.runner-list { display: grid; }
.runner-list a { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .72rem 0; border-bottom: 1px solid var(--hairline); color: var(--ink); }
.runner-list a:last-child { border-bottom: 0; }
.runner-list a:hover { color: var(--green); text-decoration: none; }
.runner-list span { display: grid; gap: .15rem; }
.runner-list b { color: #8b736b; font-size: .68rem; font-weight: 700; }
.model-notice { margin-top: 0; }
.notice { padding: .9rem 1rem; border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 4px; background: var(--panel-solid); color: var(--secondary-heading); font-size: .84rem; line-height: 1.5; }
.alert { margin-bottom: 1rem; padding: .8rem 1rem; border-radius: 6px; border: 1px solid; font-size: .88rem; }
.alert-error { color: #7f2222; background: #fff0f0; border-color: #e5b7b7; }
.alert-success { color: #7b351f; background: #fff1df; border-color: #edc7a2; }
.empty-state { padding: 3rem 1rem; text-align: center; }
.empty-state.small { padding: 1rem; }
.empty-state.full { min-height: 55vh; display: grid; place-content: center; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th { position: sticky; top: 0; z-index: 1; padding: .68rem .75rem; color: var(--muted); background: var(--table-head); border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; }
td { padding: .7rem .75rem; border-bottom: 1px solid var(--hairline); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--row-hover); }
.sortable-column { cursor: pointer; user-select: none; }
.sortable-column::after { margin-left: .35rem; color: #9aaba2; content: "↕"; font-size: .65rem; }
.sortable-column[aria-sort="ascending"]::after { color: var(--green); content: "↑"; }
.sortable-column[aria-sort="descending"]::after { color: var(--green); content: "↓"; }
.table-compact td { padding-top: .4rem; padding-bottom: .4rem; }
.table-tools { display: flex; align-items: center; gap: .5rem; padding: .65rem .75rem; background: var(--subtle); border-bottom: 1px solid var(--line); }
.table-page-filter { width: min(280px, 100%); min-height: 34px; padding: .4rem .6rem; font-size: .78rem; }
.table-result-count { margin-right: auto; color: var(--muted); font-size: .72rem; white-space: nowrap; }
.column-manager { position: relative; }
.column-manager > summary { list-style: none; }
.column-manager > summary::-webkit-details-marker { display: none; }
.column-manager[open] > summary { background: var(--soft); }
.column-manager-panel { position: absolute; z-index: 6; top: calc(100% + .45rem); right: 0; width: 220px; max-height: 320px; overflow-y: auto; padding: .55rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-solid); box-shadow: 0 18px 40px rgba(8,28,21,.16); }
.column-manager-panel label { display: flex; grid-template-columns: none; align-items: center; gap: .5rem; padding: .38rem; border-radius: 6px; font-size: .74rem; }
.column-manager-panel label:hover { background: var(--soft); }
.column-manager-panel input { width: 15px; min-height: 15px; margin: 0; }
.target-row { background: var(--green-soft); }
.long-notes { margin: 0; padding-left: 1.25rem; color: var(--secondary-heading); font-size: .8rem; line-height: 1.5; }
.long-notes li + li { margin-top: .55rem; }
.record-link { font-weight: 700; }
.status { display: inline-flex; padding: .2rem .42rem; border-radius: 999px; background: #e7ece9; font-size: .7rem; font-weight: 700; }
.status-completed { color: #8a351d; background: #ffe7d4; }
.status-partial { color: #83500b; background: #fff0d5; }
.status-failed { color: #932a2a; background: #fbe3e3; }
.error-list { min-width: 320px; padding-left: 1rem; color: var(--red); }
details summary { color: var(--red); cursor: pointer; }

.search-form { display: flex; gap: .5rem; margin-bottom: .8rem; }
.filter-form { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)) auto auto; align-items: end; gap: .65rem; }
.filter-form-wide { grid-template-columns: repeat(6, minmax(115px, 1fr)); }
.filter-form-wide > .button { align-self: end; }
.filter-form-compact { grid-template-columns: minmax(180px, 280px) auto auto 1fr; }
.coverage-table { margin-top: 1rem; }
.status-coverage-complete { color: #8a351d; background: #ffe7d4; }
.status-coverage-empty { color: #725f58; background: #f2e9e4; }
.status[class*="status-coverage-manifest_"] { color: #932a2a; background: #fbe3e3; }
.status-coverage-present_identity_gaps, .status-coverage-present_source_gaps { color: #932a2a; background: #fbe3e3; }
.status-coverage-present_not_completeness_verified { color: #83500b; background: #fff0d5; }
.status-pull-queued, .status-pull-lease_expired { color: #315a7a; background: #e7f2fa; }
.status-pull-claimed { color: #6b4c0b; background: #fff0d5; }
.status-pull-staged, .status-pull-needs_resolution { color: #932a2a; background: #fbe3e3; }
.status-pull-ready_for_promotion { color: #8a351d; background: #ffe7d4; }
.status-pull-complete { color: #fff; background: var(--green); }
.status-race-unreviewed { color: #725f58; background: #f2e9e4; }
.status-race-not_complete { color: #932a2a; background: #fbe3e3; }
.status-race-complete { color: #8a351d; background: #ffe7d4; }
.compact-list { margin: .5rem 0 0; padding-left: 1rem; white-space: nowrap; }
.search-form input { flex: 1; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; font-size: .82rem; }
.padded-pagination { padding: .85rem; border-top: 1px solid var(--line); }
.back-link { display: inline-block; margin-bottom: 1rem; font-size: .82rem; }
.model-badge { padding: .45rem .65rem; border: 1px solid #d3a864; border-radius: 999px; color: #81520a; background: #fff6e7; font-size: .72rem; font-weight: 700; white-space: nowrap; }

.probability-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-bottom: 1.35rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.probability-card { padding: 1rem; border-right: 1px solid var(--line); background: transparent; color: var(--ink); }
.probability-card:last-child { border-right: 0; }
.probability-card span { display: block; min-height: 2.1em; color: var(--secondary-heading); font-size: .7rem; font-weight: 700; letter-spacing: .035em; text-transform: uppercase; }
.probability-card strong { display: block; margin: .25rem 0 .7rem; color: var(--green-dark); font-size: 1.55rem; font-variant-numeric: tabular-nums; }
.probability-track { width: 100%; height: 3px; overflow: hidden; border: 0; background: var(--line); appearance: none; }
.probability-track::-webkit-progress-bar { background: var(--line); }
.probability-track::-webkit-progress-value { background: var(--sauce); }
.probability-track::-moz-progress-bar { background: var(--sauce); }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: minmax(120px, .8fr) 1.2fr; gap: 1rem; padding: .53rem 0; border-bottom: 1px solid var(--hairline); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: .78rem; }
.detail-list dd { margin: 0; font-size: .84rem; font-weight: 600; text-align: right; }
.footnote { margin: .9rem 0 0; font-size: .76rem; }
.code-list { display: grid; gap: .45rem; margin-top: 1rem; }
.code-list > div { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: .65rem; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px; background: var(--subtle); font-size: .76rem; }
.code-list small { white-space: nowrap; }
.import-grid { align-items: start; }
.pull-context { margin-bottom: 1rem; }
.pulls-layout { align-items: start; }
.metrics-pull { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metrics-pull .metric:last-child { grid-column: 1 / -1; }
.pipeline-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); overflow: hidden; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.pipeline-strip > div { position: relative; display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; align-items: center; gap: .05rem .55rem; padding: .85rem; border-right: 1px solid var(--line); }
.pipeline-strip > div:last-child { border-right: 0; }
.pipeline-strip > div::after { position: absolute; z-index: 2; top: 50%; right: -6px; width: 10px; height: 10px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--panel-solid); content: ""; transform: translateY(-50%) rotate(45deg); }
.pipeline-strip > div:last-child::after { display: none; }
.pipeline-strip span { display: grid; grid-row: 1 / 3; width: 28px; height: 28px; place-items: center; border-radius: 8px; color: #fff; background: var(--green); font-size: .72rem; font-weight: 800; }
.pipeline-strip strong { font-size: .78rem; }
.pipeline-strip small { font-size: .67rem; }

.system-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; margin-bottom: 1rem; border: 1px solid var(--nav-border); border-radius: var(--radius); background: var(--panel-solid); box-shadow: var(--shadow); }
.system-strip > div { display: grid; grid-template-columns: 10px 1fr; gap: .18rem .55rem; padding: .85rem 1rem; border-right: 1px solid var(--line); }
.system-strip > div:last-child { border-right: 0; }
.system-strip strong { font-size: .78rem; }
.system-strip small { grid-column: 2; font-size: .68rem; line-height: 1.35; }
.health-dot { grid-row: 1 / 3; width: 8px; height: 8px; margin-top: .25rem; border-radius: 50%; }
.health-good { background: #f28b3c; box-shadow: 0 0 0 4px rgba(242,139,60,.13); }
.health-warn { background: #d58a1c; box-shadow: 0 0 0 4px rgba(213,138,28,.11); }
.health-bad { background: #c54a4a; box-shadow: 0 0 0 4px rgba(197,74,74,.11); }
.admin-launch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.admin-launch { display: grid; grid-template-columns: 34px 1fr auto; align-items: start; gap: .75rem; min-height: 120px; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); color: var(--ink); }
.admin-launch:hover { border-color: var(--input-border); background: var(--panel-hover); text-decoration: none; transform: translateY(-1px); }
.admin-launch-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: var(--green-soft); color: var(--green-dark); font-size: .66rem; font-weight: 850; }
.admin-launch div { display: grid; gap: .3rem; }
.admin-launch strong { font-size: .9rem; }
.admin-launch p { margin: 0; font-size: .73rem; line-height: 1.4; }
.admin-launch > b { color: #89988f; font-size: .72rem; white-space: nowrap; }
.admin-queue-grid { align-items: start; }
.queue-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45rem; }
.queue-summary > div { display: grid; gap: .25rem; padding: .75rem; border: 1px solid var(--line); border-radius: 9px; background: var(--subtle); }
.queue-summary span { color: var(--muted); font-size: .68rem; }
.queue-summary strong { font-size: 1.25rem; }
.admin-activity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.admin-activity-grid table { font-size: .74rem; }

.horse-form-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); overflow: hidden; margin-bottom: 1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; }
.horse-form-strip > div:not(.horse-achievements) { display: grid; gap: .2rem; padding: .85rem 1rem; border-right: 1px solid var(--line); }
.horse-form-strip > div:nth-child(6) { border-right: 0; }
.horse-form-strip span { color: var(--muted); font-size: .68rem; }
.horse-form-strip strong { font-size: 1.18rem; letter-spacing: -.02em; }
.horse-form-strip small { color: var(--green); font-size: .65rem; font-weight: 700; }
.horse-form-strip .summary-date, .horse-form-strip .summary-money { font-size: .9rem; }
.horse-achievements { grid-column: 1 / -1; display: flex; gap: .4rem; padding: .65rem .5rem; border-top: 1px solid var(--line); background: transparent; }
.achievement { padding: .25rem .5rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-solid); }
.achievement.earned { color: #8f2c22; border-color: #e6b5a5; background: #fff0e8; font-weight: 750; }
.section-heading-inline { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 1.4rem 0 .55rem; }
.section-heading-inline h2 { margin: 0; font-size: .78rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.model-note { color: var(--quiet); font-size: .7rem; }
.pedigree-links { align-items: center; gap: 1.6rem; }
.pedigree-links a { color: var(--green-dark); font-size: .82rem; text-decoration: underline; text-underline-offset: .18em; }
.record-heading { padding-bottom: .55rem; }
.race-quality-panel { border-left: 4px solid var(--green); }
.race-quality-panel .status { white-space: nowrap; text-transform: capitalize; }
.source-document-panel { padding: 1.15rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-solid); }
.source-document-primary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.source-document-primary > div { display: grid; gap: .22rem; }
.source-document-primary small { line-height: 1.45; }
.source-document-details { margin-top: .8rem; padding-top: .75rem; border-top: 1px solid var(--hairline); }
.source-document-details summary { width: max-content; color: var(--green); font-size: .76rem; font-weight: 750; }
.source-document-details .detail-list { max-width: 760px; margin-top: .65rem; }
.race-status-form { display: grid; grid-template-columns: minmax(150px, .35fr) minmax(300px, 1fr) auto; align-items: end; gap: .75rem; }
.race-status-note textarea { min-height: 74px; }
.race-status-form .button { min-height: 74px; }

label { display: grid; gap: .35rem; color: var(--secondary-heading); font-size: .78rem; font-weight: 700; }
label small { margin-left: .25rem; }
input, select, textarea { width: 100%; min-height: 41px; padding: .58rem .65rem; border: 1px solid var(--input-border); border-radius: 5px; background: var(--field); color: var(--ink); font: inherit; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(201,40,36,.14); border-color: var(--green); }
.stack { display: grid; gap: .9rem; }
.favorite-button { white-space: nowrap; }
.favorite-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.favorite-list { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.favorite-list li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--hairline); }
.page-centered:has(.login-shell) { width: 100%; max-width: none; padding: 0; }
body:has(.login-shell)::before { background: #fff; }
.login-shell { width: 100%; min-height: 100vh; display: grid; grid-template-columns: minmax(390px, 31%) 1fr; overflow: hidden; background: #fff; color: #111; }
.login-panel { min-height: 100vh; display: flex; flex-direction: column; padding: 2rem clamp(2rem, 4vw, 5.75rem); background: #fff; }
.login-brand { width: max-content; display: inline-flex; align-items: center; gap: .5rem; color: #a51d22; font-size: .86rem; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; }
.login-brand .brand-icon { width: 28px; height: 28px; flex-basis: 28px; }
.login-brand:hover { color: #74151a; text-decoration: none; }
.login-form-panel { width: min(100%, 360px); margin: auto; padding: 5rem 0 7rem; background: #fff; }
.login-form-panel h1 { margin-bottom: 1.35rem; color: #242424; font-size: 1.55rem; font-weight: 680; letter-spacing: -.035em; }
.login-form-panel form { gap: .62rem; }
.login-form-panel form label:not(:first-of-type) { margin-top: .35rem; }
.login-form-panel label { color: #303030; font-size: .75rem; font-weight: 650; }
.login-form-panel input { min-height: 44px; border-color: #c6c6c6; border-radius: 6px; background: #fff; color: #161616; box-shadow: inset 0 1px 2px rgba(0,0,0,.025); }
.login-form-panel input:focus { outline: 3px solid rgba(201,40,36,.13); border-color: #b82425; }
.login-form-panel .alert { margin-bottom: .9rem; border-radius: 5px; font-size: .76rem; }
.turnstile-wrap { width: 100%; margin-top: .6rem; }
.turnstile-wrap .cf-turnstile { width: 100%; min-height: 65px; }
.login-submit { width: 100%; min-height: 44px; margin-top: .25rem; border-color: #74151a; border-radius: 6px; background: #8f1d21; color: #fff; font-size: .78rem; }
.login-submit:hover { border-color: #5d1014; background: #74151a; }
.login-visual { position: relative; min-height: 100vh; overflow: hidden; background: #c92824 url("/static/login-sauce-character.png") center / cover no-repeat; }
.login-visual-mark { position: absolute; left: clamp(2rem, 4vw, 5rem); bottom: clamp(3rem, 9vh, 7rem); max-width: 260px; color: #fff2d0; font-size: clamp(1.6rem, 3vw, 3rem); font-weight: 780; letter-spacing: -.05em; text-shadow: 0 2px 0 rgba(105,12,16,.22); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.form-actions { grid-column: 1 / -1; display: flex; gap: .6rem; padding-top: .3rem; }
.file-field { grid-column: 1 / -1; }
.file-field input { padding: .45rem; }
.calculator-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 1rem; }
.result-panel { min-height: 250px; }
.score-number { margin: .1rem 0 1rem; font-size: 3rem; font-weight: 800; letter-spacing: -.06em; }
.result-list { border-top: 1px solid var(--line); }
.result-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: .68rem 0; border-bottom: 1px solid var(--hairline); font-size: .8rem; }
.result-list strong { font-size: .95rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

html[data-theme="dark"] .notice { color: #f0c7ba; border-color: #744239; }
html[data-theme="dark"] .alert-error { color: #ffb7b7; background: #371d1d; border-color: #6a3737; }
html[data-theme="dark"] .alert-success { color: #ffd0a8; background: #3b2117; border-color: #70412d; }
html[data-theme="dark"] .status { background: #42231f; }
html[data-theme="dark"] .status-completed,
html[data-theme="dark"] .status-coverage-complete,
html[data-theme="dark"] .status-pull-ready_for_promotion { color: #ffd0a8; background: #49251b; }
html[data-theme="dark"] .status-partial,
html[data-theme="dark"] .status-coverage-present_not_completeness_verified,
html[data-theme="dark"] .status-pull-claimed { color: #f5d38e; background: #3d3018; }
html[data-theme="dark"] .status-failed,
html[data-theme="dark"] .status[class*="status-coverage-manifest_"],
html[data-theme="dark"] .status-coverage-present_identity_gaps,
html[data-theme="dark"] .status-coverage-present_source_gaps,
html[data-theme="dark"] .status-pull-staged,
html[data-theme="dark"] .status-pull-needs_resolution { color: #ffb3b3; background: #421f21; }
html[data-theme="dark"] .status-coverage-empty { color: #c4aaa1; background: #3d2420; }
html[data-theme="dark"] .status-race-unreviewed { color: #c4aaa1; background: #3d2420; }
html[data-theme="dark"] .status-race-not_complete { color: #ffb3b3; background: #421f21; }
html[data-theme="dark"] .status-race-complete { color: #ffd0a8; background: #49251b; }
html[data-theme="dark"] .status-pull-queued,
html[data-theme="dark"] .status-pull-lease_expired { color: #abd7f5; background: #1b3445; }
html[data-theme="dark"] .model-badge { color: #f0ca83; border-color: #765e31; background: #372d1d; }
html[data-theme="dark"] .achievement.earned { color: #ffc5b0; border-color: #7c453b; background: #47221e; }

@media (max-width: 900px) {
  .site-header { flex-wrap: wrap; gap: .35rem 1rem; padding-top: .5rem; }
  .site-header nav { order: 3; width: 100%; }
  .site-header nav a { padding: .65rem .65rem .75rem; }
  .metrics, .metrics-five, .probability-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-form, .filter-form-wide, .filter-form-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column, .calculator-layout { grid-template-columns: 1fr; }
  .race-status-form { grid-template-columns: 1fr 2fr; }
  .race-status-form .button { grid-column: 1 / -1; min-height: 41px; }
  .pipeline-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pipeline-strip > div:nth-child(3) { border-right: 0; }
  .pipeline-strip > div:nth-child(3)::after { display: none; }
  .pipeline-strip > div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .section-nav { top: 112px; }
  .racing-hero { grid-template-columns: 1fr; }
  .racing-workspace-grid { grid-template-columns: 1fr; }
  .racing-side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .system-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .system-strip > div:nth-child(2) { border-right: 0; }
  .system-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .admin-launch-grid, .admin-activity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .favorite-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .horse-form-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .horse-form-strip > div:nth-child(3) { border-right: 0; }
  .horse-form-strip > div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .login-shell { grid-template-columns: minmax(350px, 42%) 1fr; }
}

@media (max-width: 600px) {
  .page { padding: 1rem; }
  .site-header { position: static; }
  .section-nav { position: static; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .button-row, .page-heading > .button { width: 100%; }
  .button-row .button { flex: 1; }
  .metrics, .metrics-five, .probability-grid, .form-grid, .filter-form { grid-template-columns: 1fr; }
  .filter-form-wide, .filter-form-compact { grid-template-columns: 1fr; }
  .race-status-form { grid-template-columns: 1fr; }
  .race-status-form .button { grid-column: auto; }
  .metric { flex-direction: row; align-items: center; justify-content: space-between; }
  .form-actions, .file-field { grid-column: auto; }
  .search-form { align-items: stretch; flex-direction: column; }
  .site-footer { flex-direction: column; }
  .detail-list > div { grid-template-columns: 1fr; gap: .2rem; }
  .detail-list dd { text-align: left; }
  .private-state { display: none; }
  .theme-control { margin-left: auto; }
  .theme-control > span { display: none; }
  .table-tools { align-items: stretch; flex-wrap: wrap; }
  .table-page-filter { width: 100%; }
  .table-result-count { width: 100%; }
  .column-manager-panel { right: auto; left: 0; }
  .code-list > div { grid-template-columns: 45px 1fr; }
  .code-list small { grid-column: 2; }
  .pipeline-strip { grid-template-columns: 1fr; }
  .pipeline-strip > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .pipeline-strip > div:nth-child(3) { border-right: 0; }
  .pipeline-strip > div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .pipeline-strip > div:last-child { border-bottom: 0; }
  .pipeline-strip > div::after { display: none; }
  .racing-hero { padding: 1.25rem; }
  .racing-hero h1 { font-size: 2.1rem; }
  .hero-search > div { align-items: stretch; flex-direction: column; }
  .racing-side-stack, .admin-launch-grid, .admin-activity-grid, .system-strip { grid-template-columns: 1fr; }
  .favorite-groups { grid-template-columns: 1fr; }
  .system-strip > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .system-strip > div:last-child { border-bottom: 0; }
  .admin-launch { min-height: auto; }
  .queue-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .horse-form-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .horse-form-strip > div:not(.horse-achievements) { border-right: 0; border-bottom: 1px solid var(--line); }
  .horse-achievements { flex-wrap: wrap; }
  .section-heading-inline { align-items: start; flex-direction: column; }
  .source-document-primary { align-items: stretch; flex-direction: column; }
  .page-centered { width: 100%; padding: 0; }
  .page-centered + .site-footer { display: none; }
  body:has(.login-shell)::before { background: #fff; }
  .login-shell { grid-template-columns: 1fr; }
  .login-panel { min-height: 100vh; padding: 1.4rem 1.5rem; }
  .login-form-panel { width: 100%; max-width: 390px; padding: 4rem 0 6rem; }
  .login-visual { display: none; }
}
