:root {
  color-scheme: light;
  --page: #f4f7fb;
  --page-strong: #e9eef5;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-solid: #ffffff;
  --surface-subtle: #f7f9fc;
  --ink: #111827;
  --ink-soft: #334155;
  --muted: #667085;
  --line: rgba(17, 24, 39, 0.12);
  --line-strong: rgba(17, 24, 39, 0.18);
  --blue: #007aff;
  --action-text: #005fc8;
  --green: #34c759;
  --orange: #ff9f0a;
  --red: #ff3b30;
  --violet: #5856d6;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 20px 50px rgba(16, 24, 40, 0.10);
  --radius: 8px;
  --body-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(244, 247, 251, 0.96) 42%, rgba(233, 238, 245, 0.98) 100%);
  --header-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(247, 249, 252, 0.76));
  --glance-bg: rgba(255, 255, 255, 0.68);
  --input-placeholder: #98a2b3;
  --control-shadow: 0 10px 22px rgba(0, 122, 255, 0.20);
  --hover-shadow: 0 12px 24px rgba(16, 24, 40, 0.08);
  --tabs-bg: rgba(17, 24, 39, 0.06);
  --tab-active-bg: #111827;
  --tab-active-ink: #ffffff;
  --chart-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(247, 249, 252, 0.90));
  --chart-grid: rgba(17, 24, 39, 0.04);
  --empty-chart-bg: rgba(255, 255, 255, 0.72);
  --modal-overlay: rgba(15, 23, 42, 0.42);
  --modal-bg: rgba(255, 255, 255, 0.94);
  --modal-header-bg: rgba(255, 255, 255, 0.88);
  --positive-text: #1f9d55;
  --negative-text: #d92d20;
  --primary-button-bg: #006edb;
  --primary-button-ink: #ffffff;
  --chart-ink: #111827;
  --chart-muted: #667085;
  --chart-axis-line: rgba(17, 24, 39, 0.16);
  --chart-grid-line: rgba(17, 24, 39, 0.06);
  --chart-tooltip-bg: rgba(255, 255, 255, 0.96);
  --chart-tooltip-border: rgba(17, 24, 39, 0.12);
  --chart-zoom-fill: rgba(0, 122, 255, 0.12);
  --chart-ma5: #5470c6;
  --chart-ma10: #91cc75;
  --chart-ma20: #fac858;
  --chart-volume: rgba(0, 122, 255, 0.34);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f172a;
  --page-strong: #111827;
  --surface: rgba(17, 24, 39, 0.82);
  --surface-solid: #141d2e;
  --surface-subtle: #101827;
  --ink: #f8fafc;
  --ink-soft: #d8e1ee;
  --muted: #9aa8bb;
  --line: rgba(226, 232, 240, 0.13);
  --line-strong: rgba(226, 232, 240, 0.22);
  --blue: #5eb1ff;
  --action-text: #8bc5ff;
  --green: #46d982;
  --orange: #ffb13d;
  --red: #ff6b61;
  --violet: #a5a3ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 22px 58px rgba(0, 0, 0, 0.38);
  --body-bg: linear-gradient(180deg, rgba(15, 23, 42, 1) 0%, rgba(12, 18, 31, 0.98) 46%, rgba(8, 13, 23, 1) 100%);
  --header-bg: linear-gradient(135deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.78));
  --glance-bg: rgba(15, 23, 42, 0.62);
  --input-placeholder: #77869a;
  --control-shadow: 0 12px 26px rgba(94, 177, 255, 0.18);
  --hover-shadow: 0 14px 28px rgba(0, 0, 0, 0.26);
  --tabs-bg: rgba(226, 232, 240, 0.08);
  --tab-active-bg: #e5efff;
  --tab-active-ink: #0f172a;
  --chart-bg: linear-gradient(180deg, rgba(20, 29, 46, 0.84), rgba(12, 18, 31, 0.94));
  --chart-grid: rgba(226, 232, 240, 0.035);
  --empty-chart-bg: rgba(15, 23, 42, 0.66);
  --modal-overlay: rgba(2, 6, 23, 0.70);
  --modal-bg: rgba(17, 24, 39, 0.96);
  --modal-header-bg: rgba(17, 24, 39, 0.90);
  --positive-text: #7ee2a1;
  --negative-text: #ff8a82;
  --primary-button-bg: #5eb1ff;
  --primary-button-ink: #07111f;
  --chart-ink: #f8fafc;
  --chart-muted: #a9b7c8;
  --chart-axis-line: rgba(226, 232, 240, 0.18);
  --chart-grid-line: rgba(226, 232, 240, 0.08);
  --chart-tooltip-bg: rgba(15, 23, 42, 0.96);
  --chart-tooltip-border: rgba(226, 232, 240, 0.18);
  --chart-zoom-fill: rgba(94, 177, 255, 0.18);
  --chart-ma5: #8fb7ff;
  --chart-ma10: #9fe08d;
  --chart-ma20: #ffd166;
  --chart-volume: rgba(94, 177, 255, 0.30);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Noto Sans TC", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  background: var(--body-bg);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.28);
  outline-offset: 2px;
}

