/* Sprint129 Current Theme Consolidation
   목적: 계산기 상세 화면에서 다크/라이트 테마가 일부 wrapper/여백/카드에만 누락되는 문제를 현재 기준으로 통합 보정한다.
   범위: calculators.html 내부 workspace, Sprint118 상세 계산기, Sprint122 리포트, Sprint125 Lite-to-Pro, Lite 계산기 표면색/선/텍스트 대비.
   변경 없음: 계산식, 시나리오 JS, 테마 토글 JS, 단위 로직, 도메인 설정.
*/
:root{
  --j129-light-bg:#f6f8fc;
  --j129-light-panel:#ffffff;
  --j129-light-card:#f2f6fb;
  --j129-light-card-2:#eaf1fb;
  --j129-light-text:#0b1220;
  --j129-light-muted:#66768b;
  --j129-light-line:#d8e0ec;
  --j129-dark-bg:#07111f;
  --j129-dark-panel:#0f1b2d;
  --j129-dark-card:#14243a;
  --j129-dark-card-2:#1a2f4b;
  --j129-dark-text:#f8fafc;
  --j129-dark-muted:#cbd5e1;
  --j129-dark-line:#334155;
  --j129-primary:#4f83ff;
  --j129-accent:#2dd4bf;
}

html[data-theme="light"],
body[data-theme="light"],
html:not([data-theme="dark"]):not(.dark):not(.dark-mode):not(.is-dark){
  --j129-bg:var(--j129-light-bg);
  --j129-panel:var(--j129-light-panel);
  --j129-card:var(--j129-light-card);
  --j129-card-2:var(--j129-light-card-2);
  --j129-text:var(--j129-light-text);
  --j129-muted:var(--j129-light-muted);
  --j129-line:var(--j129-light-line);
}

html[data-theme="dark"],
body[data-theme="dark"],
html.dark,
body.dark,
html.dark-mode,
body.dark-mode,
html.is-dark,
body.is-dark{
  --j129-bg:var(--j129-dark-bg);
  --j129-panel:var(--j129-dark-panel);
  --j129-card:var(--j129-dark-card);
  --j129-card-2:var(--j129-dark-card-2);
  --j129-text:var(--j129-dark-text);
  --j129-muted:var(--j129-dark-muted);
  --j129-line:var(--j129-dark-line);
}

/* 1) 가장 바깥 workspace와 상세 계산기 전체 표면. 카드 사이 여백까지 같은 테마로 채운다. */
#workspace,
#workspace .workspace,
#workspace .calculator-workspace,
#workspace .calculator-detail,
#workspace .s118-shell,
#workspace .s118-layout,
#workspace .s118-layout > main,
#workspace .s118-layout > aside,
#workspace .s118-main,
#workspace .s118-side,
#workspace .s118-body,
#workspace .s118-detail,
#workspace .s118-content{
  background:var(--j129-bg) !important;
  color:var(--j129-text) !important;
  border-color:var(--j129-line) !important;
}

/* 2) 계산기 상세 큰 섹션/폼/리포트 wrapper. 기존 흰 배경이 남던 지점. */
#workspace .s118-shell :is(
  .s118-hero,
  .s118-form,
  .s118-card,
  .s118-report,
  .s118-sticky,
  .s118-result-head,
  .s118-panel,
  .s118-summary,
  .s118-section,
  .s118-step,
  .s122-advisory,
  .s122-highlight,
  .s125-funnel,
  .lite-calc-shell,
  .lite-shell,
  .lite-card,
  .lite-results,
  .result-panel,
  .result-card,
  .consulting-result-card,
  .policy-result,
  .guide,
  .guide-box,
  details,
  section
){
  background:var(--j129-panel) !important;
  color:var(--j129-text) !important;
  border-color:var(--j129-line) !important;
  box-shadow:none !important;
}

