/*
 * RACE_PROFILER_003A — Premium workspace and shared modal top-inset closeout.
 *
 * Scope:
 *   - Main Builder DOM while body[data-workspace-mode="race_profiler"] is active
 *   - Shared Live Racing evidence modal top inset for Trainer/Jockey/Sire/
 *     Dam-sire/Draw Stats only
 *
 * Behaviour is intentionally unchanged: profile defaults, report-group state,
 * filters, saved Race Profiles, quick/full reports, exclusions, section collapse,
 * sticky commands and modal navigation remain owned by existing JavaScript.
 */

/* ========================================================================
   RACE PROFILER TOKENS AND PAGE RHYTHM
   ======================================================================== */
body[data-workspace-mode="race_profiler"]{
  --rp-ink:#10213d;
  --rp-copy:#526985;
  --rp-muted:#71839a;
  --rp-line:rgba(79,111,210,.17);
  --rp-line-strong:rgba(54,111,224,.28);
  --rp-panel:rgba(255,255,255,.84);
  --rp-panel-soft:rgba(246,249,255,.82);
  --rp-teal:#0d918d;
  --rp-blue:#2d63d6;
  --rp-violet:#6948db;
  --rp-shadow:0 14px 34px rgba(17,34,72,.075),inset 0 1px 0 rgba(255,255,255,.78);
}
body[data-workspace-mode="race_profiler"] #page-builder{
  padding-bottom:104px!important;
}
body[data-workspace-mode="race_profiler"] #page-builder > .topbar{
  margin-bottom:12px!important;
}
body[data-workspace-mode="race_profiler"] #page-builder > .section,
body[data-workspace-mode="race_profiler"] #raceProfilerCommandCentre{
  box-sizing:border-box!important;
}

/* ========================================================================
   CURRENT RACE SETUP — COMPACT DARK COMMAND SURFACE
   ======================================================================== */