.app-shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.workspace {
  display: grid;
  gap: 18px;
}

.panel,
.strategy-box {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: saturate(180%) blur(20px);
}

.app-header {
  margin-bottom: 18px;
  padding: 24px;
  background: var(--header-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  backdrop-filter: saturate(180%) blur(24px);
}

.brand-stack {
  display: grid;
  gap: 8px;
}

.eyebrow {
  color: var(--blue);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-header h1 {
  margin: 0;
  font-size: 2.9rem;
  line-height: 0.96;
  font-weight: 750;
}

.header-copy {
  max-width: 640px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}


.theme-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(74px, 1fr));
  gap: 4px;
  width: 160px;
  padding: 4px;
  background: var(--tabs-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.theme-toggle button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 750;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.theme-toggle button.active {
  color: var(--tab-active-ink);
  background: var(--tab-active-bg);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.14);
}


.glance-item {
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glance-bg);
}

.glance-item span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.glance-item strong {
  display: block;
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.25;
}

.search-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}


.search-box input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(16, 24, 40, 0.03);
}

.search-box input::placeholder {
  color: var(--input-placeholder);
}

.search-box button,
.tabs button,
.refresh-button,
.view-details-btn {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.search-box button {
  min-width: 132px;
  padding: 0 22px;
  color: var(--primary-button-ink);
  background: var(--primary-button-bg);
  box-shadow: var(--control-shadow);
}

.search-box button:hover,
.tabs button:hover,
.refresh-button:hover,
.view-details-btn:hover,
.chip:hover,
.suggestion-item:hover {
  transform: translateY(-1px);
}

.refresh-controls {
  min-height: 44px;
}

.refresh-button {
  min-width: 132px;
  padding: 0 18px;
  color: var(--primary-button-ink);
  background: var(--primary-button-bg);
  box-shadow: var(--control-shadow);
}

.refresh-button.is-loading {
  cursor: wait;
}

.refresh-button:disabled {
  color: var(--muted);
  background: var(--surface-solid);
  border-color: var(--line);
  box-shadow: none;
  cursor: not-allowed;
}

.refresh-button:disabled:hover {
  transform: none;
}

.refresh-status {
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.35;
}

.history-panel {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.chip-title {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 36px;
  padding: 7px 12px;
  color: var(--ink-soft);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 650;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.chip:hover {
  border-color: rgba(0, 122, 255, 0.38);
  box-shadow: var(--hover-shadow);
}

.chip.is-empty {
  color: var(--muted);
  cursor: default;
}

.chip.is-empty:hover {
  transform: none;
  box-shadow: none;
}

.suggestion-list {
  display: grid;
  gap: 8px;
}

.suggestion-item {
  display: grid;
  grid-template-columns: minmax(86px, auto) 1fr;
  gap: 14px;
  align-items: center;
  padding: 13px 14px;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.suggestion-item:hover {
  border-color: rgba(0, 122, 255, 0.40);
  box-shadow: var(--hover-shadow);
}

.suggestion-item .symbol {
  width: fit-content;
  min-width: 84px;
  padding: 7px 10px;
  color: var(--blue);
  background: rgba(0, 122, 255, 0.08);
  border-radius: 999px;
  font-weight: 750;
  text-align: center;
}

.suggestion-item .info {
  display: grid;
  gap: 4px;
}

.muted {
  color: var(--muted);
}

.summary-panel {
  display: grid;
  gap: 12px;
}

.item-summary {
  padding: 18px;
}

.summary-title {
  margin-bottom: 14px;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 760;
}

.summary-card {
  min-height: 96px;
  padding: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.summary-card strong {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 720;
}

.summary-card .value {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 760;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.tabs {
  padding: 5px;
  background: var(--tabs-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tabs button {
  min-height: 40px;
  color: var(--ink-soft);
  background: transparent;
}

.tabs button.active {
  color: var(--tab-active-ink);
  background: var(--tab-active-bg);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.16);
}

.chart-panel {
  padding: 14px;
}

.chart-box {
  min-height: 520px;
  position: relative;
  border-radius: var(--radius);
  background:
    var(--chart-bg),
    repeating-linear-gradient(0deg, var(--chart-grid), var(--chart-grid) 1px, transparent 1px, transparent 72px);
}

.empty-state {
  min-height: inherit;
  display: grid;
  place-items: center;
  padding: 34px;
  color: var(--muted);
  text-align: center;
}

.empty-state-inner {
  display: grid;
  gap: 18px;
  justify-items: center;
  max-width: 420px;
}

.empty-chart {
  width: min(340px, 74vw);
  height: 160px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 9px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--empty-chart-bg);
}

.empty-candle {
  width: 14px;
  min-height: 48px;
  border-radius: 4px;
  background: var(--green);
  box-shadow: 0 -20px 0 -6px rgba(52, 199, 89, 0.28);
}

.empty-candle:nth-child(2),
.empty-candle:nth-child(5),
.empty-candle:nth-child(8) {
  background: var(--red);
  box-shadow: 0 -30px 0 -6px rgba(255, 59, 48, 0.22);
}

.empty-candle:nth-child(3) { min-height: 74px; }
.empty-candle:nth-child(4) { min-height: 96px; }
.empty-candle:nth-child(5) { min-height: 60px; }
.empty-candle:nth-child(6) { min-height: 118px; }
.empty-candle:nth-child(7) { min-height: 84px; }
.empty-candle:nth-child(8) { min-height: 106px; }

.empty-state h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.24rem;
}

.empty-state p {
  margin: 0;
  line-height: 1.55;
}

.strategy-box {
  padding: 18px;
}

.strategy-header {
  margin-bottom: 14px;
}

.strategy-header h2,
.news-header h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.strategy-header p,
.strategy-summary p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}


.strategy-badge {
  min-height: 44px;
  min-width: 150px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: #ffffff;
  background: #667085;
  font-weight: 780;
}

.view-details-btn {
  padding: 0 16px;
  color: var(--action-text);
  background: rgba(0, 122, 255, 0.08);
  border-color: rgba(0, 122, 255, 0.22);
}

.view-details-btn:hover {
  background: rgba(0, 122, 255, 0.12);
  box-shadow: var(--control-shadow);
}

.strategy-summary {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.strategy-summary span {
  color: var(--ink);
  font-weight: 760;
}

.strategy-rationales {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.forecast-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.forecast-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.forecast-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.forecast-heading span,
.forecast-panel p,
.forecast-method,
.forecast-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}


.forecast-card {
  min-height: 128px;
  padding: 13px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.forecast-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.forecast-price {
  margin-top: 8px;
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 780;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.forecast-change {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 760;
}

.forecast-range {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.35;
}

.forecast-positive {
  border-color: rgba(52, 199, 89, 0.32);
}

.forecast-positive .forecast-change {
  color: var(--positive-text);
}

.forecast-negative {
  border-color: rgba(255, 59, 48, 0.30);
}

.forecast-negative .forecast-change {
  color: var(--negative-text);
}

.forecast-neutral {
  border-color: rgba(0, 122, 255, 0.24);
}

.forecast-empty {
  padding: 13px;
  background: var(--surface-solid);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.strategy-rationale {
  padding: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.signal-buy {
  border-color: rgba(52, 199, 89, 0.36);
}

.signal-buy .strategy-badge {
  background: var(--green);
  color: #062713;
}

.signal-hold {
  border-color: rgba(0, 122, 255, 0.32);
}

.signal-hold .strategy-badge {
  background: var(--primary-button-bg);
  color: var(--primary-button-ink);
}

.signal-sell {
  border-color: rgba(255, 59, 48, 0.32);
}

.signal-sell .strategy-badge {
  background: var(--red);
}

.news-panel {
  padding: 18px;
}

.news-header {
  margin-bottom: 16px;
}

.news-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
}

.website-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  margin-bottom: 12px;
  padding: 12px 14px;
  color: var(--ink-soft);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.website-box strong {
  color: var(--muted);
  font-size: 0.82rem;
}

.website-box a {
  color: var(--action-text);
  font-weight: 700;
  text-decoration: none;
  word-break: break-all;
}

.website-box a:hover {
  text-decoration: underline;
}

.news-list {
  display: grid;
  gap: 10px;
}

.news-item {
  padding: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.news-item a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 760;
  line-height: 1.35;
}

.news-item a:hover {
  color: var(--action-text);
}

.news-item p {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.news-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 24px;
  background: var(--modal-overlay);
  overflow: hidden;
  overscroll-behavior: contain;
  backdrop-filter: blur(18px);
}

.modal.show {
  display: grid;
  place-items: center;
}

body.modal-open {
  overflow: hidden;
}

/*
 * Header and footer stay put and only the body scrolls, so the scrollbar never
 * runs past the rounded corners and the title cannot be scrolled away. The
 * height budget is the viewport minus the overlay padding, which is why the
 * sheet must never be taller than the space it is centred in.
 */
.modal-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(900px, 100%);
  max-height: min(920px, calc(100dvh - 48px));
  overflow: hidden;
  background: var(--modal-bg);
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background: var(--modal-header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.32rem;
}

.modal-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink-soft);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.modal-body {
  padding: 18px 18px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.analysis-section {
  margin-bottom: 18px;
}

.analysis-section:last-child {
  margin-bottom: 0;
}

.analysis-section h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 1rem;
}


.metric-card,
.recommendation-box,
.risk-reward-box {
  padding: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.metric-value {
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.metric-value.positive {
  color: var(--positive-text);
}

.metric-value.negative {
  color: var(--negative-text);
}

.recommendation-item {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.recommendation-item:last-child {
  margin-bottom: 0;
}

.recommendation-label {
  color: var(--action-text);
  font-size: 0.86rem;
  font-weight: 760;
}

.recommendation-value {
  color: var(--ink-soft);
  line-height: 1.5;
}

.risk-reward-box {
  display: grid;
  gap: 10px;
}

.risk-reward-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.risk-reward-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.risk-reward-label {
  color: var(--muted);
}

.risk-reward-value {
  color: var(--ink);
  font-weight: 760;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 1240px);
    padding: 14px 0 28px;
  }

  .app-header {
    padding: 18px;
  }

  .app-header h1 {
    font-size: 2.15rem;
  }

  .theme-toggle {
    width: 100%;
  }

  .chart-box {
    min-height: 420px;
  }

  .forecast-heading {
    display: grid;
    align-items: start;
  }

  .website-box,
  .risk-reward-row {
    display: grid;
  }

  .modal {
    padding: 12px;
  }
}

/* ── Disclaimer & data provenance ───────────────────────── */
.disclaimer-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 159, 10, 0.38);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius);
  background: rgba(255, 159, 10, 0.08);
}

.disclaimer-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 260px;
  flex: 1 1 420px;
}

.disclaimer-tag {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--orange);
  color: #1a1206;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.disclaimer-bar p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.55;
}

.disclaimer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ghost-button {
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-solid);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.ghost-button:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.source-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.source-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glance-bg);
  font-size: 0.76rem;
  color: var(--ink);
}

.source-key {
  color: var(--muted);
}

.source-chip strong[data-state="open"] {
  color: var(--positive-text);
}

.source-chip strong[data-state="closed"],
.source-chip strong[data-state="pre"] {
  color: var(--muted);
}

.panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.74rem;
}

