/* Important declarations use the first layer to override the legacy theme's
   important styles. Visibility/layout rules remain owned by their current layers. */
@layer theme, visibility, workspace, legacy;
@layer theme {
  /* Shared review refinements: apply equally to dark and daylight. Keep the
     header and numeric rows on the same grid, with a real trailing gutter. */
  html.focused-preview #eventOptionsGrid :is(.mkt-listhead,.mkt-row) {padding-inline-end:12px!important;box-sizing:border-box!important}
  html.focused-preview .detail-topbar button {white-space:nowrap!important;min-width:max-content!important}
  html.focused-preview .traffic-sign .sign-code {
    display:grid!important;place-items:center!important;position:static!important;
    width:100%!important;height:100%!important;min-width:0!important;
    font:700 9px/1.2 Inter,system-ui,sans-serif!important;letter-spacing:-.035em!important;
    color:var(--fw-muted)!important;text-shadow:none!important;transform:none!important;
  }
  html.focused-preview .traffic-sign:has(.sign-code) .sign-art {width:100%!important;height:100%!important;inset:0!important;padding:0!important}
  /* Keep failed-image fallbacks readable without displaying them over a
     successfully loaded logo. Legacy display:!important must honor hidden. */
  html.focused-preview .traffic-sign [hidden] {display:none!important}
  html.focused-preview .traffic-sign .official-logo-fallback:not([hidden]) {
    display:grid!important;place-items:center!important;width:100%!important;height:100%!important;
    color:var(--fw-muted)!important;font:700 22px/1.2 Inter,system-ui,sans-serif!important;
  }
  html.focused-preview .traffic-sign .crypto-fallback:not([hidden]) {font-size:10px!important}
  html.focused-preview .traffic-sign.flag:has(.country-flag-asset:not([hidden])) {
    outline:1px solid var(--fw-muted)!important;outline-offset:-1px!important;
  }
  html.focused-preview :is(.market-index-page-prev,.market-index-page-next,.workspace-pager>button) {
    display:inline-grid!important;place-items:center!important;padding:0!important;line-height:1!important;
  }
  html.focused-preview .pager-chevron {
    display:block!important;width:22px!important;height:22px!important;flex:none!important;
    fill:none!important;stroke:currentColor!important;stroke-width:2.4!important;
    stroke-linecap:round!important;stroke-linejoin:round!important;
  }
  :root[data-theme="daylight"] {
    color-scheme: light !important;
    --fw-bg:#ffffff!important; --fw-surface:#f5f7fb!important; --fw-inset:#ffffff!important;
    --fw-ink:#17243a!important; --fw-muted:#53637c!important; --fw-line:#d3ddea!important;
    --fw-accent:#4059ab!important; --fw-selected:#e6edfc!important;
    --ofw-bg:var(--fw-bg)!important; --ofw-surface:var(--fw-surface)!important; --ofw-surface-2:var(--fw-inset)!important;
    --ofw-surface-3:var(--fw-selected)!important; --ofw-border:var(--fw-line)!important; --ofw-border-soft:#e2e8f1!important;
    --ofw-primary:var(--fw-ink)!important; --ofw-secondary:#40516b!important; --ofw-tertiary:var(--fw-muted)!important;
    --ofw-accent:var(--fw-accent)!important; --ofw-blue:var(--fw-accent)!important; --ofw-cyan:#087854!important;
    --ofw-amber:#875800!important; --ofw-red:#be354c!important;
    --ofw-muted:var(--fw-muted)!important; --ofw-blue-soft:var(--fw-accent)!important;
    --ofw-positive:#087854!important; --ofw-negative:#be354c!important; --ofw-warning:#875800!important;
    --bg:var(--fw-bg)!important; --panel:var(--fw-surface)!important; --panel2:var(--fw-inset)!important; --panel3:var(--fw-selected)!important;
    --text:var(--fw-ink)!important; --text2:#40516b!important; --ink:var(--fw-ink)!important; --muted:var(--fw-muted)!important; --faint:#61718a!important;
    --line:var(--fw-line)!important; --line-soft:#e2e8f1!important; --amber:var(--fw-accent)!important; --amber-dim:#5267ac!important;
    --focus:var(--fw-accent)!important; --info:var(--fw-accent)!important; --blue:var(--fw-accent)!important; --violet:#7049a9!important;
    --yes:#087854!important; --yes-bg:#e9f6ef!important; --yes-line:#97c9b6!important; --win:#087854!important;
    --no:#be354c!important; --no-bg:#fff0f2!important; --no-line:#e2adb6!important; --loss:#be354c!important;
    --warn-bg:#fff7e7!important; --lime:#087854!important;
  }
  .aestus-header-tools {display:flex!important;align-items:center!important;gap:20px!important;flex:0 0 auto!important}
  .focused-preview #appSwitch .studio-rail-foot {display:flex!important;min-width:90px!important}
  .aestus-theme-toggle {
    display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;
    gap:5px!important;min-width:64px!important;min-height:64px!important;padding:4px!important;margin:0!important;
    border:0!important;background:transparent!important;box-shadow:none!important;color:var(--fw-muted)!important;
    font:500 11px/1.2 Inter,system-ui,sans-serif!important;letter-spacing:0!important;text-transform:none!important;
    cursor:pointer!important;border-radius:8px!important;flex:0 0 auto!important;
  }
  .aestus-theme-toggle::before,.aestus-theme-toggle::after {display:none!important}
  .aestus-theme-track {display:flex!important;align-items:center!important;width:52px!important;height:28px!important;padding:3px!important;border:1px solid var(--fw-muted)!important;border-radius:20px!important;background:var(--fw-inset)!important}
  .aestus-theme-thumb {display:grid!important;place-items:center!important;width:20px!important;height:20px!important;border-radius:50%!important;background:var(--fw-accent)!important;color:#182138!important;transform:translateX(0);transition:transform .16s ease}
  .aestus-theme-thumb svg {display:block;width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
  .aestus-theme-sun {display:none!important}
  [data-theme="daylight"] .aestus-theme-thumb {transform:translateX(24px);background:var(--fw-accent)!important;color:white!important}
  [data-theme="daylight"] .aestus-theme-moon {display:none!important}
  [data-theme="daylight"] .aestus-theme-sun {display:block!important}
  .aestus-theme-toggle:hover {background:var(--fw-selected)!important}
  .aestus-theme-toggle:focus-visible {outline:2px solid var(--fw-accent)!important;outline-offset:3px!important}
  .aestus-logo-daylight {display:none!important}
  [data-theme="daylight"] .aestus-logo-dark {display:none!important}
  [data-theme="daylight"] .aestus-logo-daylight {display:block!important}
  [data-theme="daylight"] :is(input,textarea,select)::placeholder {color:#68768b!important;opacity:1!important}
  [data-theme="daylight"] :is(button,a,input,select,textarea,summary,[tabindex]):focus-visible {outline-color:var(--fw-accent)!important}
  [data-theme="daylight"] #appSwitch .nav-cluster button.active {border-color:#a5b6e4!important}
  [data-theme="daylight"] :is(h1,h3,h4,.genre-nav button strong,.sign-crypto) {color:var(--fw-ink)!important}
  [data-theme="daylight"] button.primary {color:#fff!important}
  [data-theme="daylight"] #catalogList .dense-metric b {color:var(--text2)!important}
  [data-theme="daylight"] :is(.detail-betline .v,.mkt-betlabel,.leg-nm,.leg-px,.structure-outcome-chip span) {color:var(--fw-ink)!important}
  [data-theme="daylight"] .detail-betline .k {color:var(--fw-muted)!important}
  [data-theme="daylight"] .market-group-more {color:var(--fw-muted)!important}
  [data-theme="daylight"] #catalogList .dense-market-card:hover {background:#eef3fb!important;border-color:#a5b6e4!important}
  [data-theme="daylight"] #structureMarketData .book-level-row.ask td {color:var(--no)!important}
  [data-theme="daylight"] #structureMarketData .book-level-row.bid td {color:var(--yes)!important}
  [data-theme="daylight"] #normStatus {color:#875800!important}
  [data-theme="daylight"] #normStatus.ok {color:var(--yes)!important}
  [data-theme="daylight"] #valueBoard :is(b,strong) {color:var(--fw-ink)!important}
  [data-theme="daylight"] #valueBoard .football-form-chip {background:#edf2fa!important;border-color:var(--fw-line)!important;color:var(--fw-ink)!important}
  [data-theme="daylight"] #valueBoard .football-form-chip.win {background:var(--yes-bg)!important;border-color:var(--yes-line)!important}
  [data-theme="daylight"] #valueBoard .football-form-chip.loss {background:var(--no-bg)!important;border-color:var(--no-line)!important}
  [data-theme="daylight"] #valueBoard .football-form-chip.draw {background:var(--warn-bg)!important;border-color:#d9b46f!important}
  [data-theme="daylight"] #valueBoard .football-form-chip small {color:var(--fw-muted)!important}
  [data-theme="daylight"] #valueBoard .football-form-chip.win b {color:var(--yes)!important}
  [data-theme="daylight"] #valueBoard .football-form-chip.loss b {color:var(--no)!important}
  [data-theme="daylight"] .warnitem.sev {border-left-color:#c29444!important;color:#875800!important}
  [data-theme="daylight"] :is(.up,.positive,.scope-bet-positive,.sim-positive,[data-tone="positive"]) {color:var(--yes)!important}
  [data-theme="daylight"] :is(.down,.negative,.scope-bet-negative,.sim-negative,[data-tone="negative"]) {color:var(--no)!important}
  [data-theme="daylight"] :is(.workspace-market-status[data-tone="warn"],.warn,.warnitem,.status.warn) {color:#875800!important}
  [data-theme="daylight"] :is(.workspace-description,.detail-description,.structure-summary) {color:var(--text2)!important}
  [data-theme="daylight"] :is(.workspace-tabs button.active,.workspace-tabs button[aria-selected="true"]) {border-color:#a5b6e4!important}
  [data-theme="daylight"] #scopeModelTabs [aria-selected="true"] {background:#e6edfc!important;border-color:#4059ab!important;color:#17243a!important}
  [data-theme="daylight"] #scopeModelTabs [role="tab"]:focus-visible {outline-color:#4059ab!important}
  [data-theme="daylight"] .scope-counter-warning {color:#875800!important}
  /* The research ledger has legacy per-cell colours, not just inherited
     theme tokens. Override those explicitly without flattening delta tones. */
  [data-theme="daylight"] #scopeView .scope-bet-table td:not(.scope-bet-positive):not(.scope-bet-negative):not(.scope-bet-neutral) {color:var(--fw-ink)!important}
  [data-theme="daylight"] #scopeView :is(.scope-bet-side,.scope-bet-quote b) {color:var(--fw-ink)!important}
  [data-theme="daylight"] #scopeView .scope-empty p {color:var(--fw-muted)!important}
  [data-theme="daylight"] :is(.research-model-panel,.research-model-summary) :is(table,thead,tbody,tr,th,td) {background:var(--fw-surface)!important;color:var(--fw-ink)!important;border-color:var(--fw-line)!important}
  [data-theme="daylight"] .workspace-data-popover {box-shadow:0 8px 28px #17243a1a!important}
  [data-theme="daylight"] #simulatorView {color:var(--fw-ink)!important;background:var(--fw-bg)!important}
  [data-theme="daylight"] #simulatorView :is(.sim-metrics,.sim-performance,.sim-table,.sim-disclosure) {background:var(--fw-surface)!important;border-color:var(--fw-line)!important}
  [data-theme="daylight"] #simulatorView :is(.sim-scroll,th,td,.sim-metrics>div) {border-color:var(--fw-line)!important}
  [data-theme="daylight"] #simulatorView .sim-table thead {background:#edf2fa!important;color:var(--fw-muted)!important}
  [data-theme="daylight"] #simulatorView .sim-table :is(tr,th,td) {background:var(--fw-surface)!important;color:var(--fw-ink)!important}
  [data-theme="daylight"] #simulatorView .sim-table thead th {background:#edf2fa!important;color:var(--fw-muted)!important}
  [data-theme="daylight"] #simulatorView .sim-table .sim-positive {color:var(--yes)!important}
  [data-theme="daylight"] #simulatorView .sim-table .sim-negative {color:var(--no)!important}
  [data-theme="daylight"] #simulatorView :is(.sim-head p,.sim-live small,.sim-metrics dt,.sim-metrics small,.sim-section-head span,.sim-section-head small,.sim-table small,.sim-source,.sim-footnote,.sim-state) {color:var(--fw-muted)!important}
  [data-theme="daylight"] #simulatorView :is(a,.sim-disclosure summary) {color:var(--fw-accent)!important}
  [data-theme="daylight"] #simulatorView :is(.sim-method,.sim-chart-empty,.sim-table dt) {color:var(--fw-muted)!important}
  [data-theme="daylight"] #simulatorView :is(.sim-method summary,.sim-table summary) {color:var(--fw-accent)!important}
  [data-theme="daylight"] #simulatorView :is(.sim-live,.sim-line) {color:#087854!important}
  [data-theme="daylight"] #simulatorView .sim-dot {fill:#087854!important}
  [data-theme="daylight"] #simulatorView .sim-performance svg text {fill:var(--fw-muted)!important}
  [data-theme="daylight"] #simulatorView .sim-grid {stroke:var(--fw-line)!important}
  [data-theme="daylight"] #simulatorView .sim-baseline {stroke:var(--fw-muted)!important}
  [data-theme="daylight"] #simulatorView .sim-warning {background:var(--warn-bg)!important;color:#875800!important;border-color:#d9b46f!important}
  .aestus-feedback-page .brand {justify-content:space-between!important}
  [data-theme="daylight"] .aestus-feedback-page :is(label,.hint,.footnote) {color:var(--fw-muted)!important}
  [data-theme="daylight"] .aestus-feedback-page .button:not(.secondary) {color:#fff!important;background:var(--fw-accent)!important;border-color:var(--fw-accent)!important}
  [data-theme="daylight"] .aestus-feedback-page .status.error {color:var(--no)!important}
  .focused-preview #appSwitch .nav-label {overflow:visible!important;text-overflow:clip!important}
  @media (max-width:1420px) and (min-width:760px) {
    .focused-preview #appSwitch {gap:12px!important;padding-inline:20px!important;flex-wrap:wrap!important}
    .focused-preview #appSwitch .nav-cluster {order:3!important;flex:1 0 100%!important}
    .focused-preview #appSwitch .nav-cluster button {flex:0 0 auto!important;min-width:max-content!important}
    .focused-preview .ofw-index-pane {top:154px!important}
  }
  @media (max-width:759px) {
    .focused-preview #appSwitch {display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:6px 10px!important;align-items:center!important;padding:8px 14px!important}
    .focused-preview #appSwitch .studio-rail-head {width:100%!important;min-width:0!important;height:66px!important;justify-content:flex-start!important}
    .focused-preview #appSwitch :is(.studio-wordmark,.aestus-wordmark-picture,.aestus-wordmark-logo) {width:100%!important;max-width:225px!important;height:66px!important;min-height:0!important}
    .aestus-header-tools {gap:6px!important;grid-column:2!important;grid-row:1!important}
    .focused-preview #appSwitch .studio-rail-foot {min-width:76px!important;font-size:10px!important}
    .focused-preview #appSwitch .workspace-preview-label {font-size:10px!important}
    .aestus-theme-toggle {min-width:56px!important}
    .focused-preview #appSwitch .nav-cluster {grid-column:1/-1!important;grid-row:2!important;display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;width:100%!important;gap:3px!important}
    .focused-preview #appSwitch .nav-cluster button {padding:8px 2px!important;font-size:11px!important}
    .focused-preview #appSwitch .nav-label {white-space:normal!important;overflow-wrap:anywhere!important}
  }
  @media (prefers-reduced-motion:reduce) {.aestus-theme-thumb {transition:none!important}}
}