body[data-workspace-mode="race_profiler"] .race-profiler-command-centre,
body[data-workspace-mode="race_profiler"] #raceProfilerCommandCentre{
  width:100%!important;
  margin:0 0 14px!important;
  padding:0!important;
  background:transparent!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-cohort-deck{
  position:relative!important;
  overflow:hidden!important;
  width:100%!important;
  margin:0!important;
  padding:15px 16px 16px!important;
  border:1px solid rgba(97,145,241,.34)!important;
  border-radius:23px!important;
  color:#fff!important;
  background:
    radial-gradient(circle at 91% 8%,rgba(45,212,191,.22),transparent 33%),
    radial-gradient(circle at 38% 112%,rgba(99,102,241,.30),transparent 46%),
    linear-gradient(132deg,rgba(6,18,42,.99),rgba(28,54,139,.97) 58%,rgba(35,99,187,.93))!important;
  box-shadow:0 26px 62px rgba(14,28,68,.20),inset 0 1px 0 rgba(255,255,255,.22)!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-cohort-deck::after{
  content:""!important;
  position:absolute!important;
  inset:0 18px auto!important;
  height:1px!important;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.88),rgba(97,230,244,.42),transparent)!important;
  pointer-events:none!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-cohort-head{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:center!important;
  gap:16px!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-cohort-head h2{
  margin:2px 0 4px!important;
  color:#fff!important;
  font-size:clamp(20px,1.4vw,25px)!important;
  line-height:1.05!important;
  letter-spacing:-.025em!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-workflow-kicker{
  color:#7cf1ee!important;
  font-size:9px!important;
  line-height:1.1!important;
  font-weight:950!important;
  letter-spacing:.16em!important;
  text-transform:uppercase!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-cohort-head p{
  max-width:840px!important;
  margin:5px 0 0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  color:rgba(232,241,255,.86)!important;
  font-size:11.5px!important;
  line-height:1.38!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-cohort-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  flex-wrap:wrap!important;
  gap:8px!important;
  max-width:720px!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-cohort-actions button,
body[data-workspace-mode="race_profiler"] .race-profiler-warning-pill{
  min-height:34px!important;
  padding:7px 11px!important;
  border:1px solid rgba(255,255,255,.20)!important;
  border-radius:11px!important;
  background:rgba(255,255,255,.09)!important;
  color:#fff!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.14)!important;
  font-size:10.5px!important;
  font-weight:900!important;
  white-space:nowrap!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-cohort-actions button:hover,
body[data-workspace-mode="race_profiler"] .race-profiler-warning-pill:hover{
  transform:translateY(-1px)!important;
  border-color:rgba(255,255,255,.36)!important;
  background:rgba(255,255,255,.16)!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-start-guide{
  min-width:210px!important;
  color:#064e3b!important;
  border-color:rgba(153,246,228,.55)!important;
  background:linear-gradient(180deg,#d5fbef,#ecfdf8)!important;
  box-shadow:0 10px 24px rgba(16,185,129,.13)!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-warning-pill:not(.is-clear){
  color:#fff8e8!important;
  border-color:rgba(251,191,36,.38)!important;
  background:rgba(120,68,4,.30)!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-warning-pill.is-clear{
  color:#d8fff2!important;
  border-color:rgba(52,211,153,.34)!important;
  background:rgba(4,120,87,.28)!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-cohort-chips{
  display:flex!important;
  align-items:center!important;
  flex-wrap:wrap!important;
  gap:6px!important;
  margin:9px 0 0!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-cohort-chips > *{
  min-height:25px!important;
  padding:5px 8px!important;
  border-radius:999px!important;
  border:1px solid rgba(147,197,253,.19)!important;
  background:rgba(255,255,255,.085)!important;
  color:rgba(241,247,255,.91)!important;
  font-size:9.5px!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.10)!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-readiness{
  display:grid!important;
  grid-template-columns:minmax(280px,1.15fr) minmax(420px,.85fr)!important;
  align-items:center!important;
  gap:10px!important;
  margin:9px 0!important;
  padding:9px 10px!important;
  border:1px solid rgba(147,197,253,.16)!important;
  border-radius:15px!important;
  background:rgba(5,16,40,.27)!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-readiness-main strong{
  color:#fff!important;
  font-size:13px!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-readiness-main p{
  margin:2px 0 0!important;
  color:rgba(229,239,255,.78)!important;
  font-size:10px!important;
  line-height:1.28!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-readiness-kicker{
  color:#a8f3ee!important;
  font-size:8px!important;
  letter-spacing:.14em!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-readiness-metrics{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:6px!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-readiness-metrics > span{
  min-height:46px!important;
  padding:7px 8px!important;
  border:1px solid rgba(147,197,253,.15)!important;
  border-radius:10px!important;
  background:rgba(255,255,255,.065)!important;
  text-align:center!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-readiness-metrics strong{
  color:#fff!important;
  font-size:15px!important;
  line-height:1!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-readiness-metrics em{
  margin-top:3px!important;
  color:rgba(224,236,255,.72)!important;
  font-size:8.5px!important;
  line-height:1.15!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-section-map{
  display:grid!important;
  grid-template-columns:repeat(5,minmax(0,1fr))!important;
  gap:7px!important;
  margin:8px 0 0!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-section-map button{
  display:grid!important;
  grid-template-columns:25px minmax(0,1fr)!important;
  grid-template-areas:"step title" "step copy"!important;
  align-content:center!important;
  min-height:62px!important;
  padding:8px 9px!important;
  gap:2px 7px!important;
  border:1px solid rgba(147,197,253,.15)!important;
  border-radius:12px!important;
  background:rgba(255,255,255,.055)!important;
  color:#fff!important;
  text-align:left!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08)!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-section-map button:hover{
  transform:translateY(-1px)!important;
  border-color:rgba(103,232,249,.36)!important;
  background:rgba(255,255,255,.11)!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-section-map button > span{
  grid-area:step!important;
  align-self:start!important;
  display:grid!important;
  place-items:center!important;
  width:25px!important;
  height:25px!important;
  border-radius:8px!important;
  color:#dffaff!important;
  background:linear-gradient(135deg,rgba(50,120,224,.72),rgba(47,205,194,.52))!important;
  font-size:9px!important;
  font-weight:950!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-section-map button strong{
  grid-area:title!important;
  color:#fff!important;
  font-size:10.5px!important;
  line-height:1.15!important;
}
body[data-workspace-mode="race_profiler"] .race-profiler-section-map button em{
  grid-area:copy!important;
  overflow:hidden!important;
  display:-webkit-box!important;
  -webkit-line-clamp:2!important;
  -webkit-box-orient:vertical!important;
  color:rgba(220,233,251,.72)!important;
  font-size:8.5px!important;
  line-height:1.22!important;
}

/* ========================================================================
   SHARED LIGHT OPERATIONAL SECTIONS — RACE UNIVERSE VISUAL GRAMMAR
   ======================================================================== */
body[data-workspace-mode="race_profiler"] #page-builder > .section{
  position:relative!important;
  overflow:hidden!important;
  margin:11px 0!important;
  border:1px solid var(--rp-line)!important;
  border-radius:19px!important;
  background:linear-gradient(180deg,rgba(255,255,255,.91),rgba(247,250,255,.84))!important;
  box-shadow:var(--rp-shadow)!important;
}
body[data-workspace-mode="race_profiler"] #page-builder > .section > .section-header{
  position:relative!important;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:14px!important;
  min-height:58px!important;
  padding:10px 14px 10px 18px!important;
  border:0!important;
  border-bottom:1px solid rgba(76,109,203,.12)!important;
  color:var(--rp-ink)!important;
  background:
    radial-gradient(circle at 96% 0%,rgba(103,232,249,.09),transparent 34%),
    linear-gradient(180deg,rgba(255,255,255,.94),rgba(245,249,255,.82))!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.88)!important;
}
body[data-workspace-mode="race_profiler"] #page-builder > .section > .section-header::before{
  content:""!important;
  position:absolute!important;
  inset:9px auto 9px 0!important;
  width:4px!important;
  border-radius:0 5px 5px 0!important;
  background:linear-gradient(180deg,#27d4cc,#3c72e3 58%,#7757e8)!important;
  box-shadow:0 0 16px rgba(45,155,224,.28)!important;
}
body[data-workspace-mode="race_profiler"] #page-builder > .section > .section-header > div:first-child{
  min-width:0!important;
}
body[data-workspace-mode="race_profiler"] #page-builder .section-kicker{
  color:#3170af!important;
  font-size:8px!important;
  line-height:1.1!important;
  font-weight:950!important;
  letter-spacing:.15em!important;
  text-transform:uppercase!important;
}
body[data-workspace-mode="race_profiler"] #page-builder .section-title-row{
  gap:7px!important;
}
body[data-workspace-mode="race_profiler"] #page-builder .section-title{
  margin:2px 0 0!important;
  color:var(--rp-ink)!important;
  font-size:clamp(18px,1.3vw,22px)!important;
  line-height:1.06!important;
  letter-spacing:-.025em!important;
}
body[data-workspace-mode="race_profiler"] #page-builder .section-description{
  max-width:900px!important;
  margin:3px 0 0!important;
  color:var(--rp-copy)!important;
  font-size:10.5px!important;
  line-height:1.32!important;
}
body[data-workspace-mode="race_profiler"] #page-builder .section-header-actions,
body[data-workspace-mode="race_profiler"] #page-builder .profiler-header-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  flex:0 0 auto!important;
  gap:8px!important;
  margin:0!important;
  min-width:0!important;
  width:auto!important;
}
body[data-workspace-mode="race_profiler"] #page-builder :is(.profiler-section-toggle,.section-reset-button){
  width:auto!important;
  min-width:126px!important;
  min-height:34px!important;
  padding:7px 12px!important;
  border:1px solid rgba(63,106,207,.22)!important;
  border-radius:10px!important;
  background:linear-gradient(180deg,rgba(255,255,255,.96),rgba(240,246,255,.86))!important;
  color:#204d8e!important;
  box-shadow:0 7px 17px rgba(34,68,130,.07),inset 0 1px 0 rgba(255,255,255,.86)!important;
  font-size:9.5px!important;
  font-weight:900!important;
  letter-spacing:0!important;
  text-transform:none!important;
}
body[data-workspace-mode="race_profiler"] #page-builder :is(.profiler-section-toggle,.section-reset-button):hover{
  transform:translateY(-1px)!important;
  border-color:rgba(43,104,221,.38)!important;
  background:#fff!important;
}
body[data-workspace-mode="race_profiler"] #page-builder > .section > .section-body{
  padding:12px!important;
  background:transparent!important;
}

/* Cards and control groups: fewer nested visual layers. */
body[data-workspace-mode="race_profiler"] #page-builder > .section .card,
body[data-workspace-mode="race_profiler"] #page-builder > .section .time-block,
body[data-workspace-mode="race_profiler"] #page-builder > .section .range-card{
  border:1px solid rgba(73,109,203,.15)!important;
  border-radius:14px!important;
  background:linear-gradient(180deg,rgba(255,255,255,.90),rgba(247,250,255,.76))!important;
  box-shadow:0 7px 18px rgba(29,54,105,.045),inset 0 1px 0 rgba(255,255,255,.80)!important;
}
body[data-workspace-mode="race_profiler"] #page-builder > .section .card,
body[data-workspace-mode="race_profiler"] #page-builder > .section .time-block{
  padding:10px!important;
}
body[data-workspace-mode="race_profiler"] #page-builder .card-title,
body[data-workspace-mode="race_profiler"] #page-builder .range-title{
  color:#3e5578!important;
  font-size:9px!important;
  line-height:1.15!important;
  font-weight:950!important;
  letter-spacing:.105em!important;
  text-transform:uppercase!important;
}
body[data-workspace-mode="race_profiler"] #page-builder .note,
body[data-workspace-mode="race_profiler"] #page-builder .race-profiler-mini-note{
  color:#71839a!important;
  font-size:8.5px!important;
  line-height:1.28!important;
}
body[data-workspace-mode="race_profiler"] #page-builder .grid,
body[data-workspace-mode="race_profiler"] #page-builder .layout-grid{
  gap:9px!important;
}

/* Common profiler chips: premium selected state without orange saturation. */
body[data-workspace-mode="race_profiler"] #page-builder .chip{
  min-height:29px!important;
  padding:6px 10px!important;
  border:1px solid rgba(94,117,173,.20)!important;
  border-radius:999px!important;
  background:rgba(255,255,255,.88)!important;
  color:#213b62!important;
  box-shadow:0 5px 12px rgba(29,52,100,.035),inset 0 1px 0 rgba(255,255,255,.86)!important;
  font-size:9.5px!important;
  font-weight:850!important;
}
body[data-workspace-mode="race_profiler"] #page-builder .chip.selected:not(.disabled),
body[data-workspace-mode="race_profiler"] #page-builder .chip.active:not(.disabled){
  border-color:rgba(13,145,141,.45)!important;
  background:linear-gradient(180deg,rgba(230,253,249,.98),rgba(213,248,241,.90))!important;
  color:#08746f!important;
  box-shadow:0 7px 16px rgba(13,145,141,.09),inset 0 1px 0 rgba(255,255,255,.90)!important;
}
body[data-workspace-mode="race_profiler"] #page-builder .chip.disabled,
body[data-workspace-mode="race_profiler"] #page-builder .control-disabled .chip{
  opacity:.58!important;
  color:#8796aa!important;
  border-color:rgba(125,145,178,.13)!important;
  background:rgba(240,244,250,.68)!important;
}

/* ========================================================================
   PROFILE AREAS
   ======================================================================== */
body[data-workspace-mode="race_profiler"] #builder-actions .section-guide-cta{
  display:none!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions > .section-body{
  padding:12px!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .builder-action-grid.report-groups-layout{
  display:grid!important;
  grid-template-columns:minmax(245px,.52fr) minmax(560px,1.48fr)!important;
  align-items:start!important;
  gap:10px!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-control-card.polished-report-card{
  align-self:start!important;
  min-height:0!important;
  padding:10px!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions #proSnapshotCard,
body[data-workspace-mode="race_profiler"] #builder-actions .system-management-card{
  display:none!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-card-heading{
  margin-bottom:8px!important;
  font-size:9px!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-option-list{
  gap:8px!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-option{
  min-height:0!important;
  padding:9px 10px!important;
  border-radius:12px!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-option button{
  min-height:34px!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-option-copy{
  margin-top:7px!important;
  font-size:9.5px!important;
  line-height:1.34!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-table-groups-card.polished-groups-card{
  min-height:0!important;
  padding:10px!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-table-groups-header{
  margin-bottom:8px!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-table-groups-header p,
body[data-workspace-mode="race_profiler"] #builder-actions .report-table-groups-intro{
  max-width:780px!important;
  font-size:9.5px!important;
  line-height:1.35!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-table-groups-list{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:6px!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-group-toggle{
  min-height:34px!important;
  padding:7px 9px!important;
  border-radius:10px!important;
  font-size:9.5px!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-table-group-count{
  min-height:25px!important;
  padding:5px 8px!important;
  font-size:8.5px!important;
}
body[data-workspace-mode="race_profiler"] #builder-actions .report-table-groups-note{
  margin-top:7px!important;
  padding:6px 8px!important;
  font-size:8.5px!important;
}

/* ========================================================================
   TIME, RACE SETUP, CONDITIONS AND COURSE PROFILE
   ======================================================================== */
body[data-workspace-mode="race_profiler"] #time .time-strip{
  display:grid!important;
  grid-template-columns:minmax(300px,.9fr) minmax(300px,.8fr) minmax(440px,1.35fr)!important;
  gap:9px!important;
  padding:0!important;
}
body[data-workspace-mode="race_profiler"] #time .time-block.date-range{
  display:none!important;
}
body[data-workspace-mode="race_profiler"] #time .time-block{
  min-width:0!important;
}
body[data-workspace-mode="race_profiler"] #time .time-window .chips,
body[data-workspace-mode="race_profiler"] #time .day-week .chips{
  gap:7px!important;
}
body[data-workspace-mode="race_profiler"] #time .season-grid{
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:9px!important;
  margin-top:9px!important;
}
body[data-workspace-mode="race_profiler"] #time .season-grid .card:last-child{
  display:none!important;
}
body[data-workspace-mode="race_profiler"] #time .season-presets{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:7px!important;
}
body[data-workspace-mode="race_profiler"] #time .inline-inputs{
  gap:8px!important;
}
body[data-workspace-mode="race_profiler"] #time :is(select,input){
  min-height:32px!important;
  font-size:9.5px!important;
}

body[data-workspace-mode="race_profiler"] #race .race-meta-row1{
  grid-template-columns:minmax(340px,1.05fr) minmax(390px,1.2fr) minmax(220px,.55fr)!important;
}
body[data-workspace-mode="race_profiler"] #race .race-meta-ages{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
}
body[data-workspace-mode="race_profiler"] #race .race-meta-class-row{
  grid-template-columns:minmax(420px,1.05fr) minmax(500px,1.2fr)!important;
}
body[data-workspace-mode="race_profiler"] #race .meta-class,
body[data-workspace-mode="race_profiler"] #race .meta-class-subtypes{
  min-height:0!important;
}
body[data-workspace-mode="race_profiler"] #race .range-hybrid-control,
body[data-workspace-mode="race_profiler"] #race-conditions .range-hybrid-control,
body[data-workspace-mode="race_profiler"] #course-profile .range-hybrid-control{
  min-height:64px!important;
}
body[data-workspace-mode="race_profiler"] #page-builder .hybrid-summary-pill,
body[data-workspace-mode="race_profiler"] #page-builder .distance-summary-pill{
  min-height:36px!important;
  padding:6px 10px!important;
  border-radius:10px!important;
  font-size:9.5px!important;
}
body[data-workspace-mode="race_profiler"] #page-builder .distance-value-card,
body[data-workspace-mode="race_profiler"] #page-builder .hybrid-value-card{
  min-width:66px!important;
  padding:7px 8px!important;
  border-radius:11px!important;
}