.panel-meta span::before {
  content: '·';
  margin-right: 6px;
  opacity: 0.55;
}

.panel-meta span:first-child::before {
  content: none;
}

/* ── View tabs & shared controls ────────────────────────── */
.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  margin-bottom: 18px;
  border-radius: calc(var(--radius) + 4px);
  background: var(--tabs-bg);
}

.view-tabs button {
  flex: 1 1 auto;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.view-tabs button:hover {
  color: var(--ink);
}

.view-tabs button.active {
  background: var(--tab-active-bg);
  color: var(--tab-active-ink);
}

.view {
  display: grid;
  gap: 18px;
}

.view[hidden] {
  display: none;
}

.toggle-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--tabs-bg);
}

.segmented button {
  padding: 6px 14px;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
}

.segmented button.active {
  background: var(--tab-active-bg);
  color: var(--tab-active-ink);
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px 24px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 4px 0 0;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.panel-note,
.news-note {
  margin: 0;
  max-width: 520px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
  text-align: right;
  text-wrap: pretty;
}

@media (max-width: 720px) {
  .panel-note,
  .news-note {
    max-width: none;
    text-align: left;
  }
}

.sub-heading {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 16px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.control {
  display: grid;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--muted);
}

.control-wide {
  flex: 1 1 100%;
}

.control input,
.control select {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-solid);
  color: var(--ink);
  font-size: 0.86rem;
  font-family: inherit;
}

