/* 復發風險預測 UI — 對應 docs CLAUDE_predict_ui_ux.md
   調性：冷靜、臨床、可信；band 為主、不嚇人、不遊戲化。
   色彩：low #3FA796 / medium #E0A458 / high #D97757（禁用純紅）。 */

/* ── RiskBandBadge ──────────────────────────────────────── */
.risk-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--band-color) 14%, transparent);
  color: var(--band-color);
  font-weight: 700; font-size: 15px; line-height: 1;
}
.risk-badge-icon { font-size: 16px; }
.risk-badge-label { letter-spacing: .5px; }

/* ── RiskCard（畫面 A）──────────────────────────────────── */
.home-risk-slot { margin: 0 0 14px; }
.risk-card {
  border: 1px solid rgba(0, 0, 0, .08);
  border-left: 4px solid var(--band-color, #3FA796);
  border-radius: 16px; padding: 16px 18px;
  background: #fff; box-shadow: 0 2px 12px rgba(20, 40, 80, .05);
}
.risk-card.cold { border-left-color: #9aa7b5; cursor: pointer; }
.rc-top { display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: #6b7785; margin-bottom: 10px; }
.rc-title { font-weight: 600; color: #2b3a4b; }
.rc-horizon { font-size: 12px; opacity: .75; }
.rc-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rc-trend { font-size: 13px; font-weight: 600; }
.rc-trend.up { color: #D97757; }
.rc-trend.down { color: #3FA796; }
.rc-trend.flat { color: #6b7785; }
.rc-sub { font-size: 12px; color: #8a94a0; margin: 6px 0 8px; }
.rc-driver { font-size: 14px; color: #2b3a4b; margin: 8px 0; line-height: 1.5; }
.rc-driver-calm { color: #6b7785; }
.rc-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.rc-btn { flex: 1 1 auto; min-width: 120px; padding: 9px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.rc-btn.primary { background: #2b3a4b; color: #fff; }
.rc-btn.ghost { background: #fff; color: #2b3a4b; border-color: rgba(0,0,0,.15); }
.rc-disclaimer, .predict-disclaimer {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: #9aa7b5; margin-top: 10px; line-height: 1.4; }
.rc-cold { font-size: 14px; color: #2b3a4b; margin: 4px 0 10px; }

/* ── ConfidenceMeter ───────────────────────────────────── */
.confidence-meter { display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; font-size: 12.5px; color: #6b7785; margin-top: 10px; }
.cm-dots { display: inline-flex; gap: 3px; }
.cm-dot { width: 7px; height: 7px; border-radius: 50%; background: #d7dde4; }
.cm-dot.on { background: #5B9FE8; }
.cm-value { font-weight: 700; color: #2b3a4b; }
.cm-days { opacity: .8; }
.cm-warn { flex-basis: 100%; color: #D97757; font-weight: 600; }

/* ── predict 頁面 ──────────────────────────────────────── */
.predict-page { max-width: 720px; margin: 0 auto; padding: 8px 4px 40px; }
.predict-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.predict-back { width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto;
  background: #fff; border: 1px solid rgba(0,0,0,.12); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; }
.predict-head h2 { margin: 0; font-size: 19px; color: #2b3a4b; }
.predict-head p { margin: 2px 0 0; font-size: 13px; color: #8a94a0; }

.predict-summary { border: 1px solid rgba(0,0,0,.08);
  border-left: 4px solid var(--band-color, #3FA796);
  border-radius: 14px; padding: 14px 16px; background: #fff; margin-bottom: 18px; }
.ps-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ps-meta { font-size: 14px; color: #2b3a4b; font-weight: 600; }

.predict-section { margin-bottom: 22px; }
.predict-section h3 { font-size: 15px; color: #2b3a4b; margin: 0 0 10px; }

/* ── ShapBarList（畫面 C）──────────────────────────────── */
.shap-list { display: flex; flex-direction: column; gap: 14px; }
.shap-row { background: #fafbfc; border: 1px solid rgba(0,0,0,.05);
  border-radius: 12px; padding: 10px 12px; }
.shap-head { display: flex; justify-content: space-between; align-items: baseline; }
.shap-name { font-weight: 600; color: #2b3a4b; font-size: 14px; }
.shap-val { font-size: 13px; font-weight: 700; }
.shap-row.up .shap-val { color: #D97757; }
.shap-row.down .shap-val { color: #5B9FE8; }
.shap-track { position: relative; height: 8px; border-radius: 999px;
  background: #eef1f4; margin: 8px 0; overflow: hidden; }
.shap-fill { position: absolute; top: 0; height: 100%; border-radius: 999px; }
.shap-fill.up { left: 50%; background: #D97757; }      /* 向右 = 推升 */
.shap-fill.down { right: 50%; background: #5B9FE8; }   /* 向左 = 降低 */
.shap-foot { display: flex; justify-content: space-between; align-items: center;
  gap: 8px; font-size: 12.5px; color: #6b7785; }
.shap-mod { color: #2b7a6b; font-weight: 600; white-space: nowrap; }
.shap-add { margin-top: 8px; width: 100%; padding: 8px; border-radius: 9px;
  background: #eef6f4; color: #2b7a6b; border: 1px solid #cfe6e0;
  font-size: 13px; font-weight: 600; cursor: pointer; }
.shap-empty { font-size: 13px; color: #8a94a0; }
.shap-modifiable { font-size: 13.5px; color: #2b7a6b; font-weight: 600; margin-top: 12px; }

/* ── RiskTrendChart（畫面 B）──────────────────────────── */
.trend-chart { background: #fff; border: 1px solid rgba(0,0,0,.06);
  border-radius: 12px; padding: 12px; }
.trend-svg { width: 100%; height: 180px; display: block; }
.trend-conf { fill: #5B9FE8; opacity: .14; }
.trend-line { fill: none; stroke: #2b3a4b; stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round; }
.trend-today { fill: #2b3a4b; stroke: #fff; stroke-width: 2; }
.trend-flare { fill: #D97757; font-size: 13px; }
.trend-empty { text-align: center; color: #9aa7b5; font-size: 13px; padding: 40px 0; }
.trend-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 2px 0;
  font-size: 11.5px; color: #6b7785; }
.trend-legend span { display: inline-flex; align-items: center; gap: 5px; }
.trend-legend .lg-line { width: 16px; height: 2px; background: #2b3a4b; }
.trend-legend .lg-conf { width: 14px; height: 9px; background: #5B9FE8; opacity: .25; border-radius: 2px; }
.trend-legend .lg-flare { color: #D97757; }
.trend-tabs { display: flex; gap: 6px; margin-top: 12px; }
.trend-tab { flex: 1; padding: 7px 0; border-radius: 8px; font-size: 13px;
  background: #f1f4f7; color: #6b7785; border: none; cursor: pointer; }
.trend-tab.active { background: #2b3a4b; color: #fff; font-weight: 600; }

/* ── ColdStartCard（畫面 D）──────────────────────────── */
.cold-start-card { background: #fff; border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px; padding: 28px 22px; text-align: center; max-width: 460px; margin: 0 auto; }
.cs-icon { font-size: 36px; margin-bottom: 8px; }
.cs-title { font-size: 18px; color: #2b3a4b; margin: 0 0 10px; }
.cs-body { font-size: 14.5px; color: #4b5a6b; line-height: 1.6; margin: 0 0 16px; }
.cs-progress { height: 10px; border-radius: 999px; background: #eef1f4; overflow: hidden; }
.cs-bar { height: 100%; background: linear-gradient(90deg, #5B9FE8, #3FA796); border-radius: 999px;
  transition: width .4s ease; }
.cs-count { font-size: 13px; color: #6b7785; margin: 8px 0 4px; }
.cs-collecting { font-size: 13px; color: #8a94a0; margin: 0 0 18px; }
.cs-cta { padding: 11px 28px; border-radius: 10px; background: #2b3a4b; color: #fff;
  border: none; font-size: 15px; font-weight: 600; cursor: pointer; }

/* ── 載入骨架 / 錯誤 ───────────────────────────────────── */
.risk-card.skeleton { border-left-color: #e3e8ee; }
.sk-line, .sk-block { background: linear-gradient(90deg, #eef1f4 25%, #f6f8fa 50%, #eef1f4 75%);
  background-size: 200% 100%; animation: sk-shimmer 1.3s infinite; border-radius: 8px; }
.sk-line { height: 14px; margin-bottom: 10px; }
.sk-line.short { width: 50%; }
.sk-block { height: 60px; }
@keyframes sk-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.predict-error { text-align: center; color: #8a94a0; font-size: 14px; padding: 40px 0; }
.predict-disclaimer.subtle { opacity: .8; margin-top: 12px; }

/* ── 疾病別 / 文獻 / 預估參考（新增）─────────────────────── */
/* 文獻相關標記：低調的書本色，不搶 band */
.rc-linked, .cause-linked, .shap-linked {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: #5a6b9a;
  background: #eef1fb; border-radius: 999px; padding: 1px 7px; margin-left: 6px; white-space: nowrap; }
.cause-general { font-size: 12px; color: #8a94a0; }

/* 百分比收合：band 為主，數字藏在 details 裡 */
.rc-pct, .ps-pct { margin: 8px 0 2px; font-size: 12.5px; color: #8a94a0; }
.rc-pct summary, .ps-pct summary { cursor: pointer; color: #6b7785; }
.rc-pct[open] span, .ps-pct[open] span { display: inline-block; margin-top: 4px; color: #2b3a4b; font-weight: 600; }

.ps-heading { font-size: 15.5px; font-weight: 700; color: #2b3a4b; margin: 0 0 10px; line-height: 1.5; }

/* 最可能的復發原因（預估參考） */
.predict-cause { background: #fff; border: 1px solid rgba(0,0,0,.07);
  border-left: 4px solid #E0A458; border-radius: 14px; padding: 14px 16px; margin-bottom: 18px; }
.predict-cause.calm { border-left-color: #3FA796; }
.predict-cause h3 { font-size: 14px; color: #6b7785; margin: 0 0 8px; }
.cause-main { font-size: 16px; font-weight: 700; color: #2b3a4b; margin: 0 0 8px; line-height: 1.5; }
.cause-body { font-size: 14px; color: #4b5a6b; margin: 0; line-height: 1.6; }
.cause-evidence { display: flex; align-items: flex-start; gap: 5px; font-size: 12.5px;
  color: #5a6b9a; background: #f5f7fd; border-radius: 8px; padding: 7px 9px; margin: 8px 0; line-height: 1.5; }
.cause-add { margin-top: 6px; padding: 8px 12px; border-radius: 9px; background: #eef6f4;
  color: #2b7a6b; border: 1px solid #cfe6e0; font-size: 13px; font-weight: 600; cursor: pointer; }
.cause-note { font-size: 11.5px; color: #9aa7b5; margin: 10px 0 0; line-height: 1.5; }

/* 醫學文獻怎麼說 */
.lit-block { background: #fafbfc; border: 1px solid rgba(0,0,0,.05); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.lit-block.pending { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #8a94a0; font-size: 13px; flex-wrap: wrap; }
.lit-rate { font-size: 14px; color: #2b3a4b; margin: 0 0 6px; line-height: 1.5; }
.lit-summary { font-size: 13.5px; color: #4b5a6b; margin: 0; line-height: 1.6; }

/* 要注意的復發徵兆 */
.watch-signs { margin-top: 10px; }
.watch-title { font-size: 13.5px; font-weight: 600; color: #2b3a4b; margin: 0 0 6px; }
.watch-signs ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.watch-signs li { display: flex; align-items: flex-start; gap: 7px; font-size: 13.5px; color: #4b5a6b; line-height: 1.5; }
.watch-signs li i { color: #E0A458; flex: 0 0 auto; margin-top: 2px; }

/* 文獻引用 chips（根據） */
.ref-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.ref-label { font-size: 12px; color: #8a94a0; }
.ref-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: #5a6b9a;
  background: #eef1fb; border: 1px solid #dde3f4; border-radius: 999px; padding: 3px 9px; text-decoration: none; max-width: 100%; }
.ref-chip:hover { background: #e3e8f7; }

/* SHAP 因子的文獻證據 + 連結態 */
.shap-row.linked { border-color: #dde3f4; }
.shap-evidence { display: flex; align-items: flex-start; gap: 5px; font-size: 12px; color: #5a6b9a;
  background: #f5f7fd; border-radius: 8px; padding: 6px 8px; margin: 8px 0 0; line-height: 1.5; }

/* 分析用到哪些紀錄（透明清單） */
.records-inventory { list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.records-inventory li { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 4px 0; }
.records-inventory .ri-on { color: #2b3a4b; }
.records-inventory .ri-on i { color: #3FA796; }
.records-inventory .ri-off { color: #aab4c0; }
.ri-label { flex: 1; }
.ri-count { font-size: 12px; font-weight: 600; color: #2b7a6b; }
.ri-missing { font-size: 11.5px; color: #b6bfca; }
.ri-foot { font-size: 11.5px; color: #9aa7b5; margin: 10px 0 0; line-height: 1.5; }

/* 整理成就診摘要大鈕 */
.predict-tosummary { display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px; border-radius: 12px; background: #2b3a4b; color: #fff;
  border: none; font-size: 15px; font-weight: 600; cursor: pointer; margin: 6px 0 16px; }

/* 疾病綁定步驟（收集 user 資訊） */
.cs-step { text-align: left; background: #fafbfc; border: 1px solid rgba(0,0,0,.06);
  border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; }
.cs-step.done { background: #f1f8f6; border-color: #cfe6e0; }
.cs-step-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cs-step-no { width: 22px; height: 22px; flex: 0 0 auto; border-radius: 50%;
  background: #2b3a4b; color: #fff; font-size: 12.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; }
.cs-step.done .cs-step-no { background: #3FA796; }
.cs-step-title { font-size: 14.5px; font-weight: 600; color: #2b3a4b; }
.cs-hint { font-size: 12.5px; color: #8a94a0; margin: 0 0 10px; line-height: 1.5; }
.predict-bind { background: #fff; border: 1px solid rgba(0,0,0,.07); border-radius: 14px; padding: 14px 16px; }

.db-form { display: flex; gap: 8px; flex-wrap: wrap; }
.db-input { flex: 1 1 160px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(0,0,0,.15); font-size: 14px; }
.db-save, .db-warm { padding: 10px 14px; border-radius: 10px; background: #2b3a4b; color: #fff;
  border: none; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.db-warm { background: #5B9FE8; }
.db-warm:disabled { background: #aab4c0; cursor: default; }
.db-litline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.db-ok { font-size: 13px; font-weight: 600; color: #2b7a6b; }
.db-edit { background: none; border: none; color: #8a94a0; font-size: 12.5px; cursor: pointer; text-decoration: underline; padding: 0; }

/* ── 深色模式（沿用 body.theme-dark 慣例）──────────────── */
body.theme-dark .risk-card,
body.theme-dark .predict-summary,
body.theme-dark .trend-chart,
body.theme-dark .cold-start-card,
body.theme-dark .predict-back { background: #1b2430; border-color: rgba(255,255,255,.08); }
body.theme-dark .rc-title, body.theme-dark .rc-driver,
body.theme-dark .predict-head h2, body.theme-dark .ps-meta,
body.theme-dark .shap-name, body.theme-dark .cs-title,
body.theme-dark .predict-section h3 { color: #e6ecf2; }
body.theme-dark .rc-btn.primary, body.theme-dark .cs-cta,
body.theme-dark .trend-tab.active { background: #5B9FE8; }
body.theme-dark .rc-btn.ghost { background: #1b2430; color: #e6ecf2; }
body.theme-dark .shap-row { background: #222d3a; border-color: rgba(255,255,255,.05); }
body.theme-dark .trend-line { stroke: #cfe0f5; }
body.theme-dark .trend-today { fill: #cfe0f5; stroke: #1b2430; }
body.theme-dark .predict-cause,
body.theme-dark .predict-bind { background: #1b2430; border-color: rgba(255,255,255,.08); }
body.theme-dark .lit-block, body.theme-dark .cs-step { background: #222d3a; border-color: rgba(255,255,255,.06); }
body.theme-dark .cs-step.done { background: #1c2e2a; border-color: rgba(63,167,150,.3); }
body.theme-dark .cause-main, body.theme-dark .ps-heading, body.theme-dark .cause-add,
body.theme-dark .lit-rate, body.theme-dark .watch-title, body.theme-dark .cs-step-title,
body.theme-dark .records-inventory .ri-on { color: #e6ecf2; }
body.theme-dark .cause-evidence, body.theme-dark .shap-evidence,
body.theme-dark .rc-linked, body.theme-dark .cause-linked, body.theme-dark .shap-linked,
body.theme-dark .ref-chip { background: #232d44; color: #aab8e0; border-color: rgba(255,255,255,.08); }
body.theme-dark .db-input { background: #222d3a; color: #e6ecf2; border-color: rgba(255,255,255,.12); }