/* 3) 펼침형 입력 그룹의 내부 wrapper. 투명 처리하면 뒤의 라이트 배경이 비쳐서 여기를 명시한다. */
#workspace .s118-shell :is(
  .s118-group,
  .s118-group[open],
  .s118-group summary,
  .s118-fields,
  .s118-fieldset,
  .s118-actions,
  .s118-section-title,
  .s118-scenarios,
  .s118-kpis,
  .s118-compare,
  .s118-compare-grid,
  .s122-advisory-grid,
  .s122-mini-grid,
  .s122-card-grid,
  .s125-grid,
  .s125-head,
  .lite-grid,
  .lite-output-grid
){
  background:var(--j129-panel) !important;
  color:var(--j129-text) !important;
  border-color:var(--j129-line) !important;
}

/* 4) 내부 카드/입력 wrapper/KPI. 한 단계 밝은 카드 톤으로 통일. */
#workspace .s118-shell :is(
  .s118-input,
  .s118-kpi,
  .s118-compare-grid > div,
  .s118-scenario,
  .s122-mini,
  .s122-advisory-card,
  .metric,
  .analysis-item,
  .check,
  .prep-row,
  .policy-number-box,
  .policy-number-box > div,
  .input-quality-card,
  .desktop-compact-summary > div,
  .standard-card,
  .lite-input-wrap,
  .lite-result-card,
  .lite-field,
  .s125-card,
  .s125-detail,
  .s125-reason,
  .s125-next,
  .form-card,
  .input-card,
  .output-card,
  .scenario-card,
  .summary-card,
  .kpi-card
){
  background:var(--j129-card) !important;
  color:var(--j129-text) !important;
  border:1px solid var(--j129-line) !important;
  box-shadow:none !important;
}

/* 5) 입력/선택/텍스트 영역 */
#workspace .s118-shell :is(input,select,textarea),
#workspace .s118-shell :is(.s118-input input,.s118-input select,.lite-input-wrap input,.lite-field select),
#workspace :is(.lite-calc-shell input,.lite-calc-shell select){
  background:var(--j129-card-2) !important;
  color:var(--j129-text) !important;
  border-color:var(--j129-line) !important;
  box-shadow:none !important;
}
#workspace .s118-shell :is(input::placeholder,textarea::placeholder){
  color:var(--j129-muted) !important;
  opacity:.88 !important;
}

/* 6) 제목/본문 대비 */
#workspace .s118-shell :is(h1,h2,h3,h4,h5,h6,strong,label,summary,.title,.card-title,.result-heading,.s118-field > span,.s118-kpi strong,.s118-result-head strong,.s122-mini strong,.s122-advisory h3,.lite-result-card strong,.s125-card strong,.metric strong,.value),
#workspace :is(.lite-result-card strong,.s125-card strong){
  color:var(--j129-text) !important;
  opacity:1 !important;
  filter:none !important;
  word-break:keep-all;
  overflow-wrap:anywhere;
}
#workspace .s118-shell :is(p,span,small,li,.sub,.desc,.muted,.s118-group summary span,.s118-section-title p,.s118-result-head p,.s118-kpi span,.s118-compare-grid span,.s118-compare-grid small,.s118-report ul,.s118-money-read,.s122-mini li,.s122-advisory p,.lite-result-card span,.s125-card p,.s125-card span,.s125-card small),
#workspace :is(.lite-result-card span,.lite-result-card small,.s125-card p,.s125-card span,.s125-card small){
  color:var(--j129-muted) !important;
  opacity:1 !important;
  filter:none !important;
  word-break:keep-all;
  overflow-wrap:anywhere;
}

/* 7) active scenario */
#workspace .s118-shell :is(.s118-scenario.active,.s118-scenario.is-active,.scenario.active,.scenario.selected,.scenario.is-active){
  background:linear-gradient(135deg,rgba(79,131,255,.22),rgba(45,212,191,.12)),var(--j129-card) !important;
  border-color:var(--j129-accent) !important;
  color:var(--j129-text) !important;
  box-shadow:0 0 0 3px rgba(45,212,191,.12) !important;
}

/* 8) 우측 결과 리포트 카드가 좁은 세로 기둥처럼 보이지 않게 항상 1열 */
#workspace .s118-shell :is(
  .s122-advisory-grid,
  .s122-mini-grid,
  .s122-card-grid,
  .s118-sticky .s122-advisory-grid,
  .s118-sticky .s122-mini-grid,
  .s118-sticky .s122-card-grid
){
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:10px !important;
}
#workspace .s118-shell :is(.s122-mini,.s122-advisory-card){
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
}