body[data-workspace-mode="race_profiler"] #race-conditions .grid.race-top{
  grid-template-columns:minmax(620px,1.45fr) minmax(240px,.55fr)!important;
}
body[data-workspace-mode="race_profiler"] #race-conditions .grid.two{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
}
body[data-workspace-mode="race_profiler"] #race-conditions .grid.lower-two{
  grid-template-columns:minmax(620px,1.35fr) minmax(260px,.55fr) minmax(230px,.45fr)!important;
}
body[data-workspace-mode="race_profiler"] #race-conditions .condition-subtitle{
  margin:7px 0 5px!important;
  font-size:8.5px!important;
}
body[data-workspace-mode="race_profiler"] #race-conditions .runners-hybrid-card{
  padding:10px!important;
}
body[data-workspace-mode="race_profiler"] #race_profiler_official_rating_slot,
body[data-workspace-mode="race_profiler"] #num_fences_card{
  min-height:0!important;
}

body[data-workspace-mode="race_profiler"] #course-profile .course-top-context-row{
  grid-template-columns:minmax(380px,1.15fr) minmax(210px,.65fr) minmax(210px,.65fr) minmax(190px,.55fr)!important;
}
body[data-workspace-mode="race_profiler"] #course-profile .course-middle-context-row{
  grid-template-columns:minmax(520px,1.25fr) minmax(360px,.75fr)!important;
}
body[data-workspace-mode="race_profiler"] #course-profile .distance-range-card{
  padding:10px!important;
}
body[data-workspace-mode="race_profiler"] #course-profile .course-distance-presets{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
}
body[data-workspace-mode="race_profiler"] #course-profile .course-picker-button{
  min-height:32px!important;
  border-radius:10px!important;
}