.control-row .control select {
  min-width: 116px;
}

.control-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: end;
  min-height: 36px;
  padding-bottom: 0;
}

.control-checkbox input {
  width: 16px;
  height: 16px;
}

.control-row button[type="submit"] {
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  background: var(--primary-button-bg);
  color: var(--primary-button-ink);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

/* ── Stats, tables, notes ───────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stat {
  display: grid;
  gap: 4px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.stat span {
  color: var(--muted);
  font-size: 0.74rem;
}

.stat strong {
  font-size: 1.05rem;
  font-weight: 760;
  color: var(--ink);
}

.positive { color: var(--positive-text); }
.negative { color: var(--negative-text); }

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.data-table th,
.data-table td {
  padding: 9px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  background: var(--surface-subtle);
  color: var(--muted);
  font-weight: 650;
  font-size: 0.76rem;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .row-cash td {
  color: var(--muted);
}

.row-sub {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.empty-note,
.fine-print {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.empty-note {
  padding: 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.fine-print {
  margin: 14px 0 0;
}

.doc-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.65;
}

.doc-list li {
  margin-bottom: 6px;
}

.insight {
  padding: 13px 15px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.65;
}

.insight-warn {
  border-left-color: var(--orange);
  background: rgba(255, 159, 10, 0.07);
}

.verdict {
  padding: 12px 15px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 650;
}

.verdict-good {
  background: rgba(52, 199, 89, 0.12);
  color: var(--positive-text);
}

.verdict-warn {
  background: rgba(255, 159, 10, 0.12);
  color: var(--ink-soft);
}

.mini-chart {
  width: 100%;
  height: 320px;
  margin: 4px 0 16px;
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

/* ── Signal presentation ────────────────────────────────── */
.state-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.02em;
}

