/* EA LAB — professional light-theme completion layer.
   Loaded last so dynamically injected/legacy dark surfaces remain legible. */
html[data-theme="light"] body.ea-lab-page{
  --eal-light-ink:#10243a;
  --eal-light-muted:#53677d;
  --eal-light-soft:#f5f8fc;
  --eal-light-panel:#fff;
  --eal-light-line:rgba(42,72,104,.16);
  color:#10243a;
  background:radial-gradient(circle at 86% 2%,rgba(221,173,65,.12),transparent 26%),linear-gradient(180deg,#f8fbff,#eef3f8 58%,#f8fafc);
}

/* Main cards, builder steps, generated summaries and library surfaces */
html[data-theme="light"] body.ea-lab-page :is(
  .builder-card,.ea-files-panel,.ea-preview-section,.ea-progress-section,
  .ea-auto-initial-summary,.ea-auto-history-card,.ea-auto-generation-confirm-panel,
  .ea-auto-build-v16-review,.ea-auto-build-v16-report,.ea-auto-ready,
  .ea-auto-acknowledgement,.ea-guided-step-panel,.ea-guided-memory,
  .ea-lab-library-dialog,.ea-lab-library-shell,.ea-lab-library-card,
  .ea-lab-library-item,.ea-lab-credit-history-item
){
  color:var(--eal-light-ink)!important;
  border-color:var(--eal-light-line)!important;
  background:linear-gradient(145deg,#fff,#f5f8fc)!important;
  box-shadow:0 14px 36px rgba(31,57,86,.08);
}
html[data-theme="light"] body.ea-lab-page :is(
  .ea-auto-history-card strong,.ea-auto-history-card b,
  .ea-auto-history-heading strong,.ea-auto-history-heading b,
  .ea-auto-build-v16-review strong,.ea-auto-generation-confirm-panel strong,
  .ea-preview-section h3,.ea-preview-section h4,.ea-progress-section strong,
  .ea-lab-library-dialog h2,.ea-lab-library-dialog h3
){color:#10243a!important;text-shadow:none!important}
html[data-theme="light"] body.ea-lab-page :is(
  .ea-auto-acknowledgement-text,.ea-auto-ready-title,.ea-auto-ready p,
  .ea-auto-history-count,.ea-auto-history-heading span,
  .ea-auto-session-review-step strong,.ea-auto-user-answer
){color:#314960!important;text-shadow:none!important}
html[data-theme="light"] body.ea-lab-page :is(
  .ea-auto-history-card small,.ea-auto-history-card p,.ea-auto-history-card span,
  .ea-auto-generation-confirm-desc,.ea-auto-build-v16-review-head small,
  .ea-preview-section p,.ea-preview-section small,.ea-progress-section small
){color:var(--eal-light-muted)}

/* Every interactive field: clear value, label, placeholder and focus state */
html[data-theme="light"] body.ea-lab-page :is(input,select,textarea){
  color:#10243a!important;
  background-color:#fff!important;
  border-color:rgba(69,99,134,.28)!important;
  caret-color:#8c620d;
}
html[data-theme="light"] body.ea-lab-page :is(input,textarea)::placeholder{color:#718197!important;opacity:1}
html[data-theme="light"] body.ea-lab-page :is(input,select,textarea):focus{
  border-color:#b9851d!important;
  outline:none;
  box-shadow:0 0 0 3px rgba(185,133,29,.16)!important;
}
html[data-theme="light"] body.ea-lab-page :is(label,.field>span,.field-label){color:#263c53}
html[data-theme="light"] body.ea-lab-page :is(.field small,.field-help,.help-text){color:#5c7086!important}
html[data-theme="light"] body.ea-lab-page :is(.builder-card,.ea-files-panel,.ea-preview-section,.ea-progress-section) small{
  color:#536a81!important;
}
html[data-theme="light"] body.ea-lab-page :is(button,.btn){text-shadow:none}
html[data-theme="light"] body.ea-lab-page :is(.btn-ghost,.btn-soft,.ea-auto-history-card button){
  color:#243a51!important;background:#fff!important;border-color:rgba(63,91,122,.28)!important;
}
html[data-theme="light"] body.ea-lab-page :is(.btn-ghost,.btn-soft,.ea-auto-history-card button):hover{
  color:#6f4b08!important;background:#fff8e7!important;border-color:rgba(185,133,29,.45)!important;
}
html[data-theme="light"] body.ea-lab-page :is(button,[disabled]):disabled{color:#66778a!important;opacity:.72}

/* Complete light button system — legacy and dynamically rendered controls. */
html[data-theme="light"] body.ea-lab-page :is(
  .ea-auto-initial-detail-btn,.ea-auto-initial-edit-btn,
  .ea-auto-history-toggle,.ea-auto-history-edit,
  .ea-auto-build-v16-copyright-toggle,.ea-lab-library-close,
  .ea-lab-library-tab,.ea-lab-library-item button
){
  min-height:34px;padding:7px 11px;border:1px solid rgba(55,84,116,.32)!important;
  border-radius:9px;background:#fff!important;color:#243a51!important;
  font-family:inherit;font-weight:850;box-shadow:0 3px 10px rgba(31,57,86,.06);
  transition:color .16s ease,background .16s ease,border-color .16s ease,box-shadow .16s ease,transform .16s ease;
}
html[data-theme="light"] body.ea-lab-page :is(
  .ea-auto-initial-detail-btn,.ea-auto-initial-edit-btn,
  .ea-auto-history-toggle,.ea-auto-history-edit,
  .ea-auto-build-v16-copyright-toggle,.ea-lab-library-close,
  .ea-lab-library-tab,.ea-lab-library-item button
):hover{
  color:#684607!important;background:#fff7df!important;border-color:rgba(161,108,5,.48)!important;
  box-shadow:0 7px 18px rgba(111,76,12,.12);transform:translateY(-1px);
}
html[data-theme="light"] body.ea-lab-page :is(button,.btn,a.btn):focus-visible{
  outline:3px solid rgba(32,112,184,.30)!important;outline-offset:2px;
}
html[data-theme="light"] body.ea-lab-page .ea-draft-center-trigger{
  color:#17324c!important;background:linear-gradient(135deg,#fff,#fff6de)!important;
  border-color:rgba(161,108,5,.38)!important;box-shadow:0 10px 25px rgba(98,68,14,.10);
}
html[data-theme="light"] body.ea-lab-page .ea-draft-center-trigger:hover{
  color:#5f4007!important;background:linear-gradient(135deg,#fff9e8,#ffe9ac)!important;
  border-color:rgba(161,108,5,.58)!important;
}
html[data-theme="light"] body.ea-lab-page :is(.btn,.ea-auto-generation-confirm-btn,.ea-auto-build-v16-confirm):disabled{
  color:#65778b!important;background:#e9eff5!important;border-color:#cad6e2!important;
  box-shadow:none!important;filter:none!important;cursor:not-allowed;
}

/* Source code intentionally stays in a developer-dark surface. */
html[data-theme="light"] body.ea-lab-page :is(.ea-auto-build-v16-code,.terminal,pre.source-code){
  color:#e8f1fb!important;background:#091522!important;border-color:#b9c7d6!important;
}

/* Quick Backtest: light shell/table, dedicated dark plotting surfaces. */
html[data-theme="light"] #eaQuickBacktestV186{color:#10243a}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-shell{
  color:#10243a;background:linear-gradient(180deg,#fff,#f4f7fb)!important;
  border-color:rgba(168,119,25,.28)!important;box-shadow:0 20px 55px rgba(30,54,82,.12);
}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-head,.ea-qb-meta>div,.ea-qb-metric,.ea-qb-purpose,.ea-qb-history-switcher,.ea-qb-history-panel,.ea-qb-indicators,.ea-qb-disclaimer){
  color:#10243a;background:#fff!important;border-color:rgba(50,79,111,.14)!important;
}
html[data-theme="light"] #eaQuickBacktestV186 :is(h3,b,strong){color:#10243a}
/* Showcase metric values use semantic Fintech colors in the light theme. */
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-showcase-metrics b{
  color:#07845f!important;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-showcase-metrics b.is-loss{
  color:#d2385b!important;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-showcase-metrics b.is-risk{
  color:#9a6500!important;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-showcase-chart-head b{
  color:#07845f!important;
  font-weight:900;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-showcase-chart-head b.is-loss{
  color:#d2385b!important;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-metric.is-positive strong{color:#07845f!important}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-metric.is-negative strong{color:#d2385b!important}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-metric.is-neutral strong{color:#205f96!important}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-metric strong{font-weight:950;text-shadow:none}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-metric{
  border:1px solid rgba(50,79,111,.16)!important;
  border-radius:11px;
  background:linear-gradient(145deg,#fff,#f8fafc)!important;
  box-shadow:0 5px 14px rgba(31,57,86,.045);
}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-subtitle,.ea-qb-meta span,.ea-qb-panel-head small,.ea-qb-history-switcher small,.ea-qb-indicator-note span,.ea-qb-disclaimer p){color:#586b80}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-purpose-copy>p{color:#425a72!important}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-purpose-stats span{
  color:#36516c!important;background:#eef3f8!important;border-color:rgba(54,81,108,.18)!important;
  font-weight:850;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-trade-focus{
  color:#20384f;background:#fff8e8!important;border-color:rgba(161,108,5,.28)!important;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-trade-focus b{color:#172f47!important;font-weight:950}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-trade-focus span{color:#405a73!important;font-weight:650}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-panel-head small,.ea-qb-history td small,.ea-qb-history-switcher small){
  color:#536b82!important;font-size:9px!important;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history-picker>span{color:#27658e!important}
/* Chart tooltips intentionally stay dark above the light canvas. Lock every
   text role so general light-theme heading rules cannot wash them out. */
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-hover-tip,.ea-qb-osc-tip){
  color:#edf5ff!important;
  background:linear-gradient(145deg,rgba(7,20,34,.985),rgba(13,29,47,.985))!important;
  border-color:rgba(196,145,35,.70)!important;
  box-shadow:0 14px 34px rgba(15,31,48,.30),0 0 0 1px rgba(255,255,255,.04) inset!important;
}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-hover-tip,.ea-qb-osc-tip) b{
  color:#ffd35f!important;font-weight:950;text-shadow:none!important;
}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-hover-tip,.ea-qb-osc-tip) span{
  color:#dce7f3!important;font-weight:600;
}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-hover-tip,.ea-qb-osc-tip) em{
  color:#a9bbcd!important;font-style:normal;
}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-hover-tip,.ea-qb-osc-tip) strong{
  color:#f8fbff!important;font-weight:900;
}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-hover-tip,.ea-qb-osc-tip) .is-up{color:#45e0aa!important}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-hover-tip,.ea-qb-osc-tip) .is-down{color:#ff7f9a!important}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-cross-v,.ea-qb-cross-h,.ea-qb-osc-cross-v){
  background:rgba(171,116,10,.68);box-shadow:0 0 8px rgba(171,116,10,.18);
}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-price-panel,.ea-qb-equity-panel,.ea-qb-oscillator){
  color:#182d43;background:linear-gradient(180deg,#fbfdff,#f2f6fa)!important;border-color:rgba(53,84,116,.22)!important;
}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-price-panel,.ea-qb-equity-panel,.ea-qb-oscillator) :is(b,strong){color:#172d43}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-oscillator-head small{color:#216997}
html[data-theme="light"] #eaQuickBacktestV186 :is(.ea-qb-panel-head,.ea-qb-oscillator-head){background:rgba(237,243,249,.88);border-color:rgba(53,84,116,.15)}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-legend{color:#40566d}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-expand{
  color:#744d05;background:#fff7dc;border-color:rgba(161,108,5,.48);font-weight:900;
  box-shadow:0 5px 14px rgba(161,108,5,.10);
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-expand:hover{color:#4f3404;background:#ffefbc;border-color:#a16c05}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-head-run{
  color:#684607;background:#fff4cf;border-color:rgba(161,108,5,.50);
  box-shadow:0 5px 14px rgba(161,108,5,.10);font-weight:950;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-head-run:hover{color:#442e04;background:#ffe9a6;border-color:#966304}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history-platforms button{
  color:#334a61;background:#fff;border-color:rgba(55,84,116,.28);font-weight:900;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history-platforms button:hover{
  color:#684607;background:#fff7df;border-color:rgba(161,108,5,.45);
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history-platforms button.is-active{
  color:#241804;background:linear-gradient(135deg,#ffe49a,#d9a83e);border-color:#bd8620;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-chart-empty,
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-equity-empty{color:#52677d;background:#f7fafc}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history table{background:#fff;color:#23384e}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history th{color:#334a61;background:#e9f0f6;font-weight:850}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history td{color:#263b52;border-color:#e1e8ef}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history :is(td.is-buy,.is-buy){
  color:#07845f!important;font-weight:950;text-shadow:0 0 12px rgba(7,132,95,.10);
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history :is(td.is-sell,.is-sell){
  color:#d2385b!important;font-weight:950;text-shadow:0 0 12px rgba(210,56,91,.10);
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history :is(td.is-profit,.is-profit){
  color:#07845f!important;font-weight:950;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history :is(td.is-loss,.is-loss){
  color:#d2385b!important;font-weight:950;
}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history tbody tr:hover{background:#fff8e8}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history tbody tr.is-selected{background:#fff2ce}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-indicator-chip{background:#eef6ff;border-color:#c9dced}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-indicator-chip b{color:#214e79}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-indicator-chip small{color:#5b7087}
html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-progress{color:#10243a;background:#fff!important;box-shadow:0 12px 30px rgba(31,57,86,.1)}

/* Floating AI chat and captions */
html[data-theme="light"] body.ea-lab-page .ea-advisor-speech{color:#172b41;background:rgba(255,255,255,.97)!important;box-shadow:0 14px 36px rgba(48,66,92,.18)}
html[data-theme="light"] body.ea-lab-page .ea-advisor-speech :is(b,strong,span,p){color:#172b41;text-shadow:none}

/* AI selector affordance: make the whole control feel pressable on hover. */
body.ea-lab-page .ea-advisor-picker{
  position:relative;overflow:hidden;isolation:isolate;
  transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease,background .18s ease;
}
body.ea-lab-page .ea-advisor-picker::after{
  content:"";position:absolute;z-index:-1;inset:-45% auto -45% -38%;width:32%;
  pointer-events:none;opacity:0;transform:skewX(-18deg);
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.30),transparent);
}
body.ea-lab-page .ea-advisor-picker select{
  transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease,background-color .18s ease,color .18s ease;
}
body.ea-lab-page .ea-advisor-picker:has(select:hover),
body.ea-lab-page .ea-advisor-picker:focus-within{
  transform:translateY(-1px);border-color:rgba(242,199,106,.78);
  box-shadow:0 10px 28px rgba(201,145,34,.18),0 0 0 3px rgba(242,199,106,.10);
}
body.ea-lab-page .ea-advisor-picker:has(select:hover)::after,
body.ea-lab-page .ea-advisor-picker:focus-within::after{
  opacity:1;animation:eaAdvisorSelectSweep .78s ease-out both;
}
body.ea-lab-page .ea-advisor-picker select:hover,
body.ea-lab-page .ea-advisor-picker select:focus{
  transform:translateX(2px);cursor:pointer;
  border-color:rgba(242,199,106,.72)!important;
  box-shadow:0 0 0 3px rgba(242,199,106,.13),inset 0 0 18px rgba(242,199,106,.055)!important;
}
html[data-theme="light"] body.ea-lab-page .ea-advisor-picker:has(select:hover),
html[data-theme="light"] body.ea-lab-page .ea-advisor-picker:focus-within{
  background:linear-gradient(135deg,#fff,#fff4d7);border-color:rgba(161,108,5,.62);
}
html[data-theme="light"] body.ea-lab-page .ea-advisor-picker select:hover,
html[data-theme="light"] body.ea-lab-page .ea-advisor-picker select:focus{
  color:#6a4707!important;background-color:#fffaf0!important;border-color:rgba(161,108,5,.58)!important;
}
@keyframes eaAdvisorSelectSweep{
  0%{left:-38%;opacity:0}25%{opacity:1}100%{left:112%;opacity:0}
}
@media(prefers-reduced-motion:reduce){
  body.ea-lab-page .ea-advisor-picker,body.ea-lab-page .ea-advisor-picker select{transition:none}
  body.ea-lab-page .ea-advisor-picker::after{display:none}
}

@media(max-width:700px){
  html[data-theme="light"] body.ea-lab-page :is(.builder-card,.ea-preview-section,.ea-progress-section,.ea-auto-history-card){box-shadow:0 8px 22px rgba(31,57,86,.07)}
  html[data-theme="light"] body.ea-lab-page :is(input,select,textarea){font-size:16px!important}
  html[data-theme="light"] body.ea-lab-page :is(button,.btn,a.btn){min-height:40px}
  html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history-panel{overflow:hidden}
  html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-history-wrap{background:#fff}
  html[data-theme="light"] #eaQuickBacktestV186 .ea-qb-hover-tip{min-width:190px;max-width:calc(100vw - 34px);font-size:11px}
  html[data-theme="light"] body.ea-lab-page .ea-ai-advisor{
    right:5px!important;
    bottom:calc(10px + env(safe-area-inset-bottom,0px))!important;
    width:104px!important;
    height:146px!important;
  }
  html[data-theme="light"] body.ea-lab-page .ea-ai-advisor .ea-advisor-speech{
    right:82%;
    bottom:15%;
    max-width:min(158px,calc(100vw - 100px));
    padding:8px 10px;
    font-size:9px;
    line-height:1.4;
  }
}
