/* Race workspace: compact tabs and horse comparison. Gate colors are not overridden. */
.mp-race-detail .mp-race-workspace {
    --mp-race-sticky-top: 0px;
    border: 1px solid var(--mp-border, #dce3ee);
    background: var(--mp-surface, #fff);
}
.mp-race-detail .mp-race-workspace .tab-nav-container {
    position: sticky;
    top: var(--mp-race-sticky-top);
    z-index: 35;
    border-radius: 9px 9px 0 0;
    border-bottom: 1px solid var(--mp-border, #dce3ee);
    background: var(--mp-surface, #fff);
}
.mp-race-detail .mp-race-workspace .tab-nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    padding: 5px;
    scrollbar-width: thin;
    scrollbar-color: #b9c5d8 transparent;
    overscroll-behavior-x: contain;
}
.mp-race-detail .mp-race-workspace .tab-button {
    display: inline-flex;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 44px;
    padding: 9px 14px;
    white-space: nowrap;
    border-radius: 7px;
    font-size: 14px;
    line-height: 20px;
    color: var(--mp-muted, #596579);
    background: transparent;
}
.mp-race-detail .mp-race-workspace .tab-button i { margin: 0; }
.mp-race-detail .mp-race-workspace .tab-button.active {
    background: var(--mp-primary-soft, #eff3fb);
    color: var(--mp-primary, #3157a4);
    box-shadow: inset 0 -2px 0 var(--mp-primary, #3157a4);
}
.mp-race-detail .mp-race-workspace .tab-nav::-webkit-scrollbar-track { background: transparent; }
.mp-race-detail .mp-race-workspace .tab-nav::-webkit-scrollbar-thumb { background: #b9c5d8; }
.mp-race-workspace .tab-content { scroll-margin-top: calc(var(--mp-race-sticky-top) + 64px); }
.mp-race-detail #horses { padding: 20px; color: var(--mp-ink, #17243a); }
#horses .mp-horses-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
#horses .mp-horses-heading h3 { font-size: 17px; font-weight: 750; }
#horses .mp-horses-heading h3 span { margin-left: 4px; color: var(--mp-muted, #596579); font-size: 13px; font-weight: 500; }
#horses .mp-horses-heading p { margin-top: 3px; color: var(--mp-muted, #596579); font-size: 12px; }
#horses .mp-horses-heading > a { display: inline-flex; min-height: 44px; align-items: center; gap: 5px; color: var(--mp-primary, #3157a4); font-size: 13px; white-space: nowrap; }
#horses .mp-horse-list { display: grid; gap: 9px; }
#horses .mp-horse-card { min-width: 0; border: 1px solid var(--mp-border, #dce3ee); border-radius: 10px; background: #fff; }
#horses .mp-horse-header { display: flex; align-items: center; gap: 10px; padding: 10px 14px 5px; }
#horses .mp-horse-header > .gate-badge { flex-shrink: 0; }
#horses .mp-horse-identity { flex: 1; min-width: 0; }
#horses .mp-horse-name { min-height: 44px; padding: 2px 0; color: var(--mp-ink, #17243a); font-size: 16px; font-weight: 750; text-align: left; line-height: 1.35; overflow-wrap: anywhere; }
#horses button.mp-horse-name:hover { color: var(--mp-primary, #3157a4); text-decoration: underline; text-underline-offset: 3px; }
#horses .mp-horse-meta { color: var(--mp-muted, #596579); font-size: 12px; }
#horses .mp-horse-favorite { flex-shrink: 0; min-width: 44px; min-height: 44px; font-size: 17px; }
#horses .mp-horse-compare { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 0 6px; color: var(--mp-muted, #596579); font-size: 13px; cursor: pointer; white-space: nowrap; }
#horses .mp-horse-compare input { width: 16px; height: 16px; accent-color: var(--mp-primary, #3157a4); }
#horses .mp-horse-compare:has(input:checked) { color: var(--mp-primary, #3157a4); font-weight: 700; }
#horses .mp-horse-quick { display: grid; grid-template-columns: minmax(80px, 1fr) 80px minmax(142px, 1.4fr) 88px; align-items: center; gap: 12px; list-style: none; cursor: pointer; padding: 6px 14px 12px; min-height: 52px; }
#horses .mp-horse-quick::-webkit-details-marker { display: none; }
#horses .mp-horse-quick-stat { display: flex; align-items: center; gap: 8px; min-width: 0; }
#horses .mp-horse-label { display: block; color: var(--mp-muted, #596579); font-size: 12px; font-weight: 500; white-space: nowrap; }
#horses .mp-horse-quick-stat strong { font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
#horses .mp-horse-quick-stat small { font-size: 11px; font-weight: 500; margin-left: 2px; }
#horses .mp-finishes { display: inline-flex; align-items: center; gap: 3px; }
#horses .mp-finish { display: inline-flex; align-items: center; justify-content: center; width: 23px; height: 24px; border-radius: 4px; color: var(--mp-muted, #596579); background: var(--mp-canvas); font-size: 12px; font-weight: 600; }
#horses .mp-finish--placed { background: var(--mp-primary-soft, #eff3fb); color: var(--mp-primary, #3157a4); font-weight: 750; }
#horses .mp-horse-no-record { color: var(--mp-muted, #596579); font-size: 12px; }
#horses .mp-horse-disclosure { display: flex; align-items: center; justify-content: flex-end; gap: 7px; font-size: 12px; color: var(--mp-primary, #3157a4); }
#horses .mp-horse-disclosure i { font-size: 10px; transition: transform .15s; }
#horses .mp-horse-close-label { display: none; }
#horses .mp-horse-details[open] .mp-horse-open-label { display: none; }
#horses .mp-horse-details[open] .mp-horse-close-label { display: inline; }
#horses .mp-horse-details[open] .mp-horse-disclosure i { transform: rotate(180deg); }
#horses .mp-horse-detail-body { border-top: 1px solid var(--mp-border, #dce3ee); padding: 12px 14px; }
#horses .mp-horse-facts { display: flex; flex-wrap: wrap; gap: 7px 18px; margin-bottom: 10px; font-size: 12px; color: var(--mp-muted, #596579); }
#horses .mp-horse-facts strong { color: var(--mp-ink, #17243a); margin-left: 4px; font-weight: 600; }
#horses .mp-weight-up { color: var(--mp-danger, #b5413a); }
#horses .mp-weight-down { color: var(--mp-primary, #3157a4); }
#horses .mp-horse-facts .mp-horse-caution, #horses .mp-horse-facts .mp-horse-caution strong { color: var(--mp-warning); }
#horses .mp-horse-metrics { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
#horses .mp-horse-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--mp-border, #dce3ee); border-radius: 5px; padding: 3px 7px; font-size: 12px; line-height: 1.5; color: var(--mp-muted, #596579); background: var(--mp-canvas); }
#horses .mp-horse-chip--key { color: var(--mp-primary, #3157a4); background: var(--mp-primary-soft, #eff3fb); border-color: #dce5f5; }
#horses .mp-horse-chip--caution { color: var(--mp-warning); background: var(--mp-warning-soft); border-color: var(--mp-warning); }
#horses .mp-horse-insight-link { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 0 7px; margin-left: auto; color: var(--mp-primary, #3157a4); font-size: 12px; }
#horses .mp-horse-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--mp-border, #dce3ee); border-radius: 7px; overflow: hidden; background: var(--mp-border, #dce3ee); }
#horses .mp-horse-stats > div { padding: 9px 10px; background: var(--mp-canvas); }
#horses .mp-horse-stats > div > strong { display: block; margin-top: 5px; font-size: 15px; }
#horses .mp-horse-stats p { color: var(--mp-muted, #596579); font-size: 11px; line-height: 1.6; }
#horses .mp-horse-person { color: var(--mp-primary, #3157a4); min-height: 36px; font-size: 14px; font-weight: 650; }
#horses .mp-profile-link { display: inline-flex; min-width: 32px; min-height: 36px; align-items: center; justify-content: center; color: var(--mp-muted, #596579); }
#horses .mp-horse-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#horses .mp-horse-actions a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1px solid var(--mp-border, #dce3ee); border-radius: 6px; color: var(--mp-primary, #3157a4); font-size: 12px; }
#horses :is(.mp-horse-actions a, .mp-horse-insight-link, .mp-horse-person, .mp-profile-link):hover { background: var(--mp-primary-soft, #eff3fb); }
@media (max-width: 640px) {
    .mp-race-detail #horses { padding: 12px 9px; }
    .mp-race-detail .mp-race-workspace .tab-button { padding: 8px 12px; font-size: 13px; }
    .mp-race-detail .mp-race-workspace .tab-button i { display: none; }
    #horses .mp-horses-heading { align-items: flex-start; gap: 6px; }
    #horses .mp-horses-heading h3 { font-size: 16px; }
    #horses .mp-horses-heading p { max-width: 240px; font-size: 11px; }
    #horses .mp-horse-header { padding: 8px 10px 3px; gap: 7px; }
    #horses .mp-horse-name { font-size: 15px; }
    #horses .mp-horse-meta { font-size: 11px; }
    #horses .mp-horse-favorite { min-width: 44px; }
    #horses .mp-horse-compare { gap: 4px; padding: 0; font-size: 12px; }
    #horses .mp-horse-quick { grid-template-columns: minmax(48px, .9fr) minmax(40px, .7fr) minmax(113px, 1.7fr) 12px; gap: 6px; padding: 5px 10px 10px; }
    #horses .mp-horse-quick-stat { align-items: flex-start; flex-direction: column; gap: 3px; }
    #horses .mp-horse-label { font-size: 11px; }
    #horses .mp-horse-quick-stat strong { font-size: 13px; }
    #horses .mp-finishes { gap: 2px; }
    #horses .mp-finish { width: 21px; height: 23px; font-size: 11px; }
    #horses .mp-horse-disclosure > span { display: none !important; }
    #horses .mp-horse-detail-body { padding: 10px; }
    #horses .mp-horse-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #horses .mp-horse-person, #horses .mp-profile-link { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { #horses .mp-horse-disclosure i { transition: none; } }

/* Odds columns keep full horse names horizontal instead of squeezing Hangul
   into one-character lines. Extra columns scroll inside the table only. */
#odds .mp-odds-scroll {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}
#odds .mp-odds-table {
    width: 100%;
    min-width: 20rem;
    table-layout: auto;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}
#odds .mp-odds-table :is(th, td) {
    width: auto;
    min-height: 44px;
    height: 44px;
    padding: 8px;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
}
#odds .mp-odds-table :is(th, td):nth-child(3) {
    min-width: 7.5em;
    text-align: left;
}
#odds .mp-odds-table :is(th, td):not(:nth-child(3)) { min-width: 2.75rem; }

/* Odds data sources share one surface; selection is always the action color.
   Gate badges and signed market movement keep their separate data identities. */
.mp-race-detail #odds .mp-odds-panel-heading {
    background: var(--mp-canvas); border-color: var(--mp-border); background-image: none;
}
.mp-race-detail #odds .mp-odds-heading-icon { color: var(--mp-muted); }
.mp-race-detail #odds .mp-source-label { color: var(--mp-muted); background: var(--mp-surface); border: 1px solid var(--mp-border); }
.mp-race-detail #odds .mp-odds-value { color: var(--mp-ink); }
.mp-race-detail #odds .mp-odds-value--popular { color: var(--mp-ink); font-weight: 800; }
.mp-race-detail #odds .mp-odds-description { color: var(--mp-muted); }
.mp-race-detail #odds .mp-odds-ranked-row { background: var(--mp-canvas); }
.mp-race-detail #odds .mp-odds-hit-row { background: var(--mp-success-soft); }
.mp-race-detail #odds :is(.mp-odds-secondary, .user-horse-btn, .live-horse-btn-dyn) {
    min-height: 44px; background: var(--mp-surface); color: var(--mp-primary); border: 1px solid var(--mp-control-border);
}
.mp-race-detail #odds :is(.mp-odds-secondary, .user-horse-btn, .live-horse-btn-dyn):hover {
    color: var(--mp-primary-hover); background: var(--mp-primary-soft); border-color: var(--mp-primary);
}
.mp-race-detail #odds :is(.mp-odds-primary, .mp-odds-choice-active) {
    min-height: 44px; color: #fff; background: var(--mp-primary); border-color: var(--mp-primary);
}
.mp-race-detail #odds :is(.mp-odds-primary, .mp-odds-choice-active):hover { color: #fff; background: var(--mp-primary-hover); }
.mp-race-detail #odds .mp-odds-apply { color: var(--mp-ink); background: var(--mp-canvas); border-color: var(--mp-border); }
.mp-race-detail #odds .mp-upload-target { border-color: var(--mp-control-border); }
.mp-race-detail #odds .mp-upload-target:hover,
.mp-race-detail #odds .mp-upload-target--active { background: var(--mp-primary-soft); border-color: var(--mp-primary); }
.mp-race-detail #odds .mp-loading-ring { border-color: var(--mp-primary); }
.mp-race-detail #odds .mp-odds-delete { min-height: 44px; color: var(--mp-danger); }
.mp-race-detail #odds .mp-odds-delete:hover { background: var(--mp-danger-soft); }

/* Application dialogs and SMS controls use brand actions. The printed OMR
   ticket remains a separate, authentic document visualization. */
.mp-race-detail .mp-dialog-heading { color: var(--mp-ink); background: var(--mp-canvas); border-bottom: 1px solid var(--mp-border); }
.mp-race-detail .mp-dialog-heading :is(h3, h3 span, button:not(.mp-dialog-primary)) { color: var(--mp-ink); }
.mp-race-detail .mp-dialog-heading > button { min-height: 44px; min-width: 44px; }
.mp-race-detail .mp-dialog-primary { color: #fff; background: var(--mp-primary); border: 1px solid var(--mp-primary); min-height: 44px; }
.mp-race-detail .mp-dialog-primary:hover { color: #fff; background: var(--mp-primary-hover); }
.mp-race-detail .mp-dialog-secondary { color: var(--mp-primary); background: var(--mp-surface); border: 1px solid var(--mp-control-border); min-height: 44px; }
.mp-race-detail .mp-dialog-secondary:hover { color: var(--mp-primary-hover); background: var(--mp-primary-soft); }
.mp-race-detail .mp-dialog-link { color: var(--mp-primary); }
.mp-race-detail .mp-dialog-link:hover { color: var(--mp-primary-hover); }
.mp-race-detail .mp-dialog-label-icon { color: var(--mp-muted); }
.mp-race-detail .mp-dialog-value { color: var(--mp-ink); }
.mp-race-detail .mp-dialog-info,
.mp-race-detail .mp-sms-entry { color: var(--mp-ink); background: var(--mp-canvas); border-color: var(--mp-border); }
.mp-race-detail :is(.mp-sms-entry, #bettingMemoForm) :is(input[type='number'], textarea) {
    min-height: 44px; border-color: var(--mp-control-border); color: var(--mp-ink); background: var(--mp-surface); --tw-ring-color: var(--mp-focus);
}
.mp-race-detail :is(.mp-sms-entry, #bettingMemoForm) :is(input[type='number'], textarea):focus { border-color: var(--mp-primary); }
.mp-race-detail .mp-input-choice { min-height: 44px; color: var(--mp-ink); background: var(--mp-surface); border-color: var(--mp-control-border); }
.mp-race-detail .mp-input-choice:hover { border-color: var(--mp-primary); background: var(--mp-primary-soft); }
.mp-race-detail .mp-input-selected { color: var(--mp-primary); background: var(--mp-primary-soft); border-color: var(--mp-primary); box-shadow: inset 0 0 0 1px var(--mp-primary); }
.mp-race-detail .mp-radio-option { min-height: 44px; border-color: var(--mp-control-border); }
.mp-race-detail input:checked + .mp-radio-option { color: var(--mp-primary); background: var(--mp-primary-soft); border-color: var(--mp-primary); box-shadow: inset 0 0 0 1px var(--mp-primary); }
.mp-race-detail input:focus-visible + .mp-radio-option { outline: 3px solid var(--mp-focus); outline-offset: 3px; }
.mp-race-detail #sms .mp-venue-selection { color: var(--mp-ink); background: var(--mp-canvas); border-color: var(--mp-border); }
.mp-race-detail #sms .mp-venue-selection :is(h4,p,.fa-map-marker-alt) { color: var(--mp-ink); }
.mp-race-detail #sms .mp-race-mismatch :is(h4,p,ul,.fa-exclamation-triangle) { color: var(--mp-warning); }
.mp-race-detail .mp-memo-type { color: var(--mp-muted); background: var(--mp-canvas); }
.mp-race-detail .mp-memo-delete { min-height: 44px; min-width: 44px; color: var(--mp-danger); }
.mp-race-detail .mp-memo-delete:hover { background: var(--mp-danger-soft); }
.mp-race-detail #sms .mp-sms-evaluation { background: var(--mp-canvas); border-color: var(--mp-border); }
.mp-race-detail #sms .mp-sms-evaluation > h4 { color: var(--mp-ink); }