.state-buy { background: rgba(52, 199, 89, 0.16); color: var(--positive-text); }
.state-sell { background: rgba(255, 59, 48, 0.14); color: var(--negative-text); }
.state-hold { background: var(--tabs-bg); color: var(--muted); }

.confidence {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.confidence-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
}

.confidence-head strong {
  color: var(--ink);
}

.confidence-track {
  height: 7px;
  border-radius: 999px;
  background: var(--tabs-bg);
  overflow: hidden;
}

.confidence-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--blue);
}

.signal-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.signal-metrics div {
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.signal-metrics span {
  color: var(--muted);
  font-size: 0.73rem;
}

.signal-metrics strong {
  font-size: 0.95rem;
  color: var(--ink);
}

.strategy-rationale.weight-positive { border-left: 3px solid var(--positive-text); }
.strategy-rationale.weight-negative { border-left: 3px solid var(--negative-text); }
.strategy-rationale.weight-neutral { border-left: 3px solid var(--line-strong); }

/* ── Forecast fan ───────────────────────────────────────── */
.forecast-band {
  position: relative;
  height: 26px;
  margin: 10px 0 8px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(0, 122, 255, 0.06), rgba(0, 122, 255, 0.20), rgba(0, 122, 255, 0.06));
}

.band-box {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 4px;
  background: rgba(0, 122, 255, 0.34);
}