/* ========================================================================
   OPTIONAL SECTIONS — COMPACT COLLAPSED ROWS, NORMAL OPEN WORKSPACES
   ======================================================================== */
body[data-workspace-mode="race_profiler"] .profiler-optional-section.profiler-collapsed{
  min-height:0!important;
  margin:9px 0!important;
  border-radius:16px!important;
}
body[data-workspace-mode="race_profiler"] .profiler-optional-section.profiler-collapsed > .section-header{
  min-height:58px!important;
  padding-top:9px!important;
  padding-bottom:9px!important;
  border-bottom:0!important;
}
body[data-workspace-mode="race_profiler"] .profiler-optional-section.profiler-collapsed .section-description{
  max-width:820px!important;
  white-space:normal!important;
}
body[data-workspace-mode="race_profiler"] .profiler-optional-section .profiler-header-actions,
body[data-workspace-mode="race_profiler"] .profiler-optional-section.profiler-collapsed .profiler-header-actions{
  gap:8px!important;
  flex-wrap:nowrap!important;
}
body[data-workspace-mode="race_profiler"] .profiler-optional-section .profiler-section-toggle,
body[data-workspace-mode="race_profiler"] .profiler-optional-section.profiler-collapsed .profiler-section-toggle{
  width:auto!important;
  min-width:150px!important;
}
body[data-workspace-mode="race_profiler"] .profiler-optional-section .section-reset-button,
body[data-workspace-mode="race_profiler"] .profiler-optional-section.profiler-collapsed .section-reset-button{
  width:auto!important;
  min-width:116px!important;
}

