/* Reference-matched RacingLens theme. Image 1 supplies color; image 2 supplies Race Desk placement. */
:root {
  --page:#eff7f9; --surface:#fbf8f1; --surface-muted:#fefdf9;
  --ink:#102f4c; --muted:#536a79; --line:#b9cbd1; --line-soft:#dbe5e7;
  --blue:#0b7082; --blue-soft:#eaf1f1; --green:#126e68; --green-soft:#e9f4f0;
  --a:#0b7082; --b:#338cea;
  --shadow-sm:0 2px 12px rgba(16,47,76,.06);
  --shadow-md:0 16px 42px rgba(16,47,76,.10);
}
html,body { background:var(--page); color:var(--ink); }
a { color:var(--blue); }
button:focus-visible,a:focus-visible,select:focus-visible,summary:focus-visible,[tabindex]:focus-visible {
  outline-color:#0b7082;
}
.site-header {
  border-bottom:1px solid var(--line);
  background:#fbf8f1;
  box-shadow:0 2px 14px rgba(16,47,76,.06);
}
.site-header .brand {
  position:relative; display:block; flex:0 0 auto; width:246px;
  aspect-ratio:auto; height:128px; min-height:0; overflow:hidden;
  background:transparent; box-shadow:none;
}
.site-header .brand-logo {
  position:absolute; display:block; inset:0; width:100%; max-width:100%; height:100%;
  object-fit:contain;
}
.section-label { color:#0b7082; }
.guide-link,.admin-console-link,.live-button,.account-menu summary {
  border-color:var(--line-soft); background:#fefdf9; color:var(--ink); box-shadow:none;
}
.guide-link:hover,.admin-console-link:hover,.live-button:hover { border-color:#8caeb7; background:#eaf1f1; }
.language-switch { border-color:var(--line); background:#fefdf9; }
.language-switch button { color:var(--ink); }
.language-switch button[aria-pressed="true"] { background:var(--ink); color:#fff; }
.status-muted,.readiness-chip { background:#eaf1f1; color:#365567; }
.readiness-details,.account-popover { border-color:var(--line); background:#fefdf9; color:var(--ink); }
.meeting-toolbar,.workspace-page-header,.race-summary,.analysis-panel,.runner-panel,.quality-panel,
.intelligence-panel,.insight-audience-panel,.home-decision-summary,.home-race-day-card,.home-tips-card,
.home-insight-panel,.pairings-panel,.database-explorer,.selection-card {
  border-color:var(--line-soft); background:#fefdf9; color:var(--ink);
}
.meeting-hero,.workspace-page-header { background:#fbf8f1; }
.site-footer { border-top:1px solid #102f4c; background:#102f4c; color:#eaf1f1; }
.site-footer p { color:#eaf1f1; }
select,input,textarea { border-color:var(--line); background:#fefdf9; color:var(--ink); }
.insights-hero { background:#102f4c; color:#fefdf9; }
.insights-kicker { color:#9bcad0; }
.insights-hero p { color:#e1eaea; }
.audience-switcher button[aria-selected=true] { border-color:#0b7082; background:#eaf1f1; box-shadow:none; }
.selection-primary { border-color:#b9d3d5; border-top-color:#0b7082; background:#f8fcfa; }
.selection-metric { background:#eaf1f1; }
.selection-metric strong,.desk-field-probability { color:#0b7082; }
.selection-price { background:#fefdf9; }
.selection-price strong { color:#102f4c; }
.selection-confidence-notice,.selection-limitation { border-color:#d8c9ac; background:#fcf6e8; color:#645039; }

/* Race Desk has exactly one race selector: left rail on desktop, top row on phones. */
body[data-workspace="insights"] .site-header {
  display:grid; grid-template-columns:auto minmax(300px,1fr) auto;
  align-items:center; gap:16px; min-height:72px; padding:8px clamp(16px,2vw,32px);
  -webkit-backdrop-filter:none; backdrop-filter:none;
}
body[data-workspace="insights"] .site-header .brand { white-space:nowrap; }
body[data-workspace="insights"] .header-actions { flex-wrap:nowrap; gap:5px; }
body[data-workspace="insights"] #insights-nav-link { display:none; }
body[data-workspace="insights"] .guide-link,
body[data-workspace="insights"] .admin-console-link,
body[data-workspace="insights"] .live-button { width:36px; min-width:36px; min-height:36px; padding:0; }
body[data-workspace="insights"] .guide-link span,
body[data-workspace="insights"] .admin-console-link span,
body[data-workspace="insights"] .live-button span { display:none; }
body[data-workspace="insights"] .status-chip { max-width:135px; overflow:hidden; font-size:11px; text-overflow:ellipsis; }
body[data-workspace="insights"] .readiness-status { max-width:200px; }
body[data-workspace="insights"] .readiness-chip { padding:5px 6px; font-size:10px; }
body[data-workspace="insights"] .audience-switcher {
  display:flex; justify-content:center; gap:2px; min-width:0; padding:0; border:0;
  border-radius:0; background:transparent; box-shadow:none;
}
body[data-workspace="insights"] .audience-switcher button {
  display:flex; flex:0 1 auto; align-items:center; justify-content:center; gap:5px;
  min-width:0; min-height:47px; padding:7px 11px;
  border:0; border-bottom:2px solid transparent; border-radius:0;
  background:transparent; color:var(--ink); box-shadow:none; transform:none;
}
body[data-workspace="insights"] .audience-switcher button:hover { background:#f1f2ed; color:#0b7082; }
body[data-workspace="insights"] .audience-switcher button[aria-selected=true] {
  border-bottom-color:#0b7082; background:transparent; color:#0b7082;
}
body[data-workspace="insights"] .audience-number { display:none; }
body[data-workspace="insights"] .audience-switcher strong { font-size:13px; font-weight:700; }
body[data-workspace="insights"] .app-shell { width:min(1536px,calc(100% - 28px)); padding-top:14px; }
body[data-workspace="insights"] #dashboard {
  display:grid; grid-template-columns:168px minmax(0,1fr);
  grid-template-rows:auto minmax(0,1fr); gap:0;
  border:1px solid var(--line); border-radius:13px; background:#fefdf9;
  box-shadow:0 12px 32px rgba(16,47,76,.08);
}
body[data-workspace="insights"] #race-nav {
  grid-column:1; grid-row:1 / span 2; position:sticky; top:86px!important;
  align-self:start; width:100%; min-height:calc(100dvh - 110px);
  margin:0; padding:20px 10px; border:0; border-radius:12px 0 0 12px;
  background:#102f4c; color:#fefdf9; box-shadow:none;
}
body[data-workspace="insights"] .race-nav-label {
  margin:0 0 15px 8px; color:#d6e2e4; font-size:11px; letter-spacing:.08em;
}
body[data-workspace="insights"] .race-tabs { display:grid; gap:3px; overflow:visible; }
body[data-workspace="insights"] .race-tab {
  width:100%; min-width:0; min-height:47px; padding:7px 12px;
  border-radius:5px; color:#dce9eb;
}
body[data-workspace="insights"] .race-tab strong { font-size:14px; }
body[data-workspace="insights"] .race-tab span { color:#b6ccd3; font-size:11px; }
body[data-workspace="insights"] .race-tab:hover { background:#234e67; color:#fff; }
body[data-workspace="insights"] .race-tab[aria-selected=true] {
  border-left:3px solid #7bc1c7; background:#0b7082; color:#fff;
}
body[data-workspace="insights"] .race-tab[aria-selected=true] span { color:#e6f3f4; }
/* Focus race numbers stay readable when mobile tabs use dark text by default. */
body[data-workspace="insights"] .race-tab.is-meeting-focus:not([aria-selected=true]) { border-left:3px solid #d7b15c; background:#234960; color:#fff; }
body[data-workspace="insights"] .race-tab.is-meeting-focus strong { color:#fff; }
body[data-workspace="insights"] .race-tab.is-meeting-focus[aria-selected=true] { border-left-color:#e1c170; }
body[data-workspace="insights"] .race-tab .race-focus-tag { display:inline-block; width:max-content; margin-top:2px; padding:2px 6px; border-radius:4px; background:#f9e9bd; color:#644d18; font-size:10px; font-weight:800; line-height:1.2; }
body[data-workspace="insights"] .race-tab[aria-selected=true] .race-focus-tag { color:#644d18; }
body[data-workspace="insights"] #meeting-toolbar {
  grid-column:2; grid-row:1;
  display:grid; grid-template-columns:minmax(220px,1.1fr) minmax(290px,1.4fr) auto;
  align-items:center; gap:12px; min-width:0; margin:0; padding:18px 20px;
  border:0; border-bottom:1px solid var(--line); border-radius:0 12px 0 0;
  background:#fbf8f1; box-shadow:none;
}
body[data-workspace="insights"] #meeting-toolbar .toolbar-heading { display:none; }
.race-desk-context { display:none; }
body[data-workspace="insights"] .race-desk-context {
  display:block; min-width:0; margin:0; color:#102f4c;
  font-family:Georgia,"Noto Serif TC",serif; font-size:16px; font-weight:700;
  line-height:1.4; overflow-wrap:anywhere;
}
body[data-workspace="insights"] #meeting-toolbar .meeting-selects { gap:7px; }
body[data-workspace="insights"] #meeting-toolbar select {
  height:39px; border-color:var(--line); border-radius:5px; background:#fefdf9; font-size:12px;
}
body[data-workspace="insights"] #meeting-toolbar .meeting-toolbar-side { gap:2px; }
body[data-workspace="insights"] #meeting-toolbar .calendar-note { max-width:200px; font-size:10px; }
body[data-workspace="insights"] #workspace-page-header { display:none!important; }
body[data-workspace="insights"] #insights-workspace {
  grid-column:2; grid-row:2; min-width:0; gap:0; padding:0; background:#fefdf9;
}
body[data-workspace="insights"] .insights-hero,
body[data-workspace="insights"] #insight-newbie-panel > .insight-panel-heading {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}
body[data-workspace="insights"] #insight-newbie-panel {
  padding:16px 14px 24px; border:0; border-radius:0 0 12px 0;
  background:#fefdf9; box-shadow:none;
}
body[data-workspace="insights"] .newbie-layout {
  grid-template-columns:minmax(0,1fr) minmax(255px,30%);
  grid-template-areas:"picks inspector" "shortlist inspector" "detail inspector";
  align-items:start; gap:10px 12px;
}
body[data-workspace="insights"] .race-desk-pick {
  grid-template-columns:minmax(160px,1fr) auto auto; gap:3px 12px;
  min-height:87px; padding:10px 14px; border:1px solid #c8dce0;
  border-left:4px solid #6ea3b0; border-radius:6px;
  background:#fefdf9; box-shadow:none;
}
body[data-workspace="insights"] .race-desk-pick.selection-primary {
  border-left-color:#0b7082; background:#f8fcfa;
}
body[data-workspace="insights"] .race-desk-pick .selection-role {
  color:#0b7082; font-size:10px; letter-spacing:.06em;
}
body[data-workspace="insights"] .race-desk-pick h3 {
  display:flex; align-items:baseline; gap:12px; margin:1px 0;
  color:#102f4c; font-family:Georgia,"Noto Serif TC",serif; line-height:1.15;
}
.desk-horse-no { font-size:clamp(22px,2vw,29px); font-weight:700; }
.desk-horse-name { min-width:0; font-size:clamp(15px,1.2vw,18px); overflow-wrap:anywhere; }
body[data-workspace="insights"] .race-desk-pick .selection-metric { border-color:var(--line-soft); }
body[data-workspace="insights"] .race-desk-pick .selection-metric strong { color:#0b7082; font-size:20px; }
body[data-workspace="insights"] .race-desk-pick .selection-market { border-color:var(--line-soft); }
body[data-workspace="insights"] .race-desk-pick .selection-price strong { color:#102f4c; }
body[data-workspace="insights"] .desk-inspect-action { color:#0b7082; }
.race-desk-inspector {
  position:sticky; top:86px; border-color:#d8e4e6; border-radius:6px;
  background:#eaf1f1;
}
.race-desk-inspector h3 { color:#102f4c; font-family:Georgia,"Noto Serif TC",serif; }
.race-desk-inspector .horse-evidence-factor { border-color:#dce6e6; background:#fefdf9; }
.race-desk-inspector .selection-limitation { border-color:#ba6d49; background:#fcf5ec; }
.desk-inspector-close {
  position:absolute; top:10px; right:10px; display:grid; place-items:center;
  width:34px; height:34px; min-height:34px; border:0; border-radius:5px;
  background:transparent; color:#536a79; font-size:22px; line-height:1;
}
.desk-inspector-close:hover { background:#dce9e9; color:#102f4c; }
.race-desk-shortlist,.race-desk-field {
  border-color:#d7e2e3; border-radius:6px; background:#fefdf9;
}
.desk-shortlist-item { border-color:#d6e3e4; background:#f3f8f8; }
.desk-shortlist-item strong { background:#e2f1f1; color:#102f4c; }
.desk-shortlist-item[aria-pressed=true] { border-color:#0b7082; background:#eaf4f2; }
.desk-field-table { color:#102f4c; }
.desk-field-table th { background:#f5f8f7; color:#365567; }
.desk-field-table tbody tr:hover { background:#f1f8f8; }
.desk-field-table tbody tr:has(.desk-field-badge) { background:#f8fcfb; }
.desk-field-badge {
  display:inline-block; margin-left:8px; padding:3px 5px; border-radius:3px;
  background:#0b7082; color:#fff; font-size:10px; font-weight:700;
}
.desk-field-badge.is-alternative { background:#6e9db5; }
.desk-field-pending { border-color:#b87851; background:#fcf5ec; }
body[data-workspace="insights"] .audience-switcher strong { white-space:nowrap; }
@media (max-width:1200px) and (min-width:761px) {
  body[data-workspace="insights"] .site-header { grid-template-columns:auto 1fr; gap:4px 12px; }
  body[data-workspace="insights"] .audience-switcher { grid-column:1 / -1; grid-row:2; justify-content:flex-start; }
  body[data-workspace="insights"] .header-actions { justify-self:end; }
  body[data-workspace="insights"] #dashboard { grid-template-columns:136px minmax(0,1fr); }
  body[data-workspace="insights"] #race-nav { top:137px!important; }
  body[data-workspace="insights"] #meeting-toolbar { grid-template-columns:1fr 1fr; }
  body[data-workspace="insights"] .race-desk-context { grid-column:1 / -1; }
  body[data-workspace="insights"] .race-desk-inspector { top:137px; }
}
@media (max-width:760px) {
  body[data-workspace="insights"] .app-shell { width:calc(100% - 16px); padding:8px 0 100px; }
  body[data-workspace="insights"][data-presentation-rollout="true"] .site-header,
  body[data-workspace="insights"] .site-header {
    display:grid!important; grid-template-columns:44px minmax(90px,1fr) repeat(2,36px)!important;
    grid-template-rows:44px auto!important; align-items:center; gap:4px!important;
    min-height:0; padding:6px 8px!important; overflow:visible;
  }
  body[data-workspace="insights"][data-presentation-rollout="true"] .header-actions,
  body[data-workspace="insights"] .header-actions { display:contents!important; }
  body[data-workspace="insights"][data-presentation-rollout="true"] .brand,
  body[data-workspace="insights"] .brand {
    grid-column:1!important; grid-row:1!important; width:44px; min-width:44px;
  }
  body[data-workspace="insights"] .brand-copy { display:none!important; }
  body[data-workspace="insights"] .language-switch {
    grid-column:2!important; grid-row:1!important; justify-self:start;
    max-width:100px; padding:2px; border-radius:6px;
  }
  body[data-workspace="insights"] .language-switch button {
    min-height:34px; padding:3px 6px; font-size:0;
  }
  body[data-workspace="insights"] .language-switch button[data-language="zh-HK"]::after { content:"繁中"; font-size:13px; }
  body[data-workspace="insights"] .language-switch button[data-language="en-HK"]::after { content:"English"; font-size:13px; }
  body[data-workspace="insights"] .guide-link { grid-column:3!important; grid-row:1!important; }
  body[data-workspace="insights"] .account-menu { grid-column:4!important; grid-row:1!important; justify-self:center; }

  body[data-workspace="insights"] .admin-console-link { grid-column:1!important; grid-row:2!important; width:36px; min-width:36px; }
  body[data-workspace="insights"] #freshness-chip {
    grid-column:2 / 3!important; grid-row:2!important; justify-self:start;
    max-width:100%; min-height:31px; padding:4px 6px;
  }
  body[data-workspace="insights"] .readiness-status {
    grid-column:3 / -1!important; grid-row:2!important; width:100%; max-width:none;
  }
  body[data-workspace="insights"] .readiness-indicators {
    display:flex!important; flex-wrap:nowrap; gap:2px; min-width:0; overflow:hidden;
  }
  body[data-workspace="insights"] .readiness-chip {
    min-width:0; max-width:50px; overflow:hidden; white-space:nowrap!important;
    text-overflow:ellipsis; font-size:9px;
  }
  body[data-workspace="insights"] .readiness-details {
    position:fixed; top:85px; left:8px; right:8px; width:auto; max-height:calc(100vh - 100px);
  }
  body[data-workspace="insights"] .audience-switcher {
    position:fixed; z-index:65; right:0; bottom:0; left:0; grid-column:auto; grid-row:auto;
    justify-content:space-around; min-height:65px;
    padding:4px 5px max(4px,env(safe-area-inset-bottom));
    border-top:1px solid var(--line); background:#fefdf9;
    box-shadow:0 -5px 22px rgba(16,47,76,.12);
  }
  body[data-workspace="insights"] .audience-switcher button {
    flex:1 1 0; flex-direction:column; gap:1px; min-height:54px; padding:5px 2px;
    border-bottom:0; border-top:3px solid transparent;
  }
  body[data-workspace="insights"] .audience-switcher button[aria-selected=true] { border-top-color:#0b7082; }
  body[data-workspace="insights"] .audience-number { display:block; color:#0b7082; font-size:10px; }
  body[data-workspace="insights"] .audience-switcher strong { font-size:11px; }
  body[data-workspace="insights"] #dashboard {
    display:grid; grid-template-columns:minmax(0,1fr);
    grid-template-rows:auto auto minmax(0,1fr); gap:0;
  }
  body[data-workspace="insights"] #meeting-toolbar {
    grid-column:1; grid-row:1; display:grid; grid-template-columns:1fr;
    gap:6px; padding:10px; border-radius:12px 12px 0 0;
  }
  body[data-workspace="insights"] .race-desk-context { font-size:13px; }
  body[data-workspace="insights"] #meeting-toolbar .meeting-selects { grid-template-columns:1fr 1.25fr; }
  body[data-workspace="insights"] #meeting-toolbar .meeting-toolbar-side { display:none; }
  body[data-workspace="insights"] #race-nav {
    grid-column:1; grid-row:2; position:relative; top:auto!important;
    min-height:0; max-height:none; overflow:visible;
    padding:5px; border-radius:0; background:#fbf8f1;
  }
  body[data-workspace="insights"] .race-nav-label { display:none; }
  body[data-workspace="insights"] .race-tabs {
    display:flex; gap:4px; overflow-x:auto; scrollbar-width:thin;
  }
  body[data-workspace="insights"] .race-tab {
    display:grid; place-items:center; flex:0 0 auto; width:45px; min-width:45px;
    min-height:42px; padding:5px; border:1px solid var(--line-soft);
    border-radius:5px; background:#fefdf9; color:#102f4c;
  }
  body[data-workspace="insights"] .race-tab[aria-selected=true] {
    border:1px solid #0b7082; background:#0b7082; color:#fff;
  }
  body[data-workspace="insights"] .race-tab span { display:none; }
  body[data-workspace="insights"] .race-tab.is-meeting-focus { width:64px; min-width:64px; min-height:54px; border-color:#c09643; }
  body[data-workspace="insights"] .race-tab .race-focus-tag { display:inline-block; margin-top:0; padding:2px 4px; font-size:11px; }
  body[data-workspace="insights"] #insights-workspace { grid-column:1; grid-row:3; }
  body[data-workspace="insights"] #insight-newbie-panel { padding:9px; }
  body[data-workspace="insights"] .newbie-layout {
    grid-template-columns:1fr;
    grid-template-areas:"picks" "shortlist" "inspector" "detail";
    gap:7px;
  }
  body[data-workspace="insights"] .race-desk-pick {
    grid-template-columns:minmax(0,1fr) auto; gap:3px 7px; min-height:0; padding:10px;
  }
  body[data-workspace="insights"] .race-desk-pick h3 { gap:8px; }
  .desk-horse-no { font-size:22px; }
  .desk-horse-name { font-size:16px; }
  body[data-workspace="insights"] .race-desk-pick .selection-metrics {
    grid-column:1 / -1; grid-row:3;
  }
  body[data-workspace="insights"] .race-desk-pick .selection-market {
    grid-column:1 / -1; grid-row:4; padding:5px 8px;
    border:1px solid var(--line-soft); border-radius:4px; background:#eaf1f1;
  }
  body[data-workspace="insights"] .race-desk-pick .desk-inspect-action { grid-row:5; }
  .race-desk-inspector { position:relative; max-height:none; }
}
@media (max-width:350px) {
  body[data-workspace="insights"] .site-header {
    grid-template-columns:40px minmax(64px,1fr) repeat(2,34px)!important;
  }
  body[data-workspace="insights"] .language-switch button { padding:2px 4px; }
  body[data-workspace="insights"] .readiness-chip { max-width:38px; }
}

/* Preserve native hidden state despite high-specificity layout rules. */
[hidden] { display:none!important; }
.race-desk-pending-card {
  padding:16px 18px; border:1px solid #cadbdd; border-left:4px solid #0b7082;
  border-radius:6px; background:#f5f9f7; color:#102f4c;
}
.race-desk-pending-card strong { display:block; font-size:18px; font-family:Georgia,"Noto Serif TC",serif; }
.race-desk-pending-card p { margin:5px 0 0; color:#536a79; }
.race-desk-pending-card .insight-retry-button { margin-top:10px; }

@media (min-width:761px) {
  body[data-workspace="insights"] .newbie-layout:has(> .race-desk-inspector[hidden]) {
    grid-template-columns:minmax(0,1fr);
    grid-template-areas:"picks" "shortlist" "detail";
  }
}
/* Keep the mobile status readable and all primary actions on one row. */
@media (max-width:760px) {
  body[data-workspace="insights"][data-presentation-rollout="true"] .site-header,
  body[data-workspace="insights"] .site-header {
    grid-template-columns:44px minmax(64px,1fr) repeat(3,36px)!important;
    grid-template-rows:44px auto!important; gap:4px!important;
  }
  body[data-workspace="insights"] .guide-link { grid-column:3!important; grid-row:1!important; }
  body[data-workspace="insights"] .admin-console-link { grid-column:4!important; grid-row:1!important; width:36px; min-width:36px; }
  body[data-workspace="insights"] .account-menu { grid-column:5!important; grid-row:1!important; }

  body[data-workspace="insights"] #freshness-chip { display:none!important; }
  body[data-workspace="insights"] .readiness-status { grid-column:1 / -1!important; grid-row:2!important; width:100%; max-width:none; }
  body[data-workspace="insights"] .readiness-status summary {
    display:flex; align-items:center; min-height:34px; padding:3px 10px;
    border:1px solid var(--line-soft); border-radius:5px; background:#eaf1f1;
  }
  body[data-workspace="insights"] .readiness-indicators { display:flex!important; align-items:center; width:100%; gap:4px; overflow:visible; }
  body[data-workspace="insights"] .readiness-chip { display:none!important; }
  body[data-workspace="insights"] .readiness-chip:first-child {
    display:block!important; flex:1 1 auto; min-width:0; max-width:none;
    overflow:hidden; padding:3px 0; background:transparent;
    font-size:11px; text-overflow:ellipsis; white-space:nowrap!important;
  }
  body[data-workspace="insights"] .readiness-indicators::after {
    position:static; flex:0 0 auto; padding:0;
    content:"詳情 ▾"; color:#0b7082; font-size:11px; font-weight:700;
  }
  body[data-language="en-HK"][data-workspace="insights"] .readiness-indicators::after { content:"Details ▾"; }
  body[data-workspace="insights"] .readiness-details {
    top:calc(var(--racelens-header-height, 96px) + 6px);
    max-height:calc(100dvh - var(--racelens-header-height, 96px) - 18px);
  }
}

@media (max-width:760px) { .race-desk-inspector, .desk-inspector-close { scroll-margin-top:120px; } }
/* Revised no-selection rankings contain a wide table. Keep it inside the
   mobile shortlist grid so only the table scrolls, never the whole page. */
@media (max-width:760px) {
  body[data-workspace="insights"] #insight-newbie-shortlist:has(> .declaration-comparison) {
    grid-template-columns:minmax(0,1fr);
  }
  body[data-workspace="insights"] .race-revision-panel,
  body[data-workspace="insights"] .race-revision-panel .race-desk-pending-card {
    min-width:0; max-width:100%;
  }
  body[data-workspace="insights"] .race-revision-panel .desk-field-scroll {
    box-sizing:border-box; width:100%; min-width:0; max-width:100%;
    overflow-x:auto;
  }
}
/* Keep runner identity visible while the wide odds and probability columns scroll. */
@media (max-width:760px) {
  body[data-workspace="insights"] .desk-field-scroll {
    max-width:100%; overflow-x:auto; overscroll-behavior-x:contain;
    -webkit-overflow-scrolling:touch;
  }
  body[data-workspace="insights"] .desk-field-table {
    width:max(100%, 590px); min-width:590px;
    table-layout:fixed; border-collapse:separate; border-spacing:0;
  }
  body[data-workspace="insights"] .desk-field-table th,
  body[data-workspace="insights"] .desk-field-table td { box-sizing:border-box; }
  body[data-workspace="insights"] .desk-field-table th:first-child,
  body[data-workspace="insights"] .desk-field-table td:first-child {
    position:sticky; left:0; z-index:2; width:34px; min-width:34px; max-width:34px;
    padding-right:3px; padding-left:3px; background:#fefdf9;
  }
  body[data-workspace="insights"] .desk-field-table th:nth-child(2),
  body[data-workspace="insights"] .desk-field-table td:nth-child(2) {
    position:sticky; left:34px; z-index:2; width:132px; min-width:132px; max-width:132px;
    white-space:normal; overflow-wrap:anywhere; line-height:1.3;
    background:#fefdf9; box-shadow:2px 0 3px rgba(16,47,76,.09);
  }
  body[data-workspace="insights"] .desk-field-table th:first-child,
  body[data-workspace="insights"] .desk-field-table th:nth-child(2) {
    z-index:3; background:#f5f8f7;
  }
  body[data-workspace="insights"] .desk-field-table tbody tr:hover td:first-child,
  body[data-workspace="insights"] .desk-field-table tbody tr:hover td:nth-child(2) { background:#f1f8f8; }
  body[data-workspace="insights"] .desk-field-table tbody tr:has(.desk-field-badge) td:first-child,
  body[data-workspace="insights"] .desk-field-table tbody tr:has(.desk-field-badge) td:nth-child(2) { background:#f8fcfb; }
  body[data-workspace="insights"] .desk-field-badge {
    display:block; width:max-content; max-width:100%; margin:3px 0 0;
  }
}

/* Ma King Insight preview wordmark accent. */
.brand-lab { color: #c59118; }

/* Ma King Insight readable race desk preview. Keep the logo lockup, but use one
   bilingual sans-serif system for every decision and data surface. */
html { font-size:100%; }
body {
  font-family:"Segoe UI","PingFang HK","Microsoft JhengHei UI","Noto Sans TC",sans-serif;
  font-size:16px; line-height:1.55;
  -webkit-text-size-adjust:100%; text-size-adjust:100%;
}
body[data-workspace="insights"] :is(.race-desk-context,.insights-hero h1,
  .insight-panel-heading h2,.race-desk-pick h3,.race-desk-inspector h3,
  .desk-section-heading h3,.race-desk-pending-card strong) {
  font-family:inherit; letter-spacing:normal;
}
body[data-workspace="insights"] :is(.race-desk-pick,.race-desk-inspector,
  .race-desk-shortlist,.race-desk-field,.desk-field-table) {
  line-height:1.5;
}
body[data-workspace="insights"] :is(.newbie-layout,.beginner-selection-grid,
  .race-desk-pick,.race-desk-shortlist,.race-desk-field,.race-desk-inspector,
  .desk-field-scroll) { min-width:0; max-width:100%; box-sizing:border-box; }
body[data-workspace="insights"] .desk-field-scroll {
  width:100%; overflow-x:auto; overscroll-behavior-x:contain;
}
body[data-workspace="insights"] :is(.selection-metric strong,.selection-price strong,
  .desk-field-table,.readiness-chip,.status-chip) { font-variant-numeric:tabular-nums; }

/* Status, meeting and race navigation must be readable before opening a card. */
body[data-workspace="insights"] .status-chip {
  max-width:230px; font-size:13px; line-height:1.35;
}
body[data-workspace="insights"] .readiness-chip { font-size:13px; line-height:1.4; }
body[data-workspace="insights"] .audience-switcher strong { font-size:14px; }
body[data-workspace="insights"] .race-nav-label { font-size:13px; letter-spacing:normal; }
body[data-workspace="insights"] .race-tab strong { font-size:16px; }
body[data-workspace="insights"] .race-tab span { font-size:13px; }
body[data-workspace="insights"] .race-tab .race-focus-tag { font-size:12px; }
body[data-workspace="insights"] .race-desk-context { font-size:18px; line-height:1.45; }
body[data-workspace="insights"] #meeting-toolbar select {
  height:44px; font-size:15px; line-height:1.4;
}
body[data-workspace="insights"] #meeting-toolbar .calendar-note { font-size:13px; }

/* The horse and its own model/market figures are the primary scan targets. */
body[data-workspace="insights"] .race-desk-pick {
  grid-template-columns:minmax(0,1fr) auto;
  min-height:118px; gap:6px 14px; padding:14px 16px;
}
body[data-workspace="insights"] .race-desk-pick .selection-role {
  font-size:13px; letter-spacing:normal;
}
.desk-horse-no { font-size:clamp(26px,2.2vw,32px); }
.desk-horse-name { font-size:clamp(18px,1.55vw,22px); line-height:1.35; }
body[data-workspace="insights"] .race-desk-pick .selection-metric span,
body[data-workspace="insights"] .race-desk-pick .selection-price span,
body[data-workspace="insights"] .race-desk-pick .selection-market > .selection-section-label {
  color:#365567; font-size:13px; line-height:1.4;
}
body[data-workspace="insights"] .race-desk-pick .selection-metric strong,
body[data-workspace="insights"] .race-desk-pick .selection-price strong {
  font-size:25px; line-height:1.15;
}
body[data-workspace="insights"] .race-desk-pick .selection-metrics {
  grid-column:2; grid-row:1 / span 2; gap:8px;
}
body[data-workspace="insights"] .race-desk-pick .selection-market {
  grid-column:1 / -1; grid-row:3; width:auto; min-width:0;
  margin-top:6px; padding:12px 0 0; border:0;
  border-top:1px solid var(--line-soft);
}
body[data-workspace="insights"] .race-desk-pick .selection-prices {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px;
}
body[data-workspace="insights"] .race-desk-pick .selection-price {
  display:grid; align-content:start; gap:2px; min-width:0;
}
body[data-workspace="insights"] .race-desk-pick .selection-price small {
  display:block; color:#365567; font-size:13px; line-height:1.4;
  white-space:normal; overflow-wrap:anywhere;
}
body[data-workspace="insights"] .race-desk-pick .desk-inspect-action {
  grid-row:4; min-height:44px; font-size:14px;
}

/* Supporting evidence is subordinate, never microscopic. */
.race-desk-inspector { gap:11px; padding:18px; }
.race-desk-inspector h3 { font-size:21px; line-height:1.3; }
.desk-inspector-context,
.race-desk-inspector .context-evidence-block > span,
.race-desk-inspector .horse-evidence-factor strong,
.race-desk-inspector .horse-evidence-factor small,
.race-desk-inspector .horse-evidence-factor p,
.race-desk-inspector .selection-limitation,
.race-desk-inspector .selection-evidence summary,
.desk-inspector-caveat { font-size:14px; line-height:1.55; }
.race-desk-inspector .horse-evidence-factor { padding:12px; }
.race-desk-inspector .context-evidence-block > span { font-size:14px!important; }
.race-desk-inspector .context-evidence-block p { font-size:14px; line-height:1.55; }
.desk-inspector-close { width:44px; height:44px; min-height:44px; }
.desk-section-heading h3 { font-size:19px; }
.desk-section-heading p,
body[data-workspace="insights"] .newbie-shortlist > .prepared-view-note,
.desk-field-market-status,.desk-field-note,.desk-field-pending,
.race-desk-empty { font-size:14px; line-height:1.5; }
.desk-shortlist-item { font-size:14px; }
.desk-shortlist-item strong { font-size:14px; }
.desk-field-table { min-width:720px; font-size:14px; }
.desk-field-table th,.desk-field-table td { padding:10px 8px; }
.desk-field-badge { font-size:12px; }

@media (max-width:760px) {
  body[data-workspace="insights"] .newbie-layout {
    grid-template-columns:minmax(0,1fr);
  }
  body[data-workspace="insights"][data-presentation-rollout="true"] .site-header,
  body[data-workspace="insights"] .site-header {
    grid-template-columns:44px minmax(64px,1fr) repeat(3,44px)!important;
  }
  body[data-workspace="insights"] .guide-link,
  body[data-workspace="insights"] .admin-console-link,
  body[data-workspace="insights"] .account-menu summary {
    width:44px; min-width:44px; min-height:44px;
  }
  body[data-workspace="insights"] .language-switch button { min-height:44px; }
  body[data-workspace="insights"] .language-switch button[data-language="zh-HK"]::after,
  body[data-workspace="insights"] .language-switch button[data-language="en-HK"]::after { font-size:13px; }
  body[data-workspace="insights"] .readiness-status summary {
    min-height:44px; padding:7px 10px;
  }
  body[data-workspace="insights"] .readiness-chip:first-child {
    font-size:13px; line-height:1.4;
  }
  body[data-workspace="insights"] .readiness-indicators::after { font-size:13px; }
  body[data-workspace="insights"] .audience-number { font-size:12px; }
  body[data-workspace="insights"] .audience-switcher strong { font-size:13px; }
  body[data-workspace="insights"] .race-desk-context { font-size:16px; }
  body[data-workspace="insights"] .race-tab { width:50px; min-width:50px; min-height:44px; }
  body[data-workspace="insights"] .race-desk-pick { min-height:0; padding:14px; }
  .desk-horse-no { font-size:27px; }
  .desk-horse-name { font-size:19px; }
  body[data-workspace="insights"] .race-desk-pick .selection-metrics {
    gap:8px; margin-top:9px;
  }
  body[data-workspace="insights"] .race-desk-pick .selection-market {
    margin-top:7px; padding:10px 12px;
  }
  body[data-workspace="insights"] .race-desk-pick .selection-prices {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px;
  }
  body[data-workspace="insights"] .race-desk-pick .desk-inspect-action { grid-row:5; }
  body[data-workspace="insights"] .desk-field-table {
    width:max(100%,760px); min-width:760px;
  }
  body[data-workspace="insights"] .desk-field-table th:first-child,
  body[data-workspace="insights"] .desk-field-table td:first-child {
    width:40px; min-width:40px; max-width:40px;
  }
  body[data-workspace="insights"] .desk-field-table th:nth-child(2),
  body[data-workspace="insights"] .desk-field-table td:nth-child(2) {
    left:40px; width:144px; min-width:144px; max-width:144px;
  }
}

/* Evidence and research were built before the race desk and retained tiny
   captions. These are deliberately scoped to those two tabs. */
body[data-workspace="insights"] .insight-panel-heading p,
body[data-workspace="insights"] .insight-role-heading p,
#insight-quick-panel :is(.insight-card-note,.quick-plain-signal,
  .quick-factor-line,.quick-risk-line,.insight-source-note p),
#insight-quick-panel :is(.context-evidence-block p,.reference-factor-list span,
  .reference-factor-list small) {
  font-size:14px!important; line-height:1.55;
}
body[data-workspace="insights"] .section-label,
#insight-quick-panel :is(.insight-source-note summary,.newbie-evidence-details summary,
  .quick-value-row span,.condition-comparison span,.condition-comparison small,
  .reference-factor-list strong) {
  font-size:13px!important; line-height:1.45;
}
#insight-quick-panel :is(.quick-probability-badge span,.quick-odds-badge > span,
  .quick-combination-odd span,.quick-pool-chip,.context-evidence-block > span) {
  font-size:13px!important; line-height:1.4;
}
#insight-quick-panel :is(.insight-source-note summary,.insight-supporting-research > summary) {
  min-height:44px;
}

/* Research controls: readable labels without altering pivot keys or data. */
#insight-lab-panel .database-explorer {
  font-size:16px; line-height:1.5;
}
#insight-lab-panel :is(.data-explorer-season-label,.data-explorer-cutoff,
  .data-explorer-palette-heading p,.data-explorer-field-group > strong,
  .data-explorer-empty,.data-explorer-zone-empty,.data-explorer-status,
  .data-explorer-output > p,.data-explorer-notes-mobile > p,.data-explorer-result-head > strong,
  .data-explorer-result-note,.data-explorer-palette-item small,
  .data-explorer-drop-zone small) {
  font-size:14px; line-height:1.5;
}
#insight-lab-panel :is(.data-explorer-field,.data-explorer-column-add,
  .data-explorer-assigned-chip,.data-explorer-reset,.data-explorer-run,
  .data-explorer-season-label select) {
  min-height:44px; font-size:14px; line-height:1.35;
}
#insight-lab-panel .data-explorer-table { font-size:14px; line-height:1.45; }
#insight-lab-panel .data-explorer-field { overflow-wrap:anywhere; }
#insight-lab-panel .data-explorer-drop-zone strong { font-size:14px; }
#insight-lab-panel .data-explorer-zone-number { font-size:12px; }
#insight-lab-panel .data-explorer-filter summary strong { font-size:14px; }
#insight-lab-panel .data-explorer-filter-summary { font-size:13px; }
#insight-lab-panel .data-explorer-filter-values label { font-size:14px; }

@media (max-width:390px) {
  #insight-lab-panel .data-explorer-fields { grid-template-columns:1fr; }
  #insight-lab-panel .data-explorer-layout { grid-template-columns:minmax(0,1fr); }
  #insight-lab-panel .data-explorer-field { min-width:0; }
}

/* The selected race's quote age stays visible on phones; the full status record stays in details. */
@media (max-width:760px) {
  body[data-workspace="insights"] .readiness-indicators {
    display:grid!important; grid-template-columns:minmax(0,1fr) auto;
    align-items:center; gap:4px 8px; overflow:visible;
  }
  body[data-workspace="insights"] .readiness-chip,
  body[data-workspace="insights"] .readiness-chip:first-child {
    display:block!important; flex:none!important; min-width:0; max-width:none;
    padding:3px 0; overflow:visible; white-space:normal!important;
    text-overflow:clip; font-size:13px; line-height:1.4;
  }
  body[data-workspace="insights"] .readiness-chip[data-status-kind="odds"] {
    grid-column:1; grid-row:1;
  }
  body[data-workspace="insights"] .readiness-indicators::after {
    grid-column:2; grid-row:1; font-size:13px;
  }
  body[data-workspace="insights"] .race-desk-pick {
    grid-template-columns:minmax(0,1fr);
  }
  body[data-workspace="insights"] .race-desk-pick .selection-role {
    grid-column:1; grid-row:1;
  }
  body[data-workspace="insights"] .race-desk-pick h3 {
    grid-column:1; grid-row:2; flex-wrap:wrap;
  }
  body[data-workspace="insights"] .race-desk-pick .selection-metrics {
    grid-column:1; grid-row:3;
  }
  body[data-workspace="insights"] .race-desk-pick .selection-market {
    grid-column:1; grid-row:4;
  }
  body[data-workspace="insights"] .race-desk-pick .desk-inspect-action {
    grid-column:1; grid-row:5;
  }
  body[data-workspace="insights"] .desk-horse-name {
    overflow-wrap:break-word; word-break:normal;
  }
}

/* Desktop scan: both selections carry the same complete information and
   occupy equal columns, rather than one long stacked strip. */
@media (min-width:1200px) {
  body[data-workspace="insights"] .beginner-selection-grid {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr));
    align-items:stretch; gap:12px;
  }
  body[data-workspace="insights"] .race-desk-pick {
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:auto auto auto 1fr auto;
    align-items:start;
  }
  body[data-workspace="insights"] .race-desk-pick .selection-role {
    grid-column:1; grid-row:1;
  }
  body[data-workspace="insights"] .race-desk-pick h3 {
    grid-column:1; grid-row:2; flex-wrap:wrap;
  }
  body[data-workspace="insights"] .race-desk-pick .selection-metrics {
    grid-column:1; grid-row:3;
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  body[data-workspace="insights"] .race-desk-pick .selection-market {
    grid-column:1; grid-row:4; align-self:start;
  }
  body[data-workspace="insights"] .race-desk-pick .desk-inspect-action {
    grid-column:1; grid-row:5; align-self:end;
  }
}

/* The third saved shortlist choice is a complete card, not a detached label. */
@media (min-width:1600px) {
  body[data-workspace="insights"] .beginner-selection-grid.has-three-picks {
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
}
@media (min-width:1200px) and (max-width:1599px) {
  body[data-workspace="insights"] .beginner-selection-grid.has-three-picks > .race-desk-pick:nth-child(3) {
    grid-column:1 / -1;
  }
}

/* Show the complete transparent artwork, including its wordmark, on phones. */
@media (max-width:760px) {
  body[data-workspace="insights"][data-presentation-rollout="true"] .site-header,
  body[data-workspace="insights"] .site-header,
  body[data-presentation-rollout="true"] .site-header,
  .site-header {
    display:grid!important;
    grid-template-columns:186px repeat(3,minmax(0,1fr))!important;
    grid-template-rows:52px 52px auto auto!important;
    gap:4px!important; min-height:0; padding:6px 8px!important;
    overflow:visible;
  }
  body[data-workspace="insights"][data-presentation-rollout="true"] .header-actions,
  body[data-workspace="insights"] .header-actions,
  body[data-presentation-rollout="true"] .header-actions,
  .site-header .header-actions { display:contents!important; }
  body[data-workspace="insights"][data-presentation-rollout="true"] .brand,
  body[data-workspace="insights"] .brand,
  body[data-presentation-rollout="true"] .brand,
  .site-header .brand {
    grid-column:1!important; grid-row:1 / 3!important;
    align-self:center; width:186px!important; min-width:0!important;
    aspect-ratio:auto; height:97px; min-height:0; overflow:hidden;
  }
  .site-header #language-switch {
    grid-column:2 / 4!important; grid-row:1!important;
    justify-self:stretch; width:100%; max-width:none; padding:2px;
  }
  body[data-workspace="insights"] .site-header #language-switch { grid-column:2 / -1!important; }
  .site-header #language-switch button { flex:1 1 0; min-width:0; min-height:44px; padding:3px 1px; }
  body[data-presentation-rollout="true"] .site-header #insights-nav-link,
  .site-header #insights-nav-link { grid-column:4!important; grid-row:1!important; justify-self:end; width:44px; min-width:44px; padding:0; }
  body[data-workspace="insights"] .site-header .guide-link,
  body[data-presentation-rollout="true"] .site-header .guide-link,
  .site-header .guide-link { grid-column:2!important; grid-row:2!important; width:44px; min-width:44px; min-height:44px; padding:0; }
  body[data-workspace="insights"] .site-header .admin-console-link,
  body[data-presentation-rollout="true"] .site-header .admin-console-link,
  .site-header .admin-console-link { grid-column:3!important; grid-row:2!important; width:44px; min-width:44px; min-height:44px; padding:0; }
  body[data-workspace="insights"] .site-header #account-menu,
  body[data-presentation-rollout="true"] .site-header #account-menu,
  .site-header #account-menu { grid-column:4!important; grid-row:2!important; justify-self:end; }
  .site-header #freshness-chip { grid-column:1 / -1!important; grid-row:3!important; max-width:100%; }
  .site-header #readiness-status { grid-column:1 / -1!important; grid-row:4!important; width:100%; max-width:none; }
body[data-workspace="insights"] .site-header #readiness-status { grid-row:3!important; }
}

/* State confidence once per race without turning each selection into a warning. */
body[data-workspace="insights"] .selection-confidence-notice {
  display:flex; align-items:baseline; flex-wrap:wrap; gap:4px 10px;
  margin:0 0 12px; padding:10px 14px;
  border-color:#ddcfaf; border-left-width:3px;
  background:#f8f4ea; color:#594730; line-height:1.45;
}
body[data-workspace="insights"] .selection-confidence-notice strong {
  display:inline; font-size:14px;
}
body[data-workspace="insights"] .selection-confidence-notice p {
  margin:0; font-size:13px;
}
body[data-workspace="insights"] .selection-evidence > .selection-limitation {
  margin:10px 0; padding:7px 10px;
  border-left:2px solid #b69a64; background:transparent;
  color:#594730; font-size:14px; line-height:1.5;
}

/* The customer meeting browser has one date picker across every workspace. */
.meeting-selects.meeting-selects-single,
body[data-workspace]:not([data-workspace=home]) .meeting-selects.meeting-selects-single,
body[data-workspace="insights"] #meeting-toolbar .meeting-selects.meeting-selects-single {
  grid-template-columns:minmax(0,1fr);
}

/* One race-level home for analysis and the two independent HKJC pool clocks. */
body[data-workspace="insights"] #meeting-toolbar #race-data-updates {
  grid-column:1 / -1; display:grid;
  grid-template-columns:auto minmax(0,1fr) minmax(0,1.5fr);
  align-items:start; gap:8px 15px; min-width:0;
  margin-top:3px; padding-top:10px; border-top:1px solid var(--line-soft);
  color:#365567; font-size:13px; line-height:1.45;
}
body[data-workspace="insights"] #meeting-toolbar #race-data-updates[hidden] { display:none!important; }
.race-data-updates-title { color:#0b7082; font-weight:800; white-space:nowrap; }
.race-data-update { min-width:0; }
.race-analysis-update { display:flex; flex-wrap:wrap; gap:2px 7px; }
.race-data-update-label { color:#526a78; }
.race-analysis-update strong { color:#163a52; font-weight:750; }
.race-odds-update { display:grid; gap:3px; }
.race-odds-source-times { color:#526a78; font-size:13px; overflow-wrap:anywhere; }
body[data-workspace="insights"] #race-data-updates #readiness-status {
  grid-column:auto!important; grid-row:auto!important; order:0;
  width:auto; max-width:none; min-width:0; font-size:13px;
}
body[data-workspace="insights"] #race-data-updates #readiness-status summary {
  display:block; min-height:0; padding:0; border:0; border-radius:0;
  background:transparent;
}
body[data-workspace="insights"] #race-data-updates .readiness-indicators {
  display:flex!important; flex-wrap:wrap; justify-content:flex-start;
  gap:2px 4px; overflow:visible;
}
body[data-workspace="insights"] #race-data-updates .readiness-chip,
body[data-workspace="insights"] #race-data-updates .readiness-chip:first-child {
  display:inline!important; flex:0 1 auto!important; max-width:none;
  padding:0; overflow:visible; background:transparent;
  white-space:normal!important; text-overflow:clip; font-size:13px; line-height:1.45;
}
body[data-workspace="insights"] #race-data-updates .readiness-indicators::after {
  position:static; grid-column:auto; grid-row:auto; padding:0 2px;
  font-size:13px;
}
@media (max-width:900px) {
  body[data-workspace="insights"] #meeting-toolbar #race-data-updates {
    grid-template-columns:auto minmax(0,1fr); gap:5px 12px;
  }
  .race-data-updates-title { grid-row:1 / span 2; }
}
@media (max-width:760px) {
  body[data-workspace="insights"] #meeting-toolbar #race-data-updates {
    grid-column:1; grid-template-columns:minmax(0,1fr);
    gap:5px; padding-top:7px; font-size:13px;
  }
  .race-data-updates-title { grid-row:auto; }
  body[data-workspace="insights"] #race-data-updates .readiness-chip,
  body[data-workspace="insights"] #race-data-updates .readiness-chip:first-child,
  body[data-workspace="insights"] #race-data-updates .readiness-indicators::after {
    font-size:13px;
  }
  body[data-workspace="insights"] #race-data-updates .readiness-details {
    top:calc(var(--racelens-header-height, 96px) + 6px);
    left:8px; right:8px; width:auto;
  }
  body[data-workspace="insights"] #race-data-updates #readiness-status summary {
    display:flex; align-items:center; min-height:44px;
  }
}

/* Keep the two remaining account actions aligned after removing Help. */
@media (max-width:760px) {
  body[data-workspace="insights"][data-presentation-rollout="true"] .site-header,
  body[data-workspace="insights"] .site-header,
  .site-header {
    grid-template-columns:186px minmax(0,1fr) repeat(2,44px)!important;
  }
  body[data-workspace="insights"] .site-header #language-switch {
    grid-column:2 / -1!important;
  }
  body[data-workspace="insights"] .site-header .admin-console-link,
  .site-header .admin-console-link { grid-column:3!important; grid-row:2!important; }
  body[data-workspace="insights"] .site-header #account-menu,
  .site-header #account-menu { grid-column:4!important; grid-row:2!important; }
}

/* A single Ma King Insight brand thought, followed by compact ownership and age copy. */
.site-footer {
  display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  align-items:center; padding-block:24px 30px;
}
.site-footer .footer-tagline {
  min-width:0; max-width:none; color:#fefdf9; font-size:18px; font-weight:600; line-height:1.4;
}
.site-footer .footer-tagline strong { color:#f0bd50; font-weight:800; }
.site-footer .footer-legal {
  min-width:0; max-width:none; color:#c9dce2; font-size:12px; line-height:1.6;
  text-align:right; white-space:normal; overflow-wrap:break-word;
}
@media (max-width:760px) {
  .site-footer { grid-template-columns:minmax(0,1fr); gap:10px; }
  .site-footer .footer-tagline { font-size:16px; }
  .site-footer .footer-legal { text-align:left; }
}

/* Horse rationale is a separate screen on phones, not a panel below the shortlist. */
@media (max-width:760px) {
  body.mobile-desk-inspector-open { overflow:hidden; }
  body.mobile-desk-inspector-open .audience-switcher { display:none!important; }
  body.mobile-desk-inspector-open #race-desk-inspector {
    position:fixed!important;
    inset:0!important;
    z-index:1000;
    display:grid;
    align-content:start;
    gap:14px;
    box-sizing:border-box;
    width:100%;
    height:100vh;
    height:100dvh;
    max-height:none!important;
    margin:0;
    padding:calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 28px);
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
    border:0;
    border-radius:0;
    background:#fefdf9;
  }
  body.mobile-desk-inspector-open .desk-inspector-close {
    position:sticky;
    top:env(safe-area-inset-top);
    right:auto;
    z-index:1;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    justify-self:start;
    gap:8px;
    width:auto;
    min-width:88px;
    height:44px;
    padding:0 13px;
    border:1px solid #c6d8dc;
    border-radius:10px;
    background:#eaf1f1;
    color:#102f4c;
    font-size:15px;
    font-weight:750;
    box-shadow:0 2px 8px rgba(16,47,76,.1);
  }
  body.mobile-desk-inspector-open .race-desk-inspector h3 {
    margin:0;
    font-size:clamp(23px,6vw,30px);
    overflow-wrap:anywhere;
  }
  body.mobile-desk-inspector-open .desk-inspector-context { margin:0 0 4px; }
}

/* Studio is meeting-wide history, so desktop space is not reserved for race tabs. */
@media(min-width:901px){
  body[data-workspace="insights"][data-analysis-studio="true"] .app-shell{width:calc(100% - 32px);max-width:none;padding-top:12px}
  body[data-workspace="insights"][data-analysis-studio="true"] .site-header{grid-template-columns:auto minmax(220px,1fr) auto;grid-template-rows:auto;gap:12px;min-height:72px;padding:4px 18px}
  body[data-workspace="insights"][data-analysis-studio="true"] .site-header .brand{width:160px;height:64px}
  body[data-workspace="insights"][data-analysis-studio="true"] .audience-switcher{grid-column:auto;grid-row:auto;justify-content:center}
  body[data-workspace="insights"][data-analysis-studio="true"] .header-actions{grid-column:auto;grid-row:auto}
  body[data-workspace="insights"][data-analysis-studio="true"] #dashboard{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr)}
  body[data-workspace="insights"][data-analysis-studio="true"] #race-nav,
  body[data-workspace="insights"][data-analysis-studio="true"] #race-desk-context,
  body[data-workspace="insights"][data-analysis-studio="true"] #race-data-updates{display:none!important}
  body[data-workspace="insights"][data-analysis-studio="true"] #meeting-toolbar{grid-column:1;grid-row:1;grid-template-columns:minmax(0,1fr) minmax(260px,340px) auto;gap:10px 16px;padding:10px 16px;border-radius:12px 12px 0 0}
  body[data-workspace="insights"][data-analysis-studio="true"] #meeting-toolbar .meeting-toolbar-side{grid-column:auto;grid-template-columns:1fr;justify-items:end}
  body[data-workspace="insights"][data-analysis-studio="true"] #meeting-toolbar .meeting-selects label{gap:3px}
  body[data-workspace="insights"][data-analysis-studio="true"] #analysis-studio-context{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 12px;min-width:0;margin:0;color:#31576a;font-size:14px;line-height:1.45;overflow-wrap:normal}
  body[data-workspace="insights"][data-analysis-studio="true"] #analysis-studio-context>strong{color:#0b7082;font-size:13px}
  body[data-workspace="insights"][data-analysis-studio="true"] #analysis-studio-meeting{font-weight:750}
  body[data-workspace="insights"][data-analysis-studio="true"] #analysis-studio-history{flex:1 0 100%;min-width:0;color:#526a78;font-size:13px}
  body[data-workspace="insights"][data-analysis-studio="true"] #insights-workspace{grid-column:1;grid-row:2}
  body[data-workspace="insights"][data-analysis-studio="true"] #insight-lab-panel{padding:16px;border:0;border-radius:0 0 12px 12px;box-shadow:none}
  body[data-workspace="insights"][data-analysis-studio="true"] #insight-lab-panel>.insight-panel-heading{align-items:center;gap:20px;margin-bottom:12px}
  body[data-workspace="insights"][data-analysis-studio="true"] #insight-lab-panel>.insight-panel-heading h2{font-size:24px;line-height:1.25}
  body[data-workspace="insights"][data-analysis-studio="true"] #insight-lab-panel>.insight-panel-heading p{max-width:680px;font-size:13px;line-height:1.45}
  body[data-workspace="insights"][data-analysis-studio="true"] #insight-lab-panel :is(.data-explorer-cutoff,.data-explorer-result-head>strong,.data-explorer-result-note){font-size:13px;line-height:1.4}
  body[data-workspace="insights"][data-analysis-studio="true"] #insight-lab-panel .data-explorer-pivot{font-size:14px;line-height:1.35}
}


/* UAT 2026-10-19: all mobile races visible, with equal tile geometry. */
@media (max-width:760px) {
  body[data-workspace="insights"] #race-nav {
    padding:8px;
    border-bottom:1px solid var(--line-soft);
  }
  body[data-workspace="insights"] #race-nav .race-nav-label {
    display:block;
    margin:0 0 6px;
    color:var(--ink);
    font-size:12px;
    font-weight:750;
    letter-spacing:normal;
  }
  body[data-workspace="insights"] #race-tabs {
    display:grid;
    grid-template-columns:repeat(6,minmax(0,1fr));
    grid-auto-rows:54px;
    align-items:stretch;
    gap:4px;
    width:100%;
    min-width:0;
    overflow:visible;
  }
  body[data-workspace="insights"] #race-tabs .race-tab {
    box-sizing:border-box;
    display:grid;
    grid-template-rows:20px 15px;
    align-content:center;
    justify-items:center;
    gap:2px;
    width:100%;
    min-width:0;
    height:54px;
    min-height:54px;
    margin:0;
    padding:5px 2px;
    border:2px solid var(--line-soft);
    border-radius:8px;
    background:#fefdf9;
    color:#102f4c;
    box-shadow:none;
    text-align:center;
    transform:none;
  }
  body[data-workspace="insights"] #race-tabs .race-tab strong {
    grid-row:1;
    align-self:center;
    color:inherit;
    font-size:15px;
    line-height:20px;
  }
  body[data-workspace="insights"] #race-tabs .race-tab.is-meeting-focus {
    border-color:#c09643;
    background:#234960;
    color:#fff;
  }
  body[data-workspace="insights"] #race-tabs .race-tab[aria-selected=true] {
    border-color:#0b7082;
    background:#0b7082;
    color:#fff;
  }
  body[data-workspace="insights"] #race-tabs .race-tab.is-meeting-focus[aria-selected=true] {
    border-color:#e1c170;
  }
  body[data-workspace="insights"] #race-tabs .race-tab .race-focus-tag {
    grid-row:2;
    align-self:center;
    display:inline-block;
    max-width:100%;
    margin:0;
    padding:1px 3px;
    border-radius:3px;
    background:#f9e9bd;
    color:#644d18;
    font-size:10px;
    line-height:13px;
  }

  /* Keep the existing tab controls, role checks and phone safe-area handling. */
  body[data-workspace="insights"] .audience-switcher {
    gap:8px;
    min-height:68px;
    padding:7px max(8px,env(safe-area-inset-right)) max(7px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));
    border-top:1px solid var(--line);
    border-radius:0;
  }
  body[data-workspace="insights"] .audience-switcher button {
    box-sizing:border-box;
    display:flex;
    flex:1 1 0;
    flex-direction:row;
    align-items:center;
    justify-content:center;
    gap:7px;
    min-width:0;
    min-height:52px;
    padding:7px 8px;
    border:1px solid #a8c4ce;
    border-radius:10px;
    background:#fff;
    color:#102f4c;
    box-shadow:0 2px 5px rgba(16,47,76,.07);
    cursor:pointer;
  }
  body[data-workspace="insights"] .audience-switcher button[aria-selected=true] {
    border-color:#0b7082;
    background:#0b7082;
    color:#fff;
    box-shadow:0 2px 6px rgba(11,112,130,.19);
  }
  body[data-workspace="insights"] .audience-switcher .audience-number,
  body[data-workspace="insights"] .audience-switcher small {
    display:none;
  }
  body[data-workspace="insights"] .audience-switcher strong {
    color:inherit;
    font-size:13px;
    line-height:1.25;
    white-space:normal;
    text-align:left;
  }
  body[data-workspace="insights"] .audience-switcher button::before {
    content:"";
    display:block;
    flex:0 0 20px;
    width:20px;
    height:20px;
    background-color:currentColor;
    -webkit-mask:var(--mobile-tab-icon) center/contain no-repeat;
    mask:var(--mobile-tab-icon) center/contain no-repeat;
  }
  body[data-workspace="insights"] .audience-switcher [data-insight-audience="newbie"] {
    --mobile-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 6 1 1 2-2M9 6h12M3 12l1 1 2-2M9 12h12M3 18l1 1 2-2M9 18h12'/%3E%3C/svg%3E");
  }
  body[data-workspace="insights"] .audience-switcher [data-insight-audience="pools"] {
    --mobile-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h16v5a3 3 0 0 0 0 6v5H4v-5a3 3 0 0 0 0-6V4ZM14 4v2m0 4v2m0 4v2m0 2v0'/%3E%3C/svg%3E");
  }
  body[data-workspace="insights"] .audience-switcher [data-insight-audience="lab"] {
    --mobile-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 3v18h17M8 16v-5m5 5V7m5 9v-8'/%3E%3C/svg%3E");
  }
}


/* UAT 2026-10-19: one swipeable mobile race row; retain equal tiles and bottom buttons. */
@media (max-width:760px) {
  body[data-workspace="insights"] #race-tabs {
    display:flex;
    flex-flow:row nowrap;
    grid-template-columns:none;
    grid-auto-rows:auto;
    align-items:stretch;
    gap:6px;
    overflow-x:auto;
    overflow-y:hidden;
    overscroll-behavior-x:contain;
    scroll-snap-type:x proximity;
    scroll-padding-inline:2px;
    padding-block:2px 4px;
    scrollbar-width:thin;
    scrollbar-color:#8caeb7 #e8f0f2;
    -webkit-overflow-scrolling:touch;
    touch-action:pan-x pan-y pinch-zoom;
  }
  body[data-workspace="insights"] #race-tabs .race-tab {
    flex:0 0 60px;
    width:60px;
    min-width:60px;
    max-width:60px;
    height:54px;
    min-height:54px;
    max-height:54px;
    scroll-snap-align:center;
  }
  body[data-workspace="insights"] #race-tabs .race-tab:focus-visible {
    outline:2px solid #edc04c;
    outline-offset:-5px;
  }
  body[data-workspace="insights"] #race-nav::after {
    content:"↔ 左右滑動查看全部場次";
    display:block;
    margin:6px 0 0;
    color:#465f72;
    font-size:12px;
    font-weight:600;
    line-height:1.45;
    text-align:right;
  }
  html[lang^="en"] body[data-workspace="insights"] #race-nav::after {
    content:"↔ Swipe to see all races";
  }
}

/* Dev: keep race navigation visible while the race content scrolls. */
@media (min-width:761px) {
  body[data-workspace="insights"]:not([data-analysis-studio="true"]) #race-nav {
    top:calc(var(--racelens-header-height,149px) + 14px)!important;
    display:flex;
    flex-direction:column;
    align-items:stretch;
    gap:0;
    height:calc(100dvh - var(--racelens-header-height,149px) - 28px);
    max-height:calc(100dvh - var(--racelens-header-height,149px) - 28px);
    min-height:0;
    overflow:hidden;
  }
  body[data-workspace="insights"]:not([data-analysis-studio="true"]) #race-nav .race-nav-label {
    flex-shrink:0;
  }
  body[data-workspace="insights"]:not([data-analysis-studio="true"]) #race-tabs {
    flex:1 1 auto;
    min-height:0;
    align-content:start;
    grid-auto-rows:max-content;
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior-y:contain;
    scrollbar-width:none;
  }
  body[data-workspace="insights"]:not([data-analysis-studio="true"]) #race-tabs::-webkit-scrollbar {
    display:none; width:0; height:0;
  }
}

/* Dev Full Field: identify the three saved selections and the saved Special Pick. */
#insight-race-field-snapshot .insight-field-table tbody tr[data-saved-pick="main"] > td { background:#edf8f6; }
#insight-race-field-snapshot .insight-field-table tbody tr[data-saved-pick="special"] > td { background:#fff5de; }
#insight-race-field-snapshot .insight-field-table tbody tr[data-saved-pick="main"] > td:first-child { box-shadow:inset 3px 0 #087d82; }
#insight-race-field-snapshot .insight-field-table tbody tr[data-saved-pick="special"] > td:first-child { box-shadow:inset 3px 0 #b38324; }
#insight-race-field-snapshot .insight-field-table tbody tr[data-saved-pick] > td:nth-child(3) { white-space:nowrap; }
#insight-race-field-snapshot .full-field-pick-badge { display:inline-flex; align-items:center; margin-inline-start:6px; padding:1px 5px; border-radius:4px; background:#087d82; color:#fff; font-size:10px; font-weight:700; line-height:1.5; white-space:nowrap; vertical-align:middle; }
#insight-race-field-snapshot tr[data-saved-pick="special"] .full-field-pick-badge { background:#f0d38b; color:#62430c; }

/* Dev: approved wide-screen meeting picker placement. Smaller screens retain
   the existing toolbar control and phone navigation. */
@media (min-width:1600px) {
  body[data-workspace="insights"][data-header-meeting="true"]:not([data-access-blocked="true"]):has(#dashboard:not([hidden])) .site-header {
    grid-template-columns:auto minmax(336px,1fr) minmax(340px,400px) auto;
  }
  body[data-workspace="insights"][data-header-meeting="true"] .site-header > .meeting-selects-single {
    width:100%; min-width:0;
  }
  body[data-workspace="insights"][data-header-meeting="true"] .site-header > .meeting-selects-single select {
    height:44px; border-color:var(--line); border-radius:5px;
    background:#fefdf9; font-size:15px; line-height:1.4;
  }
}
body[data-access-blocked="true"] .site-header > .meeting-selects-single,
body:has(#dashboard[hidden]) .site-header > .meeting-selects-single { display:none; }

/* Keep the longer period label and complete meeting identity readable on tablets. */
@media (min-width:761px) {
  #race-analysis-workspace [data-race-analysis-pane] .ji-controls > .ji-control:has(select[id$="-period"]) {
    flex-basis:280px; min-width:min(100%,280px);
  }
}
@media (min-width:761px) and (max-width:1100px) {
  body[data-workspace="insights"] #meeting-toolbar > .meeting-selects-single { grid-column:1 / -1; }
}

/* Dev: compact desktop race rows, retaining the same dynamic buttons. */
@media (min-width:761px) {
  body[data-workspace="insights"]:not([data-analysis-studio="true"]) #race-tabs .race-tab {
    display:grid; grid-template-columns:28px minmax(0,1fr);
    column-gap:4px; row-gap:1px; align-items:center;
    min-height:44px; padding:4px 6px;
  }
  body[data-workspace="insights"]:not([data-analysis-studio="true"]) #race-tabs .race-tab strong {
    grid-column:1; grid-row:1 / span 2; align-self:center; font-size:15px; line-height:1.25;
  }
  body[data-workspace="insights"]:not([data-analysis-studio="true"]) #race-tabs .race-tab > span:not(.race-focus-tag) {
    grid-column:2; grid-row:1 / span 2; font-size:11px; line-height:1.25; white-space:nowrap;
  }
  body[data-workspace="insights"]:not([data-analysis-studio="true"]) #race-tabs .race-tab.is-meeting-focus > span:not(.race-focus-tag) {
    grid-row:1; align-self:end;
  }
  body[data-workspace="insights"]:not([data-analysis-studio="true"]) #race-tabs .race-tab .race-focus-tag {
    grid-column:2; grid-row:2; justify-self:start; align-self:start;
    margin:0; padding:1px 4px; font-size:10px; line-height:1.2;
  }
}