.band-median {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--ink);
}

.forecast-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.73rem;
}

.forecast-width {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

/* ── News sentiment ─────────────────────────────────────── */
.news-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.sentiment-tag {
  flex-shrink: 0;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.71rem;
  font-weight: 700;
}

.news-unmapped {
  opacity: 0.62;
}

.sentiment-positive { background: rgba(52, 199, 89, 0.16); color: var(--positive-text); }
.sentiment-negative { background: rgba(255, 59, 48, 0.14); color: var(--negative-text); }
.sentiment-neutral { background: var(--tabs-bg); color: var(--muted); }

.news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.74rem;
}

/* ── Summary tweaks ─────────────────────────────────────── */
.summary-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.summary-note {
  color: var(--muted);
  font-size: 0.76rem;
}

.summary-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
}

/* ── Screener cards ─────────────────────────────────────── */
.screener-summary {
  margin-bottom: 4px;
}

.screen-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.screen-card.status-fresh { border-left-color: var(--positive-text); }
.screen-card.status-stale,
.screen-card.status-unreviewed { border-left-color: var(--orange); }

.screen-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

.screen-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.screen-symbol {
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
}

.screen-name {
  font-weight: 650;
  color: var(--ink-soft);
}

.screen-english {
  color: var(--muted);
  font-size: 0.78rem;
}

.screen-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-review.badge-fresh {
  border-color: rgba(52, 199, 89, 0.4);
  background: rgba(52, 199, 89, 0.12);
  color: var(--positive-text);
}

.badge-review.badge-stale,
.badge-review.badge-unreviewed {
  border-color: rgba(255, 159, 10, 0.45);
  background: rgba(255, 159, 10, 0.14);
  color: var(--ink-soft);
  font-weight: 700;
}

.screen-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 9px;
}

.screen-metrics div {
  display: grid;
  gap: 3px;
}

.screen-metrics span {
  color: var(--muted);
  font-size: 0.72rem;
}

.screen-metrics strong {
  font-size: 0.9rem;
  color: var(--ink);
}

.screen-exit {
  display: grid;
  gap: 7px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
}

.exit-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
}

.exit-item span {
  min-width: 62px;
  color: var(--muted);
}

.exit-item strong {
  color: var(--ink);
  font-weight: 650;
}

.exit-invalidation strong {
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1.5;
}

.screen-notes summary {
  cursor: pointer;
  color: var(--action-text);
  font-size: 0.8rem;
  font-weight: 650;
}

.screen-notes ul {
  margin: 9px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.6;
}

.screen-risk {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.screen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.screen-actions button {
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-solid);
  color: var(--ink);
  font-size: 0.79rem;
  font-weight: 620;
  cursor: pointer;
  transition: border-color 0.16s ease;
}

.screen-actions button:hover {
  border-color: var(--blue);
  color: var(--action-text);
}

/* ── Review editor ──────────────────────────────────────── */
.review-form {
  display: grid;
  gap: 12px;
}

.review-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.review-actions button[type="submit"] {
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  background: var(--primary-button-bg);
  color: var(--primary-button-ink);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  .disclaimer-bar {
    flex-direction: column;
    align-items: stretch;
  }

  /* In column direction the 420px flex-basis would size the height, not the width. */
  .disclaimer-main {
    flex: 0 1 auto;
  }

  .modal {
    padding: 12px;
  }

  .modal-content {
    max-height: calc(100dvh - 24px);
  }

  .modal-header,
  .modal-body {
    padding: 14px;
  }

  .view-tabs button {
    flex: 1 1 40%;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
  }
}
