/* ส่วนที่เพิ่มในรุ่น 3 ให้เหมือนหน้าเว็บเดิม: ธีมสว่าง สวิตช์ธีม ลากคอลัมน์ กล่องค่าตั้งสูตร (แบบรุ่น 3 หัวข้อ 10) */
:root[data-theme="light"]:not([data-design-system="godseye"]) {
  color-scheme: light;
  --bg-deep: #f4f6fa;
  --bg-base: #ffffff;
  --bg-surface: #ffffff;
  --bg-raised: #eef1f6;
  --bg-overlay: #e3e8f0;
  --text: #111827;
  --text-2: #374151;
  --text-3: #4b5563;
  --border: #d5dbe5;
  --border-hover: #b8c1cf;
  --accent: #0070c0;
  --accent-2: #00866f;
  --gold: #a16207;
  --amber: #92400e;
  --amber-strong: #b45309;
  --up: #15803d;
  --down: #b91c1c;
  --avg-up: #0369a1;
  --avg-down: #c2410c;
  --quiet: #4b5563;
  --fresh: #0e7490;
  --grid-bg: #ffffff;
  --grid-head: #f1f4f9;
  --grid-text: #111827;
  --grid-line: #e2e8f0;
  --row-hover: #eef4ff;
}
.top-actions { display: flex; gap: 8px; align-items: center; }
/* สวิตช์ธีมแบบต้นฉบับ: กว้าง 56 สูง 28 ปุ่มกลม 24 · มืด ปุ่มซ้ายพื้น #2A2E39 พระจันทร์ #00B8FF · สว่าง ปุ่มขวาพื้นขาว ดวงอาทิตย์ #F7931A */
.theme-switch {
  position: relative; width: 56px; height: 28px; flex: none; padding: 0 6px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--bg-raised); display: flex; align-items: center; justify-content: space-between; cursor: pointer;
}
.theme-track { display: inline-flex; color: var(--text-3); opacity: .6; }
.theme-knob {
  position: absolute; top: 1px; left: 1px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: #2a2e39; color: #00b8ff; transition: transform .2s ease; box-shadow: 0 1px 3px rgb(0 0 0 / .35);
}
:root[data-theme="light"] .theme-switch { background: #e8ecf3; border-color: #d1d4dc; }
:root[data-theme="light"] .theme-knob { transform: translateX(28px); background: #fff; color: #f7931a; }
th[draggable="true"] { cursor: grab; }
th.dragging { opacity: .5; }
th.drop-target { box-shadow: inset 2px 0 0 var(--accent); }
.col-handle { display: inline-flex; width: 16px; justify-content: center; color: var(--text-3); font-size: 11px; }
.columns-list .studio-row[draggable="true"] { cursor: grab; }
.columns-list .studio-row.dragging { opacity: .5; }
.columns-list .studio-row.drop-target { box-shadow: inset 0 2px 0 var(--accent); }
/* เฟืองและตาที่หัวคอลัมน์: ขึ้นเมื่อชี้ เรียง [เฟือง][ตา] ตาขวาสุด ขนาด 12px (hideable-header.tsx)
   ต้องเจาะจงกว่า ".scores th button { all: unset }" ของตารางเดิม ไม่อย่างนั้นโผล่ตลอด (ลองจริง 8 พ.ย.) */
.scores th .col-gear, .scores th .col-eye {
  position: absolute; top: 50%; transform: translateY(-50%); display: none; padding: 2px; color: var(--text-3); cursor: pointer;
}
.scores th .col-eye { right: 2px; }
.scores th .col-gear { right: 18px; }
.scores th:hover .col-gear, .scores th:hover .col-eye, .scores th .col-gear:focus-visible, .scores th .col-eye:focus-visible { display: inline-flex; }
.scores th .col-gear:hover, .scores th .col-eye:hover { color: var(--accent); }
/* ไอคอน ? อธิบายคอลัมน์ (14 พ.ย.) ขึ้นตลอดหน้าชื่อคอลัมน์ วงกลมเล็กสีจาง ชี้แล้วเป็นสีเน้น */
.scores th .col-help {
  display: inline-flex; align-items: center; justify-content: center; width: 13px; height: 13px; margin-right: 4px;
  border: 1px solid var(--text-3); border-radius: 50%; color: var(--text-3); font-size: 9px; font-weight: 700; line-height: 1;
  cursor: help; vertical-align: middle;
}
.scores th .col-help::before { content: "?"; }
/* คอลัมน์จัดกึ่งกลาง: ? ยื่นไปทางซ้าย ชื่อคอลัมน์อยู่ที่เดิม ไม่ถูกดันเข้าเขตเฟือง (ลองจริง 14 พ.ย. กดเรียง ADX ไม่ได้) */
.scores th.col-adx .col-help, .scores th.col-macd .col-help, .scores th.col-average .col-help { margin-left: -17px; }
.scores th .col-help:hover, .scores th .col-help:focus-visible { color: var(--accent); border-color: var(--accent); }
/* กล่องค่าตั้งกลางจอแบบ column-info-modal.tsx: ชิดบน มุมโค้ง เส้นสีบนขอบ หัวกล่อง ไอคอน ปุ่มปิด แท็บ */
.col-modal {
  width: min(760px, calc(100vw - 32px)); max-height: 88vh; margin: 5vh auto auto; padding: 0; border: 1px solid var(--border);
  border-top: 2px solid var(--accent); border-radius: 16px; background: var(--bg-surface); color: var(--text);
  box-shadow: 0 24px 60px rgb(0 0 0 / .45); overflow: auto;
}
.col-modal::backdrop { background: rgb(0 0 0 / .5); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 6px; }
.modal-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--bg-raised); font-size: 20px; }
.modal-heading { flex: 1; min-width: 0; }
.modal-title { font-size: 16px; }
.modal-desc { margin: 2px 0 0; color: var(--text-3); font-size: 12px; }
.modal-desc:empty, .modal-version:empty { display: none; }
.modal-close { border: 0; background: transparent; color: var(--text-2); font-size: 22px; cursor: pointer; line-height: 1; }
.modal-version { margin: 0 20px 6px; color: var(--text-3); font-size: 11px; font-family: var(--mono, monospace); }
.modal-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.modal-tab {
  display: inline-flex; gap: 6px; align-items: center; padding: 8px 10px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--text-2); font-size: 13px; cursor: pointer;
}
.modal-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.modal-pane { padding: 12px 20px 18px; }
/* กล่องเครื่องมือคอลัมน์แบบสั้น (D-080) ใช้ร่วมทุกคอลัมน์ Indicator: ส่วน หัวข้อ ช่องตัวเลข ค่าขั้นสูงพับไว้ น้ำหนัก ท้ายกล่อง */
.modal-pane { font-size: 13px; line-height: 1.5; color: var(--text-2); }
.gd-section { margin: 0 0 16px; }
.gd-section h4, .gd-advanced summary { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--text); font-size: 13px; font-weight: 600; }
.gd-dim { color: var(--text-3); font-size: 12px; font-weight: 400; }
.gd-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.gd-field { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-raised); cursor: text; }
.gd-field:focus-within { border-color: var(--accent); }
.gd-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--text); font-size: 12px; font-weight: 600; }
.gd-input { display: flex; align-items: center; gap: 6px; }
.gd-input input, .gd-grid input {
  width: 76px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); color: var(--text);
  font: 600 13px var(--mono, monospace); text-align: right;
}
.gd-unit { color: var(--text-3); font-size: 11px; }
.gd-hintline { height: 18px; margin: 6px 0 0; overflow: hidden; color: var(--text-3); font-size: 11px; line-height: 18px; white-space: nowrap; text-overflow: ellipsis; }
.gd-badge { padding: 1px 7px; border: 1px solid rgba(0, 184, 255, .35); border-radius: 999px; color: var(--accent); font-size: 10px; font-weight: 600; }
.gd-badge.gd-off { border-color: var(--border); color: var(--text-3); }
.gd-advanced { margin: 0 0 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.gd-advanced summary { margin: 0; cursor: pointer; }
.gd-advanced[open] summary { margin-bottom: 12px; }
.gd-advanced .gd-section:last-child { margin-bottom: 0; }
.gd-grid { border-collapse: collapse; }
.gd-grid th, .gd-grid td { padding: 4px 12px 4px 0; text-align: left; font-size: 12px; }
.gd-grid th { color: var(--text-3); font-weight: 500; }
.gd-weights { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.gd-weight {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-raised); color: var(--text-2); font-size: 12px; cursor: pointer;
}
.gd-weight b { color: var(--text); font-family: var(--mono, monospace); }
.gd-weight[aria-pressed="true"] { border-color: var(--accent); background: rgba(0, 184, 255, .12); color: var(--accent); }
.gd-weight[aria-pressed="true"] b { color: var(--accent); }
.gd-weight-line { display: flex; align-items: center; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.gd-weight-line > b { width: 64px; color: var(--text); }
.gd-footer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); }
.gd-footer .settings-note { flex: 1; min-width: 160px; margin: 0; }
.gd-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.gd-point { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-left-width: 3px; border-radius: 10px; }
.gd-point b { color: var(--text); font-family: var(--mono, monospace); }
.gd-up { border-left-color: #34d399; } .gd-down { border-left-color: #fb7185; } .gd-accent { border-left-color: var(--accent); }
.gd-table { width: 100%; border-collapse: collapse; }
.gd-table th, .gd-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.gd-key { width: 110px; color: var(--text); font: 600 12px var(--mono, monospace); white-space: nowrap; }
.gd-example { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--bg-raised); font: 12px var(--mono, monospace); }
.gd-more summary { color: var(--accent); cursor: pointer; font-size: 12px; }
.gd-links { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }
.gd-links a { color: var(--accent); }
.gd-tips { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.gd-tips li { position: relative; padding: 8px 12px 8px 30px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); }
.gd-tips li::before { content: "✓"; position: absolute; left: 11px; color: var(--accent); font-weight: 700; }
.weight-options { display: flex; gap: 6px; margin-top: 6px; }
.weight-option { min-width: 32px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-raised); color: var(--text); cursor: pointer; }
.weight-option[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.link-button { justify-self: start; border: 0; background: transparent; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: 12px; padding: 0; }
.small-button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.settings-note { min-height: 1.4em; margin: 8px 0 0; color: var(--text-2); font-size: 12px; }
.macd-raw { width: 100%; border-collapse: collapse; font-size: 11px; font-family: var(--mono, monospace); }
.macd-raw th, .macd-raw td { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: right; }
.macd-raw th:first-child, .macd-raw td:first-child { text-align: left; }
.kn-accent { color: var(--accent); }
.kn-svg { width: 100%; height: auto; margin: 6px 0; color: var(--text-3); }
/* ป้ายตลาดปิดข้างแท็บแบบ market-tabs.tsx: จุดส้ม #F7931A ข้อความเล็ก แสดงบนจอกว้างเท่านั้น */
.closed-badge { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; color: var(--text-2); font-size: 12px; white-space: nowrap; }
.closed-badge[hidden] { display: none; }
.closed-dot { width: 7px; height: 7px; border-radius: 50%; background: #f7931a; }
@media (max-width: 900px) {
  .closed-badge { display: none; }
}
@media (max-width: 560px) { .gd-fields, .gd-points { grid-template-columns: 1fr; } }
/* ส่วนที่หน้าเว็บเดิมใช้สีตายตัว ต้องเปลี่ยนตามธีมสว่าง (ลองจริง 8 พ.ย. ยังเป็นสีเข้มค้าง) */
:root[data-theme="light"] .style-card { background: var(--bg-raised); }
:root[data-theme="light"] .statusbar, :root[data-theme="light"] .system-row { background: var(--bg-raised); }
:root[data-theme="light"] .disclaimer { background: #fff8e6; color: var(--text-2); }
:root[data-theme="light"] .disclaimer b { color: #7c2d12; }
:root[data-theme="light"] .status-reasons { color: #92400e; }
:root[data-theme="light"] .status[data-state="live"] .code, :root[data-theme="light"] .status[data-state="live"] .status-word { color: #047857; }
:root[data-theme="light"] .status[data-state="partial"] .code, :root[data-theme="light"] .status[data-state="partial"] .status-word,
:root[data-theme="light"] .status[data-state="stale"] .code, :root[data-theme="light"] .status[data-state="stale"] .status-word { color: #c2410c; }
:root[data-theme="light"] .status[data-state="starting"] .code, :root[data-theme="light"] .status[data-state="starting"] .status-word { color: #0369a1; }
:root[data-theme="light"] .dot { background: #cbd5e1; }
:root[data-theme="light"] .tone-zero, :root[data-theme="light"] .col-change .tone-zero { color: #6b7280; }
/* Momentum แรงถึงเกณฑ์: พื้นเขียว/แดง ตัวอักษรขาว สีเดียวกับ EA C'0,150,70' / C'205,40,40' (ทาง 1 14 พ.ย.) ไม่ถึงเกณฑ์เป็นสีเทา */
.scores .value.is-strong { padding: 1px 5px; border-radius: 3px; color: #fff; font-weight: 600; }
.scores .value.is-strong.tone-up { background: rgb(0, 150, 70); }
.scores .value.is-strong.tone-down { background: rgb(205, 40, 40); }
/* คอลัมน์แบบรายการ EA 16 พ.ย.: ส้ม = กลาง (AmSpreadRatio 1.0–1.5 · อัตราชนะ 40–54%) · เทา = ยังไม่ถึงจังหวะหรือข้อมูลน้อย */
.tone-warn { color: var(--amber-strong); }
.scores .value.is-strong.tone-warn { background: rgb(230, 140, 0); color: #fff; }
.scores .value.is-strong.tone-grey { background: rgb(150, 150, 150); color: #fff; }
.scores .sub.is-rank-up { color: var(--up); }
.scores .sub.is-rank-down { color: var(--down); }
.scorebook-line { margin: 6px 12px 0; font-size: 12px; color: var(--quiet); line-height: 1.5; }
/* EA 2.50: ชื่อ BTCUSDT และ GOLD ตัวหนา เขียว/แดงตาม Styles agree */
.scores .symbol-name.is-main { font-weight: 800; }
.scores .symbol-name.is-main.tone-up { color: var(--up); }
.scores .symbol-name.is-main.tone-down { color: var(--down); }
/* แถบพอร์ตเหนือตาราง (เฟส 2 16 พ.ย.) สีแท็กแบบแถบสถานะของ EA */
.portfolio-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 12px; }
.pf-tag { padding: 3px 8px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 600; }
.pf-green { background: rgb(27, 127, 59); } .pf-amber { background: rgb(200, 140, 0); } .pf-red { background: rgb(198, 40, 40); }
.pf-slate { background: rgb(70, 90, 120); } .pf-black { background: rgb(20, 20, 20); } .pf-grey { background: rgb(130, 130, 130); }
.pf-dark { background: rgb(40, 48, 66); }
.pf-btn { padding: 3px 10px; border-radius: 4px; border: 1px solid rgb(70, 90, 120); background: transparent; color: inherit;
  font-size: 12px; font-weight: 600; cursor: pointer; }
.pf-btn.pf-armed { background: rgb(198, 40, 40); color: #fff; border-color: rgb(198, 40, 40); }
.scores .detail-row td { padding: 3px 12px 3px 40px; font-size: 12px; background: var(--bg-raised); }
.scores td[data-col=mpl] { cursor: pointer; }