/* ========================================================================
   STICKY COMMAND DOCK
   ======================================================================== */
body[data-workspace-mode="race_profiler"] .builder-sticky-actions{
  bottom:12px!important;
  z-index:80!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  flex-wrap:wrap!important;
  gap:8px!important;
  padding:7px 10px!important;
  border:1px solid rgba(75,108,200,.18)!important;
  border-radius:18px!important;
  background:rgba(249,252,255,.90)!important;
  box-shadow:0 18px 42px rgba(17,31,70,.16),inset 0 1px 0 rgba(255,255,255,.92)!important;
  -webkit-backdrop-filter:blur(18px) saturate(145%)!important;
  backdrop-filter:blur(18px) saturate(145%)!important;
}
body[data-workspace-mode="race_profiler"] .builder-sticky-actions .btn{
  min-width:0!important;
  min-height:34px!important;
  padding:7px 13px!important;
  border-radius:10px!important;
  font-size:9.5px!important;
}
body[data-workspace-mode="race_profiler"] .builder-sticky-actions .sticky-divider{
  height:24px!important;
}

/* ========================================================================
   NAMED VIEWPORT CONTRACTS
   ======================================================================== */
@media(max-width:1700px){
  body[data-workspace-mode="race_profiler"] .race-profiler-section-map{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
  }
  body[data-workspace-mode="race_profiler"] #time .time-strip{
    grid-template-columns:minmax(300px,.9fr) minmax(300px,.8fr)!important;
  }
  body[data-workspace-mode="race_profiler"] #time .day-week{
    grid-column:1/-1!important;
  }
  body[data-workspace-mode="race_profiler"] #race .race-meta-row1{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  body[data-workspace-mode="race_profiler"] #race .meta-handicap{
    grid-column:1/-1!important;
  }
  body[data-workspace-mode="race_profiler"] #race-conditions .grid.lower-two{
    grid-template-columns:minmax(0,1fr) repeat(2,minmax(220px,.45fr))!important;
  }
  body[data-workspace-mode="race_profiler"] #course-profile .course-top-context-row{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}
