:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1a1d21;
  --muted: #5c6570;
  --border: #d8dde3;
  --accent: #2563eb;
  --high: #b91c1c;
  --medium: #b45309;
  --low: #15803d;
  --caution: #7c3aed;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 1rem 24px 2rem;
}

header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

header .container {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

nav .brand {
  font-weight: 700;
  margin-right: auto;
  color: var(--text);
}

.banner {
  background: #fff8e6;
  border: 1px solid #f0d78c;
  color: #7a5b00;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.card h1,
.card h2 {
  margin-top: 0;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.btn {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.btn:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.btn-secondary {
  background: #e5e7eb;
  color: var(--text);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.55rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef1f5;
  font-weight: 600;
}

tr:nth-child(even) {
  background: #fafbfc;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-high {
  background: #fee2e2;
  color: var(--high);
}

.badge-medium {
  background: #ffedd5;
  color: var(--medium);
}

.badge-low {
  background: #dcfce7;
  color: var(--low);
}

.badge-caution,
.badge-default {
  background: #ede9fe;
  color: var(--caution);
}

.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 0.75rem;
  border-radius: 6px;
}

.warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.actions {
  margin-top: 1rem;
}

.guidance-notice {
  margin-top: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: 0.88rem;
  color: #1e3a5f;
}

.field-legend {
  margin-top: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text);
}

.field-legend-title {
  margin: 0 0 0.35rem;
}

.field-legend ul {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
}

.field-legend li {
  margin-bottom: 0.2rem;
}

.field-legend-zh {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.review-step {
  min-width: 12rem;
  max-width: 18rem;
  font-size: 0.82rem;
  line-height: 1.35;
}

.badge-action-strong {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-action-watch {
  background: #e0e7ff;
  color: #4338ca;
}

.badge-action-wait {
  background: #f3f4f6;
  color: #4b5563;
}

.badge-action-caution {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-action-not {
  background: #f3f4f6;
  color: #6b7280;
}

.badge-action-reduce {
  background: #fce7f3;
  color: #9d174d;
}

.badge-risk-high {
  background: #fecaca;
  color: #991b1b;
}

.badge-risk-medium {
  background: #fed7aa;
  color: #9a3412;
}

.badge-risk-low {
  background: #bbf7d0;
  color: #166534;
}

.badge-earnings-high {
  background: #fecaca;
  color: #991b1b;
  border: 1px solid #f87171;
}

.badge-earnings-medium {
  background: #fed7aa;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.badge-earnings-low {
  background: #fef9c3;
  color: #a16207;
  border: 1px solid #fde047;
}

.badge-earnings-normal {
  background: #bbf7d0;
  color: #166534;
  border: 1px solid #86efac;
}

.badge-earnings-unknown {
  background: #e2e8f0;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.rec-table .col-earnings {
  min-width: 7.5rem;
}

.rec-table .col-earnings-date {
  min-width: 6.5rem;
}

.rec-table .col-earnings-days {
  min-width: 5.5rem;
}

.badge-tech-macd-bullish {
  background: #bbf7d0;
  color: #166534;
  border: 1px solid #86efac;
}

.badge-tech-macd-bearish {
  background: #fecaca;
  color: #991b1b;
  border: 1px solid #f87171;
}

.badge-tech-macd-neutral {
  background: #e2e8f0;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-tech-vol-low {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.badge-tech-vol-medium {
  background: #fef9c3;
  color: #a16207;
  border: 1px solid #fde047;
}

.badge-tech-vol-high {
  background: #fecaca;
  color: #991b1b;
  border: 1px solid #f87171;
}

.badge-tech-obv-accum {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.badge-tech-obv-distrib {
  background: #ffe4e6;
  color: #9f1239;
  border: 1px solid #fda4af;
}

.badge-tech-obv-neutral {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.badge-tech-bb-upper {
  background: #fed7aa;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.badge-tech-bb-lower {
  background: #bfdbfe;
  color: #1e3a8a;
  border: 1px solid #93c5fd;
}

.badge-tech-bb-middle {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #d1d5db;
}

.badge-tech-unknown {
  background: #eceff1;
  color: #546e7a;
  border: 1px solid #cfd8dc;
}

.badge-tech-view-constructive {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.badge-tech-view-mixed {
  background: #fff8e1;
  color: #f57f17;
  border: 1px solid #ffe082;
}

.badge-tech-view-caution {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffcc80;
}

.badge-tech-view-weak {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.rec-table .col-tech-macd,
.rec-table .col-tech-vol,
.rec-table .col-tech-obv,
.rec-table .col-tech-bb {
  min-width: 5.5rem;
}

.rec-table .col-tech-52w {
  min-width: 6.5rem;
}

.rec-table .col-tech-view,
.rec-table .col-tech-review-action,
.rec-table .col-tech-review-score {
  min-width: 5.5rem;
}

.rec-table .col-tech-combined {
  min-width: 10rem;
  max-width: 14rem;
}

.interpretation-clip {
  display: inline-block;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.interpretation-h4 {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.95rem;
}

.interpretation-list {
  margin: 0.25rem 0 0.5rem 1.25rem;
  padding: 0;
}

.interpretation-list li {
  margin-bottom: 0.35rem;
}

.interpretation-zh {
  display: block;
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.ticker-section-divider {
  margin: 1rem 0;
  border: none;
  border-top: 1px solid #e0e0e0;
}

.badge-ext-strong-positive {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #81c784;
}

.badge-ext-positive {
  background: #f1f8e9;
  color: #33691e;
  border: 1px solid #aed581;
}

.badge-ext-mixed {
  background: #fff8e1;
  color: #f57f17;
  border: 1px solid #ffe082;
}

.badge-ext-negative {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffcc80;
}

.badge-ext-strong-negative {
  background: #ffebee;
  color: #b71c1c;
  border: 1px solid #ef9a9a;
}

.badge-ext-none {
  background: #eceff1;
  color: #546e7a;
  border: 1px solid #cfd8dc;
}

.badge-agree-strong {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

.badge-agree-partial {
  background: #e8eaf6;
  color: #3949ab;
  border: 1px solid #9fa8da;
}

.badge-agree-conflict {
  background: #fce4ec;
  color: #c2185b;
  border: 1px solid #f48fb1;
}

.badge-agree-external-only {
  background: #ede7f6;
  color: #512da8;
  border: 1px solid #b39ddb;
}

.badge-agree-mixed {
  background: #f5f5f5;
  color: #616161;
  border: 1px solid #e0e0e0;
}

.rec-table .col-ext-view,
.rec-table .col-ext-score,
.rec-table .col-ext-agreement {
  min-width: 5rem;
  white-space: nowrap;
}

.rec-table .col-ext-reasons {
  min-width: 10rem;
  max-width: 14rem;
}

.page-watchlist .col-ext-view,
.page-watchlist .col-ext-agreement,
.page-watchlist .col-ext-score {
  white-space: nowrap;
}

.enhanced-tech-subtitle {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

/* —— Recommendations: full-width admin table —— */
.page-recommendations .card-page-header {
  margin-bottom: 0.75rem;
}

.page-recommendations .meta-line {
  margin-bottom: 0;
}

.page-recommendations .card-table-full {
  padding: 0;
  overflow: hidden;
  width: 100%;
}

.page-recommendations .table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.page-recommendations .rec-table {
  width: 100%;
  font-size: 0.8125rem;
  table-layout: auto;
}

.page-recommendations .rec-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.page-recommendations .rec-table td {
  vertical-align: middle;
}

.page-recommendations .col-rank,
.page-recommendations .col-score {
  width: 3.5rem;
  text-align: center;
}

.page-recommendations .col-symbol {
  width: 5rem;
  white-space: nowrap;
}

.page-recommendations .col-position,
.page-recommendations .col-action,
.page-recommendations .col-risk {
  white-space: nowrap;
}

.page-recommendations .col-priority {
  white-space: nowrap;
}

.page-recommendations .col-overlay {
  max-width: 10rem;
}

.page-recommendations .col-event,
.page-recommendations .col-news {
  max-width: 11rem;
}

.page-recommendations .col-step {
  min-width: 14rem;
  max-width: 22rem;
}

.page-recommendations .cell-clip {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-recommendations .cell-muted {
  color: var(--muted);
  font-size: 0.78rem;
}

.badge-position {
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.85rem;
  min-width: 1.75rem;
  text-align: center;
  padding: 0.25rem 0.55rem;
}

.badge-flag {
  background: #f5f3ff;
  color: #5b21b6;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: normal;
  line-height: 1.25;
  text-transform: none;
}

@media (max-width: 900px) {
  .page-recommendations .rec-table {
    min-width: 960px;
  }
}

/* —— Recommendations update (3F-1B) —— */
.page-recommendations .update-msg {
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.page-recommendations .update-msg-started {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e40af;
}

.page-recommendations .update-msg-busy {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.page-recommendations .update-msg-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.page-recommendations .update-actions {
  margin-bottom: 0.85rem;
}

.page-recommendations .update-now-form {
  display: inline-block;
  margin: 0;
}

.page-recommendations .btn-update-now {
  font-weight: 600;
}

.page-recommendations .update-now-hint {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}

.page-recommendations .update-status-card {
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-subtle, #f8fafc);
}

.page-recommendations .update-status-card h3 {
  margin-top: 0;
}

.page-recommendations .update-status-message,
.page-recommendations .update-log-path {
  font-size: 0.84rem;
}

/* —— Data freshness & coverage (recommendations) —— */
.page-recommendations .freshness-card {
  margin-bottom: 1rem;
}

.page-recommendations .freshness-card h2 {
  margin-top: 0;
}

.page-recommendations .freshness-note {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
}

.page-recommendations .freshness-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 900px) {
  .page-recommendations .freshness-layout {
    grid-template-columns: 1fr;
  }
}

.page-recommendations .freshness-subtitle {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.page-recommendations .freshness-dl {
  margin: 0;
  font-size: 0.88rem;
}

.page-recommendations .freshness-grid {
  display: grid;
  grid-template-columns: minmax(9rem, 32%) 1fr;
  gap: 0.35rem 0.75rem;
}

.page-recommendations .freshness-dl dt {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.page-recommendations .freshness-dl dd {
  margin: 0;
}

.page-recommendations .coverage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.5rem;
}

.page-recommendations .coverage-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-subtle, #f8fafc);
}

.page-recommendations .coverage-stat-highlight {
  border-color: #93c5fd;
  background: #eff6ff;
}

.page-recommendations .coverage-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
  line-height: 1.25;
}

.page-recommendations .coverage-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.2;
}

.page-recommendations .freshness-scope-note {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.5;
}

.page-recommendations .freshness-message {
  margin: 0.65rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
}

.badge-freshness {
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge-freshness-fresh {
  background: #dcfce7;
  color: #166534;
}

.badge-freshness-stale {
  background: #ffedd5;
  color: #9a3412;
}

.badge-freshness-missing {
  background: #fee2e2;
  color: #991b1b;
}

/* —— Portfolio: chart dashboard —— */
.page-portfolio .card-page-header {
  margin-bottom: 0.75rem;
}

.chart-dashboard {
  margin-bottom: 1rem;
}

.chart-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.chart-grid-row1 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-grid-row2 {
  grid-template-columns: 2fr 1fr;
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem 0.85rem;
}

.chart-card-wide {
  min-width: 0;
}

.chart-title {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 600;
}

.chart-canvas-wrap {
  position: relative;
  height: 240px;
  width: 100%;
}

.chart-canvas-wrap-bar {
  height: 260px;
}

.page-portfolio .portfolio-numeric-summary {
  margin-bottom: 1rem;
}

.page-portfolio .portfolio-numeric-card h2 {
  margin-top: 0;
}

.page-portfolio .portfolio-valuation-note {
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
}

.page-portfolio .portfolio-valuation-hint {
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
}

.page-portfolio .pnum-card-gap .pnum-value {
  color: #b45309;
}

.page-portfolio .pnum-warn {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.badge-val-local {
  background: #dcfce7;
  color: #166534;
}

.badge-val-manual {
  background: #e0e7ff;
  color: #3730a3;
}

.badge-val-cost {
  background: #ffedd5;
  color: #9a3412;
}

.page-portfolio .portfolio-holdings-table .col-valuation {
  white-space: nowrap;
}

.page-portfolio .pnum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
}

.page-portfolio .pnum-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.page-portfolio .pnum-card-primary {
  background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
  border-color: #bfdbfe;
}

.page-portfolio .pnum-card-score .pnum-value {
  color: #1d4ed8;
}

.page-portfolio .pnum-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
}

.page-portfolio .pnum-value {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
  word-break: break-word;
}

.page-portfolio .pnum-card-primary .pnum-value {
  font-size: 1.45rem;
}

.page-portfolio .pnum-value-text {
  font-size: 1rem;
  font-weight: 700;
}

.page-portfolio .portfolio-pnl-positive {
  color: #15803d;
}

.page-portfolio .portfolio-pnl-negative {
  color: #b91c1c;
}

.page-portfolio .portfolio-pnl-value {
  font-weight: 700;
}

.page-portfolio .portfolio-pnl-pct,
.page-portfolio .portfolio-pnl-sub {
  font-weight: 600;
}

.page-portfolio .portfolio-account-header {
  margin-bottom: 0.5rem;
}

.page-portfolio .portfolio-account-title {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.page-portfolio .portfolio-account-currency-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--border);
  color: var(--muted);
}

.page-portfolio .portfolio-account-card .portfolio-account-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem 1.25rem;
  margin: 0;
}

.page-portfolio .portfolio-account-metric-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.page-portfolio .portfolio-account-metric-value {
  font-size: 1.05rem;
  font-weight: 700;
}

.page-portfolio .portfolio-holdings-panel {
  margin-top: 0.85rem;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.page-portfolio .portfolio-holdings-summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.35rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-portfolio .portfolio-holdings-summary::-webkit-details-marker {
  display: none;
}

.page-portfolio .portfolio-holdings-summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 0.15s ease;
  color: var(--muted);
}

.page-portfolio .portfolio-holdings-panel[open] > .portfolio-holdings-summary::before {
  transform: rotate(90deg);
}

.page-portfolio .portfolio-holdings-risk-hint {
  font-size: 0.75rem;
  font-weight: 600;
  color: #b91c1c;
}

.page-portfolio .portfolio-holdings-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.page-portfolio .portfolio-holding-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.55rem;
  padding: 0.55rem 0.65rem;
  background: var(--card-bg, #fff);
}

.page-portfolio .portfolio-holding-high-risk {
  border-color: #fca5a5;
  background: #fef2f2;
  box-shadow: 0 0 0 1px rgba(185, 28, 28, 0.12);
}

.page-portfolio .portfolio-holding-acknowledged {
  border-color: var(--border);
  background: var(--card-bg, #fff);
  box-shadow: none;
}

.page-portfolio .portfolio-holding-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.85rem;
  font-size: 0.9rem;
}

.page-portfolio .portfolio-holding-symbol {
  font-weight: 700;
  min-width: 5rem;
}

.page-portfolio .portfolio-holding-field-label {
  color: var(--muted);
  font-size: 0.75rem;
  margin-right: 0.15rem;
}

.page-portfolio .portfolio-risk-ack-btn {
  margin-left: auto;
  border: 1px solid #b91c1c;
  background: #fff;
  color: #b91c1c;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
}

.page-portfolio .portfolio-risk-ack-btn:hover {
  background: #fee2e2;
}

.page-portfolio .portfolio-tech-panel {
  margin-top: 0.45rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border);
}

.page-portfolio .portfolio-tech-summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
}

.page-portfolio .portfolio-tech-summary::-webkit-details-marker {
  display: none;
}

.page-portfolio .portfolio-tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.55rem 0.75rem;
  margin-top: 0.55rem;
}

.page-portfolio .portfolio-tech-cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
}

.page-portfolio .portfolio-tech-cell-wide {
  grid-column: 1 / -1;
}

.page-portfolio .portfolio-tech-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.page-portfolio .portfolio-tech-note {
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--text);
}

.page-portfolio .portfolio-holdings-empty {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
}

.page-portfolio .portfolio-action-review {
  margin-bottom: 1rem;
}

.page-portfolio .portfolio-action-card h2 {
  margin-top: 0;
}

.page-portfolio .paction-section {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.page-portfolio .paction-section:first-of-type {
  margin-top: 0.5rem;
  padding-top: 0;
  border-top: none;
}

.page-portfolio .paction-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.page-portfolio .paction-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-portfolio .paction-item {
  padding: 0.65rem 0;
  border-bottom: 1px dashed var(--border);
}

.page-portfolio .paction-item:last-child {
  border-bottom: none;
}

.page-portfolio .paction-reason {
  margin: 0.35rem 0 0.15rem;
  font-size: 0.88rem;
}

.page-portfolio .paction-step {
  margin: 0;
  font-size: 0.8rem;
}

.page-portfolio .portfolio-risk-summary {
  margin-bottom: 1rem;
}

.page-portfolio .portfolio-risk-card h2 {
  margin-top: 0;
}

.page-portfolio .portfolio-risk-note {
  margin-bottom: 0.75rem;
}

.page-portfolio .prisk-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.page-portfolio .prisk-summary-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.page-portfolio .prisk-summary-score .prisk-summary-value {
  font-size: 1.35rem;
  color: #1d4ed8;
}

.page-portfolio .prisk-summary-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
}

.page-portfolio .prisk-summary-value {
  font-size: 0.95rem;
  font-weight: 700;
  word-break: break-word;
}

.page-portfolio .portfolio-review-summary-text {
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.page-portfolio .prisk-meta {
  margin: 0;
  font-size: 0.8rem;
}

.page-portfolio .portfolio-holdings-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.5rem;
}

.page-portfolio .portfolio-holdings-table {
  width: 100%;
  font-size: 0.8125rem;
}

.page-portfolio .portfolio-holdings-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
  font-size: 0.78rem;
  background: var(--card);
}

.page-portfolio .portfolio-holdings-table td {
  vertical-align: middle;
}

.page-portfolio .portfolio-holdings-table .col-symbol {
  white-space: nowrap;
}

.page-portfolio .portfolio-holdings-table .col-earnings,
.page-portfolio .portfolio-holdings-table .col-tech-macd,
.page-portfolio .portfolio-holdings-table .col-tech-vol,
.page-portfolio .portfolio-holdings-table .col-tech-obv,
.page-portfolio .portfolio-holdings-table .col-tech-52w,
.page-portfolio .portfolio-holdings-table .col-tech-view,
.page-portfolio .portfolio-holdings-table .col-tech-review-action,
.page-portfolio .portfolio-holdings-table .col-tech-review-score,
.page-portfolio .portfolio-holdings-table .col-ext-view,
.page-portfolio .portfolio-holdings-table .col-ext-agreement {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .page-portfolio .portfolio-holdings-table {
    min-width: 1600px;
  }
}

.chart-footnote {
  margin: 0;
  font-size: 0.84rem;
  text-align: center;
  padding: 0 0.5rem 0.25rem;
}

@media (max-width: 1100px) {
  .chart-grid-row1,
  .chart-grid-row2 {
    grid-template-columns: 1fr;
  }
}

/* —— Watch List: full-width table —— */
.page-watchlist .card-page-header {
  margin-bottom: 0.75rem;
}

.page-watchlist .card-table-full {
  padding: 0;
  overflow: hidden;
  width: 100%;
}

.page-watchlist .table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.page-watchlist .watchlist-table {
  width: 100%;
  font-size: 0.8125rem;
  table-layout: auto;
}

.page-watchlist .watchlist-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
  font-size: 0.78rem;
}

.page-watchlist .watchlist-table td {
  vertical-align: middle;
}

.page-watchlist .col-symbol {
  white-space: nowrap;
}

.page-watchlist .col-rank,
.page-watchlist .col-score {
  text-align: center;
  white-space: nowrap;
}

.page-watchlist .col-status,
.page-watchlist .col-position,
.page-watchlist .col-action,
.page-watchlist .col-risk,
.page-watchlist .col-priority,
.page-watchlist .col-earnings,
.page-watchlist .col-tech-macd,
.page-watchlist .col-tech-vol,
.page-watchlist .col-tech-obv,
.page-watchlist .col-tech-bb,
.page-watchlist .col-tech-52w,
.page-watchlist .col-tech-view,
.page-watchlist .col-tech-review-action,
.page-watchlist .col-tech-review-score {
  white-space: nowrap;
}

.page-watchlist .col-source {
  max-width: 9rem;
}

.page-watchlist .col-notes {
  min-width: 12rem;
  max-width: 18rem;
}

.page-watchlist .col-step {
  min-width: 14rem;
  max-width: 22rem;
}

.page-watchlist .col-date {
  white-space: nowrap;
}

.page-watchlist .cell-clip {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-status-risk {
  background: #fce7f3;
  color: #9d174d;
}

.badge-status-event {
  background: #fef3c7;
  color: #92400e;
}

.page-watchlist .col-actions {
  min-width: 16rem;
  vertical-align: top;
}

.wl-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 14rem;
}

.wl-action-form {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.wl-inline-form {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.35rem 0.5rem;
}

.wl-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.wl-input,
.wl-textarea {
  width: 100%;
  font-size: 0.78rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
}

.wl-textarea {
  resize: vertical;
  min-height: 2.5rem;
}

.btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  margin: 0.15rem 0 0;
}

.btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
  filter: none;
}

.watchlist-msg {
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.watchlist-msg-success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.watchlist-msg-error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

@media (max-width: 900px) {
  .page-watchlist .watchlist-table {
    min-width: 2200px;
  }
}

/* —— Transactions ledger —— */
.page-transactions .card-page-header {
  margin-bottom: 0.75rem;
}

.tx-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tx-summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tx-summary-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tx-summary-value {
  font-size: 1.15rem;
  font-weight: 700;
}

.tx-summary-list {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
}

.page-transactions .card-table-full {
  padding: 0;
  overflow: hidden;
  width: 100%;
}

.page-transactions .table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.page-transactions .tx-table {
  width: 100%;
  font-size: 0.8125rem;
}

.page-transactions .tx-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
  font-size: 0.78rem;
}

.page-transactions .col-num {
  text-align: right;
  white-space: nowrap;
}

.page-transactions .cell-clip {
  display: block;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-side-buy {
  background: #dcfce7;
  color: #166534;
}

.badge-side-sell {
  background: #fee2e2;
  color: #991b1b;
}

.tx-msg {
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.tx-msg-success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.tx-msg-error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.tx-add-card {
  margin-bottom: 1rem;
}

.tx-add-card h2 {
  margin-top: 0;
}

.tx-add-hint {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
}

.tx-add-form {
  margin-top: 0.5rem;
}

.tx-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.tx-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tx-field-wide {
  grid-column: 1 / -1;
}

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

.tx-field input,
.tx-field select,
.tx-field textarea {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: inherit;
}

.tx-field textarea {
  resize: vertical;
  min-height: 2.5rem;
}

.page-transactions .col-actions {
  min-width: 4rem;
}

.page-transactions .tx-row-actions td {
  background: #f8fafc;
  border-top: none;
  padding: 0.5rem 0.65rem 0.75rem;
}

.page-transactions .tx-actions-cell {
  vertical-align: top;
}

.tx-row-action-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.tx-row-form {
  flex: 1 1 28rem;
  min-width: 0;
}

.tx-row-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.45rem;
}

.tx-row-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.tx-row-field-wide {
  grid-column: 1 / -1;
}

.tx-row-field input,
.tx-row-field select,
.tx-row-field textarea {
  width: 100%;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.78rem;
  font-family: inherit;
}

.tx-row-field textarea {
  resize: vertical;
  min-height: 2rem;
}

.tx-row-remove-form {
  flex: 0 0 auto;
  padding-bottom: 0.15rem;
}

.page-transactions .tx-row-display td {
  border-bottom: none;
}

@media (max-width: 900px) {
  .page-transactions .tx-table {
    min-width: 1200px;
  }
}

/* —— Portfolio Compare —— */
.page-portfolio-compare .card-page-header {
  margin-bottom: 0.75rem;
}

.page-portfolio-compare .meta-line {
  margin-bottom: 0;
}

.pcmp-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.pcmp-summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pcmp-summary-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pcmp-summary-value {
  font-size: 1.05rem;
  font-weight: 700;
  word-break: break-word;
}

.pcmp-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.65rem;
}

.pcmp-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.pcmp-status-count {
  font-weight: 700;
  font-size: 1rem;
}

.badge-cmp-match {
  background: #dcfce7;
  color: #166534;
}

.badge-cmp-warn {
  background: #ffedd5;
  color: #9a3412;
}

.badge-cmp-diff {
  background: #fee2e2;
  color: #991b1b;
}

.page-portfolio-compare .card-table-full {
  padding: 0 0 0.5rem;
  overflow: hidden;
}

.page-portfolio-compare .card-table-full h2 {
  padding: 1rem 1.1rem 0.5rem;
  margin: 0;
}

.page-portfolio-compare .table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.page-portfolio-compare .pcmp-table {
  width: 100%;
  font-size: 0.8125rem;
}

.page-portfolio-compare .pcmp-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
  font-size: 0.78rem;
}

.page-portfolio-compare .pcmp-table .col-num {
  text-align: right;
  white-space: nowrap;
}

.pcmp-report-pre {
  margin: 0;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 28rem;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .page-portfolio-compare .pcmp-table {
    min-width: 1100px;
  }
}

/* —— Security settings —— */
.page-settings .card-page-header {
  margin-bottom: 0.75rem;
}

.settings-card h2 {
  margin-top: 0;
}

.settings-form {
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.settings-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.settings-field input[type="password"] {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.settings-hint {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
}

.settings-msg {
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.settings-msg-success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.settings-msg-error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.settings-token-status {
  margin: 0.5rem 0 1rem;
  font-size: 0.92rem;
}

.settings-token-missing {
  color: #b45309;
}

.settings-qt-preview {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.75rem;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* —— Ticker Review —— */
.page-ticker .card-page-header {
  margin-bottom: 0.75rem;
}

.ticker-search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
  margin-top: 1rem;
}

.ticker-search-label {
  font-size: 0.85rem;
  font-weight: 600;
  width: 100%;
}

.ticker-search-form input[type="text"] {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 22rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}

.ticker-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.ticker-card {
  margin-bottom: 1rem;
}

.ticker-dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(9rem, 38%) 1fr;
  gap: 0.35rem 1rem;
}

.ticker-dl dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.ticker-dl dd {
  margin: 0;
}

.ticker-dl-grid {
  grid-template-columns: minmax(10rem, 32%) 1fr;
}

.ticker-multiline {
  white-space: pre-wrap;
  line-height: 1.45;
}

.ticker-meta {
  margin-top: 0;
  margin-bottom: 0.65rem;
}

.ticker-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.btn-disabled,
.btn:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.85;
  filter: none;
}

.btn-disabled:hover,
.btn:disabled:hover {
  filter: none;
  text-decoration: none;
}

.ticker-disabled-hint {
  font-size: 0.88rem;
}

.badge-yes {
  background: #dcfce7;
  color: #166534;
}

.badge-no {
  background: #f3f4f6;
  color: #6b7280;
}

.ticker-msg {
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.ticker-msg-success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.ticker-msg-warn {
  background: #fff8e6;
  border: 1px solid #f0d78c;
  color: #7a5b00;
}

.ticker-msg-error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.ticker-action-note {
  margin: 0 0 0.65rem;
}

.ticker-add-form {
  display: inline;
}

/* —— Trade recommendations: P1-5-R card-first review UI —— */
.page-trade-recommendations .trade-summary-card {
  margin-bottom: 1rem;
}

.page-trade-recommendations .trade-summary-card h2 {
  margin-bottom: 0.75rem;
}

.page-trade-recommendations .trade-summary-grid,
.page-trade-recommendations .trade-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.page-trade-recommendations .trade-summary-grid > div,
.page-trade-recommendations .trade-detail-grid > section,
.page-trade-recommendations .trade-detail-grid > div {
  min-width: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.page-trade-recommendations .trade-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.page-trade-recommendations .trade-review-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  border-color: #cfd8e3;
}

.page-trade-recommendations .trade-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.9rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.page-trade-recommendations .trade-card-title,
.page-trade-recommendations .trade-card-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  line-height: 1.25;
}

.page-trade-recommendations .trade-card-subtitle,
.page-trade-recommendations .trade-card-header .muted {
  margin: 0;
  line-height: 1.4;
}

.page-trade-recommendations .trade-card-badges,
.page-trade-recommendations .trade-card-main-action {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
  min-width: 8rem;
}

.page-trade-recommendations .trade-card-money,
.page-trade-recommendations .trade-card-tax,
.page-trade-recommendations .trade-card-sell-review {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.page-trade-recommendations .trade-card-money h3,
.page-trade-recommendations .trade-card-tax h3,
.page-trade-recommendations .trade-card-sell-review h3,
.page-trade-recommendations .trade-review-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.page-trade-recommendations .trade-card-money p,
.page-trade-recommendations .trade-card-tax p,
.page-trade-recommendations .trade-card-sell-review p,
.page-trade-recommendations .trade-review-card p {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.page-trade-recommendations .trade-card-disabled-buy .trade-card-money {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: var(--muted);
}

.page-trade-recommendations .trade-card-disabled-buy .trade-card-money strong {
  color: #6b7280;
}

.page-trade-recommendations .buy-disabled-reason,
.page-trade-recommendations .trade-card-disabled-buy .trade-card-money .muted {
  margin-bottom: 0;
  font-size: 0.86rem;
}

.page-trade-recommendations .trade-card-tax-caution {
  background: #fff8e6;
  border-color: #f0d78c;
  color: #7a5b00;
}

.page-trade-recommendations .trade-card-sell-review.warn {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.page-trade-recommendations .manual-review-notice,
.page-trade-recommendations .trade-review-card .guidance-notice {
  margin-bottom: 0;
}

.page-trade-recommendations details {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.page-trade-recommendations summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
}

.page-trade-recommendations details[open] summary {
  margin-bottom: 0.75rem;
}

.page-trade-recommendations .trade-detail-grid h4 {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
}

.page-trade-recommendations .trade-detail-grid dl {
  display: grid;
  grid-template-columns: minmax(8rem, 48%) 1fr;
  gap: 0.25rem 0.65rem;
  margin: 0;
  font-size: 0.82rem;
}

.page-trade-recommendations .trade-detail-grid dt {
  color: var(--muted);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.page-trade-recommendations .trade-detail-grid dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .page-trade-recommendations .trade-card-grid {
    grid-template-columns: 1fr;
  }

  .page-trade-recommendations .trade-card-header {
    flex-direction: column;
  }

  .page-trade-recommendations .trade-card-main-action,
  .page-trade-recommendations .trade-card-badges {
    justify-content: flex-start;
  }

  .page-trade-recommendations .trade-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* —— Full universe scan: P1-7-7 shadow display —— */
.page-full-universe-scan .card-page-header {
  margin-bottom: 0.75rem;
}

.page-full-universe-scan .page-subtitle {
  margin: -0.4rem 0 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.page-full-universe-scan .meta-line {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.page-full-universe-scan .section-title-row,
.page-full-universe-scan .table-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.page-full-universe-scan .section-title-row h2,
.page-full-universe-scan .table-section-header h2 {
  margin-bottom: 0.25rem;
}

.page-full-universe-scan .summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.page-full-universe-scan .summary-stat {
  min-width: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.page-full-universe-scan .summary-stat-highlight {
  border-color: #93c5fd;
  background: #eff6ff;
}

.page-full-universe-scan .summary-label {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.page-full-universe-scan .freshness-message {
  margin: 0.75rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.page-full-universe-scan .count-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.page-full-universe-scan .count-grid h3 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.page-full-universe-scan .count-badge {
  margin: 0 0.3rem 0.35rem 0;
  text-transform: none;
}

.page-full-universe-scan .card-table-full {
  padding: 0;
  overflow: hidden;
}

.page-full-universe-scan .table-section-header {
  padding: 1rem 1.1rem 0;
}

.page-full-universe-scan .table-section-header p {
  margin: 0;
}

.page-full-universe-scan .table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.page-full-universe-scan .full-scan-table {
  min-width: 1180px;
  font-size: 0.8rem;
}

.page-full-universe-scan .full-scan-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}

.page-full-universe-scan .full-scan-table td {
  vertical-align: middle;
}

.page-full-universe-scan .stale-warning {
  margin-top: 0.15rem;
  color: #9a3412;
  font-size: 0.76rem;
  line-height: 1.25;
}

.page-full-universe-scan .boundary-card {
  background: #fff8e6;
  border-color: #f0d78c;
}

@media (max-width: 720px) {
  .page-full-universe-scan .section-title-row,
  .page-full-universe-scan .table-section-header {
    flex-direction: column;
  }

  .page-full-universe-scan .summary-grid,
  .page-full-universe-scan .count-grid {
    grid-template-columns: 1fr;
  }
}

/* —— Final review candidates: P1-7-9 shadow display —— */
.page-final-review-candidates .card-page-header {
  margin-bottom: 0.75rem;
}

.page-final-review-candidates .page-subtitle {
  margin: -0.4rem 0 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.page-final-review-candidates .meta-line {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.page-final-review-candidates .summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.page-final-review-candidates .summary-stat {
  min-width: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.page-final-review-candidates .summary-stat-highlight {
  border-color: #93c5fd;
  background: #eff6ff;
}

.page-final-review-candidates .summary-label {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.page-final-review-candidates .freshness-message {
  margin: 0.75rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.page-final-review-candidates .candidate-grid {
  display: grid;
  gap: 0.8rem;
}

.page-final-review-candidates .candidate-card {
  overflow: hidden;
}

.page-final-review-candidates .candidate-card-warning {
  border-color: #f0d78c;
  background: #fffdf5;
}

.page-final-review-candidates .candidate-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.page-final-review-candidates .candidate-header h2 {
  margin-bottom: 0.25rem;
}

.page-final-review-candidates .candidate-subline {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.page-final-review-candidates .candidate-action-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.page-final-review-candidates .candidate-snapshot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem 0.8rem;
  margin-top: 0.9rem;
}

.page-final-review-candidates .candidate-field {
  min-width: 0;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.page-final-review-candidates .candidate-label {
  display: block;
  margin-bottom: 0.18rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.page-final-review-candidates .candidate-note,
.page-final-review-candidates .candidate-blocked,
.page-final-review-candidates .candidate-flags {
  margin: 0.7rem 0 0;
}

.page-final-review-candidates .candidate-note-warning,
.page-final-review-candidates .candidate-blocked {
  color: #9a3412;
}

.page-final-review-candidates .candidate-details {
  margin-top: 0.85rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.page-final-review-candidates summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
}

.page-final-review-candidates .candidate-details[open] summary {
  margin-bottom: 0.75rem;
}

.page-final-review-candidates .candidate-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.8rem;
}

.page-final-review-candidates .candidate-details-grid section {
  min-width: 0;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.page-final-review-candidates .candidate-details-grid h3 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
}

.page-final-review-candidates .candidate-details-grid p {
  margin: 0;
  overflow-wrap: anywhere;
}

.page-final-review-candidates .candidate-context-dl {
  display: grid;
  grid-template-columns: minmax(10rem, 48%) 1fr;
  gap: 0.25rem 0.65rem;
  margin: 0;
  font-size: 0.82rem;
}

.page-final-review-candidates .candidate-context-dl dt {
  color: var(--muted);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.page-final-review-candidates .candidate-context-dl dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.page-final-review-candidates .boundary-card {
  background: #fff8e6;
  border-color: #f0d78c;
}

.page-final-review-candidates .ai-review-section-proceed {
  border: 2px solid #22c55e;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 28%);
}

.page-final-review-candidates .ai-review-meta {
  margin: 0 0 0.85rem;
}

.page-final-review-candidates .ai-proceed-grid {
  display: grid;
  gap: 0.85rem;
}

.page-final-review-candidates .ai-proceed-card {
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  background: #fff;
}

.page-final-review-candidates .ai-proceed-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.page-final-review-candidates .ai-proceed-header h3 {
  margin: 0;
  font-size: 1.15rem;
}

.page-final-review-candidates .ai-proceed-reason {
  margin: 0.35rem 0 0;
  color: #14532d;
  line-height: 1.45;
}

.page-final-review-candidates .ai-proceed-price-row,
.page-final-review-candidates .ai-proceed-position-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
  margin: 0.5rem 0;
  font-size: 0.92rem;
}

.page-final-review-candidates .rr-warning {
  color: #a16207;
  background: #fef9c3;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.page-final-review-candidates .ai-proceed-details {
  margin-top: 0.55rem;
}

.page-final-review-candidates .ai-proceed-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.page-final-review-candidates .ai-proceed-detail-body {
  margin-top: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.page-final-review-candidates .ai-proceed-footer {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.page-final-review-candidates .badge-ai-proceed {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.page-final-review-candidates .tech-pool-section > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.page-final-review-candidates .tech-pool-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.55rem;
  background: #fafafa;
}

.page-final-review-candidates .tech-pool-row > summary {
  cursor: pointer;
  font-weight: 600;
}

.page-final-review-candidates .tech-pool-summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}

.page-final-review-candidates .tech-pool-full-card {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}

.page-final-review-candidates .ai-rebuild-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.page-final-review-candidates .ai-rebuild-hint {
  font-size: 0.82rem;
  max-width: 28rem;
}

@media (max-width: 720px) {
  .page-final-review-candidates .candidate-header {
    flex-direction: column;
  }

  .page-final-review-candidates .candidate-action-wrap {
    justify-content: flex-start;
  }

  .page-final-review-candidates .candidate-details-grid,
  .page-final-review-candidates .candidate-snapshot,
  .page-final-review-candidates .summary-grid {
    grid-template-columns: 1fr;
  }

  .page-final-review-candidates .candidate-context-dl {
    grid-template-columns: 1fr;
  }
}

/* P1-8-3c AI review sections on final review page */
.page-final-review-candidates .ai-review-section-proceed {
  border: 2px solid #22c55e;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 28%);
}
.page-final-review-candidates .ai-review-meta { margin: 0 0 0.85rem; }
.page-final-review-candidates .ai-proceed-grid { display: grid; gap: 0.85rem; }
.page-final-review-candidates .ai-proceed-card {
  border: 1px solid #86efac; border-radius: 10px; padding: 0.9rem 1rem; background: #fff;
}
.page-final-review-candidates .ai-proceed-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.65rem;
}
.page-final-review-candidates .ai-proceed-header h3 { margin: 0; font-size: 1.15rem; }
.page-final-review-candidates .ai-proceed-reason {
  margin: 0.35rem 0 0; color: #14532d; line-height: 1.45;
}
.page-final-review-candidates .ai-proceed-price-row,
.page-final-review-candidates .ai-proceed-position-row {
  display: flex; flex-wrap: wrap; gap: 0.65rem 1.1rem; margin: 0.5rem 0; font-size: 0.92rem;
}
.page-final-review-candidates .rr-warning {
  color: #a16207; background: #fef9c3; padding: 0.1rem 0.35rem; border-radius: 4px;
}
.page-final-review-candidates .ai-proceed-details { margin-top: 0.55rem; }
.page-final-review-candidates .ai-proceed-details summary {
  cursor: pointer; font-weight: 600; color: var(--muted);
}
.page-final-review-candidates .ai-proceed-detail-body {
  margin-top: 0.5rem; padding: 0.65rem 0.75rem; border-radius: 8px;
  background: #f8fafc; border: 1px solid var(--border);
}
.page-final-review-candidates .ai-proceed-footer {
  margin: 0.65rem 0 0; font-size: 0.78rem; color: var(--muted); font-weight: 600;
}
.page-final-review-candidates .badge-ai-proceed {
  background: #dcfce7; color: #166534; border: 1px solid #86efac;
}
.page-final-review-candidates .badge-sector-gate-strong {
  background: #dcfce7; color: #166534; border: 1px solid #86efac;
}
.page-final-review-candidates .badge-sector-gate-neutral {
  background: #fef9c3; color: #854d0e; border: 1px solid #fde047;
}
.page-final-review-candidates .badge-sector-gate-weak {
  background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5;
}
.page-final-review-candidates .tech-pool-section > summary {
  cursor: pointer; font-weight: 700; font-size: 1.05rem; margin-bottom: 0.5rem;
}
.page-final-review-candidates .tech-pool-row {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0.55rem 0.75rem; margin-bottom: 0.55rem; background: #fafafa;
}
.page-final-review-candidates .tech-pool-row > summary { cursor: pointer; font-weight: 600; }
.page-final-review-candidates .tech-pool-summary-line {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center;
}
.page-final-review-candidates .tech-pool-full-card {
  margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px dashed var(--border);
}
.page-final-review-candidates .ai-rebuild-section {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem;
}
.page-final-review-candidates .ai-rebuild-hint { font-size: 0.82rem; max-width: 28rem; }

.page-final-review-candidates .ai-proceed-badges {
  display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end;
}
.page-final-review-candidates .badge-ai-rank {
  background: #16a34a; color: #fff; border: 1px solid #15803d; font-weight: 700;
}
.page-final-review-candidates .badge-ai-backup {
  background: #e5e7eb; color: #374151; border: 1px solid #9ca3af;
}
.page-final-review-candidates .ai-rank-reason {
  margin: 0.35rem 0 0; color: #166534; font-size: 0.9rem; line-height: 1.4;
}
.page-final-review-candidates .ai-review-section-backup {
  border: 1px solid #9ca3af; background: #f9fafb;
}
.page-final-review-candidates .ai-proceed-card-backup {
  border-color: #d1d5db; background: #f3f4f6;
}
.page-final-review-candidates .tech-pool-section-other > summary {
  cursor: pointer; font-weight: 700;
}

.page-final-review-candidates .symbol-sector-label {
  font-size: 0.82em;
  font-weight: 600;
  color: var(--muted);
  margin-left: 0.15rem;
  white-space: nowrap;
}
.page-final-review-candidates h3 .symbol-sector-label {
  vertical-align: middle;
}

/* Embedded AI chat widget */
.sac-root {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1200;
  font-size: 0.92rem;
}

.sac-toggle {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  border: none;
  background: #2563eb;
  color: #fff;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sac-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.55);
}

.sac-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.65rem);
  width: min(22rem, calc(100vw - 2rem));
  max-height: min(28rem, calc(100vh - 6rem));
  display: none;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.sac-panel.sac-open {
  display: flex;
}

.sac-header {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
  background: #f8fafc;
}

.sac-title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
}

.sac-subtitle {
  display: block;
  font-size: 0.72rem;
  margin-top: 0.15rem;
}

.sac-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 10rem;
  max-height: 18rem;
  background: #fafafa;
}

.sac-msg {
  display: flex;
  max-width: 92%;
}

.sac-msg-user {
  align-self: flex-end;
  justify-content: flex-end;
}

.sac-msg-assistant {
  align-self: flex-start;
}

.sac-bubble {
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.sac-msg-user .sac-bubble {
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 3px;
}

.sac-msg-assistant .sac-bubble {
  background: #e5e7eb;
  color: #1f2937;
  border-bottom-left-radius: 3px;
}

.sac-msg-loading .sac-bubble {
  color: #6b7280;
  font-style: italic;
}

.sac-form {
  display: flex;
  gap: 0.45rem;
  padding: 0.55rem;
  border-top: 1px solid var(--border, #e5e7eb);
  background: #fff;
}

.sac-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  min-height: 2.4rem;
}

.sac-input:focus {
  outline: 2px solid #93c5fd;
  border-color: #60a5fa;
}

.sac-send {
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  padding: 0 0.85rem;
  cursor: pointer;
}

.sac-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .sac-root {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .sac-panel {
    width: calc(100vw - 1.5rem);
  }
}