/* 9) 선/구분선 */
#workspace .s118-shell :is(hr,.progress-line,.s118-divider,.divider,.line,.connector,.step-line),
#workspace .s118-shell *{
  border-color:var(--j129-line);
}

/* 10) 라이트모드 결과 숫자 흐림 방지 */
html[data-theme="light"] #workspace .s118-shell :is(.lite-result-card strong,.s118-kpi strong,.metric strong,.value,.s125-card strong),
body[data-theme="light"] #workspace .s118-shell :is(.lite-result-card strong,.s118-kpi strong,.metric strong,.value,.s125-card strong){
  color:var(--j129-light-text) !important;
}

/* 11) 다크모드에서 남아 있는 고정 흰색 inline/style 보정 */
html[data-theme="dark"] #workspace [style*="background: white"],
html[data-theme="dark"] #workspace [style*="background:#fff"],
html[data-theme="dark"] #workspace [style*="background: #fff"],
html[data-theme="dark"] #workspace [style*="background-color: white"],
html[data-theme="dark"] #workspace [style*="background-color:#fff"],
html[data-theme="dark"] #workspace [style*="background-color: #fff"],
body.dark #workspace [style*="background: white"],
body.dark #workspace [style*="background:#fff"],
body.dark #workspace [style*="background: #fff"],
body.dark #workspace [style*="background-color: white"],
body.dark #workspace [style*="background-color:#fff"],
body.dark #workspace [style*="background-color: #fff"]{
  background:var(--j129-panel) !important;
  color:var(--j129-text) !important;
  border-color:var(--j129-line) !important;
}

/* 12) 화면 폭별 안전장치 */
@media(max-width:1180px){
  #workspace .s118-shell .s118-layout{ grid-template-columns:1fr !important; }
  #workspace .s118-shell .s118-sticky{ position:static !important; }
}

/* Sprint129 root-level override: 부모/여백 표면색까지 다크 테마로 강제 통일 */
html[data-theme="dark"] body,
html.dark body,
body.dark,
body[data-theme="dark"]{
  background:var(--j129-bg) !important;
  color:var(--j129-text) !important;
}

html[data-theme="dark"] body #workspace,
html.dark body #workspace,
body.dark #workspace,
body[data-theme="dark"] #workspace,
html[data-theme="dark"] body #workspace .workspace,
html.dark body #workspace .workspace,
body.dark #workspace .workspace,
body[data-theme="dark"] #workspace .workspace{
  background:var(--j129-bg) !important;
  background-color:var(--j129-bg) !important;
  color:var(--j129-text) !important;
  border-color:var(--j129-line) !important;
}

html[data-theme="dark"] body #workspace .s118-shell,
html.dark body #workspace .s118-shell,
body.dark #workspace .s118-shell,
body[data-theme="dark"] #workspace .s118-shell,
html[data-theme="dark"] body #workspace .s118-layout,
html.dark body #workspace .s118-layout,
body.dark #workspace .s118-layout,
body[data-theme="dark"] #workspace .s118-layout,
html[data-theme="dark"] body #workspace .s118-layout > main,
html.dark body #workspace .s118-layout > main,
body.dark #workspace .s118-layout > main,
body[data-theme="dark"] #workspace .s118-layout > main,
html[data-theme="dark"] body #workspace .s118-layout > aside,
html.dark body #workspace .s118-layout > aside,
body.dark #workspace .s118-layout > aside,
body[data-theme="dark"] #workspace .s118-layout > aside,
html[data-theme="dark"] body #workspace form.s118-form,
html.dark body #workspace form.s118-form,
body.dark #workspace form.s118-form,
body[data-theme="dark"] #workspace form.s118-form{
  background:var(--j129-panel) !important;
  background-color:var(--j129-panel) !important;
  color:var(--j129-text) !important;
  border-color:var(--j129-line) !important;
  box-shadow:none !important;
}