@media(max-width:1350px){
  body[data-workspace-mode="race_profiler"] .race-profiler-cohort-head{
    grid-template-columns:1fr!important;
    align-items:start!important;
  }
  body[data-workspace-mode="race_profiler"] .race-profiler-cohort-actions{
    justify-content:flex-start!important;
    max-width:none!important;
  }
  body[data-workspace-mode="race_profiler"] .race-profiler-readiness{
    grid-template-columns:1fr!important;
  }
  body[data-workspace-mode="race_profiler"] .race-profiler-section-map{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  body[data-workspace-mode="race_profiler"] #builder-actions .builder-action-grid.report-groups-layout{
    grid-template-columns:1fr!important;
  }
  body[data-workspace-mode="race_profiler"] #builder-actions .report-control-card.polished-report-card{
    display:grid!important;
    grid-template-columns:170px minmax(0,1fr)!important;
    align-items:start!important;
    gap:8px!important;
  }
  body[data-workspace-mode="race_profiler"] #builder-actions .report-card-heading{
    grid-column:1/-1!important;
  }
  body[data-workspace-mode="race_profiler"] #builder-actions .report-option-list{
    grid-column:1/-1!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  body[data-workspace-mode="race_profiler"] #time .time-strip,
  body[data-workspace-mode="race_profiler"] #race .race-meta-ages,
  body[data-workspace-mode="race_profiler"] #race .race-meta-class-row,
  body[data-workspace-mode="race_profiler"] #race-conditions .grid.race-top,
  body[data-workspace-mode="race_profiler"] #race-conditions .grid.two,
  body[data-workspace-mode="race_profiler"] #course-profile .course-middle-context-row,
  body[data-workspace-mode="race_profiler"] #course-profile .course-distance-presets{
    grid-template-columns:1fr!important;
  }
  body[data-workspace-mode="race_profiler"] #time .day-week{
    grid-column:auto!important;
  }
  body[data-workspace-mode="race_profiler"] #race-conditions .grid.lower-two{
    grid-template-columns:1fr 1fr!important;
  }
  body[data-workspace-mode="race_profiler"] #race-conditions .runners-hybrid-card{
    grid-column:1/-1!important;
  }
}
@media(max-width:980px){
  body[data-workspace-mode="race_profiler"] #page-builder{
    padding-bottom:132px!important;
  }
  body[data-workspace-mode="race_profiler"] .race-profiler-section-map,
  body[data-workspace-mode="race_profiler"] .race-profiler-readiness-metrics,
  body[data-workspace-mode="race_profiler"] #builder-actions .report-table-groups-list,
  body[data-workspace-mode="race_profiler"] #builder-actions .report-option-list,
  body[data-workspace-mode="race_profiler"] #time .season-presets,
  body[data-workspace-mode="race_profiler"] #race .race-meta-row1,
  body[data-workspace-mode="race_profiler"] #course-profile .course-top-context-row,
  body[data-workspace-mode="race_profiler"] #race-conditions .grid.lower-two{
    grid-template-columns:1fr!important;
  }
  body[data-workspace-mode="race_profiler"] #page-builder > .section > .section-header{
    align-items:flex-start!important;
    flex-direction:column!important;
  }
  body[data-workspace-mode="race_profiler"] #page-builder .section-header-actions,
  body[data-workspace-mode="race_profiler"] #page-builder .profiler-header-actions{
    width:100%!important;
    justify-content:flex-start!important;
    flex-wrap:wrap!important;
  }
  body[data-workspace-mode="race_profiler"] .profiler-optional-section .profiler-header-actions,
  body[data-workspace-mode="race_profiler"] .profiler-optional-section.profiler-collapsed .profiler-header-actions{
    flex-wrap:wrap!important;
  }
  body[data-workspace-mode="race_profiler"] #page-builder :is(.profiler-section-toggle,.section-reset-button){
    min-width:0!important;
  }
  body[data-workspace-mode="race_profiler"] .builder-sticky-actions{
    bottom:8px!important;
  }
}
@media(max-width:700px){
  body[data-workspace-mode="race_profiler"] .race-profiler-cohort-actions{
    display:grid!important;
    grid-template-columns:1fr!important;
  }
  body[data-workspace-mode="race_profiler"] .race-profiler-cohort-actions > *{
    width:100%!important;
  }
  body[data-workspace-mode="race_profiler"] .builder-sticky-actions{
    justify-content:flex-start!important;
    overflow-x:auto!important;
    flex-wrap:nowrap!important;
  }
  body[data-workspace-mode="race_profiler"] .builder-sticky-actions .btn{
    flex:0 0 auto!important;
  }
}