/* Dev: show the existing three main picks and Special Pick together on desktop. */
@media (min-width:1101px) and (max-width:1599px) {
  body[data-workspace="insights"] #insight-newbie-panel .method4-selection-grid:has(> .method4-selection-card:nth-child(4)) {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media (min-width:1600px) {
  body[data-workspace="insights"] #insight-newbie-panel .method4-selection-grid:has(> .method4-selection-card:nth-child(4)) {
    grid-template-columns:repeat(4,minmax(0,1fr));
  }
  body[data-workspace="insights"] #insight-newbie-panel .method4-selection-grid:has(> .method4-selection-card:nth-child(4)) > .method4-selection-card {
    padding:14px;
  }
  body[data-workspace="insights"] #insight-newbie-panel .method4-selection-grid:has(> .method4-selection-card:nth-child(4)) .method4-selection-body {
    grid-template-columns:minmax(0,1fr) 90px; gap:8px;
  }
}

@media (min-width:761px) and (max-width:1100px) {
  body[data-workspace="insights"]:not([data-analysis-studio="true"]) #race-tabs .race-tab > span:not(.race-focus-tag) { white-space:normal; }
}
@media (min-width:1600px) {
  body[data-workspace="insights"] #insight-newbie-panel .method4-selection-grid:has(> .method4-selection-card:nth-child(4)) .method4-probability-grid > div {
    display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:4px 6px;
  }
}
