:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --ink: #172126;
  --muted: #68757d;
  --line: #d8e0e5;
  --panel: #ffffff;
  --green: #16834a;
  --yellow: #a66f00;
  --red: #be3340;
  --blue: #175ddc;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--blue); text-decoration: none; }
main { width: min(1500px, calc(100% - 32px)); margin: 24px auto 64px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 18px;
  padding: 14px 22px;
  background: #102027;
  color: white;
  position: sticky;
  top: 0;
  z-index: 1001;
}
.brand { flex: 0 0 auto; display: flex; align-items: center; color: white; font-weight: 900; font-size: 21px; line-height: 1.05; letter-spacing: 0; }
nav { display: flex; gap: 16px; align-items: center; }
nav a { color: white; }
.main-nav { flex: 1; min-width: 0; display: grid; gap: 0; align-content: center; }
.nav-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; min-width: 0; padding: 5px 0; }
.nav-row a {
  flex: 0 0 auto;
  min-height: 33px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 7px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.95);
  line-height: 1.08;
  font-size: 13.5px;
  font-weight: 800;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.nav-row a:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.36); color: white; }
.nav-row-secondary {
  border-top: 1px solid rgba(255,255,255,.11);
  margin-top: 6px;
  padding-top: 8px;
}
.nav-row-secondary a {
  min-height: 26px;
  background: transparent;
  border-color: rgba(255,255,255,.1);
  color: rgba(255,255,255,.62);
  font-size: 12px;
  font-weight: 700;
  border-radius: 5px;
  letter-spacing: .01em;
}
.nav-row-secondary a:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: rgba(255,255,255,.95); }
nav form { margin: 0; }
button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 650;
}
.primary { background: var(--blue); border-color: var(--blue); color: white; }
.danger { color: var(--red); }
input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
}
@media (max-width: 1180px) {
  .topbar { align-items: flex-start; }
  .main-nav { overflow-x: visible; padding-bottom: 2px; }
  .nav-row { justify-content: flex-start; }
}
/* ── Hamburger button (nascosto su desktop) ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: transform .22s ease, opacity .22s ease;
  transform-origin: center;
}
.nav-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile menu tendina ── */
.mobile-menu {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 1002;
  background: #102027;
  transform: translateY(-120%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  max-height: calc(85vh - 64px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 3px solid #b30c42;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
}
.mobile-menu.is-open {
  transform: translateY(0);
}
.mobile-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: rgba(0,0,0,.45);
  opacity: 0;
  transition: opacity .28s ease;
  pointer-events: none;
}
.mobile-menu-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.mobile-menu-section {
  padding: 12px 0 8px;
}
.mobile-menu-section-alt {
  border-top: 1px solid rgba(255,255,255,.1);
}
.mobile-menu-label {
  margin: 0 0 6px;
  padding: 0 18px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.38);
}
.mobile-menu a {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  color: rgba(255,255,255,.88);
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.06);
  transition: background .15s, color .15s;
}
.mobile-menu a:hover,
.mobile-menu a:active {
  background: rgba(255,255,255,.08);
  color: white;
}

/* ── Breakpoint mobile: mostra hamburger, nascondi nav ── */
@media (max-width: 720px) {
  .topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
  }
  .main-nav { display: none; }
  .nav-hamburger { display: flex; }
  .mobile-menu { display: block; }
  .mobile-menu-backdrop { display: block; }
}
.actions, .title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.inline-form { display: flex; gap: 8px; }
h1, h2, h3 { margin: 0 0 12px; }
section { margin-bottom: 28px; }
.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.reason { min-width: 260px; }
.dashboard-stock-row {
  cursor: pointer;
}
.dashboard-stock-row:hover {
  background: #f9fbfc;
}
.row-main-link {
  color: var(--ink);
  font-weight: 700;
}
.position-dialog {
  width: min(540px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  border: 1px solid var(--line);
  border-top: 6px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 22px;
  box-shadow: 0 24px 70px rgba(16, 32, 39, .34);
}
.position-dialog::backdrop { background: rgba(16, 32, 39, .64); }
.position-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}
.position-dialog-head { padding-right: 48px; margin-bottom: 16px; }
.position-dialog-head > span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.position-dialog-head h2 { font-size: 26px; margin: 5px 0; }
.position-dialog-head small { color: var(--muted); }
.position-loading { padding: 22px 0; color: var(--muted); }
.position-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.position-metrics article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
  padding: 12px;
}
.position-metrics span,
.position-result > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.position-metrics strong { display: block; font-size: 20px; }
.position-metrics .position-metric-wide { grid-column: 1 / -1; }
.position-result {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--muted);
  border-radius: 8px;
  padding: 14px;
  background: #f9fbfc;
}
.position-result.positive { border-left-color: var(--green); background: #edf9f2; }
.position-result.negative { border-left-color: var(--red); background: #fff1f2; }
.position-result strong { display: block; font-size: 30px; line-height: 1.1; }
.position-result.positive strong { color: var(--green); }
.position-result.negative strong { color: var(--red); }
.position-result small { display: block; color: var(--muted); margin-top: 5px; }
.position-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.position-form p { grid-column: 1 / -1; margin: 0; color: var(--muted); }
.position-form label { color: var(--muted); font-size: 12px; font-weight: 800; }
.position-form input { width: 100%; margin-top: 5px; }
.position-purchase-preview {
  grid-column: 1 / -1;
  display: block;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #f2f7ff;
  padding: 10px 12px;
  color: var(--ink);
  font-weight: 800;
}
.position-form button { align-self: end; min-height: 42px; }
.position-form > small { align-self: center; }
.position-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.position-dialog-actions .button-link { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; }
.portfolio-live-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px 16px;
  align-items: start;
}
.portfolio-native-totals,
.portfolio-metals-total,
.portfolio-crypto-total,
.portfolio-eur-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: 4px 12px;
}
.portfolio-metals-total,
.portfolio-crypto-total,
.portfolio-eur-total {
  border-left: 1px solid var(--line);
}
.portfolio-live-summary span,
.portfolio-live-summary small { color: var(--muted); }
.portfolio-live-summary > div > span {
  display: block;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  text-align: center;
}
.portfolio-live-summary strong {
  display: block;
  font-size: 22px;
  margin: 2px 0;
  text-align: center;
}
.portfolio-live-summary > div > small {
  text-align: center;
}
.portfolio-live-summary strong > span { color: var(--ink); }
.portfolio-live-summary .portfolio-currency-separator { color: var(--muted); font-size: 22px; }
.portfolio-history-trigger {
  cursor: pointer;
  border-radius: 8px;
  transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.portfolio-history-trigger:hover {
  background: #f2f6ff;
  box-shadow: inset 0 0 0 1px rgba(23,93,220,.18);
  transform: translateY(-1px);
}
.portfolio-history-trigger:focus {
  outline: 3px solid rgba(23,93,220,.22);
  outline-offset: 2px;
}
.portfolio-history-dialog {
  width: min(980px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}
.portfolio-history-dialog::backdrop {
  background: rgba(16,32,39,.55);
}
.portfolio-history-chart-wrap {
  height: min(52vh, 420px);
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #f8fafb;
}
.portfolio-history-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.portfolio-history-stats article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafb;
}
.portfolio-history-stats span {
  display: block;
  color: var(--muted);
  font-weight: 850;
  text-transform: uppercase;
  font-size: .72rem;
  margin-bottom: 5px;
}
.portfolio-history-stats strong {
  display: block;
  font-size: 1.15rem;
}

/* AI Investment Journal */
.journal-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.journal-hero,
.journal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
}
.journal-hero {
  border-left: 6px solid var(--blue);
}
.journal-hero span,
.journal-card h2 + small {
  color: var(--muted);
  font-weight: 850;
  text-transform: uppercase;
  font-size: .74rem;
}
.journal-hero h1 {
  font-size: clamp(2rem, 4vw, 3.8rem);
  margin: 8px 0;
}
.journal-hero p {
  color: var(--muted);
  margin: 0;
}
.journal-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
}
.journal-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-weight: 850;
  text-transform: uppercase;
  font-size: .72rem;
}
.journal-form input,
.journal-form select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
}
.journal-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
}
.journal-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.journal-stats-grid article,
.journal-detail-grid article,
.journal-accuracy article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px;
}
.journal-stats-grid span,
.journal-detail-grid span,
.journal-accuracy span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.journal-stats-grid strong,
.journal-detail-grid strong,
.journal-accuracy strong {
  font-size: 1.25rem;
}
.journal-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.journal-table {
  min-width: 1180px;
}
.journal-row {
  cursor: pointer;
}
.journal-row:hover td {
  background: #f8fafb;
}
.journal-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 900;
  font-size: .74rem;
}
.journal-pill.buy {
  background: #e7f7ef;
  color: #155e3d;
}
.journal-pill.sell {
  background: #fff1f2;
  color: #9f2e39;
}
.journal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.journal-mini {
  width: 100%;
  min-height: 0;
  height: auto;
  justify-content: space-between;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 11px 12px;
  text-align: left;
}
.journal-mini span {
  color: var(--muted);
}
.journal-accuracy {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.journal-dialog {
  width: min(900px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}
.journal-dialog::backdrop {
  background: rgba(16,32,39,.55);
}
.journal-kicker {
  color: var(--blue);
  font-weight: 900;
  text-transform: uppercase;
  font-size: .76rem;
}
.journal-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

/* AI Portfolio Optimizer */
.optimizer-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.optimizer-hero,
.optimizer-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
}
.optimizer-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: 18px;
  align-items: end;
  border-left: 6px solid var(--blue);
}
.optimizer-hero span {
  color: var(--muted);
  font-weight: 850;
  text-transform: uppercase;
  font-size: .74rem;
}
.optimizer-hero h1 {
  font-size: clamp(2rem, 4vw, 3.7rem);
  margin: 8px 0;
}
.optimizer-hero p {
  color: var(--muted);
  margin: 0;
}
.optimizer-form {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: end;
}
.optimizer-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-weight: 850;
  text-transform: uppercase;
  font-size: .72rem;
}
.optimizer-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.optimizer-kpis article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 15px;
}
.optimizer-kpis span {
  display: block;
  color: var(--muted);
  font-weight: 850;
  text-transform: uppercase;
  font-size: .72rem;
}
.optimizer-kpis strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
}
.optimizer-table {
  min-width: 1180px;
}
.optimizer-risk,
.optimizer-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}
.optimizer-risk.basso,
.optimizer-action.buy {
  background: #e7f7ef;
  color: #155e3d;
}
.optimizer-risk.medio,
.optimizer-action.wait {
  background: #fffbeb;
  color: #7a5000;
}
.optimizer-risk.alto,
.optimizer-action.avoid,
.optimizer-action.reduce {
  background: #fff1f2;
  color: #9f2e39;
}
.optimizer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.optimizer-sector-row {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  background: #f8fafb;
}
.optimizer-sector-row strong,
.optimizer-sector-row span {
  position: relative;
  z-index: 1;
  display: block;
}
.optimizer-sector-row span {
  color: var(--muted);
  margin-top: 4px;
}
.optimizer-sector-row i {
  position: absolute;
  inset: auto auto 0 0;
  height: 5px;
  background: var(--blue);
}
.optimizer-warning {
  border-left: 4px solid var(--yellow);
  background: #fffbeb;
  color: #7a5000;
  padding: 10px 12px;
  border-radius: 7px;
  margin-bottom: 8px;
}

.capital-rules-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 16px 56px;
  color: #eef7fb;
}
.capital-rules-hero,
.capital-rules-card,
.capital-rules-status,
.capital-rules-kpis article {
  background: #0f1b22;
  border: 1px solid rgba(129, 170, 181, .24);
  border-radius: 12px;
}
.capital-rules-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
  gap: 24px;
  align-items: end;
  padding: 28px;
  margin-bottom: 18px;
}
.capital-rules-hero .eyebrow {
  display: block;
  margin-bottom: 10px;
  color: #4bd7f2;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .78rem;
}
.capital-rules-hero h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(2.1rem, 5vw, 4.7rem);
  line-height: .98;
}
.capital-rules-hero p {
  max-width: 760px;
  margin: 16px 0 0;
  color: rgba(230, 244, 248, .72);
  font-size: 1.02rem;
  line-height: 1.55;
}
.capital-rules-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}
.capital-rules-form label {
  display: grid;
  gap: 8px;
  color: rgba(230, 244, 248, .62);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}
