:root {
  --bg: #0f1419; --surface: #1a212b; --surface2: #232c38;
  --border: #2c3742; --text: #e6edf3; --muted: #8b98a5;
  --accent: #ffb000; --up: #ff5a5a; --down: #2ecc71;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 15px;
}
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface);
}
header h1 { font-size: 18px; margin: 0; font-weight: 500; }
.accent { color: var(--accent); }
.status { font-size: 13px; color: var(--muted); }
.status.ok { color: var(--down); }
.headRight { display: flex; align-items: center; gap: 12px; }
.ver { font-size: 12px; color: var(--muted); font-weight: 400; }
.logoutBtn { font-size: 13px; padding: 5px 12px; }

.overlay {
  position: fixed; inset: 0; background: rgba(10,14,20,0.92);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.loginBox {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 28px 26px; width: 320px; display: flex; flex-direction: column; gap: 12px;
}
.loginBox h2 { margin: 0; font-size: 18px; font-weight: 500; text-align: center; }
.loginVer { margin: 0; text-align: center; color: var(--muted); font-size: 12px; }
.loginBox input { padding: 10px 12px; font-size: 15px; }
.loginBox button { padding: 10px; font-size: 15px; background: var(--accent); color: #1a1200; border: none; font-weight: 500; }
.loginBox button:hover { opacity: 0.9; }

.tabs { display: flex; gap: 4px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.tab {
  background: none; border: none; color: var(--muted); padding: 8px 16px;
  cursor: pointer; border-radius: 8px; font-size: 15px;
}
.tab.active { background: var(--surface2); color: var(--text); }

.panel { display: none; padding: 16px; }
.panel.active { display: block; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin: 0 0 12px; font-weight: 500; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card h3 { font-size: 14px; color: var(--muted); margin: 16px 0 6px; font-weight: 400; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 400; }
td.flash-up { color: var(--up); } td.flash-down { color: var(--down); }
.pos-pnl-up { color: var(--up); } .pos-pnl-down { color: var(--down); }

#chart, #btChart { width: 100%; height: 320px; }

input, select, button {
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-size: 14px;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
.orderForm { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.orderForm input { width: 110px; }

.summary { display: flex; gap: 20px; flex-wrap: wrap; font-size: 14px; }
.summary .item { display: flex; flex-direction: column; }
.summary .item .label { color: var(--muted); font-size: 12px; }
.summary .item .val { font-size: 18px; }

.msg { font-size: 13px; margin-top: 8px; min-height: 18px; }
.msg.err { color: var(--up); } .msg.ok { color: var(--down); }
.report { white-space: pre-wrap; line-height: 1.7; font-size: 14px; }
.citations { margin-top: 14px; }
.citations h3 { font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 400; }
.cite { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px; }
.cite .n { color: var(--accent); flex-shrink: 0; }
.cite a { color: var(--text); text-decoration: none; }
.cite a:hover { color: var(--accent); }
.cite .meta { color: var(--muted); font-size: 12px; }
#kbDocTable td:nth-child(3) { white-space: normal; }
#kbDocTable a { color: var(--text); text-decoration: none; }
#kbDocTable a:hover { color: var(--accent); }

/* 技術指標面板 */
.muted { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 8px; font-size: 13px; }
.chip b { color: var(--muted); font-weight: 400; margin-right: 5px; }
.sigs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sig { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px;
  border-radius: 6px; font-size: 13px; border: 1px solid var(--border); }
.sig.up { color: var(--up); border-color: var(--up); }
.sig.down { color: var(--down); border-color: var(--down); }
.sig em { color: var(--muted); font-style: normal; font-size: 12px; }
.yoy-up { color: var(--up); } .yoy-down { color: var(--down); }

/* 技術線圖 */
.card.wide { grid-column: 1 / -1; }
.subch { margin-top: 10px; }
.sublbl { font-size: 12px; color: var(--muted); }
#techMain, #techMacd, #techKd, #techRsi { width: 100%; }