html[data-theme="dark"] body #workspace .s118-shell .s118-card,
html.dark body #workspace .s118-shell .s118-card,
body.dark #workspace .s118-shell .s118-card,
body[data-theme="dark"] #workspace .s118-shell .s118-card,
html[data-theme="dark"] body #workspace .s118-shell .s118-group,
html.dark body #workspace .s118-shell .s118-group,
body.dark #workspace .s118-shell .s118-group,
body[data-theme="dark"] #workspace .s118-shell .s118-group,
html[data-theme="dark"] body #workspace .s118-shell .s118-group summary,
html.dark body #workspace .s118-shell .s118-group summary,
body.dark #workspace .s118-shell .s118-group summary,
body[data-theme="dark"] #workspace .s118-shell .s118-group summary,
html[data-theme="dark"] body #workspace .s118-shell .s118-fields,
html.dark body #workspace .s118-shell .s118-fields,
body.dark #workspace .s118-shell .s118-fields,
body[data-theme="dark"] #workspace .s118-shell .s118-fields,
html[data-theme="dark"] body #workspace .s118-shell .s118-actions,
html.dark body #workspace .s118-shell .s118-actions,
body.dark #workspace .s118-shell .s118-actions,
body[data-theme="dark"] #workspace .s118-shell .s118-actions{
  background:var(--j129-panel) !important;
  background-color:var(--j129-panel) !important;
  color:var(--j129-text) !important;
  border-color:var(--j129-line) !important;
}

html[data-theme="dark"] body #workspace .s118-shell .s118-field,
html.dark body #workspace .s118-shell .s118-field,
body.dark #workspace .s118-shell .s118-field,
body[data-theme="dark"] #workspace .s118-shell .s118-field,
html[data-theme="dark"] body #workspace .s118-shell .s118-input,
html.dark body #workspace .s118-shell .s118-input,
body.dark #workspace .s118-shell .s118-input,
body[data-theme="dark"] #workspace .s118-shell .s118-input,
html[data-theme="dark"] body #workspace .s118-shell .s118-kpi,
html.dark body #workspace .s118-shell .s118-kpi,
body.dark #workspace .s118-shell .s118-kpi,
body[data-theme="dark"] #workspace .s118-shell .s118-kpi,
html[data-theme="dark"] body #workspace .s118-shell .s118-scenario,
html.dark body #workspace .s118-shell .s118-scenario,
body.dark #workspace .s118-shell .s118-scenario,
body[data-theme="dark"] #workspace .s118-shell .s118-scenario,
html[data-theme="dark"] body #workspace .s118-shell .s122-mini,
html.dark body #workspace .s118-shell .s122-mini,
body.dark #workspace .s118-shell .s122-mini,
body[data-theme="dark"] #workspace .s118-shell .s122-mini,
html[data-theme="dark"] body #workspace .s118-shell .s122-advisory-card,
html.dark body #workspace .s118-shell .s122-advisory-card,
body.dark #workspace .s118-shell .s122-advisory-card,
body[data-theme="dark"] #workspace .s118-shell .s122-advisory-card,
html[data-theme="dark"] body #workspace .s118-shell .s118-compare-grid > div,
html.dark body #workspace .s118-shell .s118-compare-grid > div,
body.dark #workspace .s118-shell .s118-compare-grid > div,
body[data-theme="dark"] #workspace .s118-shell .s118-compare-grid > div{
  background:var(--j129-card) !important;
  background-color:var(--j129-card) !important;
  color:var(--j129-text) !important;
  border-color:var(--j129-line) !important;
}

/* 라이트모드는 과한 검정 테두리 대신 부드러운 카드 톤 유지 */
html[data-theme="light"] body #workspace .s118-shell :is(.s118-card,.s118-group,.s118-form,.s118-report,.s122-advisory,.s125-funnel,.lite-calc-shell),
body[data-theme="light"] #workspace .s118-shell :is(.s118-card,.s118-group,.s118-form,.s118-report,.s122-advisory,.s125-funnel,.lite-calc-shell){
  background:#ffffff !important;
  color:#0b1220 !important;
  border-color:#d8e0ec !important;
}