/* ========================================================================
   SHARED EVIDENCE MODAL TOP-INSET CLOSEOUT
   The previous negative header margin assumed padded content. Current premium
   evidence modes use a zero-padding scroller, so the header was translated
   above the viewport. Keep Horse Profile unchanged; correct the affected modes.
   ======================================================================== */
#liveHorseFormModal:is(
  .is-trainer-stats,
  .is-jockey-stats,
  .is-sire-stats,
  .is-dam-sire-stats,
  .is-draw-stats
) .horse-drilldown-content{
  padding-top:0!important;
  scroll-padding-top:92px!important;
}
#liveHorseFormModal:is(
  .is-trainer-stats,
  .is-jockey-stats,
  .is-sire-stats,
  .is-dam-sire-stats,
  .is-draw-stats
) .horse-drilldown-modal-header{
  position:sticky!important;
  top:0!important;
  z-index:24!important;
  box-sizing:border-box!important;
  width:100%!important;
  margin:0!important;
  transform:none!important;
}
#liveHorseFormModal:is(
  .is-trainer-stats,
  .is-jockey-stats,
  .is-sire-stats,
  .is-dam-sire-stats,
  .is-draw-stats
).fullscreen .horse-drilldown-modal,
#liveHorseFormModal:is(
  .is-trainer-stats,
  .is-jockey-stats,
  .is-sire-stats,
  .is-dam-sire-stats,
  .is-draw-stats
) .horse-drilldown-modal{
  align-self:stretch!important;
  margin-top:0!important;
}

@media(prefers-reduced-motion:reduce){
  body[data-workspace-mode="race_profiler"] :is(button,.chip){
    transition:none!important;
  }
  body[data-workspace-mode="race_profiler"] :is(button,.chip):hover{
    transform:none!important;
  }
}
