/* =========================================================
   陳柏翰 台股盤勢分析 — 深色交易介面
   台股習慣：上漲紅、下跌綠
   ========================================================= */
:root {
  --bg: #0b0f14;
  --panel: #111821;
  --panel-2: #16202b;
  --border: #223041;
  --text: #e6edf3;
  --text-dim: #8b98a8;
  --accent: #4c8dff;
  --up: #f6465d;          /* 上漲 */
  --down: #1fbf75;        /* 下跌 */
  --flat: #c9d1d9;
  --good: #1fbf75;        /* 偏多／正面條件 */
  --warn: #f0b429;        /* 觀察／注意 */
  --bad: #f6465d;         /* 風險 */
  --radius: 10px;
  --font: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  --mono: "Consolas", "SF Mono", "Roboto Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { min-height: 100vh; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
button, input { font-family: inherit; font-size: 14px; }
.hidden { display: none !important; }
.dim { color: var(--text-dim); }
.small { font-size: 12.5px; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.placeholder { color: var(--text-dim); font-size: 13.5px; line-height: 1.6; }

/* ---------- 頂部列 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: rgba(11, 15, 20, 0.96);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #4c8dff, #7b5cff); font-weight: 700; font-size: 13px; color: #fff;
}
.brand-text { font-weight: 700; font-size: 16px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.market-state { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; }
.market-state.open { color: var(--good); }
.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.icon-btn:hover { border-color: var(--text-dim); }

/* ---------- 搜尋框 ---------- */
.search { position: relative; }
.search-top { flex: 1; max-width: 420px; }
.search-input {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text); outline: none;
}
.search-input:focus { border-color: var(--accent); }
.search-hero .search-input { font-size: 18px; padding: 16px 18px; border-radius: 12px; }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60;
  margin: 0; padding: 4px; list-style: none;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  max-height: 360px; overflow-y: auto; display: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.search-results.show { display: block; }
.search-results li {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer;
}
.search-results li.active, .search-results li:hover { background: #1f2c3a; }
.search-results .r-code { font-family: var(--mono); color: var(--accent); min-width: 64px; }
.search-results .r-name { font-weight: 600; }
.search-results .r-meta { margin-left: auto; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.search-results .r-empty { color: var(--text-dim); cursor: default; }

/* ---------- 首頁 ---------- */
.home { display: flex; justify-content: center; padding: 10vh 16px 40px; }
.home-inner { width: 100%; max-width: 720px; text-align: center; }
.home h1 { font-size: 30px; margin: 0 0 8px; }
.home-sub { color: var(--text-dim); margin: 0 0 28px; }
.list-status { font-size: 13px; color: var(--text-dim); min-height: 18px; }
.home-recent { margin-top: 28px; text-align: left; }
.home-recent h2 { font-size: 14px; color: var(--text-dim); font-weight: 600; }
.disclaimer { margin-top: 40px; font-size: 12px; color: var(--text-dim); }

/* ---------- 最近查詢 ---------- */
.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.home-recent .recent-list { flex-direction: row; flex-wrap: wrap; }
.recent-list li {
  display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--border); cursor: pointer; font-size: 13.5px;
}
.recent-list li:hover { border-color: var(--accent); }
.recent-list .code { font-family: var(--mono); color: var(--accent); }

/* ---------- Dashboard 版面 ---------- */
.dashboard {
  display: grid; gap: 12px; padding: 12px 16px 24px;
  grid-template-columns: 220px minmax(0, 1fr) 320px;
  grid-template-areas:
    "left center right"
    "left bottom right";
  align-items: start;
}
.area-left { grid-area: left; padding: 12px; position: sticky; top: 64px; }
.area-center { grid-area: center; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.area-right { grid-area: right; display: flex; flex-direction: column; gap: 12px; }
.area-bottom { grid-area: bottom; padding: 12px 14px; min-width: 0; }
.panel-head h2, .analysis-card h2 { font-size: 14px; margin: 4px 0 10px; }
.panel-head + .placeholder { margin-top: 0; }

/* ---------- 報價卡 ---------- */
.quote-card { padding: 14px 16px; }
.quote-title { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.q-name { font-size: 20px; font-weight: 700; }
.q-code { font-family: var(--mono); color: var(--text-dim); margin: 0 6px; font-size: 16px; }
.tag {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: #1d2a3a; color: #b7c7da; margin-right: 4px;
}
.tag-dim { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 6px; border: 1px solid; }
.badge.warn { color: var(--warn); border-color: rgba(240, 180, 41, 0.5); background: rgba(240, 180, 41, 0.08); }
.badge.bad { color: var(--bad); border-color: rgba(246, 70, 93, 0.5); background: rgba(246, 70, 93, 0.08); }
.badge.info { color: #9cc1ff; border-color: rgba(76, 141, 255, 0.5); background: rgba(76, 141, 255, 0.08); }
.badge.good { color: var(--good); border-color: rgba(31, 191, 117, 0.5); background: rgba(31, 191, 117, 0.08); }
.quote-main { display: flex; align-items: baseline; gap: 14px; margin: 10px 0 8px; flex-wrap: wrap; }
.q-price { font-size: 38px; font-weight: 700; font-family: var(--mono); letter-spacing: -0.5px; }
.q-change { font-size: 18px; font-family: var(--mono); }
.quote-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.quote-stats > div { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.quote-stats .label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 2px; }
.quote-stats span:not(.label) { font-family: var(--mono); font-size: 14.5px; }
.quote-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; }

.inline-message {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; line-height: 1.5;
  background: rgba(246, 70, 93, 0.08); border: 1px solid rgba(246, 70, 93, 0.4); color: #ffb3bd;
}
.inline-message.warn { background: rgba(240, 180, 41, 0.08); border-color: rgba(240, 180, 41, 0.4); color: #ffd98a; }
.inline-message .details { margin-top: 4px; font-size: 12px; color: var(--text-dim); }

/* ---------- K線 ---------- */
.chart-card { padding: 10px 12px 12px; }
.chart-toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.seg button {
  background: transparent; color: var(--text-dim); border: 1px solid transparent;
  padding: 5px 9px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.seg button:hover { color: var(--text); }
.seg button.active { color: var(--text); background: #1d2a3a; border-color: #2c3e55; }
.seg-gap { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.seg-small button { font-size: 12px; padding: 4px 8px; }
.chart-options { display: flex; gap: 10px; flex-wrap: wrap; }
.ma-toggle { font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.ma-toggle input { accent-color: currentColor; margin: 0; }
.ma5 { color: #f5c542; }
.ma20 { color: #ff7ab6; }
.ma60 { color: #4cc3ff; }
.ma120 { color: #b48cff; }
.bb { color: #a0aec0; }
.chart-legend {
  min-height: 22px; margin: 8px 2px 4px; font-size: 12.5px; font-family: var(--mono);
  display: flex; gap: 12px; flex-wrap: wrap; color: var(--text-dim);
}
.chart-legend b { color: var(--text); font-weight: 500; }
.chart-wrap { position: relative; }
.chart { width: 100%; height: 460px; }
.chart-message {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px;
  background: rgba(11, 15, 20, 0.85); color: var(--text-dim); font-size: 14px; line-height: 1.7; border-radius: 8px;
}
.chart-message .title { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.subchart-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.sub-legend { margin: 0; min-height: 0; }
.subchart { width: 100%; height: 150px; }
.chart-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- AI SIGNAL ---------- */
.signal-card { padding: 18px; text-align: center; border-width: 2px; }
.signal-head { font-size: 12px; letter-spacing: 3px; color: var(--text-dim); font-weight: 700; }
.signal-label { font-size: 26px; font-weight: 800; margin: 10px 0 4px; }
.signal-score { font-family: var(--mono); font-size: 20px; }
.signal-note { margin-top: 10px; font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.signal-pending { border-color: #2c3e55; }
.signal-pending .signal-label { color: var(--text-dim); }

/* ---------- 分析卡片 ---------- */
.analysis-card { padding: 12px 14px; }
.verdict { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.good { background: var(--good); }
.dot.neutral { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.none { background: var(--text-dim); }
.lvl-good { color: var(--good); }
.lvl-neutral { color: var(--warn); }
.lvl-bad { color: var(--bad); }
.lvl-none { color: var(--text-dim); }
.verdict-detail { font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.check-list { list-style: none; padding: 0; margin: 10px 0 0; font-size: 13px; display: flex; flex-direction: column; gap: 5px; }
.check-list li { display: flex; gap: 8px; line-height: 1.45; }
.check-list .ok { color: var(--good); }
.check-list .no { color: var(--warn); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; margin-top: 8px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; text-align: right; font-family: var(--mono); }
.note-line { font-size: 12px; color: var(--text-dim); margin-top: 8px; line-height: 1.5; }

/* ---------- 指標與法人 ---------- */
.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.mini { background: var(--panel-2); border-radius: 8px; padding: 7px 9px; font-size: 12.5px; }
.mini .t { color: var(--text-dim); display: block; margin-bottom: 2px; }
.mini .v { font-family: var(--mono); font-size: 14px; }
.event-list { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.inst-table td, .inst-table th { text-align: right; white-space: nowrap; }
.inst-table th:first-child, .inst-table td:first-child { text-align: left; }
.inst-table th { width: auto; }
.table-scroll { overflow-x: auto; }
.inst-daily td { font-size: 12.5px; padding: 6px 8px; }

/* ---------- 下方分頁 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; overflow-x: auto; }
.tabs button {
  background: transparent; border: none; color: var(--text-dim); padding: 8px 12px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .data-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th { color: var(--text-dim); font-weight: 500; width: 40%; }
.data-table td { font-family: var(--mono); }

/* ---------- 設定視窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.6);
  display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; overflow-y: auto;
}
.modal-box {
  width: 100%; max-width: 640px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px 22px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 18px; }
.settings-section { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 14px; }
.settings-section h3 { margin: 0 0 6px; font-size: 15px; }
.settings-section p { margin: 4px 0 8px; line-height: 1.55; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input, .login-box input {
  flex: 1; min-width: 180px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text); outline: none;
}
.inline-form input:focus, .login-box input:focus { border-color: var(--accent); }
button.primary {
  background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 9px 14px; cursor: pointer; font-weight: 600;
}
button.primary:disabled { opacity: 0.5; cursor: wait; }
button.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; cursor: pointer;
}
.form-result { min-height: 18px; font-size: 13px; }
.form-result.ok { color: var(--good); }
.form-result.err { color: var(--bad); }
.phone-urls { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0; }
.phone-url { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; text-align: center; }
.phone-url .qr { background: #fff; padding: 8px; border-radius: 8px; display: inline-block; line-height: 0; }
.phone-url .qr svg { width: 150px; height: 150px; }
.phone-url .url { font-family: var(--mono); font-size: 13px; margin-top: 8px; word-break: break-all; }
.phone-url .kind { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
details.help { margin-top: 8px; font-size: 13.5px; }
details.help summary { cursor: pointer; color: var(--accent); }
details.help ol { padding-left: 20px; line-height: 1.7; color: #c8d3df; }
.status-list { margin: 6px 0 10px; padding-left: 18px; line-height: 1.6; }

/* ---------- 登入頁 ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { width: 100%; max-width: 380px; padding: 28px 24px; text-align: center; }
.login-brand { justify-content: center; margin-bottom: 8px; }
.login-box form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.login-box input { width: 100%; font-size: 16px; }

/* ---------- 平板 ---------- */
@media (max-width: 1180px) {
  .dashboard {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas:
      "center right"
      "bottom right"
      "left left";
  }
  .area-left { position: static; }
  .quote-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- 手機 ---------- */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .brand-text { font-size: 15px; }
  .search-top { order: 3; flex-basis: 100%; max-width: none; }
  .btn-label { display: none; }
  .dashboard {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "center" "right" "bottom" "left";
    padding: 10px 10px 24px;
  }
  .q-price { font-size: 32px; }
  .chart { height: 340px; }
  .subchart { height: 130px; }
  .home { padding-top: 6vh; }
  .home h1 { font-size: 23px; }
  .search-hero .search-input { font-size: 16px; padding: 14px; }
  .modal { padding: 0; }
  .modal-box { border-radius: 0; min-height: 100vh; }
  input { font-size: 16px !important; } /* 避免 iPhone 輸入時自動放大 */
}

/* =========================================================
   第 3 批：訊號卡、為什麼面板、自選股、提醒、名詞解釋
   ========================================================= */
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 2px 4px; font-size: 12.5px; }
.small-btn { padding: 5px 10px !important; font-size: 12.5px; }
button.danger { color: var(--bad); border-color: rgba(246, 70, 93, 0.5); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- 訊號卡 ---- */
.signal-entry { border-color: var(--good); box-shadow: 0 0 0 1px rgba(31, 191, 117, 0.25), 0 0 24px rgba(31, 191, 117, 0.12); }
.signal-watch { border-color: var(--warn); box-shadow: 0 0 0 1px rgba(240, 180, 41, 0.25), 0 0 24px rgba(240, 180, 41, 0.10); }
.signal-exit { border-color: var(--bad); box-shadow: 0 0 0 1px rgba(246, 70, 93, 0.25), 0 0 24px rgba(246, 70, 93, 0.12); }
.signal-entry .signal-label { color: var(--good); }
.signal-watch .signal-label { color: var(--warn); }
.signal-exit .signal-label { color: var(--bad); }
.signal-score { font-size: 28px; font-weight: 700; }
.signal-badge { display: inline-block; margin-top: 8px; font-size: 15px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--panel-2); }
.signal-badge:empty { display: none; }
.why-btn {
  margin-top: 12px; width: 100%; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
}
.why-btn:hover { border-color: var(--accent); }

/* ---- 為什麼面板 ---- */
.why-panel { padding: 12px 14px; }
.why-panel h2 { font-size: 15px; margin: 4px 0; }
.why-h { font-size: 13.5px; margin: 12px 0 6px; }
.why-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.why-list li { display: flex; gap: 8px; line-height: 1.45; }
.why-list .mark { flex: none; width: 18px; text-align: center; }
.why-list .ok .mark { color: var(--good); }
.why-list .warn { color: #ffd98a; }
.why-list .no .mark { color: var(--bad); }
.why-list .none { color: var(--text-dim); }
.why-list .pts { color: var(--text-dim); font-family: var(--mono); font-size: 12px; margin-left: 4px; }
.why-conclusion { margin: 12px 0; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); font-size: 13.5px; line-height: 1.6; box-shadow: none; }
.why-conclusion p { margin: 4px 0; }
.cat-bars { display: flex; flex-direction: column; gap: 5px; }
.cat-bar { display: grid; grid-template-columns: 104px 1fr 64px; gap: 8px; align-items: center; font-size: 12.5px; }
.cat-bar .bar { height: 7px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.cat-bar .bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.cat-bar .num { text-align: right; color: var(--text-dim); }
.ai-section { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 10px; }
.ai-section h3 { font-size: 14px; margin: 0; }
.qa { margin: 8px 0 0; font-size: 13px; }
.qa dt { color: var(--accent); margin-top: 10px; font-weight: 600; }
.qa dd { margin: 3px 0 0; line-height: 1.6; }

/* ---- 自選股 ---- */
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.chip {
  background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer;
}
.chip.active { color: var(--text); border-color: var(--accent); background: #1a2a40; }
.manage-box { background: var(--panel-2); border-radius: 8px; padding: 8px; margin-bottom: 8px; }
.small-form input { min-width: 0; padding: 6px 8px; font-size: 13px; }
.wl-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wl-item {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 10px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--border); cursor: pointer;
}
.wl-item:hover { border-color: var(--accent); }
.wl-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-name .code { font-family: var(--mono); color: var(--accent); font-weight: 400; }
.wl-cat { font-size: 11px; color: var(--text-dim); font-weight: 400; }
.wl-quote { display: flex; gap: 8px; font-size: 13px; }
.wl-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.wl-score { font-size: 16px; font-weight: 700; }
.wl-tools { grid-column: 1 / -1; display: flex; gap: 4px; justify-content: flex-end; margin-top: 2px; }
.wl-tools button, .wl-tools select {
  background: transparent; color: var(--text-dim); border: 1px solid var(--border); border-radius: 6px;
  font-size: 11px; padding: 2px 6px; cursor: pointer;
}
.wl-tools select { max-width: 90px; background: var(--panel); }
.sig-pill { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.sig-pill.good { color: var(--good); border-color: rgba(31, 191, 117, 0.5); }
.sig-pill.neutral { color: var(--warn); border-color: rgba(240, 180, 41, 0.5); }
.sig-pill.bad { color: var(--bad); border-color: rgba(246, 70, 93, 0.5); }
.sig-pill.none { color: var(--text-dim); border-color: var(--border); }
.quote-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.watch-add { display: flex; gap: 6px; align-items: center; }
.watch-add select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 6px; font-size: 12.5px;
}

/* ---- 提醒 ---- */
.bell-wrap { position: relative; }
.badge-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center;
}
.alert-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, 92vw); max-height: 70vh; overflow-y: auto; z-index: 80;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.alert-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-item { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.alert-item.unread { background: rgba(76, 141, 255, 0.07); }
.alert-item.sev-good .alert-title { color: var(--good); }
.alert-item.sev-bad .alert-title { color: var(--bad); }
.alert-title { font-weight: 700; }
.alert-msg { color: #c8d3df; margin-top: 3px; line-height: 1.5; }
.alert-details { margin: 4px 0 0; padding-left: 4px; list-style: none; color: var(--text-dim); font-size: 12px; }
.alert-time { color: var(--text-dim); font-size: 11.5px; margin-top: 4px; }
.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 200; width: min(360px, calc(100vw - 32px));
  background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.5; cursor: pointer;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); transition: opacity 0.6s;
}
.toast.sev-good { border-left-color: var(--good); }
.toast.sev-bad { border-left-color: var(--bad); }
.toast.hide { opacity: 0; }

/* ---- 設定表單 ---- */
.stack-form { display: flex; flex-direction: column; gap: 8px; }
.stack-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-dim); }
.stack-form input {
  padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); outline: none;
}
.check-row { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; margin: 6px 0; line-height: 1.5; cursor: pointer; }
.check-row input { margin-top: 4px; }

/* ---- 名詞解釋 ---- */
.glossary-cats { margin-top: 10px; }
.glossary-list { margin-top: 6px; }
.glossary-cat { font-size: 13px; color: var(--accent); margin: 16px 0 6px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.term { padding: 8px 0; border-bottom: 1px dashed #1c2735; }
.term-name { font-weight: 700; font-size: 14.5px; }
.term-desc { font-size: 13.5px; line-height: 1.65; color: #c8d3df; margin-top: 2px; }
.term-sys { font-size: 12.5px; color: var(--warn); margin-top: 3px; line-height: 1.5; }
#glossary-search { margin-top: 8px; }
.home-recent .recent-list li .sig-pill { margin-left: 4px; }

@media (max-width: 760px) {
  .topbar-right { gap: 6px; }
  .icon-btn { padding: 6px 8px; }
  .quote-actions { width: 100%; justify-content: space-between; }
}

/* =========================================================
   第 4 批：新聞、股利、財務
   ========================================================= */
.news-head { align-items: flex-start; }
.news-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; }
.news-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.news-title { font-size: 14px; line-height: 1.55; }
.news-title a { color: var(--text); text-decoration: none; }
.news-title a:hover { color: var(--accent); text-decoration: underline; }
.news-meta { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.news-detail div { white-space: pre-wrap; font-size: 12.5px; color: #c8d3df; margin-top: 6px; line-height: 1.6; }
.tag-major { background: rgba(240, 180, 41, 0.15); color: var(--warn); }
.mini-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* =========================================================
   第 5 批：帳號、身分標籤、權限、管理頁、LINE 登入
   ========================================================= */
.perm-hidden { display: none !important; }
.center { text-align: center; }
.role-badge {
  display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap; vertical-align: middle;
}
.inline-message.ok { background: rgba(31, 191, 117, 0.08); border-color: rgba(31, 191, 117, 0.4); color: #a6f0c9; }
.danger-text { color: var(--bad) !important; }
.badge-inline { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; margin-left: 4px; }
.sub-h { font-size: 13.5px; margin: 14px 0 6px; }
.settings-section.first { border-top: none; margin-top: 4px; }

/* ---- 登入頁 ---- */
.login-box { max-width: 400px; text-align: left; }
.login-title { font-size: 17px; margin: 8px 0 4px; }
.login-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.login-form input { width: 100%; font-size: 16px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); outline: none; }
.login-form input:focus { border-color: var(--accent); }
.login-tabs { margin: 14px 0 0; }
.login-tabs button { flex: 1; }
.line-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 12px;
  padding: 12px; border-radius: 10px; background: #06c755; color: #fff; font-weight: 700; font-size: 16px; text-decoration: none;
}
.line-btn:hover { background: #05b34c; }
.line-btn.small { width: auto; display: inline-flex; padding: 8px 14px; font-size: 14px; margin-top: 0; }
.line-logo { background: #fff; color: #06c755; border-radius: 6px; padding: 1px 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.5px; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 12.5px; margin: 16px 0 0; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---- 設定視窗分頁 ---- */
.modal-box.modal-wide { max-width: 920px; }
.settings-tabs { margin-top: 12px; }
.users-table th, .users-table td { white-space: nowrap; font-family: var(--font); font-size: 13px; }
.users-table th { width: auto; }
.users-table select, .pending-card select, #cu-role {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 6px; font-size: 13px;
}
.pending-card { background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: 8px; padding: 10px 12px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }

/* ---- 身分與權限表 ---- */
.roles-table { font-family: var(--font); }
.roles-table th, .roles-table td { font-family: var(--font); font-size: 13px; vertical-align: middle; }
.roles-table .perm-col { min-width: 190px; width: auto; text-align: left; }
.roles-table .role-col { min-width: 132px; text-align: center; width: auto; }
.roles-table .role-name {
  width: 110px; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); text-align: center; font-weight: 700;
}
.roles-table .color-row { display: flex; justify-content: center; gap: 8px; margin: 6px 0; font-size: 12px; color: var(--text-dim); }
.roles-table .color-row label { display: inline-flex; align-items: center; gap: 3px; }
.roles-table input[type="color"] { width: 28px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: none; cursor: pointer; }
.roles-table .role-preview { margin: 4px 0; }
.roles-table .role-preview .role-badge { margin-left: 0; }
.roles-table .perm-check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.roles-table .limit-input {
  width: 70px; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); text-align: center;
}
.roles-table .group-row td { background: #0f1620; color: var(--accent); font-weight: 700; font-size: 12.5px; }
.roles-table .role-col .link-btn { font-size: 12px; }

/* ---- 自選股超過上限 ---- */
.wl-item.over-limit { opacity: 0.55; border-style: dashed; }

@media (max-width: 760px) {
  .role-badge { font-size: 11px; padding: 1px 7px; }
  .brand-text { font-size: 14px; }
}