.capital-rules-form input {
  min-height: 52px;
  border-radius: 8px;
  border: 1px solid rgba(129, 170, 181, .28);
  background: #0a151b;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 0 14px;
}
.capital-rules-form button {
  min-height: 52px;
  border-radius: 8px;
  padding: 0 22px;
}
.capital-rules-status {
  margin-bottom: 16px;
  padding: 12px 16px;
  color: rgba(230, 244, 248, .72);
  font-weight: 800;
  border-left: 5px solid #4bd7f2;
}
.capital-rules-status.aggressivo { border-left-color: #37d67a; }
.capital-rules-status.moderato { border-left-color: #4bd7f2; }
.capital-rules-status.prudente { border-left-color: #f1c75b; }
.capital-rules-status.difensivo,
.capital-rules-status.error { border-left-color: #ff6b7c; }
.capital-rules-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.capital-rules-kpis article {
  padding: 18px;
  min-height: 112px;
}
.capital-rules-kpis span,
.capital-rules-card h2 {
  color: rgba(230, 244, 248, .62);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 900;
  font-size: .78rem;
}
.capital-rules-kpis strong {
  display: block;
  margin-top: 10px;
  color: #fff;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
}
.capital-rules-card {
  padding: 22px;
  margin-bottom: 18px;
}
.capital-rules-card h2 {
  margin: 0 0 16px;
  color: rgba(230, 244, 248, .76);
  font-size: .86rem;
}
.capital-rules-summary-card p {
  margin: 0;
  color: #fff;
  font-size: 1.1rem;
  line-height: 1.65;
}
.capital-rules-tranches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.capital-rules-tranches article {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  padding: 16px;
  border-radius: 10px;
  background: rgba(75, 215, 242, .07);
  border: 1px solid rgba(75, 215, 242, .16);
}
.capital-rules-tranches article > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(75, 215, 242, .16);
  color: #4bd7f2;
  font-weight: 900;
}
.capital-rules-tranches h3 {
  margin: 0 0 6px;
  color: #fff;
  font-size: 1rem;
}
.capital-rules-tranches strong {
  color: #4bd7f2;
  font-size: 1.1rem;
}
.capital-rules-tranches p,
.capital-rule p,
.capital-rule small,
.capital-rule li,
.capital-rules-disclaimer {
  color: rgba(230, 244, 248, .68);
  line-height: 1.5;
}
.capital-rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.capital-rule {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(129, 170, 181, .18);
  background: rgba(255, 255, 255, .025);
}
.capital-rule + .capital-rule {
  margin-top: 12px;
}
.capital-rule.ok { border-left: 4px solid #37d67a; }
.capital-rule.check { border-left: 4px solid #f1c75b; }
.capital-rule.block { border-left: 4px solid #ff6b7c; }
.capital-rule-head {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: flex-start;
}
.capital-rule-head b {
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: rgba(230,244,248,.72);
  font-size: .68rem;
  text-transform: uppercase;
}
.capital-rule.ok .capital-rule-head b { background: rgba(55,214,122,.14); color: #76f0a6; }
.capital-rule.block .capital-rule-head b { background: rgba(255,107,124,.16); color: #ff8f9d; }
.capital-rule-head strong {
  color: #fff;
  font-size: .96rem;
}
.capital-rule ul {
  margin: 10px 0 0;
  padding-left: 18px;
}
.capital-rules-eligible {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.capital-rules-eligible span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(55,214,122,.12);
  border: 1px solid rgba(55,214,122,.32);
  color: #93f5b8;
  font-weight: 900;
}
.capital-rules-eligible small {
  color: rgba(255,255,255,.7);
}
.capital-rules-disclaimer {
  margin: 8px 0 0;
  text-align: center;
  font-size: .82rem;
}
@media (max-width: 900px) {
  .capital-rules-hero,
  .capital-rules-grid,
  .capital-rules-tranches {
    grid-template-columns: 1fr;
  }
  .capital-rules-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .capital-rules-page {
    padding: 18px 10px 42px;
  }
  .capital-rules-hero,
  .capital-rules-card {
    padding: 18px;
  }
  .capital-rules-form,
  .capital-rules-kpis {
    grid-template-columns: 1fr;
  }
  .capital-rule-head {
    flex-direction: column;
  }
}
@media (max-width: 520px) {
  .position-dialog { padding: 16px; }
  .position-dialog-head h2 { font-size: 22px; }
  .position-form { grid-template-columns: 1fr; }
  .position-form p { grid-column: auto; }
  .position-purchase-preview { grid-column: auto; }
  .portfolio-live-summary strong { font-size: 18px; }
  .portfolio-live-summary { grid-template-columns: 1fr; gap: 12px; }
  .portfolio-metals-total { border-left: 0; border-top: 1px solid var(--line); padding: 12px 0 0; text-align: left; }
  .portfolio-eur-total {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 12px 0 0;
    text-align: left;
  }
  .portfolio-history-stats { grid-template-columns: 1fr; }
  .portfolio-history-chart-wrap { min-height: 240px; }
  .journal-form,
  .journal-stats-grid,
  .journal-grid,
  .journal-accuracy,
  .journal-detail-grid {
    grid-template-columns: 1fr;
  }
  .optimizer-hero,
  .optimizer-form,
  .optimizer-kpis,
  .optimizer-grid {
    grid-template-columns: 1fr;
  }
  .position-metrics .position-metric-wide { grid-column: 1 / -1; }
}

@media print {
  .topbar,
  .optimizer-form,
  #alert-toast-stack,
  #push-banner {
    display: none !important;
  }
  main {
    width: 100%;
    margin: 0;
  }
  .optimizer-card,
  .optimizer-hero,
  .optimizer-kpis article {
    break-inside: avoid;
  }
}
.light {
  display: inline-flex;
  min-width: 76px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  color: white;
  font-size: 12px;
  font-weight: 800;
}
.verde { background: var(--green); }
.giallo { background: var(--yellow); }
.rosso { background: var(--red); }
.pos { color: var(--green); }
.neg { color: var(--red); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.item, .metric, .news, .card, .score-panel, .grid > article, .grid > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.item { margin-bottom: 10px; }
small { display: block; color: var(--muted); margin-top: 6px; }
.score-panel {
  display: flex;
  gap: 22px;
  align-items: center;
  color: white;
}
.big-score { font-size: 46px; font-weight: 900; min-width: 180px; }
.metric span { display: block; color: var(--muted); }
.metric strong { font-size: 28px; }
.chart {
  height: 240px;
  display: flex;
  align-items: end;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
}
.bar { flex: 1; min-width: 8px; background: var(--blue); border-radius: 3px 3px 0 0; }
.facts { line-height: 1.9; }
.news { margin-bottom: 12px; }
.news.positive { border-left: 5px solid var(--green); }
.news.neutral { border-left: 5px solid var(--yellow); }
.news.negative { border-left: 5px solid var(--red); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card.compact { min-height: 130px; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: #102027; }
.login-box {
  width: min(420px, calc(100% - 32px));
  background: white;
  border-radius: 8px;
  padding: 28px;
  display: grid;
  gap: 16px;
}
.login-box label { display: grid; gap: 6px; font-weight: 700; }
.login-box button:disabled { opacity: .75; cursor: wait; }
.login-feedback {
  margin: -4px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  text-align: center;
}
.login-feedback.ok { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }
.error { color: var(--red); font-weight: 700; }
@media (max-width: 850px) {
  main { width: min(100% - 20px, 1500px); margin-top: 16px; }
  .topbar, .actions, .title-row { align-items: flex-start; flex-direction: column; }
  .grid, .four { grid-template-columns: 1fr; }
  .score-panel { align-items: flex-start; flex-direction: column; }
}

/* News Radar Investitori */
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.radar-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 16px; }
.radar-head h1 { font-size: 34px; }
.radar-intro { max-width: 760px; color: #41515a; line-height: 1.55; margin: 8px 0 0; }
.radar-update { min-width: 260px; display: grid; justify-items: end; gap: 6px; text-align: right; }
.radar-update button { min-height: 44px; padding: 0 20px; text-transform: uppercase; }
.radar-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 0 12px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.radar-tabs a { flex: 0 0 auto; color: #33454f; font-weight: 750; padding: 9px 11px; border-bottom: 3px solid transparent; }
.radar-tabs a:hover, .radar-tabs a.active { color: var(--blue); border-color: var(--blue); }
.quick-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.quick-filters a { color: #33454f; border: 1px solid var(--line); background: white; border-radius: 999px; padding: 7px 11px; font-weight: 800; }
.quick-filters a:hover, .quick-filters a.active { color: white; background: var(--blue); border-color: var(--blue); }
.radar-status { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 8px; color: white; margin-bottom: 18px; }
.radar-status.verde { background: #17693f; }.radar-status.giallo { background: #946411; }.radar-status.rosso { background: #9f2e39; }
.radar-status .radar-light { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 7px rgba(255,255,255,.15); }
.radar-status span { display: block; color: rgba(255,255,255,.78); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.radar-status strong { font-size: 25px; }.radar-status p { margin: 2px 0 0; }
.radar-metrics { display: grid; grid-template-columns: repeat(7, minmax(130px,1fr)); gap: 10px; }
.radar-metrics article { min-width: 0; padding: 14px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.radar-metrics span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; min-height: 28px; }
.radar-metrics strong { display: block; font-size: 27px; line-height: 1.1; }.radar-metrics .metric-text { font-size: 17px; overflow-wrap: anywhere; }
.radar-metrics .metric-red { border-top: 4px solid var(--red); }.radar-metrics .metric-yellow { border-top: 4px solid var(--yellow); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; }.legend { color: var(--muted); font-size: 12px; }.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 4px 0 10px; }
.radar-top-news { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px,1fr)); gap: 12px; }
.radar-news-card { display: flex; flex-direction: column; min-height: 300px; background: white; border: 1px solid var(--line); border-top: 5px solid var(--green); border-radius: 8px; padding: 15px; }
.radar-news-card.giallo { border-top-color: var(--yellow); }.radar-news-card.rosso { border-top-color: var(--red); }
.radar-news-card h3 { font-size: 17px; line-height: 1.28; }.radar-news-card h3 a { color: var(--ink); }.radar-news-card > p:not(.eyebrow) { color: #41515a; line-height: 1.45; }
.radar-news-card details { margin-top: auto; padding-top: 10px; }.radar-news-card summary, .news-copy summary { color: var(--blue); cursor: pointer; font-weight: 750; }
.news-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }.news-meta > strong { font-size: 20px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 10px; }.badge-row span, .category-tag { display: inline-flex; padding: 4px 7px; border-radius: 4px; background: #edf2f5; color: #41515a; font-size: 11px; font-weight: 750; }
.attention { display: block; width: fit-content; margin: 4px 0; padding: 4px 7px; border-radius: 4px; background: #fff3cd; color: #7a5200; font-size: 11px; font-weight: 800; }.red-attention { background: #fde1e4; color: #982531; }
.jeremy-radar-card { display: grid; grid-template-columns: minmax(0,1fr) 270px; gap: 18px; align-items: stretch; border: 1px solid var(--line); border-left: 6px solid var(--green); border-radius: 8px; background: white; padding: 18px; }
.jeremy-radar-card.giallo { border-left-color: var(--yellow); }
.jeremy-radar-card.rosso { border-left-color: var(--red); }
.jeremy-radar-card h2 { font-size: 25px; }
.jeremy-radar-card aside { display: grid; gap: 7px; align-content: start; border-left: 1px solid var(--line); padding-left: 18px; }
.jeremy-radar-card aside p { margin: 0 0 6px; color: var(--muted); overflow-wrap: anywhere; }
.button-link { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; padding: 0 12px; font-weight: 750; }
.jeremy-profile-note { border: 1px solid var(--line); border-left: 6px solid var(--blue); border-radius: 8px; background: white; padding: 16px; }
/* ── FT Hero ── */
.ft-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 28px 28px 26px 32px;
  background: linear-gradient(135deg, #160810 0%, #290c19 60%, #1c1122 100%);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}
.ft-hero::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: #b30c42;
  border-radius: 0;
}
.ft-hero .eyebrow {
  margin: 0 0 7px;
  color: #e0637a;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.ft-hero h1 { font-size: 34px; color: white; margin: 0 0 8px; }
.ft-hero > div > p { max-width: 760px; color: rgba(255,255,255,.62); line-height: 1.52; margin: 0; }
.ft-hero-actions { min-width: 200px; display: grid; gap: 8px; justify-items: end; text-align: right; }
.ft-hero-actions strong { font-size: 17px; color: white; }
.ft-hero-actions small { color: rgba(255,255,255,.5); }
/* ── FT Control Panel ── */
.ft-control-panel {
  display: grid;
  gap: 0;
  padding: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.ft-control-panel > div { padding: 14px 18px; }
.ft-control-panel > div + div { border-top: 2px solid var(--line); background: #f8fafc; }
.ft-control-panel > div > span {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.ft-pill-row { display: flex; flex-wrap: wrap; gap: 7px; }
.ft-pill-row a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f7f9;
  color: #33454f;
  font-weight: 800;
  font-size: 13px;
  transition: background .15s, border-color .15s, color .15s;
}
.ft-pill-row a.active, .ft-pill-row a:hover { color: white; background: #b30c42; border-color: #b30c42; }
.ft-pill-row b { font-size: 11px; opacity: .75; }
/* ── FT Overview ── */
.ft-overview { display: grid; grid-template-columns: repeat(3,minmax(180px,1fr)); gap: 10px; }
.ft-overview article { padding: 15px 18px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.ft-overview span { display: block; color: var(--muted); font-size: 10.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.ft-overview strong { display: block; font-size: 24px; line-height: 1.12; }
/* ── FT Reading Layout ── */
.ft-reading-layout { display: grid; grid-template-columns: 250px minmax(0,1fr); gap: 18px; align-items: start; }
/* ── FT Side Menu ── */
.ft-side-menu {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.ft-side-menu h2 {
  margin: 0;
  padding: 10px 15px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  background: #f2f5f8;
  border-bottom: 1px solid var(--line);
}
.ft-side-menu h2:not(:first-child) { border-top: 2px solid var(--line); }
.ft-side-menu a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  border-bottom: 1px solid #f0f3f5;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 600;
  transition: background .13s, color .13s;
}
.ft-side-menu a:last-child { border-bottom: none; }
.ft-side-menu a:hover { color: #b30c42; background: #fff5f7; }
.ft-side-menu b { color: #b30c42; font-size: 12px; font-weight: 900; }
.ft-feed { display: grid; gap: 18px; }
.ft-topic-block { scroll-margin-top: 18px; margin: 0; }
.ft-topic-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 10px; }
.ft-topic-heading span { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.ft-topic-heading h2 { margin: 2px 0 0; }
.ft-topic-heading b { color: #b30c42; }
.ft-news-list { display: grid; gap: 10px; }
.ft-news-item { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 15px; background: white; border: 1px solid var(--line); border-left: 5px solid #b30c42; border-radius: 8px; padding: 14px; }
.ft-news-time { display: grid; align-content: start; gap: 5px; color: var(--muted); font-size: 12px; }
.ft-news-time span { color: #b30c42; font-weight: 900; }
.ft-news-body h3 { font-size: 20px; line-height: 1.25; margin-bottom: 8px; }
.ft-news-body h3 a { color: var(--ink); }
.ft-news-body p { color: #41515a; line-height: 1.48; margin: 0 0 9px; }
.ft-news-footer { display: grid; gap: 7px; }
.ft-news-footer details { color: var(--muted); }
.ft-news-footer summary { color: var(--blue); cursor: pointer; font-weight: 800; }
.ft-ticker-badge { display: inline-flex; padding: 4px 7px; border-radius: 4px; background: #eaf1ff; color: var(--blue); font-size: 11px; font-weight: 850; }
.empty-radar { grid-column: 1/-1; border: 1px dashed var(--line); padding: 24px; border-radius: 8px; }
.profile-strip { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 9px; }
.profile-chip { display: flex; flex-direction: column; min-height: 130px; padding: 13px; background: white; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
.profile-chip:hover { border-color: var(--blue); }.profile-chip span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }.profile-chip strong { margin: 8px 0 2px; }.profile-chip small { margin: 0; }.profile-chip b { margin-top: auto; color: var(--blue); font-size: 12px; }
.radar-layout { display: grid; grid-template-columns: minmax(0,1fr) 310px; gap: 18px; align-items: start; }
.radar-sidebar { display: grid; gap: 12px; position: sticky; top: 12px; }.radar-sidebar section { margin: 0; padding: 14px; background: white; border: 1px solid var(--line); border-radius: 8px; }.radar-sidebar h2 { font-size: 17px; }
.side-alert { border-left: 4px solid var(--red); padding: 8px 0 8px 10px; border-bottom: 1px solid var(--line); }.side-alert span { color: var(--red); font-size: 10px; text-transform: uppercase; font-weight: 850; }.side-alert strong { display: block; }.side-alert p { font-size: 12px; margin: 4px 0; }
.rank { display: grid; grid-template-columns: 22px 1fr auto; gap: 7px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }.rank > span { color: var(--muted); }.rank b { color: var(--blue); }
.trend { margin-bottom: 11px; }.trend > div { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }.trend > span { display: block; height: 7px; margin-top: 5px; background: #e7edf1; border-radius: 4px; overflow: hidden; }.trend i { display: block; height: 100%; background: var(--blue); }
.radar-filters { display: grid; grid-template-columns: repeat(4,minmax(145px,1fr)); gap: 9px; padding: 13px; margin-bottom: 12px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.radar-filters label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }.radar-filters input,.radar-filters select { min-width: 0; min-height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); }
.filter-actions { display: flex; align-items: end; gap: 12px; }.filter-actions a { padding: 9px 0; font-weight: 700; }
.radar-table table { min-width: 1050px; }.radar-table td { max-width: 370px; }.importance { display: block; margin-top: 8px; font-size: 17px; }.news-copy p { line-height: 1.42; color: #41515a; }.radar-table form { margin-top: 5px; }.radar-table button { min-height: 30px; padding: 0 8px; font-size: 11px; }
.movement-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 10px; }.movement-grid article { display: grid; gap: 6px; padding: 13px; background: white; border: 1px solid var(--line); border-radius: 8px; }.movement-grid span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.radar-disclaimer { padding: 12px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 12px; }
.back-link { display: inline-block; margin-bottom: 15px; font-weight: 750; }.investor-profile-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 22px; color: white; background: #102027; border-radius: 8px; }.investor-profile-head h2 { color: #b9c7ce; margin: 0; }.influence { text-align: right; }.influence span { display: block; color: #b9c7ce; text-transform: uppercase; font-size: 11px; }.influence strong { font-size: 38px; }
.profile-facts { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }.profile-facts article { padding: 15px; background: white; border: 1px solid var(--line); border-radius: 8px; }.profile-facts span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
@media (max-width: 1100px) { .radar-metrics { grid-template-columns: repeat(4,1fr); }.radar-layout { grid-template-columns: 1fr; }.radar-sidebar { position: static; grid-template-columns: repeat(2,1fr); }.radar-filters { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 700px) {
  .radar-head,.ft-hero { flex-direction: column; }
  .ft-hero { padding: 20px 16px 20px 20px; gap: 16px; align-items: flex-start; }
  .ft-hero h1 { font-size: 26px; margin-bottom: 6px; }
  .ft-hero > div > p { font-size: 14px; }
  .ft-hero-actions { justify-items: start; text-align: left; min-width: 0; width: 100%; flex-direction: row; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .radar-update { justify-items: start; text-align: left; }
  .radar-metrics,.radar-sidebar,.profile-facts,.ft-overview { grid-template-columns: 1fr 1fr; }
  .radar-filters,.jeremy-radar-card,.ft-reading-layout,.ft-news-item { grid-template-columns: 1fr; }
  .ft-side-menu { position: static; border-radius: 8px; }
  .ft-news-item { padding: 12px; gap: 10px; }
  .ft-news-body h3 { font-size: 16px; }
  .ft-control-panel > div { padding: 12px 14px; }
  .ft-overview article { padding: 12px 14px; }
  .jeremy-radar-card aside { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 14px; }
  .investor-profile-head { align-items: flex-start; }
  .radar-head h1 { font-size: 28px; }
}
@media (max-width: 460px) {
  .radar-metrics,.radar-sidebar,.profile-facts { grid-template-columns: 1fr; }
  .ft-overview { grid-template-columns: 1fr; }
  .ft-hero { padding: 16px 14px 16px 18px; }
  .ft-hero h1 { font-size: 22px; }
  .ft-hero .eyebrow { font-size: 10px; }
  .ft-hero > div > p { font-size: 13px; }
  .ft-control-panel > div { padding: 10px 12px; }
  .ft-pill-row a { min-height: 29px; font-size: 12px; padding: 0 10px; }
  .ft-side-menu h2 { padding: 8px 12px; font-size: 9.5px; }
  .ft-side-menu a { padding: 8px 12px; font-size: 12.5px; }
  .ft-topic-heading h2 { font-size: 18px; }
  .ft-news-body h3 { font-size: 15px; }
  main { width: calc(100% - 20px); margin: 14px auto 48px; }
}


.company-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: stretch;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.company-copy > span,
.overview-score > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.company-copy h2 { margin-bottom: 10px; }
.company-copy > p {
  color: #33454f;
  font-size: 16px;
  line-height: 1.58;
  margin: 0 0 16px;
}
.company-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.company-points article {
  background: #f9fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.company-points strong {
  display: block;
  margin-bottom: 6px;
}
.company-points p {
  color: #33454f;
  line-height: 1.45;
  margin: 0;
}
.overview-score {
  border-radius: 8px;
  color: white;
  padding: 18px;
}
.overview-score > span { color: rgba(255, 255, 255, .82); }
.overview-score strong {
  display: block;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 14px;
}
.overview-score h2 { margin-bottom: 8px; }
.overview-score p { margin: 0; line-height: 1.45; }
@media (max-width: 1000px) {
  .company-overview,
  .company-points {
    grid-template-columns: 1fr;
  }
}

.trade-hero {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 18px;
  border-radius: 8px;
  padding: 18px;
  color: white;
  background: #38434a;
}
.trade-hero.verde,
.trade-final.verde { background: #17693f; color: white; }
.trade-hero.giallo,
.trade-final.giallo { background: #9a6a10; color: white; }
.trade-hero.rosso,
.trade-final.rosso { background: #9f2e39; color: white; }
.trade-hero span {
  display: block;
  color: rgba(255,255,255,.82);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.trade-hero strong {
  display: block;
  font-size: 52px;
  line-height: 1;
  margin-bottom: 10px;
}
.trade-hero p,
.trade-final p { margin: 6px 0; line-height: 1.5; }
.trade-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.trade-facts,
.trade-news-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.trade-news-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.trade-facts article,
.trade-news-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbfc;
}
.trade-facts span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.trade-facts strong {
  display: block;
  font-size: 22px;
  overflow-wrap: anywhere;
}
.trade-notes {
  margin: 12px 0 0;
  line-height: 1.7;
}
.trade-final {
  border-radius: 8px;
  padding: 18px;
}
.trade-final .disclaimer {
  color: rgba(255,255,255,.85);
  font-size: 14px;
  margin-top: 14px;
}
.trade-input-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.trade-input-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}
.trade-input-grid input,
.trade-input-grid select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
  font-size: 14px;
  text-transform: none;
}
.trade-form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-weight: 700;
}
.button-link.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
@media (max-width: 900px) {
  .trade-hero,
  .trade-facts,
  .trade-news-grid,
  .trade-input-grid {
    grid-template-columns: 1fr;
  }
  .trade-form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .trade-hero strong { font-size: 42px; }
}

.score-breakdown .metric-button {
  width: 100%;
  min-height: 138px;
  text-align: left;
  display: block;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.score-breakdown .metric-button:hover,
.score-breakdown .metric-button:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 10px 24px rgba(23, 93, 220, .12);
  outline: none;
  transform: translateY(-1px);
}
.metric-button small {
  color: var(--blue);
  font-weight: 700;
}
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(16, 32, 39, .52);
}
.score-modal {
  position: fixed;
  z-index: 50;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(920px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(16, 32, 39, .32);
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.modal-head p {
  margin: 0 0 6px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
}
.modal-head h2 { font-size: 30px; }
.icon-close {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}
.modal-summary {
  color: #36464f;
  font-size: 16px;
  line-height: 1.55;
  margin: 0 0 18px;
}
.explain-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.explain-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.explain-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f9fbfc;
}
.explain-grid span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.explain-grid strong {
  display: block;
  font-size: 22px;
  overflow-wrap: anywhere;
}
.modal-note {
  border-left: 4px solid var(--blue);
  margin: 18px 0 0;
  padding: 10px 12px;
  background: #eef4ff;
  color: #23374a;
  border-radius: 0 6px 6px 0;
}
.modal-news-list {
  display: grid;
  gap: 10px;
}
@media (max-width: 850px) {
  .score-modal {
    padding: 16px;
  }
  .modal-head h2 { font-size: 24px; }
  .explain-grid,
  .explain-grid.compact {
    grid-template-columns: 1fr;
  }
  .score-breakdown .metric-button {
    min-height: 112px;
  }
}

.decision-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 6px;
  border-radius: 8px;
  padding: 18px;
}
.decision-panel span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.decision-panel h2 { margin-bottom: 6px; }
.decision-panel p { margin: 0; color: #33454f; line-height: 1.5; }
.decision-panel > strong {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: #5b6870;
  background: #f9fbfc;
}
.decision-panel.strong { border-left-color: var(--green); }
.decision-panel.watch, .decision-panel.study { border-left-color: var(--blue); }
.decision-panel.monitor { border-left-color: var(--yellow); }
.decision-panel.speculative, .decision-panel.avoid { border-left-color: var(--red); }
.decision-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  border: 1px solid transparent;
}
.decision-pill.strong { color: #0e6a3a; background: #e6f5ec; border-color: #b9e2c9; }
.decision-pill.study { color: #174ea6; background: #ebf2ff; border-color: #c9dcff; }
.decision-pill.monitor { color: #8a5a00; background: #fff5db; border-color: #f1d58e; }
.decision-pill.speculative { color: #9a4f00; background: #fff0df; border-color: #f0c08c; }
.decision-pill.avoid { color: #9e2633; background: #ffeaed; border-color: #efb9c0; }
.decision-pill.pending { color: #5b6870; background: #eef2f4; border-color: #d7e0e5; }
.stale-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  background: #fff5db;
  color: #8a5a00;
  border: 1px solid #f1d58e;
  cursor: help;
  vertical-align: middle;
}
.entry-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.entry-checks article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.entry-checks span {
  display: block;
  color: var(--muted);
  font-weight: 850;
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.entry-checks strong {
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
}
.entry-checks p {
  margin: 0;
  color: #33454f;
  line-height: 1.48;
}
@media (max-width: 850px) {
  .decision-panel {
    align-items: flex-start;
    flex-direction: column;
  }
  .decision-panel > strong {
    white-space: normal;
  }
}

.title-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-weight: 700;
}
.button-link.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
@media (max-width: 850px) {
  .title-actions {
    justify-content: flex-start;
  }
}

/* Detail score card: make it a focused decision panel instead of a flat green block. */
.overview-score,
.overview-score.verde,
.overview-score.giallo,
.overview-score.rosso {
  position: relative;
  overflow: hidden;
  color: #f7fbfc;
  background: #102027;
  border: 1px solid #213945;
  border-left: 8px solid #2fb66d;
  box-shadow: 0 18px 38px rgba(16, 32, 39, .18);
}
.overview-score.giallo { border-left-color: #d99a18; }
.overview-score.rosso { border-left-color: #d64b5b; }
.overview-score::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,0) 42%);
}
.overview-score > * {
  position: relative;
  z-index: 1;
}
.overview-score > span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  color: #d7e6ec;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}
.overview-score strong {
  margin: 16px 0 12px;
  color: #ffffff;
  letter-spacing: 0;
}
.overview-score h2 {
  color: #ffffff;
  font-size: 28px;
  line-height: 1.12;
}
.overview-score p {
  color: #d7e6ec;
  font-size: 15px;
  line-height: 1.52;
}

.title-row .title-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}
.title-row .title-actions form {
  margin: 0;
  flex: 0 0 auto;
}
.title-row .title-actions .button-link,
.title-row .title-actions button {
  width: auto;
  min-width: 148px;
  min-height: 48px;
  padding: 0 16px;
  white-space: nowrap;
  font-size: 16px;
  line-height: 1;
}
@media (max-width: 850px) {
  .title-row .title-actions {
    width: 100%;
    justify-content: flex-start;
    flex-direction: row;
    flex-wrap: nowrap;
  }
  .title-row .title-actions .button-link,
  .title-row .title-actions button {
    min-width: 0;
    flex: 1 1 0;
    padding: 0 10px;
  }
}

/* Final mobile/detail fixes: isolated score card and two-column action buttons. */
.company-overview .radar-score-card,
.company-overview .radar-score-card.verde,
.company-overview .radar-score-card.giallo,
.company-overview .radar-score-card.rosso {
  background: #102027 !important;
  color: #f7fbfc !important;
  border: 1px solid #213945 !important;
  border-left: 8px solid #2fb66d !important;
  box-shadow: 0 18px 38px rgba(16, 32, 39, .18) !important;
}
.company-overview .radar-score-card.giallo { border-left-color: #d99a18 !important; }
.company-overview .radar-score-card.rosso { border-left-color: #d64b5b !important; }
.company-overview .radar-score-card span,
.company-overview .radar-score-card strong,
.company-overview .radar-score-card h2,
.company-overview .radar-score-card p {
  color: #f7fbfc !important;
}
.company-overview .radar-score-card span {
  background: rgba(255,255,255,.10) !important;
  color: #d7e6ec !important;
}
.title-row .title-actions {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  align-items: stretch !important;
  gap: 10px !important;
  width: min(460px, 100%) !important;
  flex: 0 0 auto !important;
}
.title-row .title-actions form {
  display: contents !important;
  margin: 0 !important;
}
.title-row .title-actions .button-link,
.title-row .title-actions button {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 48px !important;
  padding: 0 12px !important;
  white-space: nowrap !important;
  text-align: center !important;
  font-size: clamp(13px, 3.6vw, 16px) !important;
  line-height: 1 !important;
}
@media (max-width: 850px) {
  .title-row {
    gap: 14px !important;
  }
  .title-row .title-actions {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* iPhone optimization */
@media (max-width: 600px) {
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 15px; overflow-x: hidden; }
  main {
    width: min(100% - 14px, 1500px);
    margin: 12px auto 40px;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 12px 14px;
    gap: 10px;
  }
  .brand {
    font-size: 18px;
    line-height: 1.1;
  }
  nav {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  nav a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 8px;
    background: rgba(255,255,255,.06);
    font-weight: 800;
  }
  h1 { font-size: clamp(30px, 9vw, 40px); line-height: 1.05; }
  h2 { font-size: 24px; line-height: 1.12; }
  h3 { font-size: 18px; }
  button,
  .button-link,
  input {
    min-height: 46px;
    border-radius: 8px;
    font-size: 16px;
  }
  .actions,
  .title-row {
    gap: 12px;
    margin-bottom: 18px;
  }
  .inline-form {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
  }
  .inline-form input { width: 100%; min-width: 0; }
  .title-row .title-actions {
    width: 100% !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .title-row .title-actions .button-link,
  .title-row .title-actions button {
    min-height: 48px !important;
    font-size: clamp(13px, 3.8vw, 15px) !important;
    padding: 0 8px !important;
  }
  .table-wrap {
    border-radius: 8px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table { font-size: 13px; min-width: 900px; }
  th, td { padding: 9px 8px; }
  .reason { min-width: 220px; }
  .company-overview {
    grid-template-columns: 1fr;
    padding: 14px;
    gap: 14px;
  }
  .company-copy > p {
    font-size: 15px;
    line-height: 1.5;
  }
  .company-points {
    grid-template-columns: 1fr;
  }
  .overview-score {
    padding: 16px;
  }
  .overview-score strong {
    font-size: 36px;
  }
  .overview-score h2 {
    font-size: 24px;
  }
  .decision-panel {
    padding: 14px;
  }
  .score-breakdown {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }
  .score-breakdown .metric-button {
    min-height: 112px;
    padding: 12px;
  }
  .metric strong { font-size: 24px; }
  .score-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 16px;
  }
  .modal-head h2 { font-size: 24px; }
  .explain-grid,
  .explain-grid.compact,
  .entry-checks,
  .grid,
  .four,
  .cards {
    grid-template-columns: 1fr !important;
  }
  .chart {
    height: 180px;
  }
  .facts { padding-left: 20px; }
  .news { padding: 14px; }
}

/* Full app iPhone optimization pass */
.mobile-stock-list { display: none; }
@media (max-width: 600px) {
  .table-wrap { display: none; }
  .mobile-stock-list {
    display: grid;
    gap: 12px;
  }
  .mobile-stock-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
  }
  .mobile-stock-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    color: var(--ink);
  }
  .mobile-stock-main span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  .mobile-stock-main strong {
    display: block;
    font-size: 28px;
    line-height: 1;
  }
  .mobile-stock-main small {
    color: var(--muted);
    line-height: 1.35;
  }
  .mobile-score {
    display: grid;
    justify-items: end;
    gap: 6px;
  }
  .mobile-score > strong {
    font-size: 28px;
    line-height: 1;
  }
  .mobile-stock-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 12px 0;
  }
  .mobile-stock-metrics > div {
    background: #f9fbfc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
  }
  .mobile-stock-metrics span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  .mobile-stock-metrics strong {
    font-size: 20px;
  }
  .mobile-stock-label {
    margin-bottom: 10px;
  }
  .mobile-stock-card p {
    color: #33454f;
    line-height: 1.45;
    margin: 0 0 12px;
  }
  .mobile-card-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .mobile-card-actions form { display: contents; }
  .mobile-card-actions .button-link,
  .mobile-card-actions button {
    width: 100%;
    min-height: 44px;
  }
  .light {
    min-width: 70px;
    min-height: 28px;
    align-items: center;
  }
  .grid > div,
  .grid > article,
  .item,
  .card,
  .metric,
  .news {
    padding: 14px;
  }
  .item {
    word-break: break-word;
  }
  .cards {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .page-title {
    margin-bottom: 16px;
  }
  .opportunity-card h3 {
    font-size: 21px;
    line-height: 1.18;
  }
  .opportunity-card p {
    line-height: 1.42;
  }
  .decision-pill {
    white-space: normal;
    text-align: center;
  }
  .modal-news-list,
  .explain-grid {
    gap: 10px;
  }
  .score-modal {
    top: auto;
    bottom: 8px;
    transform: translateX(-50%);
    max-height: calc(100vh - 20px);
    border-radius: 8px 8px 0 0;
  }
  .icon-close {
    min-height: 40px;
  }
}
@media (min-width: 601px) {
  .mobile-stock-list { display: none !important; }
}

.sector-button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}
.sector-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
}
.sector-button.active {
  border-color: var(--blue);
  background: #eef4ff;
  color: var(--blue);
}
.sector-button.utility {
  background: #102027;
  border-color: #102027;
  color: white;
}
.sector-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 280px;
}
.sector-actions form { margin: 0; }
.instrument-link {
  color: var(--ink);
  text-decoration: none;
}
.instrument-link:hover {
  color: var(--blue);
  text-decoration: underline;
}
.inline-add-form {
  margin: 0;
}
.inline-add-form button {
  min-height: 34px;
  white-space: nowrap;
}
.opportunity-add-form {
  align-self: end;
  margin: 0;
  padding-top: 18px;
  width: 100%;
}
.opportunity-add-form button {
  width: 100%;
  min-height: 40px;
}
.opportunity-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
}
.opportunity-cards {
  align-items: stretch;
  grid-auto-rows: 1fr;
}
.opportunity-card-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.opportunity-card p {
  flex: 0 0 auto;
}
.sector-comment {
  margin: 9px 0 0;
  color: #33454f;
  line-height: 1.45;
  font-size: 13px;
  max-width: 680px;
}
.sector-comment::before {
  content: "Lettura: ";
  color: var(--ink);
  font-weight: 850;
}
.sector-signal-card .sector-comment {
  color: #d7e6ec;
  font-size: 14px;
}
.sector-signal-card .sector-comment::before {
  color: #ffffff;
}
.sector-signal-card .light-comment {
  border-top: 1px solid rgba(255,255,255,.18);
  margin-top: 14px;
  padding-top: 12px;
}
.sector-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 16px;
}
.sector-signal-card,
.sector-rotation-card,
.sector-chart-panel,
.sector-alert-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.sector-signal-card {
  color: white;
  background: #102027;
  border-left: 8px solid var(--yellow);
}
.sector-signal-card.verde { border-left-color: var(--green); }
.sector-signal-card.giallo { border-left-color: var(--yellow); }
.sector-signal-card.rosso { border-left-color: var(--red); }
.sector-signal-card span,
.sector-rotation-card span,
.sector-alert-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.sector-signal-card span { color: rgba(255,255,255,.72); }
.sector-signal-card strong {
  display: block;
  font-size: 48px;
  line-height: 1;
  margin: 12px 0;
}
.sector-signal-card p,
.sector-rotation-card p {
  margin: 0;
  line-height: 1.5;
}
.rotation-animation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 18px;
}
.rotation-animation div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f9fbfc;
}
.rotation-animation small {
  margin: 0 0 5px;
  text-transform: uppercase;
  font-weight: 850;
}
.rotation-animation strong {
  display: block;
  margin-bottom: 5px;
}
.rotation-animation span {
  margin: 0;
  color: var(--blue);
  font-size: 36px;
}
.rotation-animation em {
  color: var(--muted);
  font-style: normal;
}
.sector-chart-panel {
  min-height: 360px;
}
.sector-chart-panel canvas {
  width: 100% !important;
  height: 260px !important;
}
.sector-svg-chart {
  width: 100%;
  min-height: 260px;
}
.sector-simple-grid {
  display: grid;
  grid-template-columns: minmax(280px, .75fr) minmax(320px, 1.25fr);
  gap: 16px;
  margin-top: 16px;
}
.score-card,
.relative-card {
  background: #f9fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.score-card {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  border-left: 8px solid var(--line);
}
.score-card.tone-verde { border-left-color: var(--green); background: #f3fbf6; }
.score-card.tone-giallo { border-left-color: var(--yellow); background: #fffaf0; }
.score-card.tone-rosso { border-left-color: var(--red); background: #fff4f5; }
.score-card span,
.relative-head strong {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.score-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0 10px;
}
.score-main strong {
  display: block;
  font-size: 76px;
  line-height: 1;
  letter-spacing: 0;
}
.score-main small {
  margin: 0;
  color: #53636c;
  font-size: 26px;
  font-weight: 900;
}
.score-card em {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 13px;
  font-style: normal;
  font-weight: 900;
  margin-bottom: 12px;
}
.score-card.tone-verde em { color: #0e6a3a; background: #dff3e7; }
.score-card.tone-giallo em { color: #8a5a00; background: #fff0c9; }
.score-card.tone-rosso em { color: #9e2633; background: #ffe1e6; }
.score-card p {
  margin: 0;
  color: #33454f;
  line-height: 1.45;
  font-weight: 700;
}
.relative-stack {
  display: grid;
  gap: 12px;
}
.relative-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.relative-head strong { margin: 0; }
.relative-head span {
  font-size: 26px;
  font-weight: 900;
}
.relative-card.positive .relative-head span { color: var(--green); }
.relative-card.negative .relative-head span { color: var(--red); }
.relative-track {
  position: relative;
  height: 22px;
  margin: 10px 0;
  border-radius: 999px;
  background: #eef2f4;
  border: 1px solid var(--line);
  overflow: hidden;
}
.relative-zero {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #102027;
  opacity: .55;
}
.relative-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
}
.relative-card.positive .relative-fill { background: var(--green); }
.relative-card.negative .relative-fill { background: var(--red); }
.relative-card p,
.sector-chart-reading {
  margin: 0;
  color: #33454f;
  line-height: 1.45;
}
.sector-chart-reading {
  margin-top: 14px;
  font-weight: 750;
}
.sector-svg-chart svg {
  display: block;
  width: 100%;
  height: 220px;
  margin-top: 10px;
  background: #f9fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.sector-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.sector-chart-grid > div {
  min-width: 0;
}
.sector-chart-grid h3 {
  font-size: 15px;
  margin: 0 0 6px;
  color: #33454f;
}
.sector-svg-chart .axis {
  stroke: #c9d4da;
  stroke-width: 2;
}
.sector-svg-chart .guide {
  stroke: #dfe7eb;
  stroke-width: 1;
  stroke-dasharray: 5 6;
}
.sector-svg-chart .guide.strong {
  stroke: rgba(16, 32, 39, .28);
  stroke-width: 1.5;
}
.sector-svg-chart .zero {
  stroke: rgba(16, 32, 39, .38);
  stroke-width: 2;
  stroke-dasharray: 7 6;
}
.sector-svg-chart .band.green { fill: rgba(22, 131, 74, .08); }
.sector-svg-chart .band.yellow { fill: rgba(166, 111, 0, .10); }
.sector-svg-chart .band.red { fill: rgba(190, 51, 64, .08); }
.sector-svg-chart .line {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sector-svg-chart .line.score { stroke: var(--blue); }
.sector-svg-chart .line.spy { stroke: var(--green); }
.sector-svg-chart .line.qqq { stroke: var(--yellow); }
.sector-svg-chart .dot {
  stroke: white;
  stroke-width: 3;
}
.sector-svg-chart .dot.score { fill: var(--blue); }
.sector-svg-chart .dot.spy { fill: var(--green); }
.sector-svg-chart .dot.qqq { fill: var(--yellow); }
.sector-svg-chart .axis-label {
  fill: #53636c;
  font-size: 13px;
  font-weight: 800;
}
.sector-chart-legend,
.sector-chart-caption {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.sector-chart-legend span,
.sector-chart-caption span,
.sector-chart-caption strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #33454f;
  font-size: 13px;
}
.sector-chart-legend i {
  width: 22px;
  height: 4px;
  border-radius: 999px;
  display: inline-block;
}
.sector-chart-legend i.score { background: var(--blue); }
.sector-chart-legend i.spy { background: var(--green); }
.sector-chart-legend i.qqq { background: var(--yellow); }
.sector-chart-caption {
  justify-content: space-between;
  margin-top: 8px;
}
@media (max-width: 900px) {
  .sector-chart-grid,
  .sector-simple-grid {
    grid-template-columns: 1fr;
  }
  .sector-chart-panel {
    min-height: 560px;
  }
}
.sector-alert-card {
  border-left: 6px solid var(--yellow);
  margin-bottom: 10px;
}
.sector-alert-card.verde { border-left-color: var(--green); }
.sector-alert-card.giallo { border-left-color: var(--yellow); }
.sector-alert-card.rosso { border-left-color: var(--red); }
.sector-alert-card h3 { margin-bottom: 8px; }
.sector-alert-card p { margin: 0; line-height: 1.45; }
@media (max-width: 950px) {
  .sector-detail-grid,
  .rotation-animation {
    grid-template-columns: 1fr;
  }
  .rotation-animation span {
    transform: rotate(90deg);
    justify-self: center;
  }
  .sector-actions {
    min-width: 0;
  }
}

.page-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.opportunity-scan-actions,
.opportunity-detail-actions,
.opportunity-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.opportunity-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 22px;
}
.opportunity-filters label {
  color: #52636e;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}
.opportunity-filters input,
.opportunity-filters select {
  width: 100%;
  margin-top: 6px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
}
.checkbox-label input {
  width: auto;
  margin: 0;
}
.advanced-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.advanced-opportunity {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.opportunity-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.opportunity-score {
  min-width: 74px;
  border-radius: 8px;
  padding: 10px 9px;
  text-align: center;
  background: #eef2f5;
  border: 1px solid #d8e0e5;
}
.opportunity-score span {
  display: block;
  color: #172129;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}
.opportunity-score small {
  color: #63727d;
  font-weight: 800;
}
.opportunity-score.green { background: #e7f5ed; border-color: #9ccfb4; }
.opportunity-score.yellow { background: #fff4d8; border-color: #e2bb62; }
.opportunity-score.red { background: #fdeaea; border-color: #d99a9a; }
.opportunity-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.opportunity-metrics span {
  border: 1px solid #dbe3e8;
  border-radius: 8px;
  padding: 9px;
  color: #667580;
  font-size: 13px;
  font-weight: 800;
}
.opportunity-metrics strong {
  display: block;
  color: #172129;
  font-size: 16px;
  margin-top: 4px;
  text-transform: none;
}
.risk-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 3px 9px;
  background: #eef2f5;
}
.risk-pill.basso { background: #e7f5ed; color: #24704c; }
.risk-pill.medio { background: #edf4ff; color: #1f5eb8; }
.risk-pill.alto { background: #fff4d8; color: #8a5b00; }
.risk-pill.speculativo { background: #fdeaea; color: #a9333d; }
.opportunity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.opportunity-tags span {
  border-radius: 999px;
  background: #eef2f5;
  color: #42525d;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}
.opportunity-card-actions {
  justify-content: flex-start;
  margin-top: auto;
}
.opportunity-card-actions form,
.opportunity-detail-actions form {
  margin: 0;
}
.ghost.danger {
  color: #b8424b;
  border-color: #e5c8cc;
  background: #fff;
}
.opportunity-alert-strip {
  margin-bottom: 24px;
}
.opportunity-alert {
  border-left: 6px solid #d8e0e5;
}
.opportunity-alert.high { border-left-color: #2f7d52; }
.opportunity-alert.medium { border-left-color: #d19a20; }
.opportunity-alert.low { border-left-color: #65727c; }
.opportunity-two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.movement-card {
  margin-bottom: 10px;
  border-left: 6px solid #d8e0e5;
}
.movement-card.positive { border-left-color: #2f7d52; }
.movement-card.negative { border-left-color: #b8424b; }
.subsection-title {
  margin: 18px 0 10px;
}
.legacy-opportunities {
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid #dbe3e8;
}
.opportunity-detail-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  border-left: 8px solid #d8e0e5;
}
.opportunity-detail-hero.green { border-left-color: #2f7d52; }
.opportunity-detail-hero.yellow { border-left-color: #d19a20; }
.opportunity-detail-hero.red { border-left-color: #b8424b; }
.opportunity-detail-hero span {
  color: #60707a;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}
.opportunity-detail-hero strong {
  display: block;
  margin: 4px 0;
  font-size: 34px;
  line-height: 1;
}
.opportunity-analysis-card {
  margin-top: 18px;
}
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.analysis-grid h3 {
  margin-bottom: 6px;
}
.disclaimer {
  color: #667580;
  font-size: 13px;
  line-height: 1.5;
}
@media (max-width: 900px) {
  .page-heading-row,
  .opportunity-two-columns,
  .opportunity-detail-hero,
  .analysis-grid {
    grid-template-columns: 1fr;
    display: grid;
  }
  .opportunity-filters {
    grid-template-columns: 1fr 1fr;
  }
  .opportunity-scan-actions,
  .opportunity-detail-actions {
    justify-content: flex-start;
  }
}
@media (max-width: 640px) {
  .opportunity-filters,
  .opportunity-metrics {
    grid-template-columns: 1fr;
  }
  .advanced-grid {
    grid-template-columns: 1fr;
  }
  .opportunity-card-top {
    flex-direction: column;
  }
  .opportunity-score {
    width: 100%;
  }
  .opportunity-card-actions a,
  .opportunity-card-actions button,
  .opportunity-scan-actions button,
  .opportunity-detail-actions a,
  .opportunity-detail-actions button {
    width: 100%;
    justify-content: center;
  }
  .opportunity-card-actions form,
  .opportunity-detail-actions form {
    width: 100%;
  }
}

/* ITI Trend Score */
body.iti-theme {
  color-scheme: dark;
  background: #091217;
  color: #f4f8fa;
}
body.iti-theme main {
  width: min(1500px, calc(100% - 32px));
}
.iti-page {
  --iti-panel: #111c22;
  --iti-panel-2: #16242b;
  --iti-line: #2b3c45;
  --iti-muted: #9babb4;
  --iti-cyan: #35c4e5;
  color: #f4f8fa;
}
.iti-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 32px;
  align-items: end;
  margin-bottom: 24px;
}
.iti-heading h1 {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  margin: 8px 0 12px;
}
.iti-heading p,
.iti-section-title p,
.iti-legend p {
  color: var(--iti-muted);
  line-height: 1.55;
  margin: 0;
}
.iti-eyebrow {
  color: var(--iti-cyan);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}
.iti-form label {
  display: block;
  color: var(--iti-muted);
  font-size: 12px;
  font-weight: 850;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.iti-form > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.iti-form input {
  width: 100%;
  min-height: 48px;
  border-color: var(--iti-line);
  background: var(--iti-panel);
  color: white;
  font-size: 16px;
}
.iti-primary,
#iti-refresh {
  min-height: 48px;
  border-color: #1e8eaa;
  background: #1e8eaa;
  color: white;
}
.iti-error {
  border: 1px solid #a73b48;
  border-left: 6px solid #e45966;
  border-radius: 7px;
  background: #35171c;
  color: #ffd7db;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-weight: 750;
}
.iti-error[hidden],
.iti-result[hidden] {
  display: none !important;
}
.iti-result {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--iti-line);
  border-radius: 8px;
  background: var(--iti-panel);
  margin-bottom: 28px;
}
.iti-score-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 210px;
  padding: 24px;
  background: #16313b;
  border-left: 7px solid var(--iti-cyan);
}
.iti-result.very-strong .iti-score-card,
.iti-result.strong .iti-score-card { border-left-color: #45d187; }
.iti-result.irregular .iti-score-card { border-left-color: #efbd3f; }
.iti-result.weak .iti-score-card,
.iti-result.absent .iti-score-card { border-left-color: #ee6571; }
.iti-score-card > span {
  color: var(--iti-cyan);
  font-size: 15px;
  font-weight: 900;
}
.iti-score-card > strong {
  font-size: 64px;
  line-height: 1;
  margin: 10px 0;
}
.iti-score-card > strong small {
  display: inline;
  color: var(--iti-muted);
  font-size: 20px;
}
.iti-score-card em {
  color: #dbe8ed;
  font-style: normal;
  font-weight: 800;
}
.iti-statusline {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}
.iti-statusline span {
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  background: rgba(0,0,0,.16);
  color: #dcebef;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
}
.iti-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--iti-line);
}
.iti-metrics article,
.iti-metric-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 20px;
  background: var(--iti-panel);
}
.iti-metric-card {
  min-height: 104px;
  border: 0;
  border-left: 5px solid transparent;
  border-radius: 0;
  color: white;
  text-align: left;
}
.iti-metric-card.good { border-left-color: #65dda0; background: #10261d; }
.iti-metric-card.fair { border-left-color: #68d0e9; background: #10242b; }
.iti-metric-card.warn { border-left-color: #f3cb63; background: #2b2614; }
.iti-metric-card.bad { border-left-color: #ff8791; background: #2c171c; }
.iti-metric-card:hover,
.iti-metric-card:focus-visible {
  filter: brightness(1.16);
  outline: 2px solid currentColor;
  outline-offset: -3px;
}
.iti-metrics span,
.iti-metric-card span {
  color: var(--iti-muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}
.iti-metrics strong,
.iti-metric-card strong {
  font-size: 30px;
  margin-top: 6px;
}
.iti-list-section,
.iti-legend,
.iti-reading-guide {
  border: 1px solid var(--iti-line);
  border-radius: 8px;
  background: var(--iti-panel);
  padding: 20px;
}
.iti-reading-guide h2 { margin-bottom: 16px; }
.iti-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.iti-guide-grid article {
  border: 1px solid var(--iti-line);
  border-radius: 7px;
  background: var(--iti-panel-2);
  padding: 16px;
}
.iti-guide-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.iti-guide-title span {
  color: white;
  font-size: 18px;
  font-weight: 850;
}
.iti-guide-title b {
  color: var(--iti-cyan);
  font-size: 11px;
  text-align: right;
  text-transform: uppercase;
}
.iti-guide-grid p {
  min-height: 44px;
  color: var(--iti-muted);
  line-height: 1.4;
}
.iti-guide-grid ul {
  display: grid;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.iti-guide-grid li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-left: 4px solid #768791;
  background: rgba(0,0,0,.14);
  padding: 7px 9px;
}
.iti-guide-grid li.good { border-left-color: #45d187; }
.iti-guide-grid li.fair { border-left-color: #58b9d2; }
.iti-guide-grid li.warn { border-left-color: #efbd3f; }
.iti-guide-grid li.bad { border-left-color: #ee6571; }
.iti-guide-grid article > small {
  color: #e8c86c;
  line-height: 1.35;
  margin-top: 12px;
}
.iti-table th small {
  color: #78909c;
  font-size: 9px;
  line-height: 1.2;
  margin-top: 3px;
  text-transform: none;
}
.iti-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.iti-section-title h2,
.iti-legend h2 { margin-bottom: 5px; }
.iti-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--iti-line);
  border-radius: 7px;
}
.iti-table { min-width: 1340px; }
.iti-table th {
  color: var(--iti-muted);
  background: #0c171c;
  border-color: var(--iti-line);
}
.iti-table td {
  color: #eaf1f4;
  border-color: var(--iti-line);
  vertical-align: middle;
}
.iti-table tbody tr:hover { background: #16252c; }
.iti-loading { color: var(--iti-muted); }
.iti-score-pill,
.iti-judgment {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 10px;
  color: white;
  font-weight: 850;
  white-space: nowrap;
}
.iti-score-pill { min-width: 66px; justify-content: center; }
.iti-score-pill.very-strong,
.iti-judgment.very-strong { background: #117345; }
.iti-score-pill.strong,
.iti-judgment.strong { background: #176b5d; }
.iti-score-pill.irregular,
.iti-judgment.irregular { background: #8b6712; }
.iti-score-pill.weak,
.iti-judgment.weak { background: #984c25; }
.iti-score-pill.absent,
.iti-judgment.absent { background: #8f303c; }
.iti-positive { color: #55d58f !important; font-weight: 800; }
.iti-negative { color: #ff7d88 !important; font-weight: 800; }
.iti-failed td { color: #ff9ca5; }
.iti-metric-value {
  min-width: 82px;
  min-height: 32px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-weight: 850;
}
.iti-metric-value.good { color: #65dda0; background: #123d2a; }
.iti-metric-value.fair { color: #68d0e9; background: #123a45; }
.iti-metric-value.warn { color: #f3cb63; background: #443814; }
.iti-metric-value.bad { color: #ff8791; background: #461f26; }
.iti-maturity-value {
  min-height: 28px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
}
.iti-maturity-value.good { color: #65dda0; }
.iti-maturity-value.fair { color: #68d0e9; }
.iti-maturity-value.warn { color: #f3cb63; }
.iti-maturity-value.bad { color: #ff8791; }
.iti-state-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.iti-metric-value:hover,
.iti-metric-value:focus-visible,
.iti-maturity-value:hover,
.iti-maturity-value:focus-visible {
  filter: brightness(1.18);
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.iti-metric-dialog {
  width: min(480px, calc(100% - 28px));
  border: 1px solid var(--iti-line);
  border-top: 7px solid #68d0e9;
  border-radius: 8px;
  background: #111c22;
  color: white;
  padding: 24px;
}
.iti-metric-dialog::backdrop { background: rgba(0, 8, 12, .76); }
.iti-metric-dialog.good { border-top-color: #65dda0; }
.iti-metric-dialog.fair { border-top-color: #68d0e9; }
.iti-metric-dialog.warn { border-top-color: #f3cb63; }
.iti-metric-dialog.bad { border-top-color: #ff8791; }
.iti-dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  min-height: 36px;
  border-color: #344750;
  background: #18262d;
  color: white;
  font-size: 24px;
  line-height: 1;
  padding: 0;
}
.iti-dialog-ticker {
  color: var(--iti-cyan);
  font-size: 13px;
  font-weight: 900;
}
.iti-metric-dialog h3 { margin: 8px 44px 6px 0; }
.iti-metric-dialog > strong {
  display: block;
  font-size: 42px;
  margin: 12px 0;
}
.iti-metric-dialog p {
  color: #c8d5db;
  line-height: 1.55;
  margin: 0;
}
.iti-final-report {
  border: 1px solid var(--iti-line);
  border-radius: 8px;
  background: var(--iti-panel);
  padding: 20px;
}
.iti-final-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}
.iti-final-heading span {
  color: var(--iti-cyan);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.iti-final-heading h2 { margin: 5px 0 0; }
.iti-final-heading small { color: var(--iti-muted); text-align: right; }
.iti-final-loading {
  border: 1px solid var(--iti-line);
  border-left: 6px solid var(--iti-cyan);
  border-radius: 7px;
  background: #0d181d;
  color: #c9d8de;
  padding: 16px;
  font-weight: 750;
}
.iti-final-loading[hidden],
.iti-final-content[hidden] { display: none !important; }
.iti-final-content {
  overflow: hidden;
  border: 1px solid var(--iti-line);
  border-top: 7px solid #f3cb63;
  border-radius: 8px;
  background: #0d181d;
}
.iti-final-content.verde { border-top-color: #65dda0; }
.iti-final-content.giallo { border-top-color: #f3cb63; }
.iti-final-content.rosso { border-top-color: #ff8791; }
.iti-final-verdict {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
  gap: 1px;
  background: var(--iti-line);
}
.iti-final-verdict > div { background: #132128; padding: 20px; }
.iti-final-verdict span,
.iti-final-scores span,
.iti-final-plan span {
  display: block;
  color: var(--iti-muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}
.iti-final-verdict > div:first-child strong {
  display: block;
  font-size: 44px;
  margin-top: 8px;
}
.iti-final-verdict h3 { margin-bottom: 7px; }
.iti-final-verdict b { color: #f5cc64; }
.iti-final-content.verde .iti-final-verdict b { color: #65dda0; }
.iti-final-content.rosso .iti-final-verdict b { color: #ff8791; }
.iti-final-verdict p { color: #bdcbd1; line-height: 1.5; margin: 10px 0 0; }
.iti-final-guidance {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--iti-line);
  background: var(--iti-line);
}
.iti-final-guidance article {
  border-left: 6px solid #68d0e9;
  background: #101c22;
  padding: 15px 17px;
}
.iti-final-guidance article.inside { border-left-color: #f3cb63; }
.iti-final-guidance span {
  color: #68d0e9;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.iti-final-guidance article.inside span { color: #f3cb63; }
.iti-final-guidance p { color: #e3ebee; line-height: 1.48; margin: 6px 0 0; font-weight: 700; }
.iti-final-scores {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--iti-line);
  border-top: 1px solid var(--iti-line);
}
.iti-final-scores article { background: #101c22; padding: 16px; }
.iti-final-scores strong { display: block; font-size: 25px; margin-top: 6px; }
.iti-final-scores small { display: inline; color: var(--iti-muted); font-size: 12px; }
.iti-final-context {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border-top: 1px solid var(--iti-line);
  background: #101c22;
  padding: 12px 16px;
}
.iti-final-context span {
  border: 1px solid var(--iti-line);
  border-radius: 999px;
  color: var(--iti-muted);
  font-size: 11px;
  padding: 6px 9px;
}
.iti-final-context b { color: #e8f0f3; margin-left: 4px; }
.iti-final-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}
.iti-final-columns article {
  border: 1px solid var(--iti-line);
  border-left: 6px solid #65dda0;
  border-radius: 7px;
  background: #101c22;
  padding: 16px;
}
.iti-final-columns article.iti-final-risks { border-left-color: #ff8791; }
.iti-final-columns ul { display: grid; gap: 8px; margin: 10px 0 0; padding-left: 20px; }
.iti-final-columns li { color: #c7d4d9; line-height: 1.4; }
.iti-final-plan { border-top: 1px solid var(--iti-line); padding: 16px; }
.iti-final-plan > div {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.iti-final-plan article { border: 1px solid var(--iti-line); border-radius: 6px; background: #132128; padding: 11px; }
.iti-final-plan strong { display: block; font-size: 18px; margin-top: 5px; overflow-wrap: anywhere; }
.iti-final-disclaimer { border-top: 1px solid var(--iti-line); color: var(--iti-muted); margin: 0; padding: 12px 16px; font-size: 12px; }
.iti-final-error { color: #ff9da6; padding: 18px; font-weight: 800; }
.iti-legend > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.iti-legend > div span {
  border: 1px solid var(--iti-line);
  border-left: 5px solid var(--iti-cyan);
  border-radius: 6px;
  background: var(--iti-panel-2);
  padding: 9px 11px;
}
.iti-legend span.very-strong,
.iti-legend span.strong { border-left-color: #45d187; }
.iti-legend span.irregular { border-left-color: #efbd3f; }
.iti-legend span.weak,
.iti-legend span.absent { border-left-color: #ee6571; }
.iti-legend b { color: white; margin-right: 5px; }

@media (max-width: 850px) {
  body.iti-theme .topbar nav {
    width: 100%;
    overflow-x: auto;
    flex-direction: row;
    padding-bottom: 4px;
  }
  body.iti-theme .topbar nav a { white-space: nowrap; }
  .iti-heading,
  .iti-result { grid-template-columns: 1fr; }
  .iti-guide-grid { grid-template-columns: 1fr; }
  .iti-final-verdict,
  .iti-final-columns,
  .iti-final-guidance { grid-template-columns: 1fr; }
  .iti-final-scores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .iti-final-plan > div { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .iti-score-card { min-height: 170px; }
}
@media (max-width: 640px) {
  body.iti-theme main { width: min(100% - 20px, 1500px); }
  .iti-heading h1 { font-size: 38px; }
  .iti-form > div,
  .iti-metrics { grid-template-columns: 1fr; }
  .iti-section-title { align-items: flex-start; flex-direction: column; }
  #iti-refresh { width: 100%; }
  .iti-table { min-width: 0; }
  .iti-table thead { display: none; }
  .iti-table,
  .iti-table tbody,
  .iti-table tr,
  .iti-table td { display: block; width: 100%; }
  .iti-table tr { padding: 12px; border-bottom: 1px solid var(--iti-line); }
  .iti-table td {
    display: grid;
    grid-template-columns: minmax(118px, 42%) minmax(0, 1fr);
    gap: 10px;
    padding: 7px 2px;
    border: 0;
    text-align: right;
  }
  .iti-table td::before {
    content: attr(data-label);
    color: var(--iti-muted);
    font-size: 11px;
    font-weight: 850;
    text-align: left;
    text-transform: uppercase;
  }
  .iti-table td:first-child { font-size: 18px; }
  .iti-table .iti-failed td { display: block; text-align: left; }
  .iti-score-pill,
  .iti-judgment { justify-self: end; white-space: normal; text-align: center; }
  .iti-state-stack { align-items: flex-end; }
  .iti-final-heading { align-items: flex-start; flex-direction: column; }
  .iti-final-heading small { text-align: left; }
  .iti-final-scores,
  .iti-final-plan > div { grid-template-columns: 1fr; }
}

.commodities-heading {
  align-items: center;
}
.commodities-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.commodity-card {
  min-height: 142px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 6px solid #d8e0e5;
}
.commodity-card span {
  color: #60707a;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}
.commodity-card strong {
  font-size: 38px;
  line-height: 1;
}
.commodity-card small {
  color: #60707a;
  font-weight: 800;
}
.commodity-card.ratio {
  border-left-color: #d19a20;
}
.commodity-card.light-card.verde { border-left-color: #2f7d52; background: #eef8f2; }
.commodity-card.light-card.giallo { border-left-color: #d19a20; background: #fff8e6; }
.commodity-card.light-card.rosso { border-left-color: #b8424b; background: #fff0f1; }
.commodities-reading {
  margin-bottom: 18px;
}
.ratio-caption-card {
  margin-bottom: 18px;
}
.ratio-band-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.ratio-band {
  border: 1px solid #dbe3e8;
  border-left: 6px solid #d8e0e5;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.ratio-band strong {
  display: block;
  color: #172129;
  font-size: 22px;
  line-height: 1;
  margin-bottom: 8px;
}
.ratio-band span {
  display: block;
  color: #24343d;
  font-weight: 900;
  margin-bottom: 8px;
}
.ratio-band p {
  margin: 0;
  color: #53636c;
  font-size: 13px;
  line-height: 1.4;
}
.ratio-band.silver-strong { border-left-color: #2f7d52; background: #eef8f2; }
.ratio-band.silver-watch { border-left-color: #74a673; background: #f4fbf6; }
.ratio-band.neutral { border-left-color: #d19a20; background: #fff8e6; }
.ratio-band.gold-watch { border-left-color: #8ba3b0; background: #f4f7f9; }
.ratio-band.gold-strong { border-left-color: #b8424b; background: #fff0f1; }
.ratio-confirmation-box {
  margin-top: 16px;
  border: 1px solid #dbe3e8;
  border-left: 6px solid #355f8c;
  border-radius: 8px;
  padding: 14px;
  background: #f7fbff;
}
.ratio-confirmation-box h3 {
  margin-bottom: 8px;
}
.ratio-confirmation-box p {
  margin: 0 0 12px;
  color: #33454f;
  line-height: 1.45;
}
.confirmation-rules {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.confirmation-rules div {
  background: white;
  border: 1px solid #dbe3e8;
  border-radius: 8px;
  padding: 10px;
}
.confirmation-rules strong {
  display: block;
  margin-bottom: 5px;
  color: #172129;
}
.confirmation-rules span {
  color: #53636c;
  font-size: 13px;
  line-height: 1.35;
}
.commodity-alerts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.commodity-alert {
  border: 1px solid #dbe3e8;
  border-left: 6px solid #d19a20;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 800;
}
.commodity-alert.high { border-left-color: #b8424b; }
.commodity-alert.medium { border-left-color: #d19a20; }
.commodity-alert.low { border-left-color: #60707a; }
.commodity-operational-card {
  margin-bottom: 18px;
}
.metal-trade-card {
  margin-bottom: 18px;
}
.metal-signal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.metal-signal-card {
  border: 1px solid #dbe3e8;
  border-left: 7px solid #d19a20;
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}
.metal-signal-card.verde {
  border-left-color: #2f7d52;
  background: #f2faf5;
}
.metal-signal-card.giallo {
  border-left-color: #d19a20;
  background: #fffaf0;
}
.metal-signal-card.rosso {
  border-left-color: #b8424b;
  background: #fff4f5;
}
.metal-signal-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}
.metal-signal-top span {
  color: #60707a;
  font-weight: 900;
  text-transform: uppercase;
}
.metal-signal-top strong {
  font-size: 26px;
}
.metal-signal-card h3 {
  margin: 0 0 8px;
}
.metal-signal-card p {
  color: #33454f;
  line-height: 1.45;
  margin: 0 0 12px;
}
.metal-signal-card em {
  display: block;
  color: #24343d;
  font-style: normal;
  font-weight: 800;
  line-height: 1.35;
  margin-top: 10px;
}
.metal-signal-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.metal-signal-levels div {
  background: rgba(255,255,255,.72);
  border: 1px solid #dbe3e8;
  border-radius: 8px;
  padding: 9px;
}
.metal-signal-levels small {
  display: block;
  color: #60707a;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}
.metal-signal-levels b {
  display: block;
  color: #172129;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.commodity-suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.commodity-suggestions div {
  border: 1px solid #dbe3e8;
  border-left: 6px solid #355f8c;
  border-radius: 8px;
  padding: 11px 12px;
  background: #f7fbff;
  color: #24343d;
  font-weight: 800;
  line-height: 1.35;
}
.analysis-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}
button.analysis-dot {
  border: 0;
  padding: 0;
  cursor: pointer;
}
button.analysis-dot:hover,
button.analysis-dot:focus-visible {
  box-shadow: 0 0 0 4px rgba(36, 101, 180, 0.18);
  outline: none;
}
.analysis-dot.verde { background: #2f7d52; }
.analysis-dot.giallo { background: #d19a20; }
.analysis-dot.rosso { background: #b8424b; }
.chart-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.segmented button {
  padding: 9px 12px;
}
.segmented button.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
.commodities-chart-wrap {
  width: 100%;
  overflow: hidden;
}
#ratio-chart {
  width: 100%;
  min-height: 280px;
  background: #ffffff;
}
#ratio-chart .ratio-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#ratio-chart .ratio-dot {
  fill: var(--blue);
  stroke: white;
  stroke-width: 3;
}
#ratio-chart .threshold {
  stroke: #aeb9c1;
  stroke-dasharray: 8 8;
  stroke-width: 2;
}
#ratio-chart .date-grid {
  stroke: #edf1f4;
  stroke-width: 1.5;
}
#ratio-chart .threshold-label {
  fill: #60707a;
  font-size: 14px;
  font-weight: 900;
}
#ratio-chart .date-label {
  fill: #60707a;
  font-size: 13px;
  font-weight: 800;
}
.commodities-news-list {
  display: grid;
  gap: 12px;
}
.commodity-news-item {
  border: 1px solid #dbe3e8;
  border-radius: 8px;
  padding: 14px;
}
.commodity-news-item h3 {
  margin-bottom: 8px;
}
.commodity-news-item p {
  margin: 0 0 8px;
  color: #33454f;
  line-height: 1.45;
}
.commodity-news-item small {
  display: block;
  color: #60707a;
  margin-bottom: 8px;
}
@media (max-width: 900px) {
  .commodities-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .ratio-band-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .confirmation-rules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metal-signal-grid,
  .metal-signal-levels {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .commodities-grid {
    grid-template-columns: 1fr;
  }
  .ratio-band-grid {
    grid-template-columns: 1fr;
  }
  .confirmation-rules {
    grid-template-columns: 1fr;
  }
  .metal-signal-grid,
  .metal-signal-levels {
    grid-template-columns: 1fr;
  }
  .commodity-card strong {
    font-size: 34px;
  }
}

/* ---- Metals banner rows ---- */
.portfolio-metals-total strong { display: block; }
.metals-row { display: block; font-size: 18px; font-weight: 700; line-height: 1.4; text-align: center; }
.metals-row small { font-size: 11px; font-weight: 900; text-transform: uppercase; color: var(--muted); display: inline; margin-right: 4px; }

/* ---- Portfolio history modal ---- */
.portfolio-history-dialog { width: min(90vw, 760px); max-height: 90vh; overflow: auto; }
.portfolio-history-dialog canvas { display: block; }
#portfolio-eur-clickable { cursor: pointer; }
#portfolio-eur-clickable:hover strong { text-decoration: underline; text-decoration-color: var(--muted); }

/* ── Indices scrolling ticker ── */
.indices-ticker-wrap {
  overflow: hidden;
  background: #0f0f1a;
  color: #cdd6f4;
  border-radius: 6px;
  padding: 7px 0;
  margin-bottom: 12px;
  position: relative;
}
.indices-ticker-track {
  display: flex;
  width: max-content;
}
.idx-inner {
  display: flex;
  align-items: center;
  gap: 0;
  animation: ticker-scroll 40s linear infinite;
  white-space: nowrap;
}
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
.indices-ticker-wrap:hover .idx-inner { animation-play-state: paused; }
.idx-item {
  padding: 0 22px;
  font-size: 13px;
  letter-spacing: .01em;
}
.idx-item strong {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  color: #6c7086;
  margin-right: 5px;
}
.idx-sep { color: #313244; padding: 0 4px; }
.idx-pos { color: #a6e3a1; }
.idx-neg { color: #f38ba8; }
.indices-ticker-loading { padding: 0 16px; font-size: 13px; color: #6c7086; }

/* ── VIX tooltip ── */
.idx-vix { cursor: pointer; text-decoration: underline dotted #6c7086; }
.vix-tooltip {
  position: absolute;
  z-index: 200;
  background: #1e1e2e;
  color: #cdd6f4;
  border: 1px solid #313244;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.7;
  width: 290px;
  box-shadow: 0 6px 24px rgba(0,0,0,.6);
}
.vix-tooltip strong { color: #cba6f7; display: block; margin-bottom: 8px; font-size: 14px; }
.vix-value { margin-bottom: 2px; }
.vix-stato { font-weight: 700; margin-bottom: 6px; }
.vix-desc { color: #bac2de; margin-bottom: 10px; }
.vix-hr { border: none; border-top: 1px solid #313244; margin: 8px 0; }
.vix-scale { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; font-weight: 700; }
.vix-low { color: #a6e3a1; }
.vix-mid { color: #f9e2af; }
.vix-high { color: #f38ba8; }

/* ── AI Assistant ── */
.ai-assistant-wrap { max-width: 820px; margin: 0 auto; padding: 24px 0; }
.ai-title { font-size: 2rem; font-weight: 900; margin-bottom: 4px; }
.ai-subtitle { color: var(--muted); margin-bottom: 24px; }

.ai-quick-wrap { margin-bottom: 18px; }
.ai-quick-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; display: block; margin-bottom: 8px; }
.ai-quick-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-quick-btn { padding: 5px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 12px; cursor: pointer; transition: all .15s; }
.ai-quick-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--bg); }

.ai-input-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 20px; }
.ai-textarea { width: 100%; border: none; background: transparent; color: var(--ink); font-size: 15px; resize: vertical; outline: none; font-family: inherit; line-height: 1.6; min-height: 80px; }
.ai-textarea::placeholder { color: var(--muted); }
.ai-input-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.ai-char-count { font-size: 12px; color: var(--muted); }
.ai-submit-btn { padding: 10px 28px; font-size: 14px; font-weight: 700; border-radius: 8px; }

.ai-answer-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.ai-answer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.ai-provider-badge { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 3px 10px; border-radius: 10px; }
.ai-badge-gemini { background: #4285f422; color: #4285f4; border: 1px solid #4285f444; }
.ai-badge-unknown { background: var(--line); color: var(--muted); }
.ai-answer-copy { background: none; border: none; cursor: pointer; font-size: 16px; color: var(--muted); padding: 2px 6px; }
.ai-answer-copy:hover { color: var(--ink); }
.ai-answer-text { font-size: 15px; line-height: 1.75; color: var(--ink); white-space: pre-wrap; }

.ai-loading { display: flex; align-items: center; padding: 20px; }
.ai-loading-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin: 0 3px; animation: ai-bounce .9s infinite; }
.ai-loading-dot:nth-child(2) { animation-delay: .15s; }
.ai-loading-dot:nth-child(3) { animation-delay: .3s; }
@keyframes ai-bounce { 0%,80%,100% { transform: scale(.7); opacity:.5; } 40% { transform: scale(1); opacity:1; } }

.ai-disclaimer { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; line-height: 1.6; }

@media (max-width: 600px) {
  .ai-provider-bar { flex-direction: column; align-items: flex-start; }
  .ai-submit-btn { width: 100%; }
}

.ai-loading[hidden], .ai-answer-wrap[hidden] { display: none !important; }

/* ── Alert cards grid ── */
.alerts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 12px;
}
.alert-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-left: 4px solid var(--line);
}
.alert-card-pos { border-left-color: #22c55e; }
.alert-card-neg { border-left-color: #ef4444; }
.alert-card-neu { border-left-color: var(--blue); }
.alert-ticker { font-size: 13px; font-weight: 900; letter-spacing: .04em; }
.alert-company { display: block; margin-top: -2px; color: var(--muted); font-size: 12px; font-weight: 700; }
.alert-card-pos .alert-ticker { color: #22c55e; }
.alert-card-neg .alert-ticker { color: #ef4444; }
.alert-card-neu .alert-ticker { color: var(--blue); }
.alert-msg { font-size: 13px; line-height: 1.5; color: var(--ink); }
.alert-time { font-size: 11px; color: var(--muted); margin-top: 4px; }
@media (max-width: 900px) { .alerts-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .alerts-grid { grid-template-columns: 1fr; } }

/* Sector rank badge in dashboard table */
.sector-rank {
  display: block;
  font-size: 10px;
  color: #6c7086;
  font-weight: 400;
  line-height: 1.2;
  margin-top: 2px;
}

/* ═══════════════════════════════════════
   AI Chat UI
   ═══════════════════════════════════════ */

/* Page layout */
.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px;
  gap: 0;
}

/* Ticker context bar */
.chat-ticker-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #102027;
  color: white;
  border-radius: 8px;
  padding: 10px 16px;
  margin-top: 16px;
  gap: 12px;
  flex-shrink: 0;
}
.chat-ticker-left { display: flex; align-items: center; gap: 10px; }
.chat-ticker-tag {
  background: var(--blue);
  color: white;
  font-weight: 800;
  font-size: 14px;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}
.chat-ticker-name { font-size: 13px; color: rgba(255,255,255,0.6); }
.chat-ticker-right { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.chat-header-score { color: #89b4fa; font-weight: 700; }
.chat-header-signal { font-weight: 700; }
.chat-header-signal.sig-verde { color: #a6e3a1; }
.chat-header-signal.sig-giallo { color: #f9e2af; }
.chat-header-signal.sig-rosso { color: #f38ba8; }
.chat-header-price { color: rgba(255,255,255,0.9); font-weight: 700; font-size: 15px; }

/* Page header row */
.chat-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 6px;
  flex-shrink: 0;
}
.chat-page-title { margin: 0; font-size: 22px; font-weight: 800; color: var(--ink); }
.chat-page-sub { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.chat-reset-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
}
.chat-reset-btn:hover { background: var(--line); color: var(--ink); }

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

/* Welcome screen */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  gap: 12px;
  text-align: center;
  flex: 1;
}
.chat-welcome-icon { font-size: 40px; }
.chat-welcome-text { font-size: 15px; color: var(--ink); margin: 0; }
.chat-quick-group { width: 100%; max-width: 640px; }
.chat-quick-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin: 0 0 8px;
}
.chat-quick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.chat-quick-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}
.chat-quick-chip:hover { background: var(--blue); border-color: var(--blue); color: white; }

/* Message rows */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  gap: 4px;
}
.chat-msg-user {
  align-self: flex-end;
  align-items: flex-end;
}
.chat-msg-model {
  align-self: flex-start;
  align-items: flex-start;
}

/* Bubbles */
.chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-msg-user .chat-bubble {
  background: var(--blue);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-msg-model .chat-bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

/* AI badge */
.chat-ai-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 2px;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
}
.chat-typing span {
  width: 7px;
  height: 7px;
  background: var(--muted);
  border-radius: 50%;
  animation: chatBounce 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Input bar */
.chat-input-bar {
  border-top: 1px solid var(--line);
  padding: 12px 0 8px;
  flex-shrink: 0;
  background: var(--bg);
}
.chat-input-inner {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 8px 8px 8px 14px;
  transition: border-color 0.15s;
}
.chat-input-inner:focus-within { border-color: var(--blue); }
.chat-textarea {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  color: var(--ink);
  line-height: 1.5;
  min-height: 24px;
  max-height: 140px;
  overflow-y: auto;
}
.chat-send-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-disclaimer {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 4px 0;
}

/* Dashboard AI row button */
.ai-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  background: #f0f4ff;
  border: 1px solid #c7d7f8;
  color: var(--blue);
  padding: 5px 10px;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.ai-row-btn:hover { background: var(--blue); color: white; border-color: var(--blue); }

/* Chart page AI button */
.chart-ai-btn {
  background: #175ddc !important;
  border-color: #175ddc !important;
  color: white !important;
  font-weight: 700;
}
.chart-ai-btn:hover { opacity: 0.85; }

/* ═══════════════════════════════════════
   Bot Review Page
   ═══════════════════════════════════════ */
.br-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}
.br-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.br-title { margin: 0 0 4px; font-size: 26px; font-weight: 900; }
.br-subtitle { margin: 0; color: var(--muted); font-size: 14px; }
.br-generate-btn { font-size: 15px; padding: 10px 22px; border-radius: 8px; }

/* Review wrapper */
.br-review-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 28px;
}
.br-review-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.br-ts { font-size: 13px; color: var(--muted); }
.br-badge-latest {
  background: #175ddc;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Top row: health + summary */
.br-top-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  margin-bottom: 28px;
  align-items: start;
}
@media (max-width: 600px) { .br-top-row { grid-template-columns: 1fr; } }

/* Health ring */
.br-health-block { text-align: center; }
.br-health-ring {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: conic-gradient(
    var(--blue) calc(var(--pct) * 1%),
    var(--line) 0
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  position: relative;
}
.br-health-ring::after {
  content: '';
  position: absolute;
  width: 80px;
  height: 80px;
  background: var(--panel);
  border-radius: 50%;
}
.br-health-num {
  position: relative;
  z-index: 1;
  font-size: 28px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
}
.br-health-lbl {
  position: relative;
  z-index: 1;
  font-size: 11px;
  color: var(--muted);
}
.br-health-label { margin: 0; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Summary */
.br-summary-block {}
.br-summary-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 14px;
}
.br-strengths { display: flex; flex-wrap: wrap; gap: 8px; }
.br-strength-chip {
  background: #f0faf3;
  border: 1px solid #b2e2bc;
  color: #16834a;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}

/* Section title */
.br-section-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 14px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Cards grid */
.br-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

/* Single card */
.br-card {
  border-radius: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.br-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.br-cat {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 700;
}
/* Priority badges */
.br-prio-badge-alta  { background: #fde8e8; color: #be3340; font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.4px; }
.br-prio-badge-media { background: #fff7e0; color: #a66f00; font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.4px; }
.br-prio-badge-bassa { background: #e8f8ed; color: #16834a; font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.4px; }

/* Card left border by priority */
.br-prio-alta  { border-left: 3px solid #be3340; }
.br-prio-media { border-left: 3px solid #a66f00; }
.br-prio-bassa { border-left: 3px solid #16834a; }

.br-card-title { font-size: 14px; font-weight: 800; margin: 0; color: var(--ink); }
.br-card-desc  { font-size: 13px; color: var(--ink); margin: 0; line-height: 1.5; flex: 1; }
.br-card-impact {
  font-size: 12px;
  color: var(--blue);
  margin: 0;
  font-weight: 600;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

/* Empty state */
.br-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

/* ── Macro Dashboard ─────────────────────────────── */
.macro-page { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.macro-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.macro-title { font-size: 1.6rem; font-weight: 700; margin: 0; }
.macro-subtitle { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

.macro-regime-badge {
  border: 2px solid; border-radius: 12px; padding: .6rem 1.2rem;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.macro-regime-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.macro-regime-badge strong { font-size: 1.1rem; }
.adj-neg { color: #e06c00; font-size: 13px; }
.adj-pos { color: #2e7d32; font-size: 13px; }

.btn-refresh {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: .5rem 1.2rem; font-size: 14px; cursor: pointer; font-weight: 600;
}
.btn-refresh:disabled { opacity: .6; cursor: default; }

.macro-kpi-grid { display: flex; flex-direction: column; gap: 1.5rem; margin-bottom: 2rem; }
.macro-section { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem 1.4rem; }
.macro-section-title { font-size: 1rem; font-weight: 700; margin: 0 0 1rem; color: var(--fg); }
.macro-kpis { display: flex; flex-wrap: wrap; gap: .8rem; }

.macro-kpi {
  border-radius: 10px; padding: .8rem 1.1rem; min-width: 160px; flex: 1;
  border-left: 4px solid var(--border);
}
.macro-kpi.kpi-ok    { background: rgba(46,125,50,.08); border-left-color: #2e7d32; }
.macro-kpi.kpi-warn  { background: rgba(224,108,0,.08); border-left-color: #e06c00; }
.macro-kpi.kpi-danger{ background: rgba(190,51,64,.1);  border-left-color: #be3340; }

.kpi-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--fg); }
.kpi-meta  { font-size: 11px; color: var(--muted); margin-top: 4px; }

.macro-score-section { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1.4rem; margin-bottom: 1.5rem; }
.macro-factors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; }

.macro-factor { border-radius: 10px; padding: .9rem 1rem; border: 1px solid var(--border); }
.macro-factor.factor-neg { background: rgba(190,51,64,.06); border-color: #be334030; }
.macro-factor.factor-pos { background: rgba(46,125,50,.06); border-color: #2e7d3030; }
.macro-factor.factor-neu { background: rgba(108,117,125,.06); }

.factor-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; flex-wrap: wrap; }
.factor-icon { font-size: 1rem; }
.factor-name { font-weight: 700; font-size: 14px; flex: 1; }
.factor-badge { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 20px; font-weight: 700; }
.factor-badge.positivo { background: rgba(46,125,50,.15); color: #2e7d32; }
.factor-badge.negativo { background: rgba(190,51,64,.15); color: #be3340; }
.factor-badge.neutro   { background: rgba(108,117,125,.15); color: var(--muted); }
.factor-detail { font-size: 13px; color: var(--fg); margin: 0 0 4px; }
.factor-period { color: var(--muted); font-size: 11px; }

.macro-note { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: .8rem 1rem; font-size: 12px; color: var(--muted); margin-top: 1rem; }

/* ── Macro mini widget in dashboard ─────────────── */
.macro-widget { 
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: .7rem 1.1rem; margin-bottom: 1.2rem; font-size: 13px;
}
.macro-widget-regime { font-weight: 700; font-size: 14px; }
.macro-widget-kpi { display: flex; align-items: center; gap: .3rem; color: var(--muted); }
.macro-widget-kpi strong { color: var(--fg); }
.macro-widget-sep { color: var(--border); }
.macro-widget-link { margin-left: auto; font-size: 12px; color: var(--accent); text-decoration: none; }
.macro-widget-link:hover { text-decoration: underline; }

/* ── Correlations Page ───────────────────────────── */
.corr-page { max-width: 1300px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.corr-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.corr-title { font-size: 1.6rem; font-weight: 700; margin: 0; }
.corr-subtitle { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.corr-cache-note { font-size: 12px; color: var(--muted); margin-bottom: 1rem; }
.corr-empty { padding: 2rem; text-align: center; color: var(--muted); }

.corr-period-bar { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.period-btn {
  padding: .4rem .9rem; border-radius: 20px; font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--panel); color: var(--fg);
  text-decoration: none; cursor: pointer;
}
.period-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.period-btn:hover:not(.active) { border-color: var(--accent); color: var(--accent); }
.refresh-btn { background: transparent; }

.corr-legend { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; margin-bottom: 1.2rem; font-size: 12px; color: var(--muted); }
.leg-item::before { content: "■"; color: var(--c); margin-right: .3rem; }

/* Heatmap */
.corr-heatmap-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-bottom: 1.5rem; }
.corr-heatmap-scroll { overflow-x: auto; overflow-y: auto; max-height: 600px; }
.corr-heatmap { border-collapse: collapse; font-size: 11px; min-width: max-content; }
.corr-corner { position: sticky; left: 0; top: 0; z-index: 3; background: var(--panel); font-size: 10px; color: var(--muted); padding: .3rem .5rem; min-width: 80px; }
.corr-th { position: sticky; top: 0; z-index: 2; background: var(--panel); padding: .3rem .4rem; text-align: center; border-bottom: 1px solid var(--border); min-width: 52px; }
.corr-th.ref-col { background: rgba(var(--accent-rgb, 0,82,204),.08); }
.corr-th-label { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 700; font-size: 10px; display: inline-block; max-height: 64px; overflow: hidden; }
.corr-row-label { position: sticky; left: 0; z-index: 1; background: var(--panel); padding: .35rem .5rem; font-weight: 700; font-size: 11px; border-right: 1px solid var(--border); white-space: nowrap; min-width: 80px; }
.corr-row-label.ref-row { background: rgba(var(--accent-rgb, 0,82,204),.06); }
.corr-row-label small { font-weight: 400; color: var(--muted); font-size: 9px; display: block; }
.corr-cell {
  text-align: center; padding: .3rem .4rem; cursor: pointer;
  border: 1px solid transparent; border-radius: 3px; transition: transform .1s;
  min-width: 52px;
}
.corr-cell:hover { transform: scale(1.15); z-index: 4; position: relative; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.corr-diag { background: rgba(108,117,125,.12) !important; cursor: default; }
.corr-val { font-weight: 700; font-size: 11px; }

/* Insights */
.corr-insights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.corr-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem 1.4rem; }
.corr-card-wide { grid-column: 1 / -1; }
.corr-card-title { font-size: 1rem; font-weight: 700; margin: 0 0 .3rem; }
.corr-card-sub { font-size: 12px; color: var(--muted); margin: 0 0 1rem; }

/* Pairs list */
.corr-pairs-list { display: flex; flex-direction: column; gap: .5rem; }
.corr-pair-row { display: flex; align-items: center; gap: .6rem; font-size: 13px; }
.pair-tickers { font-weight: 700; min-width: 130px; }
.pair-bar-wrap { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.pair-bar { height: 100%; border-radius: 4px; transition: width .4s; }
.pair-r { font-weight: 700; min-width: 45px; text-align: right; }

/* Hedges */
.corr-hedges-list { display: flex; flex-direction: column; gap: .5rem; }
.hedge-row { display: flex; align-items: center; gap: .5rem; font-size: 13px; padding: .4rem .6rem; background: rgba(21,101,192,.05); border-radius: 6px; border: 1px solid rgba(21,101,192,.15); }
.hedge-ticker { font-weight: 700; min-width: 65px; }
.hedge-arrow { color: var(--muted); }
.hedge-instrument { flex: 1; color: var(--fg); }
.hedge-r { font-weight: 700; min-width: 45px; text-align: right; }

/* vs indices table */
.corr-vs-table-wrap { overflow-x: auto; }
.corr-vs-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.corr-vs-table th { padding: .4rem .6rem; background: var(--bg); border-bottom: 1.5px solid var(--border); text-align: center; font-size: 11px; position: sticky; top: 0; }
.corr-vs-table th:first-child { text-align: left; }
.corr-vs-table td { padding: .35rem .6rem; border-bottom: 1px solid var(--border); text-align: center; }
.vs-ticker { font-weight: 700; text-align: left !important; }
.vs-cell { font-weight: 700; border-radius: 4px; }
.vs-vol { color: var(--muted); font-size: 11px; }

/* Detail popup */
.corr-detail {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.corr-detail[hidden] { display: none; }
.corr-detail-inner {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 2rem; min-width: 300px; max-width: 440px; text-align: center; position: relative;
}
.corr-detail-close {
  position: absolute; top: .8rem; right: .8rem; background: none; border: none;
  font-size: 1.2rem; cursor: pointer; color: var(--muted);
}
.detail-r-big { font-size: 3rem; font-weight: 900; margin: .5rem 0; }
.detail-label { font-weight: 700; font-size: 1.1rem; margin: .3rem 0; }
.detail-interp { font-size: 14px; color: var(--muted); margin: .5rem 0 0; line-height: 1.5; }

@media (max-width: 768px) {
  .corr-insights-grid { grid-template-columns: 1fr; }
  .corr-card-wide { grid-column: 1; }
}

/* ============================================================
   EARLY WARNING SYSTEM — light-theme styles
   ============================================================ */

/* Palette shortcuts (all inline for clarity) */
/* red:    #be3340  bg:#fff1f2  border:#f5c6c9 */
/* orange: #c55a00  bg:#fff5ee  border:#f9cba8 */
/* yellow: #946411  bg:#fffbeb  border:#f6dfa0 */
/* green:  #16834a  bg:#f0fdf4  border:#a7e5c4 */

.ew-page { max-width: 1400px; margin: 0 auto; padding: 20px; }

/* Header */
.ew-header { display:flex; justify-content:space-between; align-items:flex-end; margin-bottom:18px; flex-wrap:wrap; gap:10px; }
.ew-title { font-size:1.5rem; font-weight:700; margin:0; color:var(--ink); }
.ew-subtitle { color:var(--muted); font-size:0.88rem; }
.ew-header-right { display:flex; align-items:center; gap:12px; }
.ew-last-updated { font-size:0.78rem; color:var(--muted); }
.ew-refresh-btn { padding:6px 14px; border:1px solid var(--line); border-radius:6px; background:var(--panel); color:var(--ink); cursor:pointer; font-size:0.83rem; }
.ew-refresh-btn:hover { background:var(--blue); color:#fff; border-color:var(--blue); }

/* Summary chips */
.ew-summary-bar { display:flex; gap:10px; margin-bottom:20px; flex-wrap:wrap; }
.ew-summary-chip { display:flex; align-items:center; gap:8px; padding:10px 18px; border-radius:8px; border:1px solid; font-weight:600; min-width:80px; }
.ew-summary-chip.red    { background:#fff1f2; border-color:#f5c6c9; color:#be3340; }
.ew-summary-chip.orange { background:#fff5ee; border-color:#f9cba8; color:#c55a00; }
.ew-summary-chip.yellow { background:#fffbeb; border-color:#f6dfa0; color:#946411; }
.ew-summary-chip.green  { background:#f0fdf4; border-color:#a7e5c4; color:#16834a; }
.ew-summary-chip.neutral{ background:var(--panel); border-color:var(--line); color:var(--ink); }
.ew-chip-num   { font-size:1.5rem; line-height:1; }
.ew-chip-label { font-size:0.72rem; font-weight:500; }

/* Red alert cards */
.ew-red-alerts-section { margin-bottom:24px; }
.ew-section-title { font-weight:700; font-size:1rem; margin-bottom:12px; color:var(--ink); }
.red-text { color:#be3340; }
.ew-alert-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(290px,1fr)); gap:14px; }
.ew-alert-card { border-radius:10px; padding:16px; border:2px solid; animation:ewPulse 2.5s ease-in-out infinite; }
.ew-alert-red { background:#fff1f2; border-color:#e07080; }
@keyframes ewPulse { 0%,100%{box-shadow:0 0 0 0 rgba(190,51,64,.25)} 50%{box-shadow:0 0 0 8px rgba(190,51,64,.0)} }
.ew-ac-head { display:flex; align-items:center; gap:8px; margin-bottom:8px; flex-wrap:wrap; }
.ew-ac-ticker { font-weight:700; font-size:1.1rem; color:#be3340; }
.ew-ac-name   { color:var(--muted); font-size:0.83rem; }
.ew-ac-pattern { background:#fdd; color:#9f2e39; border-radius:4px; padding:2px 7px; font-size:0.72rem; font-weight:700; border:1px solid #f5c6c9; }
.ew-ac-score { margin-left:auto; font-weight:700; color:#be3340; font-size:0.9rem; }
.ew-ac-price { font-size:1rem; font-weight:600; margin-bottom:8px; display:block; color:var(--ink); }
.ew-ac-signals { display:flex; flex-direction:column; gap:4px; }
.ew-signal-line { font-size:0.78rem; padding:4px 8px; border-radius:4px; }
.ew-signal-line.danger { background:#fdd; color:#9f2e39; border-left:3px solid #be3340; }
.ew-ac-footer { margin-top:10px; border-top:1px solid #f5c6c9; padding-top:8px; }
.ew-ac-link { font-size:0.82rem; color:#be3340; text-decoration:none; font-weight:600; }
.ew-ac-link:hover { text-decoration:underline; }

/* Tabs */
.ew-tabs { display:flex; gap:6px; margin-bottom:16px; flex-wrap:wrap; border-bottom:2px solid var(--line); padding-bottom:0; }
.ew-tab { padding:8px 18px; border:1px solid var(--line); border-bottom:none; border-radius:6px 6px 0 0; background:var(--bg); color:var(--muted); cursor:pointer; font-size:0.84rem; font-weight:500; margin-bottom:-2px; }
.ew-tab.active { background:var(--panel); color:var(--ink); border-color:var(--line); border-bottom:2px solid var(--panel); font-weight:700; }
.ew-tab:hover:not(.active) { color:var(--ink); background:var(--panel); }
.ew-tab-content { display:none; }
.ew-tab-content.active { display:block; }

/* Main table */
.ew-table-wrapper { overflow-x:auto; border-radius:8px; border:1px solid var(--line); background:var(--panel); }
.ew-table { width:100%; border-collapse:collapse; font-size:0.82rem; }
.ew-table th { background:#eef2f5; padding:10px 12px; text-align:left; color:var(--muted); font-weight:700; cursor:pointer; white-space:nowrap; font-size:0.75rem; text-transform:uppercase; letter-spacing:.03em; }
.ew-table th:hover { color:var(--ink); }
.ew-table td { padding:9px 12px; border-bottom:1px solid #eef2f5; vertical-align:middle; background:var(--panel); color:var(--ink); }
.ew-row { cursor:pointer; transition:background .12s; }
.ew-row:hover td { background:#f8fafb !important; }
.ew-row-red    td:first-child { border-left:4px solid #be3340; }
.ew-row-orange td:first-child { border-left:4px solid #c55a00; }
.ew-row-yellow td:first-child { border-left:4px solid #d99a18; }
.ew-row-green  td:first-child { border-left:4px solid #16834a; }

/* Ticker cell */
.ew-ticker-wrap { display:flex; align-items:center; gap:8px; }
.ew-level-dot { width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.ew-dot-red    { background:#be3340; box-shadow:0 0 5px rgba(190,51,64,.5); }
.ew-dot-orange { background:#c55a00; box-shadow:0 0 5px rgba(197,90,0,.5); }
.ew-dot-yellow { background:#d99a18; box-shadow:0 0 5px rgba(217,154,24,.5); }
.ew-dot-green  { background:#16834a; }
.ew-name { font-size:0.71rem; color:var(--muted); margin-top:1px; }
.ew-cell-sector { color:var(--muted); font-size:0.76rem; }

/* Price change */
.ew-pos { color:#16834a; font-weight:600; }
.ew-neg { color:#be3340; font-weight:600; }

/* RSI badge */
.ew-rsi-badge { display:inline-block; padding:3px 7px; border-radius:4px; font-size:0.78rem; font-weight:700; background:#eef2f5; color:var(--ink); border:1px solid var(--line); }
.rsi-hot  { background:#fff1f2; color:#be3340; border-color:#f5c6c9; }
.rsi-cold { background:#eff6ff; color:#175ddc; border-color:#bfdbfe; }

/* EMA indicator dots */
.ew-ema-dot { display:inline-flex; align-items:center; justify-content:center; width:24px; height:20px; border-radius:3px; font-size:0.68rem; font-weight:700; margin:1px; border:1px solid; }
.ema-ok  { background:#f0fdf4; color:#16834a; border-color:#a7e5c4; }
.ema-bad { background:#fff1f2; color:#be3340; border-color:#f5c6c9; }

/* News counts */
.ew-news-neg { color:#be3340; font-size:0.8rem; font-weight:600; margin-right:5px; }
.ew-news-pos { color:#16834a; font-size:0.8rem; font-weight:600; }

/* Score bars */
.ew-bar-wrap { position:relative; height:22px; background:#eef2f5; border-radius:4px; min-width:90px; border:1px solid var(--line); }
.ew-bar-fill { position:absolute; left:0; top:0; height:100%; border-radius:3px; transition:width .4s; }
.ew-risk-fill-red    { background:linear-gradient(90deg,#e07080,#be3340); }
.ew-risk-fill-orange { background:linear-gradient(90deg,#e8956a,#c55a00); }
.ew-risk-fill-yellow { background:linear-gradient(90deg,#e8c060,#d99a18); }
.ew-risk-fill-green  { background:linear-gradient(90deg,#6ec49a,#16834a); }
.ew-opp-fill { background:linear-gradient(90deg,#6ec49a,#16834a); }
.ew-bar-label { position:absolute; right:5px; top:50%; transform:translateY(-50%); font-size:0.72rem; font-weight:700; color:#fff; text-shadow:0 0 3px rgba(0,0,0,.6); }

/* Pattern badges */
.ew-pattern-badge { display:inline-block; padding:3px 8px; border-radius:4px; font-size:0.71rem; font-weight:700; white-space:nowrap; border:1px solid; }
.badge-red    { background:#fff1f2; color:#9f2e39; border-color:#f5c6c9; }
.badge-orange { background:#fff5ee; color:#9a3f00; border-color:#f9cba8; }
.badge-yellow { background:#fffbeb; color:#7a5000; border-color:#f6dfa0; }
.badge-green  { background:#f0fdf4; color:#155e3d; border-color:#a7e5c4; }

/* Signal chips in table */
.ew-sig-chip { font-size:0.72rem; padding:3px 6px; border-radius:3px; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:230px; border-left:3px solid; }
.ew-sig-danger      { background:#fff1f2; color:#9f2e39; border-left-color:#be3340; }
.ew-sig-warning     { background:#fff5ee; color:#9a3f00; border-left-color:#c55a00; }
.ew-sig-caution     { background:#fffbeb; color:#7a5000; border-left-color:#d99a18; }
.ew-sig-opportunity { background:#f0fdf4; color:#155e3d; border-left-color:#16834a; }

/* Top Risk / Top Opportunity cards */
.ew-top-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:16px; padding:4px; }
.ew-top-card { background:var(--panel); border-radius:10px; padding:18px; border:1px solid var(--line); position:relative; }
.ew-tc-red    { border-top:4px solid #be3340; }
.ew-tc-orange { border-top:4px solid #c55a00; }
.ew-tc-yellow { border-top:4px solid #d99a18; }
.ew-tc-green  { border-top:4px solid #16834a; }
.ew-tc-opp    { border-top:4px solid #16834a; }
.ew-tc-rank { position:absolute; top:14px; right:16px; font-size:1.6rem; font-weight:700; color:var(--line); }
.ew-tc-head { margin-bottom:12px; }
.ew-tc-ticker { display:block; font-size:1.15rem; font-weight:700; color:var(--ink); }
.ew-tc-name { font-size:0.8rem; color:var(--muted); }
.ew-tc-score { display:flex; align-items:baseline; gap:6px; margin-bottom:10px; }
.ew-tc-score-label { font-size:0.75rem; color:var(--muted); }
.ew-tc-score-val { font-size:1.6rem; font-weight:700; line-height:1.2; }
.risk-val { color:#be3340; }
.opp-val  { color:#16834a; }
.ew-tc-pattern { font-size:0.76rem; padding:3px 8px; background:#fff1f2; color:#9f2e39; border-radius:4px; display:inline-block; margin-bottom:10px; border:1px solid #f5c6c9; }
.ew-tc-signals { display:flex; flex-direction:column; gap:5px; margin-bottom:12px; }
.ew-tc-sig { font-size:0.77rem; color:var(--muted); padding-left:8px; border-left:2px solid var(--line); }
.opp-sig { color:#16834a; border-left-color:#a7e5c4; }
.ew-tc-footer { display:flex; justify-content:space-between; align-items:center; border-top:1px solid var(--line); padding-top:10px; font-size:0.82rem; color:var(--ink); }
.ew-tc-footer a { color:var(--blue); text-decoration:none; font-weight:600; }

/* History table */
.ew-history-table { width:100%; border-collapse:collapse; font-size:0.82rem; }
.ew-history-table th { background:#eef2f5; padding:10px 12px; text-align:left; color:var(--muted); font-size:0.75rem; text-transform:uppercase; font-weight:700; }
.ew-history-table td { padding:8px 12px; border-bottom:1px solid #eef2f5; color:var(--ink); background:var(--panel); }
.ew-hist-sigs { color:var(--muted); max-width:300px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Modal */
.ew-modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:1000; align-items:center; justify-content:center; padding:20px; }
.ew-modal-box { background:var(--panel); border-radius:12px; border:1px solid var(--line); max-width:560px; width:100%; max-height:85vh; overflow-y:auto; padding:26px; position:relative; box-shadow:0 20px 60px rgba(0,0,0,.2); }
.ew-modal-close { position:absolute; top:14px; right:16px; background:none; border:none; color:var(--muted); font-size:1rem; cursor:pointer; line-height:1; }
.ew-modal-close:hover { color:var(--ink); }
.ew-modal-header { margin-bottom:18px; }
.ew-modal-ticker { font-size:1.4rem; font-weight:700; color:var(--ink); }
.ew-modal-name { font-size:0.84rem; color:var(--muted); margin-top:2px; }
.ew-modal-scores { display:flex; gap:12px; flex-wrap:wrap; margin-bottom:20px; }
.ew-modal-score-box { background:#f8fafb; border-radius:8px; padding:12px 16px; flex:1; min-width:110px; border:1px solid var(--line); }
.ew-ms-label { font-size:0.72rem; color:var(--muted); text-transform:uppercase; letter-spacing:.03em; margin-bottom:4px; }
.ew-ms-val { font-size:1.6rem; font-weight:700; line-height:1.2; color:var(--ink); }
.ew-ms-pattern { font-size:0.73rem; margin-top:4px; color:#9f2e39; font-weight:600; }
.ew-modal-section { margin-bottom:18px; }
.ew-modal-sec-title { font-weight:700; font-size:0.88rem; margin-bottom:10px; color:var(--ink); text-transform:uppercase; letter-spacing:.03em; }
.ew-modal-sig { font-size:0.82rem; padding:6px 8px; border-radius:4px; margin-bottom:4px; color:var(--ink); background:#f8fafb; border-left:3px solid var(--line); }
.ew-modal-sig.opp { background:#f0fdf4; border-left-color:#16834a; color:#155e3d; }
.ew-modal-meta { font-size:0.82rem; margin-bottom:5px; color:var(--muted); }
.ew-modal-meta strong { color:var(--ink); }
.ew-modal-footer { border-top:1px solid var(--line); padding-top:14px; margin-top:4px; }
.ew-modal-link { color:var(--blue); text-decoration:none; font-size:0.88rem; font-weight:600; }
.ew-modal-link:hover { text-decoration:underline; }

/* Empty/loading states */
.ew-empty { padding:40px; text-align:center; color:var(--muted); }
.ew-loading { padding:20px; text-align:center; color:var(--muted); }

@media (max-width: 768px) {
  .ew-top-grid { grid-template-columns: 1fr; }
  .ew-alert-cards { grid-template-columns: 1fr; }
  .ew-table { font-size: 0.74rem; }
  .ew-cell-sector, .ew-cell-ema, .ew-cell-signals { display: none; }
}

/* Seasonality 10 years */
.seasonality-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.seasonality-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  background: #102027;
  color: white;
  border-radius: 10px;
  padding: 26px;
  border: 1px solid #26404a;
}
.seasonality-hero span {
  color: #54d6f4;
  font-weight: 800;
  text-transform: uppercase;
  font-size: .78rem;
  letter-spacing: .04em;
}
.seasonality-hero h1 {
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 1;
  margin: 10px 0;
}
.seasonality-hero p {
  color: #b7c5cc;
  max-width: 780px;
  margin: 0;
  font-size: 1.05rem;
}
.seasonality-controls label {
  display: block;
  color: #b7c5cc;
  font-weight: 800;
  text-transform: uppercase;
  font-size: .75rem;
  margin-bottom: 8px;
}
.seasonality-controls div {
  display: flex;
  gap: 10px;
}
.seasonality-controls select {
  min-height: 42px;
  min-width: 190px;
  border-radius: 7px;
  border: 1px solid #38515b;
  background: #0c1a20;
  color: white;
  padding: 0 12px;
  font-weight: 750;
}
.seasonality-card,
.seasonality-legend,
.seasonality-alert,
.seasonality-error {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}
.seasonality-section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.seasonality-section-head p,
.seasonality-section-head small {
  color: var(--muted);
  margin: 0;
}
.seasonality-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.seasonality-table {
  min-width: 1060px;
  background: white;
}
.seasonality-table th {
  background: #eef2f5;
  white-space: nowrap;
}
.seasonality-table td,
.seasonality-table th {
  text-align: center;
}
.seasonality-table button.heat {
  width: 100%;
  min-width: 74px;
  color: #172126;
  border: 1px solid rgba(23,33,38,.08);
  font-weight: 850;
  min-height: 34px;
}
.seasonality-table button.heat:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16,32,39,.12);
}
.seasonality-table .heat {
  border-radius: 5px;
  font-weight: 850;
}
.heat-pos-1 { background: #dcf7e8; color: #155e3d; }
.heat-pos-2 { background: #8ee0b1; color: #0f4b31; }
.heat-pos-3 { background: #16834a; color: white !important; }
.heat-neg-1 { background: #fde4e7; color: #9f2e39; }
.heat-neg-2 { background: #ef9aa3; color: #7a1d27; }
.heat-neg-3 { background: #be3340; color: white !important; }
.seasonality-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.seasonality-summary-grid article {
  background: white;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 9px;
  padding: 16px;
}
.seasonality-summary-grid span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: .72rem;
  margin-bottom: 8px;
}
.seasonality-summary-grid strong {
  display: block;
  font-size: 1.35rem;
}
.seasonality-summary-grid small {
  color: var(--muted);
}
.seasonality-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  min-width: 74px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 850;
}
.seasonality-badge.strong,
.seasonality-badge.strong,
.seasonality-alert.strong {
  background: #e7f7ef;
  color: #155e3d;
  border-color: #a7e5c4;
}
.seasonality-badge.neutral,
.seasonality-alert.neutral {
  background: #fffbeb;
  color: #7a5000;
  border-color: #f6dfa0;
}
.seasonality-badge.weak,
.seasonality-alert.weak {
  background: #fff1f2;
  color: #9f2e39;
  border-color: #f5c6c9;
}
.seasonality-error {
  color: var(--red);
  border-color: #f5c6c9;
  background: #fff1f2;
  font-weight: 750;
}
.seasonality-reasons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.seasonality-reasons article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafb;
}
.seasonality-reasons p {
  color: var(--muted);
  margin: 6px 0 0;
}
.seasonality-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.seasonality-legend h2 {
  grid-column: 1 / -1;
}
.seasonality-legend div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.seasonality-legend p {
  margin: 10px 0 0;
  color: var(--muted);
}
.seasonality-dialog {
  width: min(720px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}
.seasonality-dialog::backdrop {
  background: rgba(16,32,39,.55);
}
#seasonality-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  padding: 0;
}
.seasonality-dialog-eyebrow {
  display: block;
  color: var(--blue);
  font-weight: 850;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.seasonality-dialog h2 {
  font-size: 3rem;
}
.seasonality-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 18px 0;
}
.seasonality-detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafb;
}
.seasonality-detail-grid span {
  display: block;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.seasonality-dialog li {
  margin-bottom: 8px;
}
.seasonality-dialog small {
  color: var(--muted);
}
.seasonality-dashboard-alert {
  display: grid;
  grid-template-columns: minmax(240px, 360px) 1fr;
  gap: 16px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 6px solid #54d6f4;
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 22px;
}
.seasonality-dashboard-alert span {
  display: block;
  color: var(--muted);
  font-weight: 850;
  text-transform: uppercase;
  font-size: .74rem;
  margin-bottom: 5px;
}
.seasonality-dashboard-alert strong {
  display: block;
  font-size: 1.2rem;
}
.seasonality-dashboard-alert small {
  color: var(--muted);
}
.seasonality-dashboard-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.seasonality-dashboard-chip {
  min-width: 210px;
  border-radius: 9px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #f8fafb;
}
.seasonality-dashboard-chip strong {
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--ink);
}
.seasonality-dashboard-chip span {
  color: var(--ink);
  font-size: .82rem;
  text-transform: none;
  font-weight: 800;
}
.seasonality-dashboard-chip.strong {
  background: #e7f7ef;
  border-color: #a7e5c4;
}
.seasonality-dashboard-chip.weak {
  background: #fff1f2;
  border-color: #f5c6c9;
}
.seasonality-dashboard-empty {
  color: var(--muted);
  text-transform: none !important;
  font-weight: 600 !important;
  margin: 0 !important;
}
@media (max-width: 860px) {
  .seasonality-hero {
    align-items: stretch;
    flex-direction: column;
  }
  .seasonality-controls div,
  .seasonality-controls select,
  .seasonality-controls button {
    width: 100%;
  }
  .seasonality-summary-grid,
  .seasonality-legend,
  .seasonality-detail-grid,
  .seasonality-dashboard-alert {
    grid-template-columns: 1fr;
  }
  .seasonality-section-head {
    flex-direction: column;
  }
}


/* ── Market Reaction card ─────────────────────────────────────── */
.mr-card{background:#fff;border:1px solid #d8e0e7;border-radius:10px;padding:20px;margin-bottom:18px}
.mr-header{display:flex;align-items:center;gap:12px;margin-bottom:14px;flex-wrap:wrap}
.mr-title{font-weight:800;font-size:15px;color:#172126;flex:1}
.mr-score-num{font-size:22px;font-weight:900;line-height:1}
.mr-score-label{font-size:11px;color:#68757d;margin-top:2px}
.mr-badge{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:5px 12px;font-weight:900;font-size:13px}
.mr-badge.verde{background:#dcfce7;color:#166534}
.mr-badge.giallo{background:#fef9c3;color:#854d0e}
.mr-badge.arancione{background:#ffedd5;color:#9a3412}
.mr-badge.rosso{background:#fee2e2;color:#991b1b}
.mr-dot{width:9px;height:9px;border-radius:50%;display:inline-block}
.mr-dot.verde{background:#22c55e}
.mr-dot.giallo{background:#facc15}
.mr-dot.arancione{background:#f97316}
.mr-dot.rosso{background:#ef4444}
.mr-bar-wrap{background:#eef2f4;border-radius:999px;height:7px;margin:10px 0 14px;overflow:hidden}
.mr-bar-fill{height:100%;border-radius:999px;transition:width .5s}
.mr-bar-fill.verde{background:#22c55e}
.mr-bar-fill.giallo{background:#facc15}
.mr-bar-fill.arancione{background:#f97316}
.mr-bar-fill.rosso{background:#ef4444}
.mr-msg{background:#f8fafc;border-left:3px solid #d8e0e7;padding:10px 14px;border-radius:4px;font-size:13px;color:#33454f;margin:0 0 14px}
.mr-kv-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:8px;margin-bottom:14px}
.mr-kv{background:#f8fafc;border:1px solid #eef2f4;border-radius:7px;padding:9px 12px}
.mr-kv .lbl{font-size:11px;color:#68757d;margin-bottom:3px}
.mr-kv .val{font-size:14px;font-weight:700;color:#172126}
.mr-kv .val.up{color:#16834a}
.mr-kv .val.down{color:#be3340}
.mr-timeline{display:flex;align-items:flex-start;gap:0;margin:16px 0;overflow-x:auto;padding-bottom:4px}
.mr-tl-step{flex:1;min-width:90px;text-align:center;position:relative}
.mr-tl-step:not(:last-child)::after{content:"";position:absolute;top:12px;left:50%;width:100%;height:2px;background:#d8e0e7;z-index:0}
.mr-tl-dot{width:24px;height:24px;border-radius:50%;border:2px solid #d8e0e7;background:#fff;display:inline-flex;align-items:center;justify-content:center;font-size:11px;position:relative;z-index:1;margin-bottom:5px}
.mr-tl-dot.done{background:#16834a;border-color:#16834a;color:#fff}
.mr-tl-dot.active{background:#175ddc;border-color:#175ddc;color:#fff;box-shadow:0 0 0 3px #dbeafe}
.mr-tl-dot.warn{background:#be3340;border-color:#be3340;color:#fff}
.mr-tl-label{font-size:11px;color:#68757d;line-height:1.3;display:block}
.mr-tl-label.active{color:#175ddc;font-weight:700}
.mr-tl-label.warn{color:#be3340;font-weight:700}
.mr-ai-box{background:#f0f7ff;border:1px solid #c3d8f5;border-radius:8px;padding:14px 16px;margin-top:14px}
.mr-ai-lbl{font-size:11px;font-weight:800;color:#175ddc;text-transform:uppercase;letter-spacing:.05em;margin-bottom:6px}
.mr-ai-text{font-size:13px;color:#172126;line-height:1.6;white-space:pre-wrap}
.mr-news-type-pill{display:inline-block;background:#eef2f4;color:#68757d;border-radius:999px;padding:3px 10px;font-size:11px;font-weight:700;margin-left:8px}
.mr-prob{font-size:13px;color:#33454f;margin-bottom:10px}
.mr-prob strong{color:#172126}

/* ── Portfolio Concentration Alert ─────────────────────────────────────────── */
.concentration-alert-section {
  margin: 0 0 1rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  transition: border-color .3s;
}
.concentration-alert-section.risk-alta { border-color: #e67e22; }
.concentration-alert-section.risk-molto-alta { border-color: #e74c3c; }
.concentration-alert-section.risk-media { border-color: #f1c40f; }
.concentration-alert-section.risk-bassa { border-color: #2ecc71; }

.concentration-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1rem;
  font-size: .95rem;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  user-select: none;
}
.concentration-icon { font-size: 1.1rem; }

.concentration-badge {
  margin-left: auto;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-bassa    { background: rgba(46,204,113,.2);  color: #2ecc71; }
.badge-media    { background: rgba(241,196,15,.2);  color: #f1c40f; }
.badge-alta     { background: rgba(230,126,34,.2);  color: #e67e22; }
.badge-molto-alta { background: rgba(231,76,60,.2); color: #e74c3c; }

.concentration-body {
  padding: .75rem 1rem 1rem;
}
.concentration-summary {
  margin-bottom: .6rem;
  font-size: .92rem;
  color: #ccc;
}
.concentration-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  margin-bottom: .6rem;
}
.concentration-table th {
  text-align: left;
  padding: .3rem .5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: #999;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
}
.concentration-table td {
  padding: .3rem .5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: #ddd;
}
.concentration-table tr:last-child td { border-bottom: none; }
.concentration-suggestion {
  display: block;
  margin-top: .4rem;
  color: #999;
  font-size: .82rem;
  font-style: italic;
}

/* ── Sector Rotation Intelligence ─────────────────────────────────────────── */
.sri-section {
  margin-bottom: 2rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  overflow: hidden;
}
.sri-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem .6rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.sri-title { margin: 0 0 .15rem; font-size: 1.1rem; }

.sri-dominant-box {
  margin: 0 1.2rem 1rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border-left: 4px solid #3498db;
  padding: .8rem 1rem;
}
.sri-dominant-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #999; margin-bottom: .3rem; }
.sri-dominant-sector { font-size: 1.4rem; font-weight: 700; color: #fff; }
.sri-dominant-meta { display: flex; gap: .5rem; margin: .4rem 0; flex-wrap: wrap; }
.sri-dominant-msg { margin: .3rem 0 0; color: #bbb; font-size: .88rem; }

.sri-impact-panel { padding: 0 1.2rem 1.2rem; }
.sri-impact-panel h3 { margin: 0 0 .6rem; font-size: .95rem; }

.sri-table { font-size: .84rem; }
.sri-table th { font-size: .75rem; }
.sri-loading { color: #777; font-style: italic; padding: 1rem !important; }

.sri-score {
  display: inline-block;
  padding: .2rem .5rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: .85rem;
}
.sri-score-high { background: rgba(46,204,113,.2);  color: #2ecc71; }
.sri-score-mid  { background: rgba(241,196,15,.2);  color: #f1c40f; }
.sri-score-low  { background: rgba(231,76,60,.15);  color: #e74c3c; }

.sri-badge {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.sri-inflow        { background: rgba(46,204,113,.2);  color: #2ecc71; }
.sri-outflow       { background: rgba(231,76,60,.2);   color: #e74c3c; }
.sri-neutral-badge { background: rgba(255,255,255,.08); color: #999; }
.sri-confermata    { background: rgba(46,204,113,.2);  color: #2ecc71; }
.sri-osservazione  { background: rgba(241,196,15,.2);  color: #f1c40f; }
.sri-debole        { background: rgba(231,76,60,.2);   color: #e74c3c; }

.sri-risk-badge {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
}
.sri-risk-badge.risk-basso  { background: rgba(46,204,113,.2);  color: #2ecc71; }
.sri-risk-badge.risk-medio  { background: rgba(241,196,15,.2);  color: #f1c40f; }
.sri-risk-badge.risk-alto   { background: rgba(231,76,60,.2);   color: #e74c3c; }

.sri-error {
  margin: .5rem 1.2rem;
  padding: .6rem .8rem;
  background: rgba(231,76,60,.15);
  border-radius: 6px;
  color: #e74c3c;
  font-size: .85rem;
}
.sri-refresh-btn { flex-shrink: 0; }

/* ── Correlations page v2 ─────────────────────────────────────────────────── */
.corr-page { max-width: 1400px; margin: 0 auto; }
.corr-header { display:flex; align-items:flex-start; justify-content:space-between; flex-wrap:wrap; gap:1rem; margin-bottom:.5rem; }
.corr-title { margin:0 0 .2rem; font-size:1.3rem; }
.corr-subtitle { margin:0; color:#999; font-size:.85rem; }
.corr-controls { display:flex; align-items:center; gap:.6rem; flex-wrap:wrap; }
.corr-period-bar { display:flex; gap:.3rem; }
.period-btn { padding:.35rem .75rem; border-radius:6px; border:1px solid rgba(255,255,255,.12); background:transparent; color:#ccc; cursor:pointer; font-size:.82rem; }
.period-btn:hover, .period-btn.active { background:rgba(255,255,255,.1); color:#fff; border-color:rgba(255,255,255,.25); }
.corr-refresh-btn { flex-shrink:0; }
.corr-cache-note { font-size:.78rem; color:#777; margin:.2rem 0 .8rem; }

.corr-ai-summary { display:flex; align-items:flex-start; gap:.7rem; background:rgba(52,152,219,.1); border:1px solid rgba(52,152,219,.25); border-radius:10px; padding:.8rem 1rem; margin-bottom:.8rem; font-size:.9rem; color:#bbb; }
.corr-ai-icon { font-size:1.2rem; flex-shrink:0; }

.corr-alerts-wrap { display:flex; flex-direction:column; gap:.5rem; margin-bottom:.8rem; }
.corr-alert-box { display:flex; align-items:flex-start; gap:.7rem; background:rgba(231,76,60,.1); border:1px solid rgba(231,76,60,.3); border-radius:8px; padding:.65rem .9rem; font-size:.86rem; }
.corr-alert-icon { font-size:1.1rem; flex-shrink:0; }

.corr-top-grid { display:grid; grid-template-columns:1fr 1fr; gap:1rem; margin-bottom:1rem; }
@media(max-width:768px) { .corr-top-grid { grid-template-columns:1fr; } }

.corr-mid-grid { display:grid; grid-template-columns:1fr 1fr; gap:1rem; margin-bottom:1rem; }
@media(max-width:768px) { .corr-mid-grid { grid-template-columns:1fr; } }

.corr-card { background:rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.08); border-radius:10px; padding:1rem 1.1rem; }
.corr-card-full { margin-bottom:1rem; }
.corr-card-header-row { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.5rem; margin-bottom:.6rem; }
.corr-card-title { margin:0 0 .25rem; font-size:.95rem; font-weight:700; }
.corr-card-sub { margin:0 0 .75rem; color:#999; font-size:.8rem; }

.corr-legend { display:flex; gap:.8rem; flex-wrap:wrap; }
.corr-leg { font-size:.75rem; color:#999; }
.corr-leg::before { content:"■"; color:var(--lc); margin-right:.25rem; }

/* Diversification */
.corr-div-score-wrap { display:flex; align-items:center; gap:1rem; margin:.4rem 0; }
.corr-div-score-circle { width:60px; height:60px; border-radius:50%; border:3px solid #999; display:flex; align-items:center; justify-content:center; font-size:1.3rem; font-weight:700; flex-shrink:0; }
.corr-div-label { font-size:1rem; font-weight:700; }
.corr-div-desc { font-size:.8rem; color:#aaa; margin-top:.15rem; }
.corr-bar-track { height:8px; background:rgba(255,255,255,.08); border-radius:4px; overflow:hidden; margin:.6rem 0 .3rem; }
.corr-bar-fill { height:100%; border-radius:4px; transition:width .5s ease; }
.corr-bar-ticks { display:flex; justify-content:space-between; font-size:.67rem; color:#666; }

/* Concentration risk */
.corr-risk-grid { display:grid; grid-template-columns:1fr 1fr; gap:.8rem; }
@media(max-width:600px) { .corr-risk-grid { grid-template-columns:1fr; } }
.corr-risk-block h4 { font-size:.78rem; text-transform:uppercase; letter-spacing:.05em; color:#999; margin:0 0 .4rem; }
.corr-risk-loading { color:#777; font-size:.85rem; padding:.4rem; }
.crisk-row { display:flex; align-items:center; gap:.4rem; margin-bottom:.3rem; }
.crisk-label { font-size:.78rem; width:90px; flex-shrink:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.crisk-bar-track { flex:1; height:6px; background:rgba(255,255,255,.08); border-radius:3px; overflow:hidden; }
.crisk-bar-fill { height:100%; border-radius:3px; }
.crisk-pct { font-size:.75rem; width:36px; text-align:right; color:#ccc; flex-shrink:0; }

/* Matrix */
.corr-heatmap-scroll { overflow-x:auto; }
.corr-heatmap { border-collapse:collapse; font-size:.78rem; white-space:nowrap; }
.corr-heatmap th, .corr-heatmap td { padding:.32rem .45rem; border:1px solid rgba(255,255,255,.06); text-align:center; }
.corr-corner { min-width:60px; }
.corr-th, .corr-row-label { font-weight:600; font-size:.75rem; color:#ccc; background:rgba(255,255,255,.04); }
.corr-cell { cursor:pointer; transition:opacity .15s; min-width:52px; font-weight:600; font-size:.8rem; }
.corr-cell:hover { opacity:.7; }
.corr-diag { cursor:default; color:#555 !important; }
.corr-ref-table .corr-row-label { min-width:60px; font-weight:700; }

/* Pairs table */
.corr-pairs-table { width:100%; border-collapse:collapse; font-size:.82rem; }
.corr-pairs-table th { font-size:.72rem; text-transform:uppercase; color:#888; padding:.3rem .4rem; border-bottom:1px solid rgba(255,255,255,.08); text-align:left; }
.corr-pairs-table td { padding:.32rem .4rem; border-bottom:1px solid rgba(255,255,255,.04); }
.corr-pairs-table tr:last-child td { border-bottom:none; }

/* Suggestions */
.corr-suggestions-list { display:flex; flex-direction:column; gap:.55rem; }
.corr-suggestion-row { display:flex; align-items:flex-start; gap:.7rem; }
.corr-sug-num { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%; background:rgba(52,152,219,.2); color:#3498db; font-size:.72rem; font-weight:700; flex-shrink:0; margin-top:.1rem; }
.corr-suggestion-row p { margin:0; font-size:.85rem; color:#ccc; line-height:1.5; }

/* Dynamic */
.corr-dynamic-controls { display:flex; align-items:center; gap:.6rem; flex-wrap:wrap; margin-bottom:.8rem; }
.corr-select { padding:.35rem .6rem; border-radius:6px; border:1px solid rgba(255,255,255,.15); background:#1a2535; color:#eee; font-size:.85rem; }
.corr-dynamic-sep { font-size:1.1rem; color:#777; }
.corr-dyn-result { margin-top:.6rem; }
.corr-dyn-bars { display:flex; flex-direction:column; gap:.5rem; margin-bottom:.6rem; }
.corr-dyn-bar-row { display:flex; align-items:center; gap:.6rem; }
.corr-dyn-period { width:70px; font-size:.78rem; color:#aaa; flex-shrink:0; }
.corr-dyn-track { flex:1; height:10px; background:rgba(255,255,255,.07); border-radius:5px; overflow:hidden; display:flex; }
.corr-dyn-fill { height:100%; border-radius:5px; transition:width .4s ease; }
.corr-dyn-val { width:60px; font-size:.82rem; font-weight:700; text-align:right; flex-shrink:0; }
.corr-dyn-interp { font-size:.84rem; color:#aaa; margin:0; font-style:italic; }

/* Detail popup */
.corr-detail { position:fixed; inset:0; background:rgba(0,0,0,.6); display:flex; align-items:center; justify-content:center; z-index:9999; }
.corr-detail-inner { background:#1a2535; border:1px solid rgba(255,255,255,.12); border-radius:12px; padding:1.5rem; min-width:280px; max-width:360px; position:relative; }
.corr-detail-close { position:absolute; top:.6rem; right:.8rem; background:none; border:none; color:#aaa; font-size:1.1rem; cursor:pointer; }
.detail-r-big { font-size:2.5rem; font-weight:800; margin:.4rem 0; }
.detail-label { font-size:.9rem; font-weight:600; margin:0 0 .4rem; }
.detail-interp { font-size:.82rem; color:#aaa; margin:0; line-height:1.5; }

.corr-loading-msg { color:#777; font-style:italic; padding:.8rem; font-size:.85rem; }

/* ── Macro Risk Intelligence v2 ───────────────────────────────────────────── */
.macro-page { max-width: 1300px; margin: 0 auto; }
.macro-header { display:flex; align-items:flex-start; justify-content:space-between; flex-wrap:wrap; gap:1rem; margin-bottom:1rem; }
.macro-title { margin:0 0 .2rem; font-size:1.3rem; }
.macro-subtitle { margin:0; color:#999; font-size:.85rem; }
.macro-refresh-btn { flex-shrink:0; }

/* Regime box */
.macro-regime-box {
  border:2px solid #555;
  border-radius:12px;
  padding:1.2rem 1.5rem;
  margin-bottom:1rem;
  transition:border-color .3s, background .3s;
}
.macro-regime-inner { display:grid; grid-template-columns:180px 200px 1fr; gap:1.5rem; align-items:center; }
@media(max-width:768px) { .macro-regime-inner { grid-template-columns:1fr; } }
.macro-regime-loading { color:#888; font-style:italic; padding:.5rem; }
.macro-regime-regime-label { font-size:.72rem; text-transform:uppercase; letter-spacing:.06em; color:#999; margin-bottom:.25rem; }
.macro-regime-regime { font-size:1.3rem; font-weight:800; letter-spacing:.03em; }
.macro-regime-risk { font-size:.85rem; margin-top:.3rem; color:#bbb; }
.macro-score-big { font-size:3rem; font-weight:800; line-height:1; }
.macro-score-label { font-size:.72rem; text-transform:uppercase; color:#888; margin-bottom:.4rem; }
.macro-score-bar-track { height:8px; background:rgba(255,255,255,.08); border-radius:4px; overflow:hidden; margin:.3rem 0; }
.macro-score-bar-fill { height:100%; border-radius:4px; transition:width .6s ease; }
.macro-score-scale { display:flex; justify-content:space-between; font-size:.65rem; color:#666; margin-top:.15rem; }
.macro-regime-summary { font-size:.88rem; color:#ccc; margin:0; line-height:1.6; }

/* Card */
.macro-card { background:rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.08); border-radius:10px; padding:1rem 1.1rem; margin-bottom:1rem; }
.macro-card-title { margin:0 0 .2rem; font-size:.95rem; font-weight:700; }
.macro-card-sub { margin:0 0 .75rem; color:#999; font-size:.8rem; }

/* Two column grid */
.macro-two-col { display:grid; grid-template-columns:1fr 1fr; gap:1rem; margin-bottom:1rem; }
@media(max-width:900px) { .macro-two-col { grid-template-columns:1fr; } }

/* Signals table */
.macro-signals-table { width:100%; border-collapse:collapse; font-size:.82rem; }
.macro-signals-table th { font-size:.73rem; text-transform:uppercase; color:#888; padding:.35rem .5rem; border-bottom:1px solid rgba(255,255,255,.08); text-align:left; }
.macro-signals-table td { padding:.38rem .5rem; border-bottom:1px solid rgba(255,255,255,.04); vertical-align:top; }
.macro-signals-table tr:last-child td { border-bottom:none; }
.macro-weight-bar-wrap { display:flex; align-items:center; gap:.4rem; }
.macro-weight-bar { height:6px; border-radius:3px; min-width:2px; }
.macro-weight-bar-wrap span { font-size:.72rem; color:#888; width:28px; flex-shrink:0; }

/* Impact table */
.macro-impact-table { width:100%; border-collapse:collapse; font-size:.82rem; }
.macro-impact-table th { font-size:.72rem; text-transform:uppercase; color:#888; padding:.3rem .4rem; border-bottom:1px solid rgba(255,255,255,.08); text-align:left; }
.macro-impact-table td { padding:.32rem .4rem; border-bottom:1px solid rgba(255,255,255,.04); }
.macro-impact-table tr:last-child td { border-bottom:none; }

/* Impact badges */
.macro-badge { display:inline-block; padding:.18rem .55rem; border-radius:999px; font-size:.76rem; font-weight:700; }
.badge-pos-strong { background:rgba(46,204,113,.2);  color:#2ecc71; }
.badge-pos        { background:rgba(52,152,219,.2);  color:#3498db; }
.badge-neu        { background:rgba(255,255,255,.07); color:#999; }
.badge-neg        { background:rgba(230,126,34,.2);  color:#e67e22; }
.badge-neg-strong { background:rgba(231,76,60,.2);   color:#e74c3c; }

/* KPI grid (existing FRED data) */
.macro-kpi-grid { display:flex; flex-direction:column; gap:1rem; }
.macro-section { }
.macro-section-sub { margin:0 0 .6rem; font-size:.83rem; font-weight:600; color:#ccc; }
.macro-kpis { display:flex; flex-wrap:wrap; gap:.6rem; }
.macro-kpi { padding:.55rem .8rem; border-radius:8px; border:1px solid rgba(255,255,255,.08); min-width:140px; }
.macro-kpi.kpi-ok { border-color:rgba(46,204,113,.3); background:rgba(46,204,113,.06); }
.macro-kpi.kpi-warn { border-color:rgba(241,196,15,.3); background:rgba(241,196,15,.06); }
.macro-kpi.kpi-danger { border-color:rgba(231,76,60,.3); background:rgba(231,76,60,.06); }
.kpi-label { font-size:.72rem; color:#999; margin-bottom:.15rem; }
.kpi-value { font-size:1.1rem; font-weight:700; }
.kpi-meta { font-size:.68rem; color:#777; margin-top:.1rem; }

.macro-loading { color:#777; font-style:italic; font-size:.85rem; }

/* ── AI Decision Engine ─────────────────────────────────────────────────── */
.de-container { max-width: 1200px; margin: 0 auto; padding: 0 0 40px; }
.de-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.de-title { margin: 0; font-size: 1.6rem; font-weight: 700; color: var(--text-primary); }
.de-subtitle { margin: 4px 0 0; font-size: 0.85rem; color: var(--text-muted); }
.de-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.de-btn { padding: 8px 18px; border-radius: 6px; border: none; cursor: pointer; font-size: 0.9rem; font-weight: 600; background: var(--accent-blue); color: #fff; transition: opacity 0.15s; }
.de-btn:hover { opacity: 0.85; }
.de-btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.de-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; gap: 16px; color: var(--text-muted); }
.de-spinner { width: 40px; height: 40px; border: 4px solid var(--border-color); border-top-color: var(--accent-blue); border-radius: 50%; animation: de-spin 0.8s linear infinite; }
@keyframes de-spin { to { transform: rotate(360deg); } }
.de-section-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin: 28px 0 12px; padding-left: 10px; border-left: 3px solid var(--accent-blue); }
.de-score-row { display: grid; grid-template-columns: 220px 1fr 1fr; gap: 16px; margin-bottom: 24px; }
@media(max-width:800px) { .de-score-row { grid-template-columns: 1fr; } }
.de-score-card, .de-exposure-card, .de-summary-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; }
.de-score-card { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.de-score-ring-wrap { position: relative; width: 120px; height: 120px; }
.de-score-ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.de-ring-bg { fill: none; stroke: var(--border-color); stroke-width: 10; }
.de-ring-fill { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.8s ease, stroke 0.4s; }
.de-score-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; }
.de-score-num { font-size: 2rem; font-weight: 800; color: var(--text-primary); }
.de-score-label { font-size: 0.75rem; color: var(--text-muted); }
.de-score-meta { text-align: center; width: 100%; }
.de-mode-badge { display: inline-block; padding: 5px 14px; border-radius: 20px; color: #fff; font-weight: 700; font-size: 0.9rem; letter-spacing: 0.5px; margin-bottom: 8px; }
.de-signal-chip { display: inline-block; padding: 4px 12px; border-radius: 16px; color: #fff; font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; }
.de-confidence { font-size: 0.78rem; color: var(--text-muted); }
.de-exposure-card h3 { margin: 0 0 14px; font-size: 0.95rem; }
.de-exposure-bar { display: flex; height: 28px; border-radius: 14px; overflow: hidden; margin-bottom: 8px; background: var(--border-color); }
.de-exposure-invest { background: #2ecc71; transition: width 0.6s ease; }
.de-exposure-cash { background: #95a5a6; transition: width 0.6s ease; }
.de-exposure-labels { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--text-muted); }
.de-reasons { margin-top: 14px; }
.de-reason { font-size: 0.8rem; color: var(--text-muted); padding: 3px 0; }
.de-summary-card h3 { margin: 0 0 10px; font-size: 0.95rem; }
.de-summary-card p { margin: 0; font-size: 0.88rem; line-height: 1.6; color: var(--text-primary); }
.de-generated-at { margin-top: 10px !important; font-size: 0.75rem !important; color: var(--text-muted) !important; }
.de-alerts-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.de-alert { padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; font-weight: 500; border-left: 4px solid; }
.de-alert-red { background: rgba(231,76,60,0.12); border-color: #e74c3c; color: var(--text-primary); }
.de-alert-orange { background: rgba(230,126,34,0.12); border-color: #e67e22; color: var(--text-primary); }
.de-signals-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 8px; }
@media(max-width:700px) { .de-signals-grid { grid-template-columns: 1fr; } }
.de-signal-box { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; min-height: 120px; }
.de-signal-box-title { font-size: 0.85rem; font-weight: 700; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color); }
.de-buy-box .de-signal-box-title { color: #2ecc71; }
.de-wait-box .de-signal-box-title { color: #f1c40f; }
.de-reduce-box .de-signal-box-title { color: #e74c3c; }
.de-ticker-list { display: flex; flex-direction: column; gap: 8px; }
.de-ticker-item { display: flex; align-items: flex-start; gap: 10px; }
.de-ticker-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.de-ticker-info { display: flex; flex-direction: column; gap: 2px; }
.de-ticker-name { font-weight: 700; font-size: 0.88rem; color: var(--text-primary); }
.de-ticker-score { font-size: 0.75rem; color: var(--text-muted); }
.de-ticker-summary { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }
.de-sectors-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 8px; }
@media(max-width:600px) { .de-sectors-row { grid-template-columns: 1fr; } }
.de-sectors-box { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; }
.de-sectors-head { font-weight: 700; font-size: 0.9rem; margin-bottom: 12px; }
.de-sectors-best .de-sectors-head { color: #2ecc71; }
.de-sectors-worst .de-sectors-head { color: #e74c3c; }
.de-sector-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border-color); font-size: 0.85rem; }
.de-sector-row:last-child { border-bottom: none; }
.de-sector-score { font-weight: 700; padding: 2px 8px; border-radius: 10px; font-size: 0.8rem; }
.de-sector-good { background: rgba(46,204,113,0.15); color: #2ecc71; }
.de-sector-bad { background: rgba(231,76,60,0.15); color: #e74c3c; }
.de-breakdown-table-wrap { overflow-x: auto; }
.de-breakdown-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.de-breakdown-table th { text-align: left; padding: 10px 12px; background: var(--table-header-bg); color: var(--text-muted); font-weight: 600; border-bottom: 2px solid var(--border-color); }
.de-breakdown-table td { padding: 9px 12px; border-bottom: 1px solid var(--border-color); color: var(--text-primary); }
.de-breakdown-table tfoot td { font-size: 0.9rem; padding: 12px; border-top: 2px solid var(--border-color); }
.de-score-pill { padding: 2px 8px; border-radius: 10px; font-weight: 700; font-size: 0.8rem; color: #111; }
.de-empty { color: var(--text-muted); font-size: 0.82rem; padding: 8px 0; }

/* ── AI Prediction Engine ─────────────────────────────────────────────────── */
.pred-container{max-width:1200px;margin:0 auto;padding:0 0 40px}.pred-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:24px;gap:16px;flex-wrap:wrap}.pred-title{margin:0;font-size:1.6rem;font-weight:700;color:var(--text-primary)}.pred-subtitle{margin:4px 0 0;font-size:.85rem;color:var(--text-muted)}.pred-actions{display:flex;gap:10px;flex-wrap:wrap}.pred-btn{padding:8px 18px;border-radius:6px;border:none;cursor:pointer;font-size:.9rem;font-weight:600;background:var(--accent-blue);color:#fff;transition:opacity .15s}.pred-btn:hover{opacity:.85}.pred-btn-outline{background:transparent;border:1px solid var(--border-color);color:var(--text-primary)}.pred-loading{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:200px;gap:16px;color:var(--text-muted)}.pred-spinner{width:40px;height:40px;border:4px solid var(--border-color);border-top-color:var(--accent-blue);border-radius:50%;animation:pred-spin .8s linear infinite}@keyframes pred-spin{to{transform:rotate(360deg)}}.pred-section-title{font-size:1rem;font-weight:700;color:var(--text-primary);margin:28px 0 12px;padding-left:10px;border-left:3px solid var(--accent-blue)}.pred-empty{color:var(--text-muted);font-size:.82rem;padding:8px 0}.pred-market-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:8px}@media(max-width:800px){.pred-market-grid{grid-template-columns:repeat(2,1fr)}}@media(max-width:500px){.pred-market-grid{grid-template-columns:1fr 1fr}}.pred-market-card{background:var(--card-bg);border:1px solid var(--border-color);border-radius:10px;padding:14px;text-align:center}.pred-market-label{font-size:.78rem;color:var(--text-muted);margin-bottom:6px}.pred-market-prob{font-size:1.6rem;font-weight:800;margin-bottom:8px}.pred-bar-wrap{height:4px;background:var(--border-color);border-radius:2px;overflow:hidden}.pred-bar-fill{height:100%;border-radius:2px;transition:width .6s ease}.pred-warnings-list{display:flex;flex-direction:column;gap:8px;margin-bottom:8px}.pred-warning{padding:10px 14px;border-radius:8px;font-size:.85rem;font-weight:500;border-left:4px solid;color:var(--text-primary)}.pred-two-col{display:grid;grid-template-columns:1fr 1fr;gap:16px}@media(max-width:640px){.pred-two-col{grid-template-columns:1fr}}.pred-signal-list{display:flex;flex-direction:column;gap:8px}.pred-signal-item{display:grid;grid-template-columns:1fr auto auto auto;align-items:center;gap:10px;background:var(--card-bg);border:1px solid var(--border-color);border-radius:8px;padding:10px 12px;cursor:pointer;transition:border-color .15s}.pred-signal-item:hover{border-color:var(--accent-blue)}.pred-si-ticker{font-weight:700;font-size:.9rem;color:var(--text-primary)}.pred-si-prob{font-weight:800;font-size:1rem}.pred-si-label,.pred-si-conf{font-size:.75rem;color:var(--text-muted)}.pred-sectors-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}@media(max-width:800px){.pred-sectors-grid{grid-template-columns:repeat(2,1fr)}}.pred-sector-card{background:var(--card-bg);border:1px solid var(--border-color);border-radius:10px;padding:12px}.pred-sec-name{font-size:.78rem;color:var(--text-muted);margin-bottom:4px;text-transform:capitalize}.pred-sec-score{font-size:1.3rem;font-weight:800;margin-bottom:8px}.pred-sec-probs{display:flex;flex-direction:column;gap:2px;font-size:.75rem}.pred-watchlist-wrap{overflow-x:auto}.pred-table{width:100%;border-collapse:collapse;font-size:.84rem}.pred-table th{text-align:left;padding:10px;background:var(--table-header-bg);color:var(--text-muted);font-weight:600;border-bottom:2px solid var(--border-color);white-space:nowrap}.pred-table td{padding:9px 10px;border-bottom:1px solid var(--border-color);color:var(--text-primary)}.pred-table tbody tr:hover{background:var(--hover-bg)}.pred-tl-dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:6px;vertical-align:middle}.pred-accuracy-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}@media(max-width:700px){.pred-accuracy-grid{grid-template-columns:1fr 1fr}}.pred-acc-card{background:var(--card-bg);border:1px solid var(--border-color);border-radius:10px;padding:14px}.pred-acc-label{font-size:.78rem;color:var(--text-muted);margin-bottom:6px}.pred-acc-val{font-size:1rem;font-weight:700;color:var(--text-primary)}.pred-acc-small{font-size:.8rem;font-weight:500}.pred-acc-n{font-size:.75rem;color:var(--text-muted);font-weight:400}.pred-popup-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.6);z-index:1000;display:flex;align-items:center;justify-content:center;padding:20px}.pred-popup{background:var(--card-bg);border:1px solid var(--border-color);border-radius:14px;padding:24px;max-width:560px;width:100%;max-height:90vh;overflow-y:auto;position:relative}.pred-popup-close{position:absolute;top:14px;right:14px;background:none;border:none;font-size:1.1rem;cursor:pointer;color:var(--text-muted);padding:4px 8px;border-radius:4px}.pred-popup-close:hover{background:var(--border-color)}
/* AI Coach */
.ai-coach-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 56px;
  color: #f4f8fb;
}

.ai-coach-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  margin-bottom: 22px;
}

.ai-coach-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(44px, 7vw, 86px);
  line-height: .95;
  color: #ffffff;
}

.ai-coach-hero p {
  margin: 0;
  max-width: 820px;
  color: #a9bac4;
  font-size: 19px;
  line-height: 1.45;
}

.ai-coach-hero .eyebrow {
  margin-bottom: 12px;
  color: #45d9f4;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

#ai-coach-refresh {
  background: #2597b3;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 15px 20px;
  font-weight: 900;
  cursor: pointer;
}

.ai-coach-status {
  margin: 0 0 18px;
  color: #8ea3ad;
  font-weight: 800;
}

.ai-coach-card {
  background: #0f1c22;
  border: 1px solid #2c414b;
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .16);
}

.ai-coach-summary-card {
  border-left: 6px solid #45d9f4;
  margin-bottom: 18px;
}

.ai-coach-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.ai-coach-card-head span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(69, 217, 244, .14);
  color: #45d9f4;
  font-weight: 900;
}

.ai-coach-card h2,
.ai-coach-card h3 {
  margin: 0;
  color: #ffffff;
}

.ai-coach-card h2 {
  font-size: 24px;
}

.ai-coach-card h3 {
  margin-top: 20px;
  font-size: 16px;
  color: #a9bac4;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ai-coach-summary p,
.ai-coach-card p,
.ai-coach-card li {
  color: #d7e2e8;
  font-size: 17px;
  line-height: 1.5;
}

.ai-coach-summary p {
  margin: 0 0 8px;
}

.ai-coach-card ul {
  margin: 0;
  padding-left: 20px;
}

.ai-coach-card li + li {
  margin-top: 10px;
}

.ai-coach-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.ai-coach-lesson-card {
  grid-column: 1 / -1;
}

.ai-coach-disclaimer {
  margin-top: 18px;
  color: #8ea3ad;
  font-size: 14px;
  font-weight: 800;
}

@media (max-width: 760px) {
  .ai-coach-page {
    padding: 22px 14px 44px;
  }

  .ai-coach-hero,
  .ai-coach-grid {
    grid-template-columns: 1fr;
  }

  #ai-coach-refresh {
    width: 100%;
  }

  .ai-coach-card {
    padding: 18px;
  }

  .ai-coach-card h2 {
    font-size: 20px;
  }
}
/* Alert Center Pro */
.alerts-center-page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 24px 60px;
  color: #f4f8fb;
}

.alerts-center-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
}

.alerts-center-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(44px, 7vw, 84px);
  line-height: .95;
  color: #fff;
}

.alerts-center-hero p {
  margin: 0;
  max-width: 860px;
  color: #a9bac4;
  font-size: 19px;
  line-height: 1.45;
}

.alerts-center-hero .eyebrow {
  margin-bottom: 12px;
  color: #45d9f4;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

#alerts-refresh {
  background: #2597b3;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 15px 20px;
  font-weight: 900;
  cursor: pointer;
}

.alerts-status {
  margin: 0 0 18px;
  color: #8ea3ad;
  font-weight: 800;
}

.alerts-summary-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  background: #0f1c22;
  border: 1px solid #2c414b;
  border-left: 6px solid #45d9f4;
  border-radius: 8px;
  padding: 22px;
  margin-bottom: 20px;
}

.summary-label {
  display: block;
  color: #45d9f4;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.alerts-summary-card p {
  margin: 0;
  color: #d7e2e8;
  font-size: 18px;
  line-height: 1.5;
}

.alerts-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  gap: 10px;
}

.alerts-kpis div {
  background: #13262e;
  border: 1px solid #2c414b;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.alerts-kpis strong {
  display: block;
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.alerts-kpis span {
  display: block;
  margin-top: 6px;
  color: #a9bac4;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.alerts-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.alerts-panel {
  background: #0f1c22;
  border: 1px solid #2c414b;
  border-radius: 8px;
  padding: 20px;
}

.alert-critical-panel,
.alert-resolved-panel {
  grid-column: 1 / -1;
}

.alerts-panel h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  color: #fff;
  font-size: 26px;
}

.level-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.level-dot.critical { background: #e03349; }
.level-dot.high { background: #f28c28; }
.level-dot.medium { background: #d6a51d; }
.level-dot.low { background: #8ea3ad; }
.level-dot.resolved { background: #4fd18b; }

.alerts-list {
  display: grid;
  gap: 12px;
}

.alert-card {
  background: #13262e;
  border: 1px solid #2d4651;
  border-left: 5px solid #8ea3ad;
  border-radius: 8px;
  padding: 16px;
}

.alert-card.alert-critical { border-left-color: #e03349; }
.alert-card.alert-high { border-left-color: #f28c28; }
.alert-card.alert-medium { border-left-color: #d6a51d; }
.alert-card.alert-low { border-left-color: #8ea3ad; }

.alert-card-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.alert-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.alert-badge.critical { background: rgba(224, 51, 73, .18); color: #ff7b8b; }
.alert-badge.high { background: rgba(242, 140, 40, .18); color: #ffb25f; }
.alert-badge.medium { background: rgba(214, 165, 29, .18); color: #ffd666; }
.alert-badge.low { background: rgba(142, 163, 173, .18); color: #c4d0d6; }

.alert-source,
.alert-card time,
.alert-meta span {
  color: #9fb1bb;
  font-size: 12px;
  font-weight: 800;
}

.alert-card h3 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 20px;
}

.alert-card p {
  margin: 0 0 12px;
  color: #d7e2e8;
  line-height: 1.45;
}

.alert-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.alert-meta span {
  border: 1px solid #36525d;
  border-radius: 999px;
  padding: 4px 9px;
}

.alert-action {
  color: #b9c8cf;
  font-size: 14px;
  line-height: 1.4;
}

.alert-action strong {
  color: #45d9f4;
}

.alerts-empty,
.alerts-disclaimer {
  color: #8ea3ad;
  font-weight: 800;
}

.alerts-disclaimer {
  margin-top: 18px;
  font-size: 14px;
}

@media (max-width: 820px) {
  .alerts-center-page {
    padding: 22px 14px 44px;
  }

  .alerts-center-hero,
  .alerts-summary-card,
  .alerts-section-grid {
    grid-template-columns: 1fr;
  }

  #alerts-refresh {
    width: 100%;
  }

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

  .alert-critical-panel,
  .alert-resolved-panel {
    grid-column: auto;
  }
}
/* Scenario Simulator */
.scenario-page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 24px 60px;
  color: #f4f8fb;
}

.scenario-hero {
  margin-bottom: 22px;
}

.scenario-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(42px, 7vw, 82px);
  line-height: .95;
  color: #fff;
}

.scenario-hero p {
  margin: 0;
  max-width: 860px;
  color: #a9bac4;
  font-size: 19px;
  line-height: 1.45;
}

.scenario-hero .eyebrow {
  margin-bottom: 12px;
  color: #45d9f4;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.scenario-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(160px, .6fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  background: #0f1c22;
  border: 1px solid #2c414b;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
}

.scenario-form label {
  display: grid;
  gap: 7px;
  color: #a9bac4;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.scenario-form select,
.scenario-form input {
  width: 100%;
  background: #101c22;
  color: #f4f8fb;
  border: 1px solid #314a55;
  border-radius: 8px;
  padding: 13px 14px;
  font-size: 16px;
}

.scenario-form button {
  background: #2597b3;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 14px 20px;
  font-weight: 900;
  cursor: pointer;
}

.scenario-status {
  margin: 0 0 16px;
  color: #8ea3ad;
  font-weight: 800;
}

.scenario-impact-card,
.scenario-panel {
  background: #0f1c22;
  border: 1px solid #2c414b;
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .16);
}

.scenario-impact-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  border-left: 6px solid #45d9f4;
  padding: 24px;
  margin-bottom: 18px;
}

.scenario-label {
  display: block;
  color: #45d9f4;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}

.scenario-impact-card h2 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 46px;
  line-height: 1;
}

.scenario-impact-card p {
  margin: 0;
  color: #d7e2e8;
  font-size: 17px;
  line-height: 1.45;
}

.scenario-risk-pill,
.scenario-risk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 900;
  text-transform: uppercase;
}

.scenario-risk-pill {
  min-width: 120px;
  padding: 12px 16px;
  background: rgba(142, 163, 173, .18);
  color: #c4d0d6;
}

.scenario-risk {
  padding: 4px 9px;
  font-size: 12px;
}

.scenario-risk-pill.critico,
.scenario-risk.critico { background: rgba(224, 51, 73, .18); color: #ff7b8b; }
.scenario-risk-pill.alto,
.scenario-risk.alto { background: rgba(242, 140, 40, .18); color: #ffb25f; }
.scenario-risk-pill.medio,
.scenario-risk.medio { background: rgba(214, 165, 29, .18); color: #ffd666; }
.scenario-risk-pill.basso,
.scenario-risk.basso { background: rgba(79, 209, 139, .16); color: #74e7aa; }

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.scenario-panel {
  padding: 20px;
}

.scenario-panel h2 {
  margin: 0 0 16px;
  color: #fff;
  font-size: 24px;
}

.scenario-table-wrap {
  overflow-x: auto;
}

.scenario-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.scenario-table th,
.scenario-table td {
  border-bottom: 1px solid #2c414b;
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
}

.scenario-table th {
  color: #9fb1bb;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.scenario-table td {
  color: #d7e2e8;
  font-size: 14px;
  line-height: 1.35;
}

.scenario-table .impact {
  font-weight: 900;
}

.scenario-table .impact.neg {
  color: #ff7b8b;
}

.scenario-table .impact.pos {
  color: #74e7aa;
}

.scenario-list {
  margin: 0;
  padding-left: 20px;
}

.scenario-list li {
  color: #d7e2e8;
  font-size: 16px;
  line-height: 1.45;
}

.scenario-list li + li {
  margin-top: 10px;
}

.scenario-disclaimer {
  margin-top: 18px;
  color: #8ea3ad;
  font-size: 14px;
  font-weight: 800;
}

@media (max-width: 900px) {
  .scenario-page {
    padding: 22px 14px 44px;
  }

  .scenario-form,
  .scenario-impact-card,
  .scenario-grid {
    grid-template-columns: 1fr;
  }

  .scenario-form button {
    width: 100%;
  }

  .scenario-impact-card h2 {
    font-size: 36px;
  }
}

/* Earnings & Event Calendar Pro */
.events-calendar-page {
  min-height: calc(100vh - 74px);
  padding: 34px 26px 56px;
  background: #071014;
  color: #eef7fb;
}

.events-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 20px;
}

.events-kicker {
  margin: 0 0 8px;
  color: #37c8e8;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.events-hero h1 {
  margin: 0;
  color: #f7fbff;
  font-size: clamp(42px, 6vw, 78px);
  line-height: .96;
  letter-spacing: 0;
}

.events-hero p {
  margin: 14px 0 0;
  max-width: 850px;
  color: #aabac3;
  font-size: 18px;
  line-height: 1.4;
}

.events-hero button,
.events-refresh {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  background: #2497ad;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.events-status {
  min-height: 24px;
  margin: 0 0 18px;
  color: #9fb1bb;
  font-size: 14px;
  font-weight: 800;
}

.events-summary-card,
.events-panel {
  border: 1px solid #28424d;
  background: #101b21;
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0,0,0,.16);
}

.events-summary-card {
  padding: 18px 20px;
  margin-bottom: 18px;
  border-left: 5px solid #37c8e8;
}

.events-summary-card h2,
.events-panel h2 {
  margin: 0 0 10px;
  color: #f4fbff;
  font-size: 22px;
  line-height: 1.15;
}

.events-summary-card p {
  margin: 0;
  color: #c7d7df;
  font-size: 16px;
  line-height: 1.45;
}

.events-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.events-panel {
  padding: 18px;
  min-width: 0;
}

.events-wide {
  grid-column: span 2;
}

.events-list {
  display: grid;
  gap: 12px;
}

.event-card {
  border: 1px solid #243944;
  background: #0b151a;
  border-radius: 10px;
  padding: 14px;
  border-left-width: 5px;
}

.event-low { border-left-color: #85939a; }
.event-medium { border-left-color: #d9af2a; }
.event-high { border-left-color: #e0873a; }
.event-critical { border-left-color: #e24a5f; }

.event-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}

.event-date,
.event-type,
.event-meta span {
  color: #95a9b3;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.event-type {
  color: #62d9f3;
}

.event-badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.event-badge.low {
  background: rgba(133,147,154,.18);
  color: #c7d0d5;
}

.event-badge.medium {
  background: rgba(217,175,42,.18);
  color: #ffd76a;
}

.event-badge.high {
  background: rgba(224,135,58,.2);
  color: #ffb36f;
}

.event-badge.critical {
  background: rgba(226,74,95,.22);
  color: #ff8494;
}

.event-card h3 {
  margin: 0 0 8px;
  color: #f5fbff;
  font-size: 18px;
  line-height: 1.2;
}

.event-card p,
.event-impact,
.event-action {
  margin: 0;
  color: #c6d4db;
  font-size: 14px;
  line-height: 1.45;
}

.event-card p + .event-meta,
.event-meta + .event-impact,
.event-impact + .event-action {
  margin-top: 8px;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.event-impact strong,
.event-action strong {
  color: #f1f7fb;
}

.events-empty,
.events-disclaimer {
  color: #8fa1aa;
  font-size: 14px;
  font-weight: 800;
}

.events-disclaimer {
  margin: 18px 0 0;
}

@media (max-width: 900px) {
  .events-calendar-page {
    padding: 24px 14px 48px;
  }

  .events-hero,
  .events-grid {
    grid-template-columns: 1fr;
  }

  .events-wide {
    grid-column: auto;
  }

  .events-hero button {
    width: 100%;
  }
}

/* Signal Quality Control */
.signal-quality-page {
  min-height: calc(100vh - 74px);
  padding: 34px 26px 56px;
  background: #071014;
  color: #eef7fb;
}

.signal-quality-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.signal-quality-kicker {
  margin: 0 0 8px;
  color: #37c8e8;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.signal-quality-hero h1 {
  margin: 0;
  color: #f7fbff;
  font-size: clamp(42px, 6vw, 78px);
  line-height: .96;
}

.signal-quality-hero p {
  margin: 14px 0 0;
  max-width: 900px;
  color: #aabac3;
  font-size: 18px;
  line-height: 1.4;
}

.signal-quality-hero button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 22px;
  background: #2497ad;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.sq-status {
  min-height: 24px;
  margin: 0 0 18px;
  color: #9fb1bb;
  font-size: 14px;
  font-weight: 800;
}

.sq-score-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.sq-score-card,
.sq-summary-card,
.sq-panel {
  border: 1px solid #28424d;
  background: #101b21;
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0,0,0,.16);
}

.sq-score-card {
  padding: 24px;
  border-left: 6px solid #37c8e8;
}

.sq-score-card span {
  display: block;
  color: #9fb1bb;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sq-score-card strong {
  display: block;
  margin-top: 12px;
  font-size: 54px;
  line-height: 1;
  font-weight: 950;
}

.sq-score-card p,
.sq-summary-card p {
  margin: 10px 0 0;
  color: #c7d7df;
  font-size: 16px;
  line-height: 1.45;
}

.sq-good { color: #56df96; }
.sq-mid { color: #ffd76a; }
.sq-bad { color: #ff7f8f; }

.sq-summary-card,
.sq-panel {
  padding: 18px;
}

.sq-summary-card h2,
.sq-panel h2 {
  margin: 0 0 12px;
  color: #f4fbff;
  font-size: 22px;
  line-height: 1.15;
}

.sq-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.sq-wide {
  margin-bottom: 18px;
}

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

.sq-mini-card {
  border: 1px solid #243944;
  background: #0b151a;
  border-left: 5px solid #37c8e8;
  border-radius: 10px;
  padding: 12px;
}

.sq-mini-card.good {
  border-left-color: #56df96;
}

.sq-mini-card.calibration {
  border-left-color: #ffd76a;
}

.sq-mini-card.bad {
  border-left-color: #ff7f8f;
}

.sq-mini-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.sq-mini-top strong {
  color: #f5fbff;
  font-size: 15px;
}

.sq-mini-top span,
.sq-mini-card small {
  color: #95a9b3;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.sq-mini-card p,
.sq-empty {
  margin: 0;
  color: #c6d4db;
  font-size: 14px;
  line-height: 1.45;
}

.sq-table-wrap {
  overflow-x: auto;
}

.sq-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.sq-table th,
.sq-table td {
  border-bottom: 1px solid #2c414b;
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

.sq-table th {
  color: #9fb1bb;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.sq-table td {
  color: #d7e2e8;
  font-size: 14px;
}

.sq-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.sq-pill.good {
  background: rgba(86,223,150,.18);
  color: #56df96;
}

.sq-pill.calibration {
  background: rgba(255,215,106,.18);
  color: #ffd76a;
}

.sq-pill.bad {
  background: rgba(255,127,143,.2);
  color: #ff7f8f;
}

.sq-recommendations {
  margin: 0;
  padding-left: 20px;
}

.sq-recommendations li {
  color: #d7e2e8;
  font-size: 16px;
  line-height: 1.45;
}

.sq-recommendations li + li {
  margin-top: 10px;
}

.sq-disclaimer {
  margin: 18px 0 0;
  color: #8fa1aa;
  font-size: 14px;
  font-weight: 800;
}

@media (max-width: 900px) {
  .signal-quality-page {
    padding: 24px 14px 48px;
  }

  .signal-quality-hero,
  .sq-score-grid,
  .sq-panels {
    grid-template-columns: 1fr;
  }

  .signal-quality-hero button {
    width: 100%;
  }
}

/* Market Regime Memory */
.mrm-page {
  min-height: calc(100vh - 74px);
  padding: 34px 26px 56px;
  background: #071014;
  color: #eef7fb;
}

.mrm-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.mrm-kicker {
  margin: 0 0 8px;
  color: #37c8e8;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.mrm-hero h1 {
  margin: 0;
  color: #f7fbff;
  font-size: clamp(42px, 6vw, 78px);
  line-height: .96;
}

.mrm-hero p {
  margin: 14px 0 0;
  max-width: 980px;
  color: #aabac3;
  font-size: 18px;
  line-height: 1.4;
}

.mrm-hero button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 22px;
  background: #2497ad;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.mrm-status {
  min-height: 24px;
  margin: 0 0 18px;
  color: #9fb1bb;
  font-size: 14px;
  font-weight: 800;
}

.mrm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.mrm-current-grid {
  grid-template-columns: 360px minmax(0, 1fr);
}

.mrm-card,
.mrm-metric,
.mrm-mini-card {
  border: 1px solid #28424d;
  background: #101b21;
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0,0,0,.16);
}

.mrm-card {
  padding: 18px;
  margin-bottom: 18px;
}

.mrm-current-card {
  border-left: 6px solid #37c8e8;
}

.mrm-current-card span,
.mrm-metric span,
.mrm-forward span {
  display: block;
  color: #9fb1bb;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.mrm-current-card strong {
  display: block;
  margin-top: 12px;
  color: #f7fbff;
  font-size: 36px;
  line-height: 1.05;
}

.mrm-card h2 {
  margin: 0 0 12px;
  color: #f4fbff;
  font-size: 22px;
}

.mrm-card p,
.mrm-current-card p,
.mrm-empty {
  margin: 10px 0 0;
  color: #c7d7df;
  font-size: 15px;
  line-height: 1.45;
}

.mrm-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.mrm-metric {
  padding: 14px;
  min-height: 88px;
}

.mrm-metric strong {
  display: block;
  margin-top: 10px;
  color: #f4fbff;
  font-size: 22px;
  line-height: 1.1;
}

.mrm-metric.good strong,
.mrm-table .good,
.mrm-forward.good strong,
.mrm-trend.good {
  color: #56df96;
}

.mrm-metric.mid strong,
.mrm-table .mid,
.mrm-forward.mid strong,
.mrm-trend.mid {
  color: #ffd76a;
}

.mrm-metric.bad strong,
.mrm-table .bad,
.mrm-forward.bad strong,
.mrm-trend.bad {
  color: #ff7f8f;
}

.mrm-forward-grid,
.mrm-list-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.mrm-forward,
.mrm-mini-card {
  border: 1px solid #243944;
  background: #0b151a;
  border-radius: 10px;
  padding: 14px;
}

.mrm-forward strong {
  display: block;
  margin-top: 8px;
  color: #eef7fb;
  font-size: 24px;
}

.mrm-list {
  margin: 0;
  padding-left: 20px;
}

.mrm-list li {
  color: #d7e2e8;
  font-size: 15px;
  line-height: 1.45;
}

.mrm-list li + li {
  margin-top: 8px;
}

.mrm-table-wrap {
  overflow-x: auto;
}

.mrm-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}

.mrm-table th,
.mrm-table td {
  border-bottom: 1px solid #2c414b;
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
}

.mrm-table th {
  color: #9fb1bb;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.mrm-table td {
  color: #d7e2e8;
  font-size: 14px;
}

.mrm-pill,
.mrm-trend {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(55,200,232,.16);
  color: #62d9f3;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.mrm-mini-card strong {
  color: #f5fbff;
  font-size: 16px;
}

.mrm-mini-card p {
  margin-top: 6px;
}

.mrm-disclaimer {
  margin: 18px 0 0;
  color: #8fa1aa;
  font-size: 14px;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .mrm-metrics,
  .mrm-forward-grid,
  .mrm-list-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .mrm-page {
    padding: 24px 14px 48px;
  }

  .mrm-hero,
  .mrm-grid,
  .mrm-current-grid {
    grid-template-columns: 1fr;
  }

  .mrm-hero button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .mrm-metrics,
  .mrm-forward-grid,
  .mrm-list-cards {
    grid-template-columns: 1fr;
  }
}

.exit-rules-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 16px 56px;
  color: #eef7fb;
}

.exit-rules-hero,
.exit-rules-card,
.exit-rules-status,
.exit-rules-kpis article {
  background: #0f1b22;
  border: 1px solid rgba(129, 170, 181, .24);
  border-radius: 12px;
}

.exit-rules-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 28px;
  margin-bottom: 18px;
}

.exit-rules-hero .eyebrow {
  display: block;
  margin-bottom: 10px;
  color: #4bd7f2;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .78rem;
}

.exit-rules-hero h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(2.1rem, 5vw, 4.5rem);
  line-height: .98;
}

.exit-rules-hero p {
  max-width: 780px;
  margin: 16px 0 0;
  color: rgba(230, 244, 248, .72);
  font-size: 1.02rem;
  line-height: 1.55;
}

.exit-rules-hero button {
  min-height: 52px;
  border-radius: 8px;
  padding: 0 22px;
}

.exit-rules-status {
  margin-bottom: 16px;
  padding: 12px 16px;
  color: rgba(230, 244, 248, .72);
  font-weight: 800;
  border-left: 5px solid #4bd7f2;
}

.exit-rules-status.alto,
.exit-rules-status.error { border-left-color: #ff6b7c; }
.exit-rules-status.medio { border-left-color: #f1c75b; }
.exit-rules-status.basso { border-left-color: #37d67a; }

.exit-rules-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.exit-rules-kpis article {
  padding: 18px;
  min-height: 112px;
}

.exit-rules-kpis span,
.exit-rules-card h2 {
  color: rgba(230, 244, 248, .62);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 900;
  font-size: .78rem;
}

.exit-rules-kpis strong {
  display: block;
  margin-top: 10px;
  color: #fff;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.exit-rules-card {
  padding: 22px;
  margin-bottom: 18px;
}

.exit-rules-card h2 {
  margin: 0 0 16px;
  color: rgba(230, 244, 248, .76);
  font-size: .86rem;
}

.exit-rules-card p,
.exit-rules-disclaimer {
  color: rgba(230, 244, 248, .72);
  line-height: 1.55;
}

.exit-rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.exit-mini {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(129, 170, 181, .18);
  border-left: 4px solid #4bd7f2;
}

.exit-mini + .exit-mini {
  margin-top: 12px;
}

.exit-mini.sell { border-left-color: #ff6b7c; }
.exit-mini.reduce { border-left-color: #f1c75b; }
.exit-mini.take_profit { border-left-color: #4bd7f2; }
.exit-mini.hold { border-left-color: #37d67a; }

.exit-mini strong {
  color: #fff;
  font-size: 1.02rem;
}

.exit-mini span {
  display: block;
  margin-top: 2px;
  color: rgba(230, 244, 248, .58);
  font-size: .82rem;
}

.exit-mini b {
  color: #fff;
}

.exit-mini p {
  grid-column: 1 / -1;
  margin: 0;
  font-size: .9rem;
}

.exit-rules-table {
  min-width: 1320px;
  width: 100%;
  border-collapse: collapse;
}

.exit-rules-table th,
.exit-rules-table td {
  border-bottom: 1px solid rgba(129, 170, 181, .18);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
}

.exit-rules-table th {
  color: rgba(230, 244, 248, .58);
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.exit-rules-table td {
  color: rgba(230, 244, 248, .82);
  font-size: .88rem;
}

.exit-rules-table .pos { color: #76f0a6; font-weight: 900; }
.exit-rules-table .neg { color: #ff8f9d; font-weight: 900; }

.exit-signal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.exit-signal.sell { background: rgba(255,107,124,.16); color: #ff8f9d; }
.exit-signal.reduce { background: rgba(241,199,91,.16); color: #ffd979; }
.exit-signal.take_profit { background: rgba(75,215,242,.14); color: #67e4f8; }
.exit-signal.hold { background: rgba(55,214,122,.14); color: #76f0a6; }

.exit-rules-disclaimer {
  margin: 8px 0 0;
  text-align: center;
  font-size: .82rem;
}

@media (max-width: 900px) {
  .exit-rules-hero,
  .exit-rules-grid {
    grid-template-columns: 1fr;
  }
  .exit-rules-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .exit-rules-hero button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .exit-rules-page {
    padding: 18px 10px 42px;
  }
  .exit-rules-hero,
  .exit-rules-card {
    padding: 18px;
  }
  .exit-rules-kpis {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════
   IPHONE / MOBILE — GLOBAL PASS
   Runs at ≤767px; safe-area + touch target improvements
   ════════════════════════════════════════════════════ */

/* ── Touch targets: all interactive elements ≥ 44px ── */
@media (max-width: 767px) {
  a, button, [role="button"], input[type="submit"],
  input[type="button"], label[for], select {
    min-height: 44px;
  }
  /* Inline links inside paragraphs should keep natural height */
  p a, li a, td a, .rrs-item, .rrt-action-btn,
  .rrt-hamburger { min-height: unset; }
  .rrs-item { min-height: 36px; }
  .rrt-action-btn { min-height: 32px; }
  .rrt-hamburger { min-height: 36px; }

  /* Section headings padding */
  section h2:first-child { margin-top: 0; }
}

/* ── Portfolio section mobile stack ── */
@media (max-width: 600px) {
  .portfolio-grid,
  .portfolio-summary-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .portfolio-metals-total,
  .portfolio-crypto-total,
  .portfolio-eur-total {
    padding: 12px !important;
    border-radius: 8px !important;
  }
}

/* ── Concentration table responsive ── */
@media (max-width: 600px) {
  #concentration-table { font-size: 12px; }
  #concentration-table th, #concentration-table td { padding: 7px 6px; }
}

/* ── Form add-ticker on dashboard ── */
@media (max-width: 600px) {
  form[action="/watchlist/add"] {
    display: flex;
    gap: 8px;
  }
  form[action="/watchlist/add"] input[type="text"] {
    flex: 1;
    min-width: 0;
  }
  form[action="/watchlist/add"] button {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ── Table overflow fix for pages with no table-wrap ── */
@media (max-width: 767px) {
  .table-wrap, table { -webkit-overflow-scrolling: touch; }
  /* Tables without wrapper should scroll horizontally */
  section > table, div > table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── intraday / swing dashboard cards ── */
@media (max-width: 600px) {
  .id-news-radar { font-size: 12px; }
  .id-news-row { flex-direction: column; align-items: flex-start !important; gap: 4px !important; }
  .id-ticker-row { font-size: 12px; }
}

/* ── Reasoning page ── */
@media (max-width: 600px) {
  .reasoning-grid,
  .reasoning-cols { grid-template-columns: 1fr !important; }
}

/* ── Command Center ── */
@media (max-width: 600px) {
  .cc-decision-meta { min-width: 0; }
  .cc-prob-item { min-width: 60px; padding: 8px 4px; }
}

/* ── Mode overlay cards — full-screen on phone ── */
@media (max-width: 540px) {
  .rr-mode-box {
    padding: 24px 16px;
    border-radius: 14px;
    width: calc(100vw - 24px);
  }
  .rr-mode-card { padding: 16px 10px; }
  .rr-mode-card-emoji { font-size: 1.8rem; margin-bottom: 6px; }
  .rr-mode-card-name { font-size: .85rem; }
  .rr-mode-card-desc { font-size: .66rem; }
}

/* ── Investment / Swing engine page ── */
@media (max-width: 600px) {
  .inv-ticker-grid,
  .sw-ticker-grid { grid-template-columns: 1fr !important; }
  .inv-ticker-card,
  .sw-ticker-card { padding: 14px !important; }
}

/* ── Decision Engine page ── */
@media (max-width: 600px) {
  .de-grid { grid-template-columns: 1fr !important; }
  .de-module { padding: 12px !important; }
}

/* ── Breadcrumb topbar: ellipsis on long titles ── */
@media (max-width: 767px) {
  .rrt-crumb-current {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ── Scrollable horizontal tables: momentum + indicator ── */
.table-wrap {
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: none;
}
.table-wrap::-webkit-scrollbar { height: 4px; }
.table-wrap::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 2px; }

/* ── AI Reasoning page waterfall ── */
@media (max-width: 600px) {
  .reasoning-waterfall { font-size: 12px; padding: 10px !important; }
  .reasoning-committee-member { font-size: 12px; }
}

/* ── Portfolio add form (dashboard bottom) ── */
@media (max-width: 600px) {
  .portfolio-form, form.portfolio-entry {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .portfolio-form input, form.portfolio-entry input {
    font-size: 15px !important;
  }
}
