:root {
  --bg: #f5f2ec;
  --panel: #ffffff;
  --ink: #1c2529;
  --muted: #687176;
  --line: #d8d2c8;
  --teal: #006d77;
  --teal-2: #e1f1ef;
  --red: #b13a2f;
  --gold: #b7832f;
  --green: #39785a;
  --blue: #3c5f91;
  --shadow: 0 18px 45px rgba(33, 40, 44, .11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans TC", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.file-button {
  border: 0;
  background: var(--teal);
  color: white;
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
}

button.secondary,
.file-button {
  background: #263238;
}

button.quote-button {
  background: var(--blue);
}

button:disabled {
  cursor: wait;
  opacity: .65;
}

button.danger {
  background: var(--red);
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: #edf0ee;
  color: var(--ink);
  font-size: 22px;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #fbfaf7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
}

.brand p,
.eyebrow,
label,
.timestamp,
.metric span {
  color: var(--muted);
  font-size: 13px;
}

label {
  display: grid;
  gap: 7px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
  min-height: 40px;
}

textarea {
  resize: vertical;
}

.sidebar-block,
.sidebar-grid,
.actions {
  margin-top: 18px;
}

.sidebar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.actions {
  display: grid;
  gap: 10px;
}

.sidebar-quick-add {
  margin: 0 0 16px;
  gap: 4px;
}

.sidebar-quick-add input,
.sidebar-quick-add button {
  min-height: 44px;
}

.sidebar-nav { display: grid; gap: 8px; margin-top: 8px; }
.sidebar-nav .nav-item { display: grid; gap: 2px; width: 100%; min-height: 56px; padding: 9px 12px; border: 1px solid transparent; background: transparent; color: var(--ink); text-align: left; }
.sidebar-nav .nav-link { align-content: center; border-radius: 8px; text-decoration: none; }
.sidebar-nav .nav-item span { font-size: 14px; font-weight: 750; }
.sidebar-nav .nav-item small { color: var(--muted); font-size: 11px; }
.sidebar-nav .nav-item:hover { background: var(--teal-2); }
.sidebar-nav .nav-item.active { border-color: color-mix(in srgb, var(--teal) 28%, var(--line)); background: var(--teal-2); color: var(--teal); }
.sidebar-nav-divider { display: flex; align-items: center; gap: 8px; margin: 7px 0 0; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.sidebar-nav-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.research-tool-link { border-color: color-mix(in srgb, var(--blue) 16%, var(--line)) !important; background: color-mix(in srgb, var(--blue) 5%, white) !important; }
[hidden] { display: none !important; }

.sidebar-watchlist {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.sidebar-watchlist h2 {
  margin: 0 0 2px;
  font-size: 16px;
}

.sidebar-watchlist .metric {
  width: 100%;
  box-shadow: none;
}

.sidebar-watchlist .metric strong {
  font-size: 24px;
}

.owned-return-panel {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.owned-return-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: #f5f7f5;
  color: var(--ink);
  text-align: left;
}

.owned-return-toggle > span { display: grid; gap: 1px; }
.owned-return-toggle strong { font-size: 14px; }
.owned-return-toggle small { color: var(--muted); font-size: 11px; }
.owned-return-toggle b { color: var(--teal); font-size: 12px; }
.owned-return-content { display: grid; gap: 10px; }
.owned-return-group { display: grid; gap: 4px; }
.owned-return-market { color: var(--muted); font-size: 11px; font-weight: 750; }
.owned-return-market b { margin-left: 4px; font-variant-numeric: tabular-nums; }

.owned-return-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.owned-return-item:hover,
.owned-return-item:focus-visible {
  border-color: var(--teal);
  background: var(--teal-2);
  box-shadow: 0 4px 14px rgba(18, 87, 82, .10);
}

.owned-return-item > span { display: grid; min-width: 0; }
.owned-return-item strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.owned-return-item small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.owned-return-item b { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.owned-return-item b.flat { color: var(--muted); }
.owned-return-empty { color: var(--muted); font-size: 12px; }

.quick-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
}

.quick-message {
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
}

.theme-strength-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  margin: 0 7px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
}
.theme-strength-strong { background: #d9f3e4; color: #14653d !important; border: 1px solid #9ed5b3; }
.theme-strength-range { background: #eaf0f6; color: #38546a !important; border: 1px solid #c7d5e1; }
.theme-strength-weak { background: #fbe4e4; color: #9d2929 !important; border: 1px solid #ebbbbb; }
.theme-strength-opening { background: #fff5d9; color: #885c05 !important; border: 1px solid #ebd092; }
.theme-strength-initial { background: #fff0df; color: #9b5500 !important; border: 1px solid #ebbf88; }
.theme-strength-limit-up { background: #d2f5df; color: #0d713c !important; border: 1px solid #76c895; }
.theme-strength-limit-down { background: #f9d9d9; color: #a21f1f !important; border: 1px solid #df9d9d; }
}

.quick-message.error {
  color: var(--red);
}

.quick-message.ok {
  color: var(--green);
}

.file-button {
  display: grid;
  place-items: center;
}

.file-button input {
  display: none;
}

main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.status-stack {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.quote-status {
  border-radius: 999px;
  min-height: 28px;
  padding: 6px 11px;
  background: #edf0ee;
  color: var(--muted);
  font-size: 13px;
}

.quote-status.ok {
  background: #e7f5ec;
  color: var(--green);
}

.quote-status.loading {
  background: #e7f0ff;
  color: var(--blue);
}

.quote-status.warning {
  background: #fff1d8;
  color: #7b5218;
}

.quote-status.error {
  background: #f4e8e5;
  color: var(--red);
}

.wake-lock-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s ease;
}

.wake-lock-status.active {
  background: #fef9c3;
  color: #854d0e;
  border-color: #fde047;
  box-shadow: 0 1px 3px rgba(133, 77, 14, 0.15);
}

.wake-lock-status:hover {
  filter: brightness(0.96);
}


.market-session-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}

.market-session-status[hidden] {
  display: none;
}

.market-session-lane {
  border-radius: 999px;
  padding: 4px 8px;
  background: #f0f3f5;
  color: #52606d;
}

.market-session-lane.freshness-connected {
  background: #e7f5ec;
  color: var(--green);
}

.market-session-lane.freshness-degraded {
  background: #fff1d8;
  color: #7b5218;
}

.market-session-lane.freshness-unavailable {
  background: #f4e8e5;
  color: var(--red);
}

.market-loading-state,
.market-loading-row td {
  color: var(--muted);
  text-align: center;
}

.market-loading-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-weight: 700;
}

.market-loading-indicator::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--teal);
  animation: market-loading-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes market-loading-pulse {
  from { opacity: 0.35; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.topbar h2 {
  font-size: clamp(22px, 2.4vw, 32px);
}

.page-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
}

.page-title-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  color: var(--ink);
  font-size: clamp(15px, 1.8vw, 22px);
  font-weight: 700;
  line-height: 1.2;
}

.page-title-links span {
  padding: 0 4px;
  color: var(--muted);
  font-weight: 400;
}

.page-title-links a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 4px;
  white-space: nowrap;
}

.page-title-links a:hover,
.page-title-links a:focus-visible {
  color: var(--teal);
  text-decoration: underline;
}

.quant-overview {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(33, 40, 44, .06);
}

.market-overview-grid,
.global-index-grid,
.theme-rotation-grid {
  display: grid;
  gap: 8px;
}

.quant-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 8px;
}

.quant-section-heading strong { font-size: 14px; }
.quant-section-heading span { color: var(--muted); font-size: 12px; }
.quant-section-heading-secondary { margin-top: 16px; }

.global-index-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.global-index-row { min-width: 0; }
.global-index-row-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.global-index-row-title strong { font-size: 13px; }
.global-index-row-title span { color: var(--muted); font-size: 11px; }
.global-index-row-grid { display: grid; gap: 8px; }
.asia-index-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.top-weights-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.core-futures-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.us-spot-index-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.us-futures-index-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.global-index-card {
  min-width: 0;
  min-height: 96px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue);
  border-radius: 8px;
  background: #fbfaf7;
}

.global-index-card.index-up { border-top-color: var(--red); }
.global-index-card.index-down { border-top-color: var(--green); }
.global-index-card.index-pending { border-top-color: var(--line); }
.global-index-link { color: inherit; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.global-index-link:hover,
.global-index-link:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(20, 47, 61, .12); outline: 2px solid rgba(15, 139, 141, .28); outline-offset: 2px; }

.global-index-meta,
.global-index-quote {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.global-index-meta { margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.global-index-card > strong { display: block; font-size: 13px; white-space: nowrap; }
.global-index-quote { margin-top: 9px; font-variant-numeric: tabular-nums; }
.global-index-quote b { font-size: 18px; }
.global-index-change { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 12px; font-weight: 800; line-height: 1.1; }
.global-index-change b { font-size: 12px; }
.global-index-change small { font-size: 11px; font-weight: 750; }
.index-up .global-index-quote span { color: var(--red); }
.index-down .global-index-quote span { color: var(--green); }
.index-pending .global-index-quote span { color: var(--muted); }

@keyframes priceFlash {
  0% { background-color: rgba(234, 88, 12, 0.35); }
  100% { background-color: transparent; }
}
.price-flash {
  animation: priceFlash 1.5s ease-out;
  border-radius: 4px;
}

.top-weight-impact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 750;
  background: #f1f5f9;
  color: var(--ink);
}
.top-weight-impact.impact-up {
  background: rgba(220, 38, 38, 0.08);
  color: var(--red);
}
.top-weight-impact.impact-down {
  background: rgba(22, 163, 74, 0.08);
  color: var(--green);
}
.top-weight-impact.impact-flat {
  background: #f1f5f9;
  color: var(--muted);
}

.future-basis-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 750;
  background: #f1f5f9;
  color: var(--ink);
}
.future-basis-badge.basis-contango {
  background: rgba(220, 38, 38, 0.08);
  color: var(--red);
}
.future-basis-badge.basis-backwardation {
  background: rgba(22, 163, 74, 0.08);
  color: var(--green);
}
.future-basis-badge.basis-flat {
  background: #f1f5f9;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .asia-index-grid,
  .top-weights-grid,
  .core-futures-grid,
  .us-spot-index-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .asia-index-grid,
  .top-weights-grid,
  .core-futures-grid,
  .us-spot-index-grid,
  .us-futures-index-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .global-index-row-title { align-items: flex-start; flex-direction: column; gap: 1px; margin-bottom: 4px; }
  .global-index-row-title strong { font-size: 12px; }
  .global-index-row-title span { font-size: 10px; }
  .quant-section-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .global-index-card { padding: 8px 9px; min-height: 74px; border-radius: 6px; }
  .global-index-card > strong { font-size: 12px; }
  .global-index-meta { margin-bottom: 4px; font-size: 10px; }
  .global-index-quote { margin-top: 4px; gap: 4px; }
  .global-index-quote b { font-size: 14px; }
  .global-index-change b { font-size: 11px; }
  .global-index-change small { font-size: 10px; }
  .top-weight-impact,
  .future-basis-badge { margin-top: 4px; padding: 2px 5px; font-size: 10px; }
}

@media (max-width: 380px) {
  .asia-index-grid,
  .top-weights-grid,
  .core-futures-grid,
  .us-spot-index-grid,
  .us-futures-index-grid { grid-template-columns: 1fr; }
}

.market-decision-dashboard {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.market-data-quality {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin: 0 0 2px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12px;
}

.market-data-quality.blocked { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.market-data-quality.verified { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }

.decision-core-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.decision-core-grid.action-full-width { grid-template-columns: minmax(0, 1fr); }

.decision-action-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #bfd0df;
  border-left: 5px solid var(--blue);
  border-radius: 9px;
  background: #edf5fb;
}

.decision-action-panel.tone-risk { border-left-color: var(--red); background: #fff0f0; }
.decision-action-panel.tone-caution { border-left-color: var(--gold); background: #fff8e8; }
.decision-action-panel.tone-opportunity { border-left-color: var(--green); background: #eef9f2; }
.decision-action-panel .action-heading { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.decision-action-panel .action-heading > span { display: grid; place-items: center; flex: 0 0 26px; width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 900; }
.decision-action-panel .action-heading > div { display: grid; gap: 2px; min-width: 0; }
.decision-action-panel .action-heading small { color: var(--muted); font-size: 10px; font-weight: 750; }
.decision-action-panel .action-heading b { font-size: 12px; line-height: 1.4; }
.decision-action-panel .action-heading-main { flex: 1; min-width: 0; }
.decision-action-panel .action-heading-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.market-combat-badge { padding: 2px 8px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: 10px; font-weight: 850; white-space: nowrap; }
.market-combat-badge.is-unavailable { background: #eef1f3; color: var(--muted); }
.cockpit-jump-link { margin-left: auto; color: var(--blue); font-size: 10px; font-weight: 800; white-space: nowrap; }
.decision-action-panel .action-copy { min-width: 0; }

.market-forecast-highlight {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 5px 10px;
  margin: 0 0 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.market-forecast-highlight b { font-size: 14px; }
.market-forecast-highlight span { color: var(--muted); font-size: 12px; font-weight: 800; }
.market-forecast-highlight.forecast-green { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.market-forecast-highlight.forecast-orange { color: #c2410c; background: #fff7ed; border-color: #fed7aa; }
.market-forecast-highlight.forecast-red { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }

.us-impact-banner { margin: 8px 0; padding: 10px 12px; border: 1px solid rgba(15, 61, 102, .15); border-left: 4px solid #94a3b8; border-radius: 8px; background: #f8fafc; }
.us-impact-banner.impact-ready { border-left-color: #2563eb; background: #f0f7ff; }
.us-impact-banner.impact-pending { border-left-color: #94a3b8; background: #f8fafc; }
.us-impact-badge { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: #475569; font-size: 11px; font-weight: 800; }
.us-impact-banner.impact-ready .us-impact-badge { color: #1d4ed8; }
.us-impact-banner .badge-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2563eb; }
.us-impact-banner.impact-pending .badge-dot { background: #94a3b8; }
.us-impact-headline { margin-bottom: 4px; color: #0f172a; font-size: 13px; }
.us-impact-analysis { color: #334155; font-size: 12px; line-height: 1.55; }

.playbook-lines { display: grid; gap: 6px; margin-top: 8px; }
.playbook-line { padding: 7px 9px; border-left: 3px solid #cbd5e1; border-radius: 0 6px 6px 0; background: rgba(255, 255, 255, .68); color: var(--ink); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.decision-audit-line { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 8px; padding-top: 7px; border-top: 1px solid rgba(15, 61, 102, .16); color: var(--muted); font-size: 10px; font-weight: 750; }

.next-session-panel { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfaf7; }
.next-session-panel.gate-bearish { border-left: 5px solid var(--red); }
.next-session-panel.gate-extreme-risk { border-color: #ef9a9a; border-left: 5px solid var(--red); background: #fff8f8; }
.next-session-panel > header { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.next-session-panel > header > div { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 9px; align-items: center; min-width: 0; }
.next-session-panel header > div > span { display: grid; place-items: center; grid-row: 1 / span 2; width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 900; }
.next-session-panel header small,
.next-session-panel header h4 { grid-column: 2; }
.next-session-panel header small { color: var(--muted); font-size: 10px; font-weight: 750; }
.next-session-panel h4 { margin: 1px 0 0; font-size: 15px; line-height: 1.4; }
.next-session-panel header p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.next-session-panel header p b { color: var(--ink); }

.next-stock-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 10px; }
.next-stock-card { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.next-stock-link { display: block; color: inherit; text-decoration: none; }
.next-stock-link:hover { border-color: var(--teal); }
.next-stock-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 7px; min-width: 0; }
.next-stock-header > div { display: grid; gap: 2px; min-width: 0; }
.next-stock-card .combat-radar-badge { flex: 0 0 auto; padding: 3px 6px; border-radius: 999px; background: #e9f5ed; color: #187143; font-size: 9px; font-weight: 850; }
.next-stock-card .combat-radar-badge.is-neutral { background: #eef2f7; color: #526176; }
.next-stock-card .combat-radar-badge.is-cautious { background: #fbefeb; color: #a33e2b; }
.next-stock-card.is-counter-trend { border-color: #d49a2a; border-top: 3px solid #d49a2a; background: #fffdf7; }
.next-stock-card > div { display: flex; align-items: flex-start; justify-content: space-between; gap: 7px; min-width: 0; }
.next-stock-card > div strong { min-width: 0; font-size: 12px; line-height: 1.4; }
.next-stock-card > div span { flex: 0 0 auto; color: var(--teal); font-size: 9px; font-weight: 800; }
.next-stock-card > p { min-height: 2.8em; margin: 6px 0; color: var(--muted); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.next-stock-card dl { display: grid; gap: 4px; margin: 0; }
.next-stock-card dl div { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-top: 4px; border-top: 1px solid #eeeae2; font-size: 10px; font-variant-numeric: tabular-nums; }
.next-stock-card dt { color: var(--muted); }
.next-stock-card dd { margin: 0; color: var(--ink); font-weight: 850; }
.next-stock-card > small { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.decision-empty { grid-column: 1 / -1; margin: 0; padding: 12px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 12px; }

@media (min-width: 560px) {
  .next-stock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 760px) {
  .decision-action-panel { grid-template-columns: 155px minmax(0, 1fr); gap: 14px; padding: 13px 15px; }
  .next-session-panel,
  .market-data-quality { padding: 14px; }
  .next-session-panel > header { flex-direction: row; justify-content: space-between; }
  .next-session-panel header p { max-width: 280px; text-align: right; }
}

@media (min-width: 900px) {
  .next-stock-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .next-stock-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.theme-rotation-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-top: 8px;
}

.market-regime-card,
.theme-rank-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 10px 12px;
}

.market-risk-summary {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.market-risk-summary {
  grid-column: 1 / -1;
  display: grid;
  align-content: start;
  gap: 8px;
  border-left: 4px solid var(--blue);
}

.market-risk-summary.regime-risk-off { border-left-color: var(--red); }
.market-risk-summary.regime-reduced-risk { border-left-color: var(--gold); }
.market-risk-summary span,
.market-risk-summary small { color: var(--muted); font-size: 12px; }
.market-risk-summary strong { font-size: 17px; }
.vix-risk-panel { display: grid; gap: 6px; margin-top: 4px; padding: 10px; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 7px; background: #fff; }
.vix-risk-panel > div { display: flex; align-items: baseline; gap: 8px; }
.vix-risk-panel > div span { flex: 1; color: var(--ink); font-size: 12px; font-weight: 700; }
.vix-risk-panel b { font-size: 20px; font-variant-numeric: tabular-nums; }
.vix-risk-panel em { color: var(--muted); font-size: 12px; font-style: normal; font-weight: 800; }
.vix-risk-panel > strong { font-size: 13px; }
.vix-risk-panel p { margin: 0; color: var(--ink); font-size: 12px; line-height: 1.5; }
.vix-risk-panel.vix-low { border-left-color: var(--green); }
.vix-risk-panel.vix-normal { border-left-color: var(--blue); }
.vix-risk-panel.vix-elevated { border-left-color: var(--gold); }
.vix-risk-panel.vix-high { border-left-color: var(--red); }
.market-intelligence-card { display: grid; align-content: start; gap: 12px; }
.market-intelligence-card > h4 { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.international-intelligence-card { border-top: 3px solid var(--gold); }
.data-intelligence-card { border-top: 3px solid var(--blue); }

.theme-prediction-card { align-items: center; flex-wrap: wrap; }
.theme-prediction-main { display: grid; gap: 2px; min-width: 130px; flex: 1; }
.theme-prediction-card dl { display: grid; grid-template-columns: repeat(3, minmax(82px, 1fr)); gap: 8px; margin: 0; }
.theme-prediction-card dl div { display: grid; gap: 2px; }
.theme-prediction-card dt { color: var(--muted); font-size: 11px; }
.theme-prediction-card dd { margin: 0; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.theme-stock-list { display: flex; flex: 1 0 100%; gap: 9px; align-items: flex-start; padding-top: 9px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.55; }
.theme-stock-list b { flex: 0 0 auto; color: var(--blue); }
.theme-stock-list span { color: var(--muted); }

@media (max-width: 980px) {
  .market-overview-grid { grid-template-columns: 1fr 1fr; }
  .market-risk-summary { grid-column: 1 / -1; }
  .theme-prediction-card { align-items: flex-start; flex-wrap: wrap; }
}

@media (max-width: 680px) {
  .market-overview-grid { grid-template-columns: 1fr; }
  .market-risk-summary { grid-column: auto; }
  .theme-prediction-card dl { order: 4; width: 100%; }
  .theme-stock-list { order: 5; display: grid; gap: 3px; }
}

.market-regime-card {
  border-left: 4px solid var(--blue);
}

.market-regime-card.regime-risk-on { border-left-color: var(--green); }
.market-regime-card.regime-risk-off { border-left-color: var(--red); }
.market-regime-card.regime-reduced-risk { border-left-color: var(--gold); }

.market-regime-card > div:first-child,
.market-regime-card dl,
.theme-rank-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.market-regime-card span,
.market-regime-card dt,
.theme-rank-card small,
.quant-score-main span,
.quant-score-main small,
.quant-score-metrics span,
.quant-score-action span {
  color: var(--muted);
  font-size: 12px;
}

.market-regime-card dl {
  margin: 10px 0 0;
}

.market-regime-card dl div {
  min-width: 0;
}

.market-regime-card dt,
.market-regime-card dd {
  margin: 0;
}

.market-regime-card dd {
  margin-top: 2px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.theme-rank-number {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--teal-2);
  color: var(--teal);
  font-weight: 800;
}

.theme-rank-card > div:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.theme-rank-score {
  display: grid;
  justify-items: end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

.quant-signal-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 10px;
}

.quant-signal-card.tone-strong { border-left-color: var(--green); }
.quant-signal-card.tone-positive { border-left-color: var(--teal); }
.quant-signal-card.tone-risk { border-left-color: var(--red); }

.quant-score-main {
  display: grid;
  align-content: start;
  gap: 2px;
}

.quant-score-main > strong {
  font-size: 28px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.quant-score-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.quant-score-metrics div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.quant-score-metrics strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.quant-score-action {
  grid-column: 1 / -1;
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.quant-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 5px 20px rgba(33, 40, 44, .05);
  text-align: left;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.metric label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.metric-select-card select {
  width: 100%;
  min-height: 38px;
  margin-top: 4px;
  background: #fbfaf7;
}

.metric.accent {
  border-color: #c8d8d0;
  background: #eef7f1;
}

.metric-button {
  color: inherit;
  font: inherit;
  min-height: auto;
}

.metric-button:hover,
.metric-button.active {
  border-color: var(--green);
  box-shadow: 0 8px 24px rgba(41, 124, 75, .16);
}

.workspace {
  display: block;
}

.stock-list-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.futures-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #b9d7d0;
  border-radius: 999px;
  background: #f2faf7;
  color: #155e52;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.futures-filter input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #087f6a;
}

.table-wrap,
.detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.stock-table {
  min-width: 0;
  table-layout: fixed;
}

.stock-col-identity { width: 20%; }
.stock-col-price { width: 7%; }
.stock-col-change { width: 10%; }
.stock-col-volume { width: 14%; }
.stock-col-board-trend { width: 12%; }
.stock-col-board-battlefield { width: 14%; }
.stock-col-board-pattern { width: 13%; }
.stock-col-board-defense { width: 10%; }

.stock-table th,
.stock-table td {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stock-table td:nth-child(3),
.stock-table td:nth-child(4) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.change-pair {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.25;
}

.change-pair small { font-size: 11px; }

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #ece7df;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fbfaf7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.theme-row td {
  background: #f4f0e9;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}

.theme-row strong {
  margin: 0 8px;
  font-size: 15px;
}

.theme-row span {
  color: var(--muted);
  font-size: 12px;
}

.group-toggle {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 6px;
  background: #263238;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.active {
  background: var(--teal-2);
}

.stock-list-name,
.detail-title strong {
  display: block;
  font-size: 16px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.stock-list-primary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.stock-table .stock-cell {
  padding-right: 4px;
  padding-left: 4px;
}

.stock-list-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 850;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-list-futures {
  overflow: hidden;
  margin-top: 4px;
  color: #176b5c;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-list-futures-delayed {
  color: #8a5b0a;
}

.futures-snapshot {
  display: flex;
  align-items: center;
  gap: 8px 16px;
  overflow-x: auto;
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid #b9d8d0;
  border-radius: 8px;
  background: #f3faf8;
  font-size: 12px;
  white-space: nowrap;
}

.futures-compact-title { color: #176b5c; font-size: 13px; }
.futures-basis-plain { color: #176b5c; font-weight: 800; }
.futures-snapshot > small { margin-left: auto; color: var(--muted); font-size: 10px; }

.stock-strength-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  margin: 0;
  padding: 0 6px;
  border: 1px solid #76c895;
  border-radius: 999px;
  background: #c9f3da;
  color: #087037;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.stock-strength-limit { border-color: #4ba970; background: #a8edc2; color: #07552d; }
.stock-strength-limit-up { border-color: #4ba970; background: #a8edc2; color: #07552d; }
.stock-strength-range { border-color: #c7d5e1; background: #eaf0f6; color: #38546a; }
.stock-strength-weak { border-color: #ebbbbb; background: #fbe4e4; color: #9d2929; }
.stock-strength-opening { border-color: #ebd092; background: #fff5d9; color: #885c05; }
.stock-strength-pending { border-color: #d5d9de; background: #f3f4f6; color: #5f6873; }
.stock-row-strong td:first-child { box-shadow: inset 4px 0 #2f9d62; }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  background: #edf0ee;
  color: #334044;
}

.tag.p1 {
  background: #fff1d8;
  color: #7b5218;
}

.status-watch {
  background: #eef1f4;
}

.status-research {
  background: #e7f0ff;
  color: var(--blue);
}

.status-owned {
  background: #e7f5ec;
  color: var(--green);
}

.status-paused {
  background: #f4e8e5;
  color: var(--red);
}

.up {
  color: var(--green);
  font-weight: 700;
}

.down {
  color: var(--red);
  font-weight: 700;
}

.estimate-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  max-width: 100%;
  line-height: 1.3;
  white-space: normal;
}

.estimate-cell small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

@media (max-width: 720px) {
  .table-wrap { overflow-x: auto; }
  .stock-table { min-width: 900px; }
}

.volume-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  line-height: 1.25;
}

.volume-cell b {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.volume-cell small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.volume-cell .volume-up { color: var(--blue); }
.volume-cell .volume-down { color: var(--muted); }
.volume-cell .volume-flat { color: var(--ink); }
.intraday-delayed {
  color: #8a5a00;
  background: #fff8df;
  border-radius: 4px;
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 4px;
  font-weight: 700;
}
.intraday-delayed small,
.stock-table td > span small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
}
.volume-cell .volume-surge {
  padding: 2px 5px;
  border-radius: 4px;
  background: #fff0c9;
  color: #855800;
  font-weight: 900;
}

.target-plan-cell {
  display: block;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.42;
}

.target-plan-cell b { font-weight: 800; }

.board-signal-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.35;
}

.board-signal-cell b { font-weight: 800; }
.board-signal-cell span { color: var(--muted); font-size: 10px; }
.board-signal-unavailable b { color: #9b5c22; }
.combat-grade-strong b { color: #dc2626; }
.combat-grade-bull b { color: #ea580c; }
.combat-grade-neutral b { color: var(--ink); }
.combat-grade-weak b { color: #16a34a; }
.combat-accumulating b { color: #dc2626; font-weight: 800; }
.combat-distributing b { color: #16a34a; font-weight: 800; }
.combat-overbought b { color: #d97706; }
.combat-entry b { color: #0284c7; }
.combat-defensive b { color: #78716c; }
.combat-exit b { color: #16a34a; }

.wave-pilot-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
  font-size: 11px;
  line-height: 1.35;
}

.wave-pilot-cell span { color: var(--muted); font-size: 10px; }
.wave-pilot-cell b { color: var(--ink); font-size: 11px; }
.wave-level-cell b { color: var(--teal); }
.daily-wave-validation b { color: #315d7e; }

.target-basis {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.limit-up.limit-locked b,
.limit-up.limit-high b {
  color: var(--green);
}

.limit-down.limit-locked b,
.limit-down.limit-high b {
  color: var(--red);
}

.limit-medium b {
  color: #9a5b00;
}

.limit-watch b {
  color: var(--blue);
}

.limit-low b {
  color: var(--muted);
}

.limit-warning-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfaf7;
}

.limit-warning-card strong,
.limit-warning-card span {
  display: block;
}

.limit-warning-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.limit-warning-card p {
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-panel,
aside.detail {
  display: none;
  min-height: 520px;
}

tbody tr:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: -3px;
  background: var(--teal-2);
}

.detail-page .app-shell { grid-template-columns: 1fr; }
.detail-page .sidebar,
.detail-page .topbar,
.detail-page .stock-view-tool,
.detail-page .table-wrap,
.detail-page .stock-workspace-tabs { display: none !important; }
.detail-page main { padding: 24px; }
.detail-page .workspace { display: block; }
.detail-page .detail-panel,
.detail-page aside.detail {
  display: block;
  width: min(1080px, 100%);
  margin: 0 auto;
  overflow: visible;
}
.detail-page .detail-title {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 0 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
}
.detail-page .unified-detail-title {
  margin: 0 0 12px;
}
.detail-page-close { min-height: 44px; }

.empty-state {
  display: grid;
  place-items: center;
  min-height: 520px;
  gap: 10px;
  text-align: center;
  padding: 30px;
}

.sparkline {
  width: 210px;
  height: 88px;
  border-radius: 8px;
  background:
    linear-gradient(140deg, transparent 20%, rgba(0, 109, 119, .18) 20% 35%, transparent 35%),
    linear-gradient(25deg, transparent 18%, rgba(177, 58, 47, .18) 18% 28%, transparent 28%),
    linear-gradient(165deg, transparent 10%, rgba(183, 131, 47, .22) 10% 24%, transparent 24%),
    #f4f0e9;
}

.detail-content {
  padding: 18px;
}

.detail-title {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto minmax(280px, 1fr);
  grid-template-areas: "position identity actions";
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.detail-title-position {
  grid-area: position;
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 6px 12px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.detail-title-position span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.detail-title-position strong {
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.detail-stock-identity {
  grid-area: identity;
  min-width: 0;
  text-align: center;
}

.detail-stock-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-title .detail-stock-name {
  display: block;
  color: var(--ink);
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .01em;
}

.detail-stock-role {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.detail-title-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
  flex-shrink: 0;
}

.detail-trade-button,
.detail-page-close {
  min-height: 44px;
  padding-inline: 16px;
}

.detail-page-close {
  background: #536168;
}

.compact-button {
  min-height: 30px;
  padding: 0 10px;
}

.detail-groups {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfaf7;
}

.detail-group h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.wide-box {
  grid-column: 1 / -1;
}

.detail-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.detail-box-note {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
}

.detail-box-note span { margin: 0; }
.detail-box-note .volume-up { color: var(--blue); }
.detail-box-note .volume-down { color: var(--muted); }
.detail-box-note .volume-flat { color: var(--ink); }

.compact-snapshot {
  display: grid;
  grid-template-columns: 140px minmax(100px, .8fr) minmax(160px, 1.25fr) minmax(175px, 1.35fr) minmax(145px, 1.1fr) minmax(180px, 1.4fr);
  gap: 1px;
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.compact-snapshot-heading,
.compact-metric {
  min-width: 0;
  background: #fff;
  padding: 8px 10px;
}

.compact-snapshot-heading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #f4f7f6;
}

.compact-snapshot-heading strong { font-size: 14px; }
.quote-freshness {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-left: 4px;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 750;
  line-height: 1.3;
  vertical-align: 2px;
}
.freshness-live { color: #18704a; background: #edf9f3; }
.freshness-delayed { color: #8a5a00; background: #fff8df; }
.freshness-intraday-waiting-trade { color: #8a5a00; background: #fff8df; }
.freshness-stale { color: #a22922; background: #fff0ee; }
.freshness-closed,
.freshness-unavailable { color: #64748b; background: #f1f5f9; }
.compact-snapshot-heading span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}
.compact-snapshot-heading .quote-freshness {
  display: inline-flex;
  margin: 0 0 0 4px;
  font-size: 9px;
}
.compact-snapshot-heading .freshness-live { color: #18704a; }
.compact-snapshot-heading .freshness-delayed { color: #8a5a00; }
.compact-snapshot-heading .freshness-stale { color: #a22922; }
.compact-snapshot-heading .freshness-closed,
.compact-snapshot-heading .freshness-unavailable { color: #64748b; }

.compact-metric span,
.compact-metric small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.compact-metric strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.25;
}

.change-pair { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.change-pair b { font-size: 14px; line-height: 1.15; }
.compact-metric .change-pair small { color: inherit; margin: 0; font-size: 12px; font-weight: 800; line-height: 1.15; }

.compact-metric small {
  margin-top: 2px;
  line-height: 1.25;
}

.compact-momentum strong {
  color: #315d7e;
}

.high-review-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin: -4px 0 12px;
  padding: 7px 10px;
  border-left: 3px solid #718096;
  background: #f7f9fb;
  color: #354455;
  font-size: 12px;
  line-height: 1.45;
}

.high-review-panel strong { color: #1f2d3d; }
.high-review-line {
  display: block;
  margin-top: 3px;
  color: #596b7d;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.section-title-row h4 { margin: 0; }

.technical-core-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(300px, 1fr);
  gap: 14px;
  align-items: start;
}

.technical-core-grid.technical-core-chart-only {
  grid-template-columns: minmax(0, 1fr);
}

.technical-core-grid > .detail-section {
  margin-top: 14px;
}

.technical-chart-section { overflow: hidden; }
.technical-chart-title-row > div { display: grid; gap: 2px; }
.technical-chart-title-row small,
.technical-chart-meta,
.technical-chart-attribution { color: var(--muted); font-size: 11px; line-height: 1.45; }
.technical-pattern-badge { border: 1px solid #c9d6dc; border-radius: 999px; padding: 5px 9px; background: #f4f8fa; color: #315d7e; font-size: 12px; font-weight: 750; }
.technical-chart-legend { display: flex; flex-wrap: wrap; gap: 7px 14px; margin: 8px 0 6px; color: #425466; font-size: 11px; }
.technical-chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.technical-chart-legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; background: #66737c; }
.technical-chart-legend .legend-candle { height: 9px; border: 2px solid #59636b; background: transparent; }
.technical-chart-legend .legend-volume { height: 8px; background: rgba(89, 99, 107, .45); }
.technical-chart-legend .ma-fast { background: #334155; }
.technical-chart-legend .ma-quick { background: #0f8b8d; }
.technical-chart-legend .ma-short { background: #1f6fa8; }
.technical-chart-legend .ma-medium { background: #b66a14; }
.technical-chart-legend .ma-long { background: #7357a6; }
.technical-chart-legend .legend-wave-impulse { background: #2563a6; height: 4px; }
.technical-chart-legend .legend-wave-correction { background: #c06a19; height: 4px; }
.technical-chart-legend .legend-wave-developing {
  height: 4px;
  background: repeating-linear-gradient(90deg, #0f8b8d 0 5px, transparent 5px 8px);
}
.technical-chart-legend .legend-adam-candidate {
  height: 4px;
  background: repeating-linear-gradient(90deg, #b7791f 0 6px, transparent 6px 10px);
}
.technical-chart-legend .legend-adam-confirmed { height: 4px; background: #15803d; }
.technical-chart-legend .legend-adam-invalidated { height: 4px; background: #7b8790; }
.technical-chart-legend.decision-indicator-strip { gap: 6px 8px; padding: 7px 8px; border: 1px solid #d8e1e6; border-radius: 8px; background: #f8fafb; }
.technical-chart-legend.decision-indicator-strip span { min-height: 24px; padding: 2px 6px; border-radius: 5px; background: #fff; font-variant-numeric: tabular-nums; }
.technical-chart-legend.decision-indicator-strip b { color: #173f5f; font-weight: 850; }
.technical-chart-legend.decision-indicator-strip .decision-risk-value { border: 1px solid rgba(168, 50, 50, .28); color: #8f2929; }
.elliott-wave-map { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 8px; margin: 8px 0; }
.elliott-wave-track { display: flex; min-width: 0; align-items: center; justify-content: center; gap: 5px; padding: 8px 10px; border: 1px solid #bfd0df; border-radius: 9px; background: #f5f9fc; }
.elliott-wave-track > span { margin-right: 3px; color: #425466; font-size: 11px; font-weight: 800; }
.elliott-wave-track > b { display: inline-grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: 16px; line-height: 1; box-shadow: 0 2px 6px rgba(26, 55, 75, .18); }
.elliott-wave-track > i { color: #77858e; font-size: 13px; font-style: normal; font-weight: 900; }
.elliott-wave-track.impulse > b { background: #2563a6; }
.elliott-wave-track.correction { border-color: #e3c9ad; background: #fff8f0; }
.elliott-wave-track.correction > b { background: #c06a19; }
.elliott-wave-track.correction > b.active { outline: 3px solid rgba(192, 106, 25, .24); outline-offset: 2px; }
.elliott-wave-track.c-subwaves { grid-column: 1 / -1; border-color: #e3c9ad; background: #fffaf4; }
.elliott-wave-track.c-subwaves > b { flex-basis: 46px; width: 46px; border-radius: 8px; background: #a85412; font-size: 12px; }
.elliott-wave-track.c-subwaves > b.active { background: #873d09; outline: 3px solid rgba(168, 84, 18, .22); outline-offset: 2px; }
.elliott-wave-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 12px; margin: 7px 0 9px; padding: 9px 11px; border: 1px solid #c9d8e5; border-radius: 8px; background: #f5f9fc; color: #425466; font-size: 11px; line-height: 1.45; }
.elliott-wave-summary strong { grid-column: 1 / -1; color: #173f5f; font-size: 13px; }
.elliott-wave-summary span { font-weight: 650; }
.elliott-wave-summary small { grid-column: 1 / -1; color: var(--muted); }
.technical-chart-canvas { position: relative; display: grid; place-items: center; width: 100%; height: 420px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; touch-action: pan-y; cursor: grab; }
.technical-chart-canvas.technical-chart-canvas-decision { height: 560px; }
.decision-pane-labels { position: absolute; z-index: 4; inset: 0; pointer-events: none; color: #425466; font-size: 11px; font-weight: 850; }
.decision-pane-labels span { position: absolute; left: 8px; padding: 2px 6px; border: 1px solid #d7e0e5; border-radius: 5px; background: rgba(255, 255, 255, .88); box-shadow: 0 1px 3px rgba(20, 47, 61, .08); }
.decision-pane-labels .macd-pane-label { top: 64%; color: #176b87; }
.decision-pane-labels .rsi-pane-label { top: 83%; color: #65479a; }
.technical-chart-canvas:active { cursor: grabbing; }
.technical-chart-loading,
.technical-chart-error { max-width: 520px; padding: 16px; color: var(--muted); text-align: center; line-height: 1.55; }
.technical-chart-loading { background: linear-gradient(90deg, #f4f7f8 25%, #e9eef0 50%, #f4f7f8 75%); background-size: 200% 100%; animation: chart-loading 1.4s ease-in-out infinite; }

.tx-wave-page { min-height: 100vh; background: #f4f1ea; }
.tx-wave-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 40px; }
.tx-wave-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 18px; }
.tx-wave-header h1 { margin: 3px 0 8px; color: #173f5f; font-size: clamp(24px, 3vw, 36px); }
.tx-wave-header p:last-child { margin: 0; color: var(--muted); }
.tx-wave-actions { display: flex; gap: 8px; align-items: center; }
.tx-wave-actions a,
.tx-wave-actions button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 0 15px; border: 1px solid #176b87; border-radius: 8px; background: #fff; color: #176b87; font-weight: 800; text-decoration: none; }
.tx-wave-actions button { background: #176b87; color: #fff; cursor: pointer; }
.tx-wave-actions button:disabled { opacity: .62; cursor: progress; }
.tx-wave-quote { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.tx-wave-quote > div { display: grid; gap: 5px; padding: 13px 16px; background: #fff; }
.tx-wave-quote small { color: var(--muted); font-size: 11px; }
.tx-wave-quote strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.tx-rollover-notice { display: grid; gap: 7px; margin: -4px 0 16px; padding: 12px 14px; border: 1px solid #d89424; border-left: 5px solid #b42323; border-radius: 10px; background: linear-gradient(135deg, #fff8e7, #fff4f4); }
.tx-rollover-notice[hidden] { display: none; }
.tx-rollover-notice > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tx-rollover-notice span { color: #9d1c1c; font-size: 11px; font-weight: 900; }
.tx-rollover-notice strong { color: var(--ink); font-size: 16px; }
.tx-rollover-notice p { margin: 0; color: #394b55; font-size: 12px; line-height: 1.45; }
.tx-rollover-notice b { color: #9d1c1c; }
.tx-alert-monitor { margin-bottom: 12px; padding: 13px; border: 1px solid #bdcdd2; border-radius: 12px; background: rgba(255,255,255,.78); box-shadow: 0 4px 14px rgba(20,47,61,.05); }
.tx-decision-summary-head { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; margin-bottom: 12px; padding: 2px 2px 0; }
.tx-decision-summary-head > div { display: grid; gap: 3px; min-width: 0; }
.tx-decision-summary-head small { color: #60717c; font-size: 11px; font-weight: 800; }
.tx-decision-summary-head strong { color: #173f5f; font-size: 18px; font-weight: 850; line-height: 1.35; }
.tx-decision-summary-head span { color: #60717c; font-size: 13px; font-weight: 650; text-align: right; }
.tx-decision-summary-levels { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid #ccdadd; border-radius: 9px; background: #ccdadd; }
.tx-decision-summary-levels > div { display: grid; align-content: center; gap: 5px; min-width: 0; min-height: 76px; padding: 12px 14px; background: #fff; }
.tx-decision-summary-levels small { color: #60717c; font-size: 11px; font-weight: 800; }
.tx-decision-summary-levels strong { color: #173f5f; font-size: 16px; line-height: 1.4; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tx-decision-summary-levels > div:first-child { border-left: 4px solid #176b87; }
.tx-decision-summary-levels > div:nth-child(2) { border-left: 4px solid #a83232; }
.tx-decision-summary-levels > div:nth-child(3) { border-left: 4px solid #b07819; }
.tx-decision-summary[data-summary-status="confirmed"] .tx-decision-summary-head strong { color: #176b5a; }
.tx-decision-summary[data-summary-status="prepare"] .tx-decision-summary-head strong { color: #9a650e; }
.tx-decision-summary[data-summary-status="blocked"] .tx-decision-summary-head strong,
.tx-decision-summary[data-summary-status="exit"] .tx-decision-summary-head strong { color: #a83232; }
.tx-decision-summary[data-summary-status="stale"] { opacity: .75; }
.tx-wave-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.62); }
.tx-wave-tabs button { display: grid; place-items: center; min-height: 52px; padding: 7px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #52636f; cursor: pointer; transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease; }
.tx-wave-tabs button strong { font-size: 15px; }
.tx-wave-tabs button span { margin-top: 2px; font-size: 11px; font-weight: 700; }
.tx-wave-tabs button:hover { border-color: #a9c4ce; background: #fff; color: #176b87; }
.tx-wave-tabs button[aria-selected="true"] { border-color: #176b87; background: #176b87; color: #fff; box-shadow: 0 3px 10px rgba(23,107,135,.18); }
.tx-wave-tabs button:focus-visible { outline: 3px solid rgba(23,107,135,.3); outline-offset: 2px; }
.tx-wave-grid { display: block; }
.tx-wave-day-stack { display: grid; gap: 18px; }
.tx-wave-day-stack[hidden] { display: none; }
.tx-wave-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 4px 15px rgba(20, 47, 61, .06); }
[data-tx-adam-chart] { position: relative; }
.tx-adam-marker-card { position: absolute; z-index: 8; overflow: hidden; border: 1px solid #ccd7dd; border-top: 4px solid #2563a6; border-radius: 10px; background: rgba(255, 255, 255, .98); box-shadow: 0 12px 34px rgba(23, 63, 95, .2); color: #304656; font-size: 12px; }
.tx-adam-marker-card[hidden] { display: none; }
.tx-adam-marker-card.is-prepare { border-top-color: #c08a19; }
.tx-adam-marker-card.is-confirm { border-top-color: #15803d; }
.tx-adam-marker-card.is-reduce { border-top-color: #c06a19; }
.tx-adam-marker-card.is-exit { border-top-color: #b91c1c; }
.tx-adam-marker-card > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 12px 8px; border-bottom: 1px solid #e3e9ec; background: #f8fafb; }
.tx-adam-marker-card > header > div:last-child { display: flex; align-items: center; gap: 8px; }
.tx-adam-marker-card h3 { margin: 1px 0 0; color: #173f5f; font-size: 15px; }
.tx-adam-marker-card header small { color: #6d7f8b; }
.tx-adam-marker-score { padding: 3px 7px; border-radius: 999px; background: #e8f1f7; color: #173f5f; font-size: 13px; }
.tx-adam-marker-close { width: 27px; height: 27px; padding: 0; border: 0; border-radius: 50%; background: #e6ecef; color: #425466; font-size: 19px; line-height: 1; cursor: pointer; }
.tx-adam-marker-close:hover { background: #d7e0e5; }
.tx-adam-marker-metrics { display: grid; padding: 7px 12px; }
.tx-adam-marker-metric { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 5px 0; border-bottom: 1px dashed #e4e9eb; }
.tx-adam-marker-metric:last-child { border-bottom: 0; }
.tx-adam-marker-metric span { color: #617582; }
.tx-adam-marker-metric strong { color: #263f50; text-align: right; }
.tx-adam-marker-metric.is-pass span { color: #15803d; }
.tx-adam-marker-metric.is-fail span { color: #b91c1c; }
.tx-adam-marker-card > footer { display: grid; gap: 5px; padding: 9px 12px 11px; border-top: 1px solid #e3e9ec; background: #f8fafb; }
.tx-adam-marker-card > footer > div { display: grid; grid-template-columns: 65px minmax(0, 1fr); gap: 8px; }
.tx-adam-marker-card > footer span { color: #71838e; }
.tx-adam-marker-card > footer strong { color: #263f50; font-weight: 700; }
.tx-wave-card[hidden] { display: none; }
.tx-wave-card > header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.tx-wave-card h2 { margin: 2px 0 0; color: #173f5f; font-size: 18px; }
.tx-wave-card header small { color: var(--muted); }
.tx-wave-badge { max-width: 55%; padding: 5px 8px; border-radius: 999px; background: #eaf4f3; color: #176b5c; font-size: 11px; font-weight: 800; text-align: right; }
.tx-wave-summary { display: flex; flex-wrap: wrap; gap: 6px 14px; min-height: 44px; margin-bottom: 9px; padding: 9px 11px; border-radius: 8px; background: #f6f8f8; color: #425466; font-size: 12px; }
.tx-wave-summary strong { color: #173f5f; }
.tx-indicator-legend { display: flex; flex-wrap: wrap; gap: 7px; margin: -2px 0 9px; color: #526671; font-size: 10px; font-weight: 800; }
.tx-indicator-legend span { padding: 3px 7px; border: 1px solid #d7e0e3; border-radius: 999px; background: #fff; }
.tx-indicator-legend .ema8 { color: #2563a6; }
.tx-indicator-legend .ema21 { color: #c06a19; border-width: 2px; }
.tx-indicator-legend .ema55 { color: #7357a6; }
.tx-indicator-legend .macd { color: #475569; }
.tx-indicator-legend .rsi { color: #0f8b8d; }
.tx-indicator-legend .buy { color: #15803d; background: #ecfdf3; }
.tx-indicator-legend .prepare { color: #2563a6; background: #eff6ff; }
.tx-indicator-legend .invalidated { color: #667784; background: #f1f5f7; }
.tx-indicator-legend .trial { color: #0f8b8d; background: #ecfeff; }
.tx-indicator-legend .add { color: #166534; background: #dcfce7; }
.tx-indicator-legend .take-profit { color: #9a6700; background: #fffbeb; }
.tx-indicator-legend .stop { color: #b91c1c; background: #fff1f2; }
.tx-wave-canvas { display: grid; place-items: center; width: 100%; min-width: 0; height: 520px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.tx-wave-fallback-svg { display: block; width: 100%; height: 100%; }
.tx-wave-meta { min-height: 18px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.tx-wave-note { margin: 16px 0 0; padding: 12px 14px; border-left: 3px solid #0f8b8d; background: rgba(255,255,255,.72); color: var(--muted); font-size: 12px; line-height: 1.65; }

@media (max-width: 860px) {
  .tx-wave-header { flex-direction: column; }
  .tx-wave-quote { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tx-wave-canvas { height: 440px; }
  .tx-wave-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tx-decision-summary-levels { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .tx-wave-shell { width: min(100% - 18px, 1180px); padding-top: 16px; }
  .tx-wave-actions { width: 100%; }
  .tx-wave-actions > * { flex: 1; }
  .tx-wave-quote { grid-template-columns: 1fr; }
  .tx-wave-canvas { height: 350px; }
  .tx-wave-badge { max-width: 48%; }
  .tx-wave-tabs { gap: 4px; padding: 4px; }
  .tx-wave-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tx-wave-tabs button { min-height: 48px; padding-inline: 6px; }
  .tx-decision-summary-head { align-items: flex-start; flex-direction: column; gap: 5px; }
  .tx-decision-summary-head span { text-align: left; }
}
.technical-chart-error { border: 1px solid #e4c2bd; border-radius: 8px; background: #fff4f2; color: #8f2d26; }
@keyframes chart-loading { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .technical-chart-loading { animation: none; } .tx-wave-tabs button { transition: none; } }
.technical-chart-meta { margin-top: 6px; font-variant-numeric: tabular-nums; }
.technical-chart-table-wrap { overflow-x: auto; }
.technical-chart-data-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.technical-chart-data-table th,
.technical-chart-data-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: right; }
.technical-chart-data-table th:first-child,
.technical-chart-data-table thead th { background: #f4f7f6; }
.technical-chart-attribution { margin-top: 6px; text-align: right; }
.technical-chart-attribution a { color: var(--teal); }

.detail-page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 7px;
  background: #536168;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.sixty-minute-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.sixty-minute-overview article {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f6f9f8;
}

.sixty-minute-overview article > span { color: var(--muted); font-size: 11px; font-weight: 750; }
.sixty-minute-overview article > strong { color: var(--ink); font-size: 14px; line-height: 1.45; }
.sixty-minute-overview .wave-pilot-cell { font-weight: 650; }
.sixty-minute-integrity-note { margin-top: 7px; padding: 8px 10px; border-left: 3px solid #b7832f; background: #fff8e8; color: #715719; font-size: 11px; line-height: 1.5; }
.technical-chart-data-table th small { display: block; color: #8a6418; font-size: 9px; font-weight: 700; }

.price-level-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.price-level-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) minmax(150px, .8fr) minmax(230px, 1.4fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: #fff;
}

.price-level-row + .price-level-row { border-top: 1px solid var(--line); }
.price-level-header {
  border-left: 4px solid transparent;
  padding-top: 7px;
  padding-bottom: 7px;
  background: #f4f7f6;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.price-level-name { display: grid; gap: 2px; }
.price-level-name strong { font-size: 13px; }
.price-level-name small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.price-level-row b { font-variant-numeric: tabular-nums; }
.price-level-row span { color: var(--muted); font-size: 12px; }
.price-level-status { display: grid; gap: 2px; }
.price-level-status strong { width: max-content; border-radius: 999px; padding: 3px 7px; font-size: 11px; }
.price-level-status small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.price-level-status.status-broken strong { background: #fff0ef; color: #9a3029; }
.price-level-status.status-testing strong { background: #fff4d8; color: #815500; }
.price-level-status.status-confirmed strong { background: #e8f6ee; color: #17643d; }
.price-level-status.status-waiting strong,
.price-level-status.status-pending strong { background: #eef3f6; color: #425466; }
.price-level-action { color: var(--ink) !important; line-height: 1.5; }
.level-support { border-left: 4px solid #2f8f65; }
.level-resistance { border-left: 4px solid #c7792a; }

.wave-price-decision { display: grid; gap: 10px; }
.wave-price-current { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px 12px; align-items: center; padding: 10px 12px; border: 1px solid #d8c5af; border-radius: 9px; background: #fff9f2; }
.wave-price-current span { color: #755230; font-size: 11px; font-weight: 800; }
.wave-price-current strong { color: #873d09; font-size: 18px; font-variant-numeric: tabular-nums; }
.wave-price-current small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.wave-price-table { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; }
.wave-price-row { display: grid; grid-template-columns: minmax(240px, 1.15fr) minmax(210px, 1fr) minmax(210px, 1fr); gap: 12px; align-items: center; padding: 11px 12px; background: #fff; }
.wave-price-row + .wave-price-row { border-top: 1px solid var(--line); }
.wave-price-row > div { display: flex; align-items: center; gap: 8px; }
.wave-price-row strong { color: var(--ink); font-size: 12px; line-height: 1.5; }
.wave-price-row span { color: #425466; font-size: 12px; line-height: 1.5; }
.wave-price-row em { flex: 0 0 auto; border-radius: 999px; padding: 3px 7px; background: #873d09; color: #fff; font-size: 10px; font-style: normal; font-weight: 800; }
.wave-price-header { background: #f4f7f6; color: var(--muted); font-size: 11px; font-weight: 750; }
.wave-price-header span { color: var(--muted); font-size: 11px; }
.wave-price-row.is-current { box-shadow: inset 4px 0 #873d09; background: #fff8ef; }

.trade-setup-table-wrap { overflow-x: auto; }

.trade-setup-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: #fff;
}

.trade-setup-table th,
.trade-setup-table td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

.trade-setup-table thead th { background: #f4f7f6; color: var(--muted); }
.trade-setup-table tbody th { width: 145px; color: var(--ink); }
.trade-setup-table .setup-ready td:last-child { color: #17643d; font-weight: 800; }
.trade-setup-table .setup-blocked td:last-child { color: #a23b32; font-weight: 800; }

.invalidation-line {
  margin: 8px 0 0;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff0ef;
  color: #8f2d26;
  font-size: 13px;
}

.technical-evidence-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.technical-evidence-list > div {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
}

.technical-evidence-list > div + div { border-top: 1px solid var(--line); }
.technical-evidence-list strong { font-size: 12px; color: #315d7e; }
.technical-evidence-list span { font-size: 12px; line-height: 1.5; }

.technical-source-line {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.technical-details > summary,
.detail-disclosure > summary {
  min-height: 44px;
  color: #315d7e;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.technical-details-body,
.detail-disclosure-body {
  padding-top: 8px;
}

.detail-disclosure-body {
  display: grid;
  gap: 18px;
}

.detail-disclosure-body section + section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.latest-research-title { align-items: flex-end; }
.latest-research-title small { color: var(--muted); font-size: 11px; }

.latest-research-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.financial-analysis-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.research-panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.research-panel-title h5 { margin: 0; color: var(--ink); font-size: 14px; }
.research-panel-title span { color: var(--muted); font-size: 11px; text-align: right; }
.financial-analysis-empty { border: 1px dashed #c9d6dc; border-radius: 8px; padding: 14px; background: #f8fafb; }
.financial-analysis-empty strong { font-size: 13px; }
.financial-analysis-empty p { margin: 5px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.financial-period { width: max-content; border-radius: 999px; padding: 4px 8px; background: #eef3f6; color: #425466; font-size: 11px; font-weight: 750; }
.financial-judgment { display: grid; gap: 4px; margin-top: 8px; border-left: 4px solid var(--blue); border-radius: 7px; padding: 10px 12px; background: #edf5fb; }
.financial-judgment span { color: #315d7e; font-size: 11px; font-weight: 750; }
.financial-judgment strong { font-size: 13px; line-height: 1.55; }
.financial-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.financial-metric { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 7px; padding: 8px; background: #fff; }
.financial-metric span { color: var(--muted); font-size: 10px; }
.financial-metric strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.financial-metric.metric-negative strong { color: #9a3029; }
.financial-analysis-details { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 7px; }
.financial-analysis-details summary { min-height: 44px; color: #315d7e; font-size: 12px; font-weight: 750; cursor: pointer; }
.financial-analysis-details p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }

.technical-reference-line {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f4f7fb;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.technical-reference-line strong {
  color: var(--ink);
}

.technical-reference-line a {
  color: var(--teal);
  font-weight: 700;
}

.investment-evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.investment-evidence-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.investment-evidence-grid h5 { margin: 0 0 6px; font-size: 13px; }
.investment-evidence-grid ul { margin: 0; padding-left: 20px; }
.investment-evidence-grid li { margin: 4px 0; font-size: 13px; line-height: 1.45; }

.compact-forecast {
  display: grid;
  grid-template-columns: minmax(170px, 1.3fr) repeat(3, minmax(120px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid #b8cee0;
  border-radius: 8px;
  background: #b8cee0;
}

.compact-forecast > * { padding: 9px 10px; background: #f2f7fb; }
.compact-forecast strong { color: #0f3d66; }
.compact-forecast span { font-size: 12px; }

.detail-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.detail-section h4 {
  margin: 0 0 8px;
}

.futures-instrument-summary {
  border: 1px solid #cbd9df;
  border-radius: 12px;
  padding: 12px;
  background: #f8fbfc;
}

.futures-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.futures-summary-grid > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}

.futures-summary-grid small {
  color: var(--muted);
  font-size: 11px;
}

.futures-summary-grid strong {
  overflow-wrap: anywhere;
}

.futures-instrument-links,
.futures-linked-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.futures-linked-instrument {
  border: 1px solid #cbd9df;
  border-radius: 12px;
  padding: 12px;
  background: #fbfdfd;
}

.futures-linked-row strong { color: #176b87; }

.research-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.research-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 10px;
}

.research-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.research-card p,
.legacy-note {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.forecast-card-grid .research-card:nth-child(-n + 4) {
  border-color: #b8cee0;
  background: #f2f7fb;
}

.forecast-card-grid .research-card:nth-child(-n + 4) p {
  color: #0f3d66;
  font-weight: 800;
}

.forecast-validation {
  margin: 10px 0 0;
  line-height: 1.6;
}

.forecast-signal-card.forecast-actionable {
  border-color: #4f8f73;
  background: #eef8f2;
}

.forecast-signal-card.forecast-no-edge {
  border-color: #d2a94f;
  background: #fff8e8;
}

.forecast-model-details {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--muted);
}

.forecast-model-details summary {
  cursor: pointer;
  color: #0f3d66;
  font-weight: 700;
}

.forecast-model-details p {
  margin: 9px 0 0;
  line-height: 1.6;
}

.research-evidence-details {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.research-evidence-details summary {
  min-height: 44px;
  padding: 12px;
  cursor: pointer;
  color: var(--blue);
  font-weight: 700;
}

.research-evidence-meta {
  display: grid;
  gap: 7px;
  padding: 0 12px 12px;
}

.research-evidence-meta span {
  color: var(--muted);
  font-size: 12px;
}

.research-evidence-meta .evidence-warning { color: #a34216; }

.research-job-status {
  max-width: 420px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.research-job-status summary {
  cursor: pointer;
  font-weight: 700;
}

.research-job-status details > div {
  display: grid;
  gap: 3px;
  margin-top: 5px;
}

.research-job-status a { color: var(--blue); }
.research-job-status.status-partial,
.research-job-status.status-failed,
.research-job-status .job-error { color: #a34216; }

.legacy-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.portfolio-section {
  border: 2px solid #c8d8d0;
  border-radius: 8px;
  padding: 14px;
  margin-top: 16px;
  background: #f3faf5;
  box-shadow: 0 10px 28px rgba(41, 120, 90, .10);
}

.portfolio-section h4 {
  color: var(--green);
  font-size: 17px;
}

.event-list {
  display: grid;
  gap: 8px;
}

.event-list a {
  display: grid;
  grid-template-columns: 92px 90px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  background: #fbfaf7;
}

.event-list span {
  color: var(--blue);
  font-weight: 700;
  font-size: 13px;
}

.event-list small {
  color: var(--muted);
  min-width: 0;
}

dialog {
  width: min(1040px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(28, 37, 41, .35);
}

#stockForm {
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  padding: 14px 16px 16px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dialog-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialog-head {
  position: sticky;
  z-index: 2;
  top: -14px;
  margin: -14px -16px 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.form-save-status {
  max-width: 280px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 10px;
  margin: 12px 0;
}

.form-grid label {
  gap: 4px;
  font-size: 12px;
}

.form-grid input,
.form-grid select {
  min-height: 38px;
  padding: 7px 9px;
}

.target-lock-hint {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.wide {
  margin-top: 12px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.section-head h4 {
  margin: 0;
}

.trade-editor {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 4px;
}

.research-editor {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.section-hint {
  color: var(--muted);
  font-size: 12px;
}

.research-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.risk-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.research-field-grid label {
  min-width: 0;
}

.trade-header,
.trade-row {
  display: grid;
  grid-template-columns: 1.15fr .75fr .9fr 1fr .8fr minmax(118px, .9fr);
  gap: 8px;
  align-items: center;
}

.trade-header {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.trade-rows {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.trade-editor-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.trade-row { border-radius: 8px; padding: 6px; border: 1px solid transparent; }
.trade-row-persisted.is-locked { border-color: #d9e1e5; background: #f6f8f9; }
.trade-row-persisted:not(.is-locked) { border-color: #dbb982; background: #fff8ed; }
.trade-row.is-locked input,
.trade-row.is-locked select { color: #59636b; background: #edf1f3; cursor: not-allowed; }
.trade-row-control { display: flex; align-items: center; gap: 6px; }
.trade-row-control span { color: var(--muted); font-size: 11px; font-weight: 750; }
.trade-row-control button { min-height: 34px; padding: 6px 9px; border: 1px solid #b8c5cc; border-radius: 7px; background: #fff; color: #425466; font-size: 11px; font-weight: 750; cursor: pointer; }
.trade-row-control button:disabled { cursor: default; opacity: .75; }
.trade-row-control .trade-new-badge { border-radius: 999px; padding: 4px 8px; background: #e8f6ee; color: #17643d; }

.trade-row input,
.trade-row select {
  min-height: 36px;
  padding: 7px 8px;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.portfolio-grid div,
.trade-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 9px;
}

.portfolio-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.trade-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.trade-item {
  display: grid;
  grid-template-columns: 92px 52px minmax(0, 1fr) 58px;
  gap: 8px;
  align-items: center;
}

.trade-item small {
  color: var(--muted);
}

.dialog-actions {
  margin-top: 18px;
}

.unified-stock-detail { max-width: 1480px; margin: 0 auto; }
.unified-detail-title { position: sticky; top: 0; z-index: 22; }
.unified-live-research {
  min-height: 104px;
  margin: 0 0 14px;
  border: 1px solid #cbd9df;
  border-radius: 12px;
  background: #f8fbfc;
  overflow: hidden;
}
.unified-live-research-heading,
.unified-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.unified-live-research-heading { padding: 9px 12px 0; }
.unified-live-research-heading strong,
.unified-section-heading span { color: #176b87; font-size: 11px; font-weight: 820; letter-spacing: .04em; }
.unified-live-research-heading span,
.unified-section-heading small { color: var(--muted); font-size: 11px; }
.unified-live-research-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 8px; padding: 8px; }
.unified-live-research-grid > p { align-self: center; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.stock-news-center-link { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 11px; border: 1px solid #bdd3dd; border-radius: 7px; background: #f3f9fb; color: #155b7a; font-size: 12px; font-weight: 800; text-decoration: none; }
.stock-news-center-link:hover { background: #e8f3f7; }
.unified-live-card { min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.unified-live-card > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "label title toggle" "label meta toggle";
  align-items: center;
  gap: 2px 9px;
  min-height: 64px;
  padding: 9px 11px;
  cursor: pointer;
  list-style: none;
}
.unified-live-card > summary::-webkit-details-marker { display: none; }
.unified-live-card > summary:focus-visible,
.unified-position-details > summary:focus-visible { outline: 3px solid rgba(23, 107, 135, .25); outline-offset: -3px; }
.unified-live-label { grid-area: label; align-self: start; border-radius: 999px; padding: 3px 7px; background: #edf5fb; color: #315d7e; font-size: 10px; font-weight: 820; white-space: nowrap; }
.unified-live-financial .unified-live-label { background: #eef8f2; color: #27714b; }
.unified-live-card > summary strong { grid-area: title; min-width: 0; overflow: hidden; color: var(--ink); font-size: 13px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.unified-live-card > summary small { grid-area: meta; min-width: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.unified-live-card > summary b,
.unified-position-details > summary b { grid-area: toggle; color: #176b87; font-size: 11px; }
.unified-live-card[open] > summary b::before,
.unified-position-details[open] > summary b::before { content: "收合"; }
.unified-live-card[open] > summary b,
.unified-position-details[open] > summary b { font-size: 0; }
.unified-live-card[open] > summary b::before,
.unified-position-details[open] > summary b::before { font-size: 11px; }
.unified-live-body { border-top: 1px solid var(--line); padding: 12px; }
.unified-decision-workspace { min-width: 0; }
.unified-section-heading { margin: 2px 0 9px; padding: 0 2px; }
.unified-section-heading > div { display: flex; align-items: baseline; gap: 8px; }
.unified-section-heading h3 { margin: 0; color: var(--ink); font-size: 18px; }
.unified-position-details { margin-top: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fafcfc; overflow: hidden; }
.unified-position-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 10px 14px; cursor: pointer; list-style: none; }
.unified-position-details > summary::-webkit-details-marker { display: none; }
.unified-position-details > summary span { display: grid; gap: 2px; }
.unified-position-details > summary strong { color: var(--ink); font-size: 14px; }
.unified-position-details > summary small { color: var(--muted); font-size: 11px; }
.unified-position-details > .detail-section { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
[data-timeframe-chart-panel][hidden] { display: none !important; }
.unified-chart-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}
.unified-chart-toolbar > .sixty-wave-tabs { min-width: 0; width: 100%; grid-auto-flow: row; }
.unified-chart-toolbar .sixty-wave-tabs button { min-width: 0; }
.unified-chart-toolbar .sixty-wave-tabs { margin-bottom: 14px; }
/* 已移除個股頁的進階分析導流連結，舊節點不再顯示。 */
.daily-wave-reference-btn,
.daily-wave-reference-link,
.daily-wave-reference-mobile { display: none !important; }
.daily-wave-reference-note {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
  padding: 11px 14px;
  border: 1px solid #d5e1e5;
  border-radius: 10px;
  background: #f8fbfc;
}
.daily-wave-reference-note strong { color: #173f5f; font-size: 16px; }
.daily-wave-reference-note span { color: var(--muted); font-size: 12px; }
.daily-wave-reference-page .technical-chart-canvas { min-height: 520px; }
.unified-stock-detail .sixty-wave-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.unified-subtabs {
  display: flex;
  gap: 6px;
  margin: 0 0 14px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f5f8f9;
  scrollbar-width: thin;
}
.unified-subtabs button {
  min-width: max-content;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 780;
  cursor: pointer;
}
.unified-subtabs button:hover { background: #eaf1f4; color: var(--ink); }
.unified-subtabs button[aria-selected="true"] {
  border-color: #b9d1db;
  background: #fff;
  color: #176b87;
  box-shadow: 0 2px 8px rgba(24, 68, 88, .08);
}
.unified-subtabs button:focus-visible { outline: 3px solid rgba(23, 107, 135, .28); outline-offset: 2px; }
[data-unified-daily-panel][hidden] { display: none !important; }
.adam-daily-chart-section .technical-chart-canvas { height: 520px; }
.adam-direction-summary { grid-template-columns: auto minmax(0, 1fr); }

@media (max-width: 1120px) {
  .app-shell,
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-watchlist {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-watchlist h2 {
    grid-column: 1 / -1;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 900px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  main,
  .sidebar {
    padding: 12px 14px;
  }

  .brand {
    margin-bottom: 8px;
    gap: 8px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .brand h1 {
    font-size: 17px;
  }

  .brand p {
    font-size: 11px;
  }

  .sidebar-quick-add {
    margin: 0 0 8px;
  }

  .sidebar-quick-add input,
  .sidebar-quick-add button {
    min-height: 38px;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
  }

  .sidebar-nav .nav-item {
    display: inline-flex;
    align-items: center;
    width: auto;
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 6px;
  }

  .sidebar-nav .nav-item span {
    font-size: 13px;
  }

  .sidebar-nav .nav-item small {
    display: none;
  }

  .sidebar-watchlist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
  }

  .sidebar-watchlist h2 {
    grid-column: 1 / -1;
    font-size: 12px;
    margin: 0;
  }

  .sidebar-watchlist .metric {
    min-height: 44px;
    padding: 6px 10px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
    padding: 4px 0 8px;
    margin-bottom: 8px;
    gap: 6px;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .status-stack {
    justify-items: start;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
  }

  .quote-status {
    font-size: 11px;
    padding: 3px 8px;
    min-height: 24px;
  }

  .timestamp {
    font-size: 11px;
  }

  .market-session-status {
    font-size: 11px;
    gap: 4px;
  }

  .market-session-lane {
    padding: 2px 6px;
    font-size: 10px;
  }

  .quant-overview {
    padding: 10px 10px;
    margin-bottom: 14px;
    border-radius: 8px;
  }

  .sidebar-grid,
  .research-field-grid,
  .portfolio-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .page-title-row {
    gap: 4px 8px;
  }

  .page-title-links {
    font-size: 14px;
    gap: 3px;
  }

  .page-title-links span {
    padding: 0 2px;
  }

  .quant-signal-card,
  .quant-score-metrics {
    grid-template-columns: 1fr;
  }

  .quant-score-action {
    grid-column: auto;
  }

  .trade-header {
    display: none;
  }

  .trade-row {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid { grid-template-columns: 1fr; }
  .dialog-head { align-items: flex-start; }
  .dialog-head-actions { flex-wrap: wrap; justify-content: flex-end; }
  .form-save-status { order: 3; width: 100%; max-width: none; }

  .table-wrap {
    overflow-x: auto;
  }

  table {
    min-width: 930px;
  }

  .detail-page main { padding: 0; }
  .detail-page .detail-panel {
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  .detail-page .detail-content { padding: 16px; }
  .detail-page .detail-title {
    grid-template-columns: 1fr;
    grid-template-areas:
      "identity"
      "position"
      "actions";
    gap: 10px;
    margin: 0 0 16px;
    padding: 12px 16px;
  }
  .detail-page .detail-title-position {
    justify-self: center;
    flex-wrap: wrap;
    justify-content: center;
  }
  .detail-page .detail-title-actions {
    justify-self: center;
    flex-wrap: wrap;
    justify-content: center;
  }

  .unified-detail-title { position: static; }
  .unified-live-research { min-height: 0; }
  .unified-live-research-heading,
  .unified-section-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .unified-chart-toolbar { grid-template-columns: 1fr; }
  .daily-wave-reference-note { align-items: flex-start; flex-direction: column; gap: 3px; }
  .unified-live-research-grid { grid-template-columns: 1fr; }
  .unified-live-card > summary { grid-template-columns: auto minmax(0, 1fr) auto; min-height: 58px; }
  .unified-stock-detail .sixty-wave-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adam-daily-chart-section .technical-chart-canvas { height: 400px; }

  .compact-snapshot {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .compact-snapshot-heading { grid-column: 1 / -1; }
  .futures-snapshot {
    flex-wrap: wrap;
  }
  .futures-snapshot > small { width: 100%; margin-left: 0; }
  .high-review-panel { align-items: flex-start; flex-direction: column; gap: 2px; }
  .high-review-line { white-space: normal; }
  .technical-core-grid { grid-template-columns: 1fr; }
  .latest-research-grid { grid-template-columns: 1fr; }
  .latest-research-title { align-items: flex-start; flex-direction: column; }
  .financial-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .investment-evidence-grid { grid-template-columns: 1fr; }
  .technical-chart-title-row { align-items: flex-start; flex-direction: column; }
  .technical-chart-canvas { height: 360px; }
  .technical-chart-canvas.technical-chart-canvas-decision { height: 480px; }
  .sixty-minute-overview { grid-template-columns: 1fr; }
  .elliott-wave-map { grid-template-columns: 1fr; }
  .elliott-wave-track.c-subwaves { grid-column: auto; overflow-x: auto; justify-content: flex-start; }
  .elliott-wave-summary { grid-template-columns: 1fr; }
  .elliott-wave-summary strong,
  .elliott-wave-summary small { grid-column: auto; }
  .price-level-header { display: none; }
  .price-level-row { grid-template-columns: minmax(0, 1fr) auto; gap: 7px 10px; }
  .price-level-status,
  .price-level-action { grid-column: 1 / -1; }
  .price-level-status { display: flex; align-items: center; gap: 7px; }
  .wave-price-current { grid-template-columns: auto 1fr; }
  .wave-price-current small { grid-column: 1 / -1; }
  .wave-price-header { display: none; }
  .wave-price-row { grid-template-columns: 1fr; gap: 6px; }
  .wave-price-row > span:last-child { padding-top: 5px; border-top: 1px dashed #d8dddf; color: var(--ink); }
  .technical-evidence-list > div { grid-template-columns: 1fr; gap: 3px; }
  .compact-forecast { grid-template-columns: 1fr 1fr; }
}

.adam-prototype-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 2px;
  color: #475569;
  font-size: 13px;
}

.adam-prototype-toolbar[hidden] {
  display: none;
}

.adam-prototype-toolbar button {
  border: 1px solid rgba(21, 128, 61, .34);
  border-radius: 999px;
  background: rgba(21, 128, 61, .07);
  color: #166534;
  padding: 5px 10px;
  font: inherit;
  cursor: pointer;
}

.adam-prototype-toolbar button:hover,
.adam-prototype-toolbar button:focus-visible {
  border-color: rgba(21, 128, 61, .72);
  background: rgba(21, 128, 61, .13);
  outline: none;
}

/* Market Chips & Public Bank Dashboard */
.market-chips-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.chips-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.chips-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 40%, transparent);
  padding-bottom: 6px;
}

.chips-card-header strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.chips-card-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f0f0f0;
  color: var(--muted);
  font-weight: 600;
}

.chips-metric-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chips-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.chips-metric-row span {
  color: var(--muted);
}

.chips-metric-row strong {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.stock-chips-card {
  background: #fafaf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0;
  display: grid;
  gap: 8px;
}

/* Unified Stock Detail: Top Minimal Header & Auxiliary Deck */
.unified-detail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 12px;
}

.detail-header-main {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.detail-stock-primary {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-stock-name {
  font-size: 18px;
  font-weight: 850;
  color: var(--ink);
}

.stock-theme-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--teal) 12%, transparent);
  color: var(--teal);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
  border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent);
  white-space: nowrap;
}

.detail-stock-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-muted, #f1f5f9);
  color: var(--muted, #475569);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line, #e2e8f0);
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-stock-quote-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.detail-quote-price {
  font-size: 20px;
  font-weight: 850;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.detail-quote-price.up { color: #d9383a; }
.detail-quote-price.down { color: #1b813e; }
.detail-quote-price.flat { color: var(--ink); }

.detail-quote-change {
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.detail-quote-change.up { color: #d9383a; }
.detail-quote-change.down { color: #1b813e; }
.detail-quote-change.flat { color: var(--muted); }

.detail-quote-volume {
  font-size: 12px;
  color: var(--muted);
}

.detail-quote-volume b {
  color: var(--ink);
  font-weight: 750;
}

.detail-volume-status {
  font-size: 12px;
  font-weight: 750;
}

.detail-volume-status.volume-up { color: var(--blue); }
.detail-volume-status.volume-down { color: var(--muted); }
.detail-volume-status.volume-flat { color: var(--ink); }

.unified-auxiliary-deck {
  margin: 10px 0 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.auxiliary-deck-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 8px 0;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.deck-tab-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 750;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.deck-tab-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
}

.deck-tab-btn[aria-selected="true"] {
  color: #176b87;
  background: #ffffff;
  border-color: var(--line);
  margin-bottom: -1px;
  border-bottom: 1px solid #ffffff;
}

.auxiliary-deck-panels {
  padding: 8px 12px;
}

.auxiliary-deck-panels .deck-panel[hidden] {
  display: none !important;
}

.deck-tab-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 750;
  color: var(--teal, #176b87);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  text-decoration: none;
  transition: all 0.15s ease;
}

.deck-tab-link:hover {
  color: #0e4d62;
  background: rgba(23, 107, 135, 0.06);
  border-color: var(--line);
}

/* ==========================================================================
   Sidebar Market & Sector Navigation (3-Tier Taxonomy)
   ========================================================================== */
.sidebar-market-nav {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.sidebar-market-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfdfd;
  overflow: hidden;
  transition: border-color .18s ease, background .18s ease;
}

.sidebar-market-block.active {
  border-color: color-mix(in srgb, var(--teal) 45%, var(--line));
  background: #f9fbfb;
}

.sidebar-market-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-weight: 750;
  font-size: 13.5px;
}

.sidebar-market-header:hover {
  background: var(--teal-2);
}

.sidebar-market-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-market-flag {
  font-size: 15px;
}

.sidebar-market-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: #eef2f3;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 4px;
}

.sidebar-market-arrow {
  font-size: 11px;
  color: var(--muted);
  transition: transform .2s ease;
}

.sidebar-market-block.expanded .sidebar-market-arrow {
  transform: rotate(180deg);
}

.sidebar-sector-list {
  display: grid;
  gap: 2px;
  padding: 4px 8px 8px 16px;
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  background: #f8faf9;
}

.sidebar-sector-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.sidebar-sector-item:hover {
  background: var(--teal-2);
  color: var(--ink);
}

.sidebar-sector-item.active {
  background: var(--teal-2);
  color: var(--teal);
  border-color: color-mix(in srgb, var(--teal) 30%, transparent);
  font-weight: 750;
}

.sidebar-sector-count {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}

/* ==========================================================================
   Detail Page Breadcrumbs (3-Tier Taxonomy Breadcrumbs)
   ========================================================================== */
.detail-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.detail-breadcrumbs a,
.detail-breadcrumbs span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--muted);
}

.detail-breadcrumbs a:hover {
  color: var(--teal);
  text-decoration: underline;
}

.detail-breadcrumbs .breadcrumb-separator {
  color: #a0aec0;
  font-size: 11px;
}

.detail-breadcrumbs .breadcrumb-current {
  color: var(--ink);
  font-weight: 750;
}


/* ==========================================================================
   Stock Workspace Classification Tabs (Market & Sector Filter Tabs)
   ========================================================================== */
.stock-workspace-tabs {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.workspace-tab-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.workspace-tab-label {
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
  margin-right: 4px;
  white-space: nowrap;
}

.workspace-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf9;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all .15s ease;
}

.workspace-tab-btn:hover {
  background: var(--teal-2);
  border-color: color-mix(in srgb, var(--teal) 35%, var(--line));
}

.workspace-tab-btn.active {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
  font-weight: 750;
}

.workspace-tab-count {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--muted);
}

.workspace-tab-btn.active .workspace-tab-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.workspace-tab-divider {
  width: 100%;
  height: 1px;
  background: color-mix(in srgb, var(--line) 60%, transparent);
  margin: 2px 0;
}

/* ==========================================================================
   Stock Industry Thesis & Valuation Profile (個股產業與價值報告)
   ========================================================================== */
.detail-thesis {
  display: grid;
  gap: 12px;
}

.thesis-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.thesis-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 750;
  border: 1px solid var(--line);
}

.thesis-status-badge.bullish {
  background: color-mix(in srgb, var(--teal) 15%, #ffffff);
  color: var(--teal);
  border-color: color-mix(in srgb, var(--teal) 40%, transparent);
}

.thesis-status-badge.neutral {
  background: #f1f5f9;
  color: var(--ink);
  border-color: #cbd5e1;
}

.thesis-status-badge.warning {
  background: color-mix(in srgb, #f59e0b 15%, #ffffff);
  color: #b45309;
  border-color: color-mix(in srgb, #f59e0b 40%, transparent);
}

.thesis-status-badge.bearish {
  background: color-mix(in srgb, #ef4444 15%, #ffffff);
  color: #b91c1c;
  border-color: color-mix(in srgb, #ef4444 40%, transparent);
}

.thesis-gauge-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  display: grid;
  gap: 12px;
}

.thesis-gauge-scale {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
}

.thesis-gauge-track-wrap {
  position: relative;
  height: 14px;
  background: linear-gradient(90deg, #10b981 0%, #0ea5e9 40%, #f59e0b 75%, #ef4444 100%);
  border-radius: 999px;
  margin: 6px 0 16px;
}

.thesis-gauge-pin {
  position: absolute;
  top: -4px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: left .2s ease;
}

.thesis-gauge-pin-head {
  width: 14px;
  height: 22px;
  background: #0f172a;
  border: 2px solid #ffffff;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

.thesis-gauge-pin-label {
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  background: #ffffff;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

.thesis-metrics-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.thesis-metric-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
}

.thesis-metric-box small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 3px;
}

.thesis-metric-box strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.thesis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.thesis-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.thesis-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  padding-bottom: 6px;
}

.thesis-card-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--teal-2);
  color: var(--teal);
}

.thesis-card-item {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
}

.thesis-card-item strong {
  color: var(--muted);
  font-weight: 650;
  margin-right: 4px;
}

.thesis-scenario-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 4px;
}

.thesis-scenario-table th,
.thesis-scenario-table td {
  padding: 6px 8px;
  border: 1px solid var(--line);
  text-align: left;
}

.thesis-scenario-table th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 700;
}

.thesis-invalidation-notice {
  font-size: 11.5px;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  margin-top: 4px;
}

/* ==========================================================================
   Futures Detail Streamlined Layout (個股期交易員直出 K 線極簡佈局)
   ========================================================================== */
.futures-detail-streamlined {
  display: flex !important;
  flex-direction: column !important;
  padding-top: 4px;
}

.futures-detail-streamlined .unified-detail-title {
  order: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 6px 12px !important;
  margin: 0 0 6px !important;
  min-height: 38px !important;
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

.futures-detail-streamlined .unified-decision-workspace {
  order: 2 !important;
}

.futures-detail-streamlined .unified-auxiliary-deck {
  order: 3 !important;
}

.futures-detail-streamlined .futures-tabs-compact button {
  min-height: 44px !important;
  height: 44px !important;
  border: 2px solid #cbd5e1 !important;
  border-radius: 999px !important;
  font-weight: 800 !important;
}

.futures-detail-streamlined .futures-chart-section-compact .elliott-wave-summary {
  display: none !important;
}

.futures-detail-streamlined .detail-volume-status {
  display: inline-flex !important;
  align-items: center !important;
  height: 22px !important;
  padding: 2px 7px !important;
  border-radius: 4px !important;
  font-size: 11px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
}

.futures-detail-streamlined .unified-chart-toolbar.futures-toolbar-compact {
  margin: 4px 0 8px !important;
}

.futures-detail-streamlined .futures-tabs-compact {
  display: flex !important;
  gap: 8px !important;
  margin: 0 !important;
}

.futures-detail-streamlined .futures-tabs-compact button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 88px !important;
  padding: 4px 14px !important;
  color: #334155 !important;
  background: #fff !important;
}

.futures-detail-streamlined .futures-tabs-compact button span {
  display: none !important;
}

.futures-detail-streamlined .futures-title-row-compact {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  margin-bottom: 6px !important;
}

.futures-detail-streamlined .futures-calibration-anchor {
  margin-left: auto !important;
}

.futures-detail-streamlined .detail-header-main {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  flex-wrap: wrap !important;
}

.futures-detail-streamlined .detail-stock-primary {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.futures-detail-streamlined .detail-stock-name {
  font-size: 16px !important;
  font-weight: 750 !important;
  color: var(--ink) !important;
  white-space: nowrap !important;
}

.futures-badge {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 1px 6px !important;
  border-radius: 4px !important;
}

.futures-detail-streamlined .detail-stock-quote-group {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.futures-detail-streamlined .detail-quote-price {
  font-size: 18px !important;
  font-weight: 800 !important;
}

.futures-detail-streamlined .detail-quote-change {
  font-size: 13px !important;
  font-weight: 700 !important;
}

.futures-detail-streamlined .detail-quote-volume {
  font-size: 12px !important;
  color: var(--muted) !important;
}

.futures-spot-pill {
  font-size: 12px !important;
  color: #475569 !important;
  background: #f1f5f9 !important;
  padding: 2px 8px !important;
  border-radius: 999px !important;
  border: 1px solid #e2e8f0 !important;
}

.futures-spot-pill [data-unified-spot-basis],
.futures-instrument-links [data-unified-spot-basis] {
  font-weight: 700;
}

.futures-basis-contango {
  color: #dc2626 !important;
}

.futures-basis-backwardation {
  color: #16a34a !important;
}

.futures-basis-flat,
.futures-basis-pending {
  color: #64748b !important;
}

/* ETF 識別徽章與頂部淨值膠囊 */
.etf-badge {
  background: #0284c7 !important;
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 750 !important;
  padding: 1px 6px !important;
  border-radius: 4px !important;
  margin-left: 6px !important;
  vertical-align: middle;
}

.etf-nav-pill {
  font-size: 12px !important;
  color: #334155 !important;
  background: #f8fafc !important;
  padding: 2px 8px !important;
  border-radius: 999px !important;
  border: 1px solid #cbd5e1 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.etf-nav-pill [data-unified-etf-discount] {
  font-weight: 750 !important;
}

.etf-discount-safe {
  color: #16a34a !important;
}
.etf-discount-normal {
  color: #475569 !important;
}
.etf-discount-mild {
  color: #d97706 !important;
}
.etf-discount-warning {
  color: #dc2626 !important;
  font-weight: 850 !important;
}

/* ETF 深度數據與盤後覆核面板 */
.etf-recon-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.etf-recon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.etf-recon-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.etf-recon-card small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.etf-recon-card strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
  font-weight: 800;
}

.etf-recon-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.etf-recon-box.recon-warning {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.etf-recon-box.recon-safe {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.etf-recon-box h5 {
  margin: 0 0 4px 0;
  font-size: 13px;
  font-weight: 800;
}

.etf-recon-box p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.futures-detail-streamlined .detail-title-actions .detail-page-link {
  padding: 4px 10px !important;
  font-size: 12px !important;
  min-height: auto !important;
}

/* Timeframe pill buttons matching reference link size (44px) */
.futures-toolbar-compact {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  margin: 4px 0 10px !important;
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.futures-toolbar-compact > .sixty-wave-tabs,
.futures-tabs-compact {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  width: auto !important;
  flex-wrap: wrap !important;
}

.futures-tabs-compact button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 44px !important;
  height: 44px !important;
  padding: 8px 18px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  background: #ffffff !important;
  border: 2px solid #cbd5e1 !important;
  color: #1e293b !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
  transition: all 0.15s ease !important;
}

.futures-tabs-compact button strong {
  font-size: 14px !important;
  font-weight: 800 !important;
}

.futures-tabs-compact button span {
  display: none !important;
}

.futures-tabs-compact button:hover {
  border-color: #0f766e !important;
  color: #0f766e !important;
  background: #f0fdfa !important;
}

.futures-tabs-compact button[aria-selected="true"] {
  background: #0f766e !important;
  border: 2px solid #0f766e !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.25) !important;
}

/* Compact chart section & title with embedded calibration button */
.futures-chart-section-compact {
  padding: 6px 12px 10px !important;
  margin-bottom: 12px !important;
}

.futures-title-row-compact {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 4px !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
}

.futures-title-row-compact h4 {
  font-size: 15px !important;
  font-weight: 800 !important;
  color: var(--ink) !important;
  margin: 0 !important;
}

.futures-calibration-anchor {
  display: inline-flex !important;
  align-items: center !important;
  margin-left: auto !important;
}

.futures-calibration-anchor .visual-calibration-toolbar {
  margin: 0 !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.futures-calibration-anchor [data-calib-save-btn] {
  padding: 4px 12px !important;
  font-size: 12px !important;
  min-height: 28px !important;
  height: 28px !important;
  font-weight: 700 !important;
  background: #f0fdfa !important;
  border: 1.5px solid #0f766e !important;
  color: #0f766e !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.futures-calibration-anchor [data-calib-save-btn]:hover {
  background: #0f766e !important;
  color: #ffffff !important;
}

.futures-calibration-anchor [data-calib-clear-btn] {
  padding: 4px 8px !important;
  font-size: 12px !important;
  min-height: 28px !important;
  height: 28px !important;
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #64748b !important;
  border-radius: 6px !important;
  cursor: pointer !important;
}

.futures-calibration-anchor [data-calib-clear-btn]:hover {
  background: #f1f5f9 !important;
  color: #1e293b !important;
}

.futures-chart-section-compact .technical-chart-legend {
  display: none !important;
}

.futures-chart-section-compact .elliott-wave-summary {
  display: none !important;
}

.futures-chart-section-compact .technical-pattern-badge {
  display: none !important;
}

/* Index-first homepage visual refresh. News remains a separate page and data flow. */
body[data-domain-page="index.html"]:not(.detail-page) {
  --bg: #edf2f5;
  --panel: #ffffff;
  --ink: #172a38;
  --muted: #627482;
  --line: #d7e1e7;
  --teal: #176b78;
  --teal-2: #e6f2f2;
  --blue: #355e83;
  background: var(--bg);
}

body[data-domain-page="index.html"]:not(.detail-page) .app-shell {
  grid-template-columns: minmax(248px, 276px) minmax(0, 1fr);
}

body[data-domain-page="index.html"] .sidebar {
  background: #f8fafb;
  border-right-color: #d5e0e6;
}

body[data-domain-page="index.html"] .brand-mark {
  border-radius: 11px;
  background: #173748;
  box-shadow: 0 6px 14px rgba(23, 55, 72, .16);
}

body[data-domain-page="index.html"] .brand h1 {
  letter-spacing: -.025em;
}

body[data-domain-page="index.html"] .sidebar-nav {
  gap: 5px;
}

body[data-domain-page="index.html"] .sidebar-nav .nav-item {
  border-radius: 9px;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

body[data-domain-page="index.html"] .sidebar-nav .nav-item.active {
  border-color: #c6dcdf;
  background: #e7f2f2;
  color: #155c68;
}

body[data-domain-page="index.html"] .sidebar-nav .nav-item:focus-visible,
body[data-domain-page="index.html"] .sidebar-watchlist button:focus-visible,
body[data-domain-page="index.html"] .sidebar-market-header:focus-visible,
body[data-domain-page="index.html"] .sidebar-sector-item:focus-visible {
  outline: 3px solid rgba(23, 107, 120, .34);
  outline-offset: 2px;
}

body[data-domain-page="index.html"]:not(.detail-page) main {
  width: 100%;
  max-width: 1840px;
  margin: 0 auto;
  padding: clamp(22px, 2.5vw, 38px) clamp(18px, 2.3vw, 40px);
}

body[data-domain-page="index.html"] .topbar {
  align-items: center;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid #d7e1e7;
}

body[data-domain-page="index.html"] .page-heading {
  flex: 1 1 auto;
  min-width: 0;
}

body[data-domain-page="index.html"] .topbar h2 {
  color: #152b3a;
  font-size: clamp(27px, 2.2vw, 34px);
  letter-spacing: -.04em;
}

body[data-domain-page="index.html"] .page-title-row {
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 12px;
}

body[data-domain-page="index.html"] .page-title-actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
}

body[data-domain-page="index.html"] .home-title-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

body[data-domain-page="index.html"] .home-title-links[hidden] {
  display: none;
}

body[data-domain-page="index.html"] .home-analysis-link,
body[data-domain-page="index.html"] .home-news-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid #cfdae0;
  border-radius: 8px;
  background: #fff;
  color: #176b78;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

body[data-domain-page="index.html"] .home-analysis-link {
  border-color: #176b78;
  background: #176b78;
  color: #fff;
}

body[data-domain-page="index.html"] .home-analysis-link:hover,
body[data-domain-page="index.html"] .home-analysis-link:focus-visible {
  border-color: #125d68;
  background: #125d68;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body[data-domain-page="index.html"] .home-news-link:hover,
body[data-domain-page="index.html"] .home-news-link:focus-visible {
  border-color: #176b78;
  background: #f1f8f8;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body[data-domain-page="index.html"] .status-stack {
  gap: 7px;
}

body[data-domain-page="index.html"] .quote-status {
  border: 1px solid #d9e3e8;
  font-size: 12px;
  font-weight: 750;
}

body[data-domain-page="index.html"] .quant-overview {
  margin-bottom: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-domain-page="index.html"] .quant-section-heading {
  min-height: 43px;
  margin: 0 0 10px;
  padding: 0 2px;
}

body[data-domain-page="index.html"] .quant-section-heading:first-child strong {
  color: #16394b;
  font-size: 17px;
  letter-spacing: -.02em;
}

body[data-domain-page="index.html"] .quant-section-heading:first-child span {
  color: #637987;
}

body[data-domain-page="index.html"] .quant-section-heading-secondary {
  min-height: 38px;
  margin: 22px 0 9px;
  padding-top: 14px;
  border-top: 1px solid #d7e1e7;
}

body[data-domain-page="index.html"] .quant-section-heading-secondary strong {
  color: #1d3544;
  font-size: 14px;
}

body[data-domain-page="index.html"] .global-index-grid {
  gap: 12px;
}

body[data-domain-page="index.html"] .global-index-row {
  padding: 16px;
  border: 1px solid #dce5ea;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(28, 54, 69, .045);
}

body[data-domain-page="index.html"] .global-index-row-title {
  margin-bottom: 10px;
}

body[data-domain-page="index.html"] .global-index-row-title strong {
  color: #294859;
  font-size: 13px;
  font-weight: 800;
}

body[data-domain-page="index.html"] .global-index-row-title span {
  color: #71828d;
}

body[data-domain-page="index.html"] .global-index-row-grid {
  gap: 9px;
}

body[data-domain-page="index.html"] .global-index-card {
  min-height: 98px;
  padding: 12px 13px;
  border: 1px solid #e0e7eb;
  border-top: 3px solid #9aabb5;
  border-radius: 9px;
  background: #fbfcfd;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

body[data-domain-page="index.html"] .global-index-card.index-up {
  border-top-color: #b13a2f;
}

body[data-domain-page="index.html"] .global-index-card.index-down {
  border-top-color: #398060;
}

body[data-domain-page="index.html"] .global-index-card.index-pending {
  border-top-color: #aab8c1;
}

body[data-domain-page="index.html"] .global-index-card > strong {
  color: #203b4a;
  font-size: 13px;
}

body[data-domain-page="index.html"] .global-index-meta {
  color: #6f808b;
}

body[data-domain-page="index.html"] .global-index-quote b {
  color: #183446;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

body[data-domain-page="index.html"] .global-index-link:hover,
body[data-domain-page="index.html"] .global-index-link:focus-visible {
  border-color: #a9c6cd;
  background: #fff;
  box-shadow: 0 8px 18px rgba(20, 57, 73, .1);
}

body[data-domain-page="index.html"] .global-index-link:focus-visible,
body[data-domain-page="index.html"] a:focus-visible,
body[data-domain-page="index.html"] button:focus-visible,
body[data-domain-page="index.html"] input:focus-visible,
body[data-domain-page="index.html"] select:focus-visible {
  outline: 3px solid rgba(23, 107, 120, .35);
  outline-offset: 2px;
}

body[data-domain-page="index.html"] .skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 8px;
  background: #173748;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

body[data-domain-page="index.html"] .skip-link:focus {
  transform: translateY(0);
}

@media (max-width: 1120px) {
  body[data-domain-page="index.html"]:not(.detail-page) .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-domain-page="index.html"] .sidebar {
    position: relative;
    border-bottom-color: #d5e0e6;
  }
}

@media (max-width: 720px) {
  body[data-domain-page="index.html"]:not(.detail-page) main {
    padding: 18px 14px 28px;
  }

  body[data-domain-page="index.html"] .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 13px;
  }

  body[data-domain-page="index.html"] .status-stack {
    width: 100%;
    justify-items: start;
  }

  body[data-domain-page="index.html"] .page-title-row {
    align-items: center;
  }

  body[data-domain-page="index.html"] .global-index-row {
    padding: 12px;
    border-radius: 10px;
  }

  body[data-domain-page="index.html"] .global-index-card {
    min-height: 78px;
    padding: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-domain-page="index.html"] *,
  body[data-domain-page="index.html"] *::before,
  body[data-domain-page="index.html"] *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Mobile navigation and responsive workspace */
.mobile-nav-bar,
.mobile-menu-btn,
.mobile-drawer-close,
.mobile-drawer-backdrop {
  display: none;
}

@media (max-width: 900px) {
  body[data-domain-page="index.html"]:not(.detail-page) .app-shell {
    display: block !important;
    min-height: 100vh;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0;
    width: min(320px, 85vw) !important;
    max-width: 85vw;
    z-index: 100;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 16px 18px 32px !important;
    border-right: 1px solid var(--line);
    border-bottom: 0 !important;
    background: #fbfaf7 !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, .15);
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.16, 1, .3, 1);
  }

  body[data-domain-page="index.html"].drawer-open .sidebar {
    transform: translateX(0);
  }

  .mobile-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: block;
    visibility: hidden;
    opacity: 0;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(2px);
    transition: opacity .2s ease, visibility .2s ease;
  }

  body[data-domain-page="index.html"].drawer-open .mobile-drawer-backdrop {
    visibility: visible;
    opacity: 1;
  }

  body.drawer-open { overflow: hidden; }

  .mobile-drawer-close {
    display: grid;
    flex: 0 0 36px;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 20px;
  }

  .mobile-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    font-weight: 750;
  }

  .mobile-view-tabs {
    display: flex;
    gap: 4px;
    padding: 3px;
    border-radius: 8px;
    background: #edf1f3;
  }

  .mobile-tab-btn {
    min-height: 32px;
    padding: 0 16px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
  }

  .mobile-tab-btn.active {
    background: #fff;
    color: var(--teal);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  }

  body[data-domain-page="index.html"]:not(.detail-page) main {
    padding: 10px 14px 28px;
  }

  body[data-domain-page="index.html"] .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    padding: 0 0 8px;
  }

  body[data-domain-page="index.html"] .page-heading { width: 100%; }
  body[data-domain-page="index.html"] .page-title-row { align-items: center; }

  body[data-domain-page="index.html"] .status-stack {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-items: initial;
    gap: 6px !important;
    width: 100% !important;
    overflow-x: auto !important;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  body[data-domain-page="index.html"] .status-stack > * {
    flex: 0 0 auto;
    max-width: 82vw;
    white-space: nowrap;
  }

  body[data-domain-page="index.html"] .global-index-row-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px;
  }

  body[data-domain-page="index.html"] .global-index-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 8px;
    min-width: 0;
    min-height: 72px !important;
    padding: 9px 12px !important;
  }

  body[data-domain-page="index.html"] .global-index-card > strong,
  body[data-domain-page="index.html"] .global-index-meta,
  body[data-domain-page="index.html"] .global-index-quote,
  body[data-domain-page="index.html"] .global-index-quote b,
  body[data-domain-page="index.html"] .global-index-quote span {
    min-width: 0;
    white-space: nowrap;
  }

  body[data-domain-page="index.html"] .global-index-card > strong {
    grid-column: 1;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
  }

  body[data-domain-page="index.html"] .global-index-meta {
    grid-column: 1;
    margin: 3px 0 0;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
  }

  body[data-domain-page="index.html"] .global-index-quote {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 7px;
    margin: 0;
    text-align: right;
  }

  body[data-domain-page="index.html"] .global-index-quote b { font-size: 16px; }

  body[data-domain-page="index.html"] .stock-workspace-tabs {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }

  body[data-domain-page="index.html"] .workspace-tab-row {
    flex-wrap: nowrap !important;
    width: max-content;
  }

  body[data-domain-page="index.html"] .table-wrap { overflow-x: hidden; }
  body[data-domain-page="index.html"] .stock-table {
    width: 100% !important;
    min-width: 100% !important;
    table-layout: fixed !important;
  }

  body[data-domain-page="index.html"] .stock-col-identity { width: 34%; }
  body[data-domain-page="index.html"] .stock-col-price { width: 18%; }
  body[data-domain-page="index.html"] .stock-col-change { width: 22%; }
  body[data-domain-page="index.html"] .stock-col-board-trend { width: 26%; }

  body[data-domain-page="index.html"] .stock-col-volume,
  body[data-domain-page="index.html"] .stock-col-board-battlefield,
  body[data-domain-page="index.html"] .stock-col-board-pattern,
  body[data-domain-page="index.html"] .stock-col-board-defense {
    display: none;
    width: 0;
  }

  body[data-domain-page="index.html"] .stock-table th:nth-child(4),
  body[data-domain-page="index.html"] .stock-table th:nth-child(6),
  body[data-domain-page="index.html"] .stock-table th:nth-child(7),
  body[data-domain-page="index.html"] .stock-table th:nth-child(8),
  body[data-domain-page="index.html"] .stock-table td:nth-child(4),
  body[data-domain-page="index.html"] .stock-table td:nth-child(6),
  body[data-domain-page="index.html"] .stock-table td:nth-child(7),
  body[data-domain-page="index.html"] .stock-table td:nth-child(8) {
    display: none !important;
  }

  body[data-domain-page="index.html"] .stock-table th,
  body[data-domain-page="index.html"] .stock-table td {
    padding: 9px 6px !important;
    font-size: 12px !important;
    overflow-wrap: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-drawer-backdrop,
  body[data-domain-page="index.html"] .sidebar { transition-duration: .01ms; }
}

/* ==========================================================================
   QFFR1 小型台積電期貨五檔盤口與即時成交明細 (左右並排雙欄)
   ========================================================================== */
.qff-microstructure-section {
  margin-top: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.qff-microstructure-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 12px;
}

.qff-microstructure-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.qff-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
}
.qff-status-badge.status-open {
  background: #dcfce7;
  color: #15803d;
}
.qff-status-badge.status-snapshot {
  background: #e0f2fe;
  color: #0369a1;
}
.qff-status-badge.status-error {
  background: #fee2e2;
  color: #b91c1c;
}
.qff-tick-change-up { color: #15803d; }
.qff-tick-change-down { color: #dc2626; }
.qff-tick-change-flat { color: #64748b; }

.qff-microstructure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 0;
  gap: 16px;
}
@media (max-width: 860px) {
  .qff-microstructure-grid {
    grid-template-columns: 1fr;
  }
}

.qff-column {
  min-width: 0;
  max-width: 100%;
  background: #fafafa;
  border: 1px solid #f1f5f9;
  border-radius: 6px;
  padding: 10px;
}

.qff-column-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

.qff-spread-badge {
  font-size: 12px;
  font-weight: 600;
  color: #0f766e;
  background: #f0fdfa;
  padding: 1px 6px;
  border-radius: 4px;
}

.qff-ratio-bar-wrap {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: #e2e8f0;
  margin-bottom: 4px;
}
.qff-ratio-bar-bid {
  background: #ef4444;
  transition: width 0.3s ease;
}
.qff-ratio-bar-ask {
  background: #22c55e;
  transition: width 0.3s ease;
}
.qff-ratio-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 10px;
}

.qff-orderbook-table, .qff-timesales-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.qff-orderbook-table th, .qff-timesales-table th {
  padding: 4px 6px;
  text-align: right;
  color: #64748b;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
}
.qff-orderbook-table th:first-child, .qff-timesales-table th:first-child {
  text-align: left;
}

.qff-orderbook-table td, .qff-timesales-table td {
  padding: 5px 6px;
  text-align: right;
}
.qff-orderbook-table td:first-child, .qff-timesales-table td:first-child {
  text-align: left;
}

.qff-cell-bid-vol, .qff-cell-ask-vol {
  position: relative;
  z-index: 2;
}
.qff-cell-bid-price {
  color: #dc2626;
  font-weight: 700;
}
.qff-cell-ask-price {
  color: #16a34a;
  font-weight: 700;
}

.qff-timesales-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #ffffff;
}

.qff-tick-side-buy {
  color: #dc2626;
  font-weight: 700;
}
.qff-tick-side-sell {
  color: #16a34a;
  font-weight: 700;
}
.qff-tick-side-neutral {
  color: #64748b;
}

.qff-badge-side-buy {
  background: #fef2f2;
  color: #b91c1c;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}
.qff-badge-side-sell {
  background: #f0fdf4;
  color: #15803d;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}

@media (max-width: 720px) {
  .qff-microstructure-grid,
  .qff-column,
  .qff-timesales-scroll {
    min-width: 0;
    max-width: 100%;
  }

  .qff-orderbook-table,
  .qff-timesales-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
  }

  .qff-timesales-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .qff-timesales-table th,
  .qff-timesales-table td {
    padding: 4px 3px;
    white-space: nowrap;
  }

  .qff-timesales-table th:nth-child(1) { width: 22% !important; }
  .qff-timesales-table th:nth-child(2) { width: 25% !important; }
  .qff-timesales-table th:nth-child(3) { width: 12% !important; }
  .qff-timesales-table th:nth-child(4) { width: 23% !important; }
  .qff-timesales-table th:nth-child(5) { width: 18% !important; }
}

/* 手機首頁指數卡：直向雙欄、橫向三至四欄 */
@media (max-width: 600px) {
  body[data-domain-page="index.html"]:not(.detail-page) .global-index-row-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-card {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    gap: 2px;
    min-width: 0 !important;
    min-height: 82px !important;
    padding: 8px 9px !important;
    border-radius: 8px !important;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-card > strong {
    order: 1;
    overflow: hidden !important;
    margin: 2px 0 1px !important;
    font-size: 13px !important;
    font-weight: 750 !important;
    line-height: 1.25 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-meta {
    order: 0;
    gap: 4px;
    width: 100%;
    min-width: 0;
    margin: 0 !important;
    overflow: hidden;
    font-size: 10px !important;
    white-space: nowrap;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-meta > span,
  body[data-domain-page="index.html"]:not(.detail-page) .global-index-meta > small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-meta > small {
    flex: 0 1 auto;
    text-align: right;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-quote {
    order: 2;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: baseline !important;
    justify-content: space-between !important;
    gap: 2px 6px !important;
    margin: 4px 0 2px !important;
    text-align: left !important;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-quote > b {
    font-size: 15px !important;
    font-weight: 850 !important;
    letter-spacing: -0.01em;
    white-space: nowrap;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-change {
    flex-direction: row !important;
    align-items: baseline !important;
    gap: 3px !important;
    font-size: 11px !important;
    font-variant-numeric: tabular-nums !important;
    white-space: nowrap;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-change b {
    font-size: 11px !important;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-change small {
    font-size: 10px !important;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-card .card-wave-link {
    display: none !important;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .top-weight-impact,
  body[data-domain-page="index.html"]:not(.detail-page) .future-basis-badge {
    order: 3;
    align-self: flex-start !important;
    display: inline-flex !important;
    margin-top: 3px !important;
    padding: 1px 5px !important;
    border-radius: 4px !important;
    font-size: 10px !important;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  body[data-domain-page="index.html"]:not(.detail-page) main {
    padding: 8px 12px 18px;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "mobile-nav mobile-nav" "page-heading status";
    align-items: center;
    gap: 3px 10px;
    margin-bottom: 6px;
    padding: 0 0 6px;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .mobile-nav-bar { grid-area: mobile-nav; padding-bottom: 4px; }
  body[data-domain-page="index.html"]:not(.detail-page) .page-heading { grid-area: page-heading; width: auto; min-width: 0; }
  body[data-domain-page="index.html"]:not(.detail-page) .status-stack {
    grid-area: status;
    justify-self: end;
    width: auto !important;
    max-width: 100%;
    overflow-x: auto !important;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .page-title-row { flex-wrap: nowrap; gap: 6px; }
  body[data-domain-page="index.html"]:not(.detail-page) .page-title-row h2 { font-size: 22px; line-height: 1.2; white-space: nowrap; }
  body[data-domain-page="index.html"]:not(.detail-page) .home-title-links { flex-wrap: nowrap; gap: 4px; }
  body[data-domain-page="index.html"]:not(.detail-page) .home-title-links a { padding: 5px 7px; font-size: 10px; white-space: nowrap; }
  body[data-domain-page="index.html"]:not(.detail-page) .status-stack > * { max-width: none; font-size: 10px; }

  body[data-domain-page="index.html"]:not(.detail-page) .quant-overview { margin-bottom: 12px; }
  body[data-domain-page="index.html"]:not(.detail-page) .quant-section-heading {
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    padding: 0 2px;
  }
  body[data-domain-page="index.html"]:not(.detail-page) .quant-section-heading > strong { flex: 0 0 auto; font-size: 14px; white-space: nowrap; }
  body[data-domain-page="index.html"]:not(.detail-page) .quant-section-heading > span { min-width: 0; font-size: 10px; text-align: right; }

  /* 橫向首屏共用卡片網格，卡片內的市場／代號仍標明商品類別。 */
  body[data-domain-page="index.html"]:not(.detail-page) #globalIndexCards.global-index-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-row,
  body[data-domain-page="index.html"]:not(.detail-page) .global-index-row-grid {
    display: contents;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-row-title {
    grid-column: 1 / -1;
    margin: 0;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-row:not(:first-child) .global-index-row-title {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-card {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    gap: 1px;
    min-height: 84px !important;
    padding: 6px 8px !important;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-meta {
    gap: 4px;
    width: 100%;
    min-width: 0;
    margin: 0 !important;
    overflow: hidden;
    font-size: 10px !important;
    white-space: nowrap;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-meta > span,
  body[data-domain-page="index.html"]:not(.detail-page) .global-index-meta > small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-meta > small {
    flex: 0 1 auto;
    text-align: right;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-card > strong {
    order: 1;
    overflow: hidden;
    margin: 0;
    font-size: 12px !important;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-quote {
    order: 2;
    flex-wrap: nowrap;
    gap: 4px;
    margin: 2px 0 1px;
    text-align: left;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-quote b {
    font-size: 14px !important;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-quote > b {
    white-space: nowrap;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-change {
    flex-direction: row;
    align-items: baseline;
    gap: 3px;
    font-size: 10px;
    white-space: nowrap;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .global-index-change b,
  body[data-domain-page="index.html"]:not(.detail-page) .global-index-change small {
    font-size: 10px !important;
  }

  body[data-domain-page="index.html"]:not(.detail-page) .top-weight-impact,
  body[data-domain-page="index.html"]:not(.detail-page) .future-basis-badge {
    order: 3;
    align-self: flex-start;
    margin-top: 1px;
    padding: 1px 5px;
    font-size: 10px;
  }

}

@media (min-width: 761px) and (max-width: 900px) {
  body[data-domain-page="index.html"]:not(.detail-page) #globalIndexCards.global-index-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

}

/* QFFR1 個股期貨頁手機直向版面 */
@media (max-width: 600px) {
  .futures-detail-streamlined .unified-detail-title {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 0 8px !important;
    padding: 10px 12px !important;
  }

  .futures-detail-streamlined .detail-header-main {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .futures-detail-streamlined .detail-stock-primary {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-width: 0 !important;
    padding-right: 72px !important;
  }

  .futures-detail-streamlined .detail-stock-name {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    font-size: clamp(14px, 4vw, 16px) !important;
    font-weight: 850 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .futures-detail-streamlined .detail-title-actions {
    position: absolute !important;
    top: 10px !important;
    right: 12px !important;
    justify-content: flex-end !important;
    margin: 0 !important;
  }

  .futures-detail-streamlined .detail-title-actions .detail-page-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 30px !important;
    height: 30px !important;
    padding: 0 8px !important;
    border-radius: 6px !important;
    font-size: 0 !important;
    white-space: nowrap !important;
  }

  .futures-detail-streamlined .detail-title-actions .detail-page-link::after {
    content: "✕ 首頁";
    font-size: 12px;
  }

  .futures-detail-streamlined .detail-stock-quote-group {
    display: flex !important;
    align-items: baseline !important;
    flex-wrap: wrap !important;
    gap: 6px 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin-top: 2px !important;
  }

  .futures-detail-streamlined .detail-quote-price {
    flex: 0 0 100% !important;
    font-size: clamp(20px, 6vw, 22px) !important;
    font-weight: 850 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .futures-detail-streamlined .detail-quote-change,
  .futures-detail-streamlined .detail-quote-volume,
  .futures-detail-streamlined .futures-spot-pill {
    white-space: nowrap !important;
  }

  .futures-detail-streamlined .detail-quote-change {
    font-size: 13px !important;
    font-weight: 750 !important;
  }

  .futures-detail-streamlined .detail-quote-volume {
    color: var(--muted) !important;
    font-size: 12px !important;
  }

  .futures-detail-streamlined .futures-spot-pill {
    padding: 2px 6px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
  }

  .futures-detail-streamlined .unified-chart-toolbar {
    display: block !important;
    margin: 4px 0 8px !important;
  }

  .futures-detail-streamlined .futures-tabs-compact {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 4px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  .futures-detail-streamlined .futures-tabs-compact button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    height: 44px !important;
    padding: 2px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    text-align: center !important;
  }

  .futures-detail-streamlined .futures-tabs-compact button span {
    display: none !important;
  }

  .futures-detail-streamlined .futures-tabs-compact button strong {
    white-space: nowrap !important;
  }

  .futures-detail-streamlined .futures-title-row-compact {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 6px !important;
    overflow: visible !important;
  }

  .futures-detail-streamlined .futures-title-row-compact h4 {
    align-self: center !important;
    font-size: 14px !important;
    text-align: center !important;
  }

  .futures-detail-streamlined .futures-calibration-anchor {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  .futures-detail-streamlined .visual-calibration-toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto !important;
    grid-template-areas: "title title title title" "upper lower save clear" "status status status status" !important;
    align-items: center !important;
    justify-content: stretch !important;
    gap: 4px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .futures-detail-streamlined .visual-calibration-toolbar > span:first-child {
    grid-area: title;
    white-space: nowrap !important;
  }

  .futures-detail-streamlined .visual-calibration-toolbar label:first-of-type {
    grid-area: upper;
  }

  .futures-detail-streamlined .visual-calibration-toolbar label:nth-of-type(2) {
    grid-area: lower;
  }

  .futures-detail-streamlined .visual-calibration-toolbar label {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 2px !important;
    min-width: 0 !important;
    margin: 0 !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  .futures-detail-streamlined .visual-calibration-toolbar input {
    flex: 0 0 58px !important;
    width: 58px !important;
    min-width: 0 !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 2px 4px !important;
    border-radius: 5px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-align: center !important;
  }

  .futures-detail-streamlined .visual-calibration-toolbar [data-calib-save-btn] {
    grid-area: save;
    min-width: 40px !important;
    min-height: 30px !important;
    height: 30px !important;
    padding: 2px 8px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  .futures-detail-streamlined .visual-calibration-toolbar [data-calib-clear-btn] {
    grid-area: clear;
    min-width: 30px !important;
    min-height: 30px !important;
    height: 30px !important;
    padding: 2px 6px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  .futures-detail-streamlined .visual-calibration-toolbar [data-calib-status] {
    grid-area: status;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-align: center !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .futures-detail-streamlined .technical-chart-canvas {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 320px !important;
    min-height: 300px !important;
  }
}

@media (max-width: 360px) {
  .futures-detail-streamlined .visual-calibration-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-areas: "title title" "upper lower" "save clear" "status status" !important;
  }
}

@media (min-width: 601px) and (max-width: 900px) and (orientation: landscape) {
  .futures-detail-streamlined .technical-chart-canvas {
    height: calc(100vh - 76px) !important;
    min-height: 300px !important;
  }
}
