:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(60, 60, 67, 0.14);
  --accent: #0071e3;
  --accent-2: #30d158;
  --good: #16803c;
  --bad: #d70015;
  --warn: #b76e00;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 42%, #eef2f6 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, sans-serif;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px clamp(18px, 4vw, 48px) 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  font-weight: 800;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 10px;
  padding: 5px 10px;
  border: 1px solid rgba(0, 113, 227, 0.22);
  border-radius: 999px;
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.client-error-status {
  margin: 0 24px 12px;
  padding: 10px 14px;
  border: 1px solid #ff9f0a;
  border-radius: 10px;
  background: #fff7e6;
  color: #7a3f00;
  font-size: 13px;
  font-weight: 700;
}

h2 {
  font-size: 19px;
  font-weight: 760;
}

.status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.status .sr-status {
  display: none;
}

.status span,
.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px);
}

.status-action {
  min-height: 0;
  border: 1px solid rgba(0, 113, 227, 0.22);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.status-action:hover {
  background: rgba(0, 113, 227, 0.14);
}

.primary-status-action {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.primary-status-action:hover {
  background: #303033;
}

.status-menu {
  position: relative;
}

.status-menu summary {
  min-height: 0;
  border: 1px solid rgba(0, 113, 227, 0.22);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.status-menu summary::-webkit-details-marker {
  display: none;
}

.status-menu-panel {
  position: absolute;
  right: 0;
  z-index: 40;
  display: grid;
  min-width: 170px;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.status-menu-panel .status-action {
  width: 100%;
  justify-content: center;
}

.faq-dialog {
  display: none;
  flex-direction: column;
  width: min(760px, calc(100vw - 32px));
  height: min(760px, calc(100dvh - 32px));
  max-height: min(760px, calc(100vh - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.faq-dialog[open] {
  display: flex;
}

.faq-dialog::backdrop {
  background: rgba(20, 20, 24, 0.34);
  backdrop-filter: blur(5px);
}

.faq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.faq-head span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.faq-head h2,
.faq-content h3,
.faq-content p {
  margin: 0;
}

.faq-head h2 {
  margin-top: 4px;
  font-size: 24px;
}

.faq-close {
  width: 38px;
  min-width: 38px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

/* Ricerca dentro la guida. Sta fra l'intestazione e le voci, resta ferma
   mentre l'elenco sotto scorre. */
.faq-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px 10px;
  flex: 0 0 auto;
}

.faq-search input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel, transparent);
  color: inherit;
  font: inherit;
  font-size: 14px;
}

.faq-search input:focus {
  outline: none;
  border-color: var(--accent, currentColor);
}

.faq-search span {
  font-size: 12px;
  opacity: 0.65;
  white-space: nowrap;
}

.faq-content mark {
  background: rgba(255, 214, 0, 0.35);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.faq-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 24px 24px;
}

.faq-content section {
  padding: 16px 18px 16px 0;
  border-bottom: 1px solid var(--line);
}

.faq-content section:nth-child(even) {
  padding-right: 0;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.faq-content h3 {
  margin-bottom: 6px;
  font-size: 15px;
}

.faq-content p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 680px) {
  .faq-content {
    grid-template-columns: 1fr;
  }

  .faq-content section,
  .faq-content section:nth-child(even) {
    padding: 15px 0;
    border-left: 0;
  }
}

.notify-action {
  position: relative;
}

.notification-badge {
  position: absolute;
  right: -5px;
  bottom: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 11px;
  line-height: 14px;
  font-weight: 850;
  text-align: center;
}

.app-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px clamp(18px, 4vw, 48px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 245, 247, 0.78);
  backdrop-filter: blur(22px);
}

.nav-group {
  position: relative;
  display: inline-flex;
}

.nav-group > button::after {
  content: "⌄";
  margin-left: 7px;
  color: currentColor;
  font-size: 11px;
}

.nav-submenu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  display: none;
  min-width: 230px;
  margin-top: 2px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.nav-group:hover .nav-submenu,
.nav-group:focus-within .nav-submenu {
  display: grid;
  gap: 4px;
}

.nav-group.menu-suppressed .nav-submenu {
  display: none !important;
}

.nav-submenu button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  white-space: nowrap;
}

.nav-group.active > button {
  background: var(--ink);
  color: #fff;
}

button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 720;
  cursor: pointer;
}

button.active {
  background: var(--ink);
  color: #fff;
}

.sort-button,
.sale-sort-button,
.div-sort-button,
.total-div-sort-button,
.lookthrough-sort-button,
.lookthrough-summary-sort-button {
  min-height: auto;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
  text-transform: inherit;
}

.sort-button.active-sort,
.sale-sort-button.active-sort,
.div-sort-button.active-sort,
.total-div-sort-button.active-sort,
.lookthrough-sort-button.active-sort,
.lookthrough-summary-sort-button.active-sort {
  background: transparent;
  color: var(--accent);
}

.sort-button.active-sort::after,
.sale-sort-button.active-sort::after,
.div-sort-button.active-sort::after,
.total-div-sort-button.active-sort::after,
.lookthrough-sort-button.active-sort::after,
.lookthrough-summary-sort-button.active-sort::after {
  /* La freccia sostituisce le parole "asc" e "desc": erano larghe in modo
     diverso l'una dall'altra, e cambiando ordinamento le colonne si
     spostavano. Il carattere e' sempre lo stesso e la casella ha una
     larghezza dichiarata, cosi' nessuna intestazione cambia misura. */
  content: attr(data-direction);
  color: var(--muted);
  font-size: 10px;
}

main {
  padding: 24px clamp(18px, 4vw, 48px) 48px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.metrics {
  display: grid;
  /* 250px invece di 210: con dodici riquadri su due file i valori a sei cifre
     (valore totale, di carico, di mercato) uscivano dal riquadro. */
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.metric {
  min-height: 126px;
  padding: 18px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.metric > span {
  color: #3a3a3c;
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin: 11px 0 8px;
  font-size: clamp(22px, 2.5vw, 33px);
  line-height: 1;
  font-weight: 800;
}

.metric.primary {
  background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
  border-color: rgba(0, 113, 227, 0.26);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 18px;
  margin-bottom: 18px;
}

.watch-layout {
  grid-template-columns: minmax(0, 1.38fr) minmax(280px, 0.62fr);
}

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

.panel.wide {
  min-height: 360px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

/* Il blocco del titolo si prende tutto lo spazio che avanza e puo' anche
   restringersi. Serve a due cose: un nome di file lungo non schiaccia piu' i
   comandi accanto, e soprattutto i riquadri a destra restano sempre attaccati
   fra loro invece di allontanarsi quando il testo a sinistra e' corto. */
.panel-head > div:first-child { min-width: 0; flex: 1 1 auto; }
.panel-head .coverage-note { overflow-wrap: anywhere; }

.panel-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.form-grid input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.form-actions button {
  border: 1px solid rgba(0, 113, 227, 0.35);
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}

.form-actions button:first-child,
.form-actions .primary-action {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.cloud-login-fallback {
  display: none;
  margin-top: 12px;
}

.cloud-login-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--ink);
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
  cursor: pointer;
}

.cloud-save-state {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cloud-save-state span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cloud-save-state span.is-ok {
  border-color: rgba(52, 199, 89, 0.28);
  background: rgba(52, 199, 89, 0.08);
  color: var(--good);
}

.cloud-save-state span.is-warning {
  border-color: rgba(255, 149, 0, 0.34);
  background: rgba(255, 149, 0, 0.1);
  color: #9a5a00;
}

.cloud-backup-panel {
  grid-column: 1 / -1;
}

.movement-history-panel {
  grid-column: 1 / -1;
}

.movement-history-tabs {
  width: max-content;
  max-width: 100%;
  margin-bottom: 12px;
}

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

.movement-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(100px, auto) minmax(116px, auto) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.movement-row.dividend {
  border-left-color: var(--good);
}

.movement-row strong,
.movement-row span,
.movement-row small {
  display: block;
}

.movement-row strong {
  margin-bottom: 3px;
  font-size: 14px;
}

.movement-row span,
.movement-row small {
  color: var(--muted);
  font-size: 12px;
}

.movement-amount {
  text-align: right;
}

.movement-amount span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.movement-amount strong {
  white-space: nowrap;
}

.movement-state {
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.movement-state.is-saved {
  border-color: rgba(52, 199, 89, 0.28);
  background: rgba(52, 199, 89, 0.09);
  color: var(--good);
}

.movement-state.is-pending {
  border-color: rgba(255, 149, 0, 0.34);
  background: rgba(255, 149, 0, 0.1);
  color: #9a5a00;
}

.movement-state.is-error {
  border-color: rgba(215, 0, 21, 0.28);
  background: rgba(215, 0, 21, 0.08);
  color: var(--bad);
}

.movement-edit {
  min-height: 32px;
  border: 1px solid rgba(0, 113, 227, 0.24);
  border-radius: 8px;
  padding: 0 11px;
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

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

.cloud-backup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.cloud-backup-row strong,
.cloud-backup-row span,
.cloud-backup-row small {
  display: block;
}

.cloud-backup-row small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.cloud-backup-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cloud-backup-actions button {
  border: 1px solid rgba(0, 113, 227, 0.28);
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.segmented,
.mini-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 248, 250, 0.86);
}

.segmented {
  max-width: 100%;
}

/* Nel riquadro Dettaglio strumento le schede stanno accanto ai comandi:
   si dispongono anche loro su due righe e restano centrate in altezza. */
.panel-head .segmented { align-content: center; }

.segmented button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.segmented button.active {
  border-color: rgba(0, 113, 227, 0.22);
  background: var(--ink);
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.15fr) minmax(220px, 0.85fr);
  gap: 18px;
  align-items: start;
}

canvas {
  width: 100%;
  max-width: 680px;
  height: auto;
}

.chart-box {
  position: relative;
  min-height: 380px;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  display: grid;
  gap: 6px;
  max-width: 280px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  pointer-events: none;
}

.chart-tooltip strong,
.chart-tooltip span {
  display: block;
  font-size: 15px;
  line-height: 1.25;
}

.chart-tooltip span {
  color: var(--muted);
}

.legend,
.ranking,
.event-list,
.warning-list {
  display: grid;
  gap: 10px;
}

.legend-row,
.rank-row,
.event-row,
.warning-row {
  display: grid;
  gap: 6px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.legend-row {
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.row-main,
.row-sub {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.row-main {
  font-weight: 780;
}

.row-sub {
  color: var(--muted);
  font-size: 13px;
}

.bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(60, 60, 67, 0.11);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.positive {
  color: var(--good);
}

.negative {
  color: var(--bad);
}

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

.alert-list.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.alert-layout {
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
}

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

.alert-category-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.alert-category-card:last-child {
  grid-column: 1 / -1;
}

.quality-grid .alert-category-card:last-child {
  grid-column: auto;
}

.alert-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.alert-category-head strong {
  font-size: 14px;
}

.alert-category-head span {
  min-width: 28px;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.alert-row {
  display: grid;
  gap: 6px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.alert-row.warning {
  border-left-color: #ff9f0a;
}

.alert-row.critical {
  border-left-color: #ff375f;
}

.alert-row.muted-row {
  border-left-color: var(--line);
  background: rgba(255, 255, 255, 0.46);
}

.alert-row span,
.alert-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.alert-row strong {
  display: block;
  margin: 3px 0;
  color: var(--ink);
  font-size: 14px;
}

.compact-input {
  width: 100%;
  min-width: 110px;
  padding: 7px 8px;
  font-size: 13px;
}

.market-symbol-input[data-field="provider_symbol"] {
  min-width: 120px;
  font-weight: 700;
}

.notification-center {
  position: fixed;
  right: clamp(14px, 3vw, 30px);
  bottom: clamp(14px, 3vw, 30px);
  z-index: 20;
  display: grid;
  justify-items: end;
  gap: 10px;
}

.notification-toggle {
  position: relative;
  min-height: 44px;
  border: 1px solid rgba(0, 113, 227, 0.22);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  color: var(--accent);
  font-weight: 820;
}

.notification-toggle strong {
  position: absolute;
  right: -6px;
  bottom: -7px;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 12px;
  line-height: 17px;
}

.notification-panel {
  width: min(380px, calc(100vw - 28px));
  max-height: min(520px, calc(100vh - 110px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.notification-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.notification-head button {
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 9px;
}

.notification-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.notification-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 9px;
  padding: 11px;
  background: rgba(248, 248, 250, 0.76);
  text-align: left;
}

.notification-item.warning {
  border-left-color: #ff9f0a;
}

.notification-item.critical {
  border-left-color: #ff375f;
}

.notification-item span,
.notification-item small,
.notification-empty span {
  color: var(--muted);
  font-size: 12px;
}

.notification-item strong,
.notification-empty strong {
  color: var(--ink);
  font-size: 14px;
}

.notification-empty {
  display: grid;
  gap: 4px;
  padding: 12px;
}

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

.rules-list div {
  display: grid;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.rules-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.rules-list span {
  color: var(--muted);
  font-size: 13px;
}

.warning-row {
  border-color: rgba(183, 110, 0, 0.24);
}

.warning-row strong {
  color: var(--warn);
}

.performance-panel {
  width: calc(100vw - 20px);
  margin: 0 calc(50% - 50vw + 10px) 18px;
  padding: 18px 20px 24px;
}

.performance-head {
  align-items: flex-start;
  gap: 22px;
}

.performance-head strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: 0;
}

.performance-head .panel-note {
  font-size: 15px;
  line-height: 1.45;
}

.performance-separator {
  display: inline-block;
  margin: 0 8px;
  color: var(--muted);
}

.performance-controls {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: min(860px, 58vw);
}

.performance-history-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 6px 0 14px;
}

.performance-history-cards > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.performance-history-cards span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.performance-history-cards strong {
  font-size: 20px;
  line-height: 1;
}

.performance-history-cards small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.performance-mode-tabs,
.performance-tabs {
  justify-content: flex-end;
  gap: 8px;
  max-width: 100%;
}

.performance-mode-tabs button,
.performance-tabs button {
  min-width: 54px;
  min-height: 40px;
  font-size: 14px;
}

.performance-mode-tabs button {
  min-width: 118px;
}

.performance-tabs button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
}

.performance-tabs button.muted-range:not(.active) {
  color: rgba(60, 60, 67, 0.38);
}

.performance-chart-box {
  position: relative;
  min-height: 680px;
  margin-top: 18px;
  width: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  padding-bottom: 8px;
}

.performance-chart-box canvas {
  width: 100%;
  max-width: none;
  height: clamp(660px, 76vh, 840px);
  min-height: 640px;
  display: block;
}

.table-panel {
  margin-bottom: 18px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.search input {
  width: min(280px, 46vw);
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font: inherit;
}

textarea {
  min-height: 82px;
  padding-block: 9px;
  resize: vertical;
}

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

.trade-scenario-panel {
  margin-bottom: 18px;
}

.trade-scenario-panel .panel-head {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 320px 320px;
  align-items: end;
}

.scenario-name {
  display: grid;
  gap: 6px;
  width: 320px;
  max-width: 100%;
}

.scenario-tools {
  display: grid;
  gap: 8px;
  width: 320px;
  max-width: 100%;
}

.scenario-tools label {
  display: grid;
  gap: 6px;
}

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

.scenario-buttons button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  padding-inline: 8px;
  white-space: nowrap;
}

.scenario-name span,
.scenario-tools span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.trade-form label {
  display: grid;
  gap: 6px;
}

.trade-form .full-field,
.operation-preview {
  grid-column: 1 / -1;
}

.lookup-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.lookup-field button {
  border: 1px solid rgba(0, 113, 227, 0.24);
  border-radius: 8px;
  padding: 0 11px;
  background: rgba(0, 113, 227, 0.09);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.lookup-status {
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
}

.lookup-status.error {
  color: var(--bad);
}

.lookup-status.success {
  color: var(--good);
}

.form-status {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-status.error {
  color: var(--bad);
}

.form-status.success {
  color: var(--good);
}

.lookup-fallback {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.lookup-fallback a {
  border: 1px solid rgba(0, 113, 227, 0.22);
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.lookup-choices {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.lookup-choices button {
  display: grid;
  grid-template-columns: minmax(82px, auto) minmax(0, 1fr);
  gap: 4px 10px;
  height: auto;
  min-height: 48px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  text-align: left;
}

.lookup-choices button:hover {
  border-color: rgba(0, 113, 227, 0.34);
  background: rgba(0, 113, 227, 0.06);
}

.lookup-choices strong {
  color: var(--ink);
  font-size: 13px;
}

.lookup-choices span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 680;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lookup-choices small {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
}

.trade-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.operation-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(0, 113, 227, 0.06);
}

.operation-preview-hero {
  min-height: 74px;
  border-color: rgba(0, 113, 227, 0.24);
  background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
}

.operation-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.operation-preview strong {
  font-size: 28px;
  line-height: 1;
}

.operation-preview small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

.operation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, auto) minmax(130px, 160px) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.operation-row.done {
  border-left-color: var(--good);
}

.operation-row.cancelled {
  border-left-color: var(--muted);
  opacity: 0.78;
}

.operation-row span,
.operation-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.operation-row strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.operation-value {
  text-align: right;
}

.operation-value span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.operation-value strong {
  margin: 0;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.row-actions button,
.detail-toggle,
.operations-toggle {
  min-height: 30px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 12px;
}

.operations-toggle {
  border-color: rgba(0, 113, 227, 0.22);
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
}

.operation-history {
  display: grid;
  gap: 6px;
}

.operation-history-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

.operation-history-summary > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(246, 247, 249, 0.78);
}

.operation-history-summary span,
.operation-history-row span small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.operation-history-summary strong {
  font-size: 14px;
}

.operation-history-summary small {
  color: var(--muted);
  font-size: 11px;
}

.operation-history-head,
.operation-history-row {
  display: grid;
  grid-template-columns: 0.8fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
}

.operation-history-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.operation-history-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.72);
}

.operation-history-row span {
  display: grid;
  gap: 2px;
}

.operation-history-row.done {
  border-color: rgba(50, 215, 75, 0.28);
}

.operation-row.archived,
.operation-history-row.archived {
  border-color: rgba(0, 113, 227, 0.18);
  background: rgba(0, 113, 227, 0.05);
}

.operation-history-row.cancelled {
  opacity: 0.72;
}

.operation-history-empty {
  color: var(--muted);
  font-size: 13px;
}

.trade-actions {
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
}

.trade-actions button:first-child {
  background: var(--ink);
  color: #fff;
}

.instrument-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(112px, 0.45fr) minmax(132px, 0.45fr);
  gap: 8px;
  align-items: end;
}

.instrument-tools label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.instrument-tools .search {
  align-items: stretch;
}

.instrument-tools .search input {
  width: 100%;
}

.trade-list,
.impact-list,
.watch-list,
.lookthrough-list {
  display: grid;
  gap: 10px;
}

.lookthrough-layout {
  grid-template-columns: minmax(250px, 0.28fr) minmax(0, 1fr);
  align-items: start;
}

.lookthrough-search {
  align-items: stretch;
  margin-bottom: 12px;
}

.lookthrough-search input {
  width: 100%;
}

.lookthrough-instrument {
  display: grid;
  gap: 4px;
  height: auto;
  min-height: 66px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
}

.lookthrough-instrument.active {
  border-color: rgba(0, 113, 227, 0.32);
  background: rgba(0, 113, 227, 0.08);
  color: var(--ink);
}

.lookthrough-instrument strong,
.lookthrough-instrument span,
.lookthrough-instrument small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lookthrough-instrument span,
.lookthrough-instrument small {
  color: var(--muted);
  font-size: 12px;
}

.lookthrough-form,
.lookthrough-row-form {
  margin-bottom: 14px;
}

.lookthrough-row-form {
  grid-template-columns: minmax(0, 1fr) 120px 130px 120px;
  align-items: end;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.lookthrough-row-form .trade-actions {
  grid-column: auto;
}

.lookthrough-row-form .trade-actions button {
  width: 100%;
}

.button-help {
  margin: -5px 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.lookthrough-table-wrap {
  overflow-x: hidden;
}

#lookthroughDetailsPage .panel.wide {
  overflow: visible;
}

#lookthroughDetailsPage table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

#lookthroughDetailsPage th:first-child,
#lookthroughDetailsPage td:first-child {
  width: 58%;
}

#lookthroughDetailsPage th:nth-child(2),
#lookthroughDetailsPage td:nth-child(2) {
  width: 12%;
}

#lookthroughDetailsPage th:nth-child(3),
#lookthroughDetailsPage td:nth-child(3) {
  width: 15%;
}

#lookthroughDetailsPage th:last-child,
#lookthroughDetailsPage td:last-child {
  width: 15%;
}

#lookthroughRowsTable input {
  min-height: 32px;
  padding-inline: 6px;
  font-size: 13px;
}

#lookthroughRowsTable .lookthrough-row-weight,
#lookthroughRowsTable .lookthrough-row-value {
  text-align: right;
}

#lookthroughRowsTable .remove-lookthrough-row {
  min-width: 64px;
  padding-inline: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 12px;
}

.trade-row,
.impact-row {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.trade-row {
  grid-template-columns: minmax(0, 1fr) auto auto auto auto auto;
}

.trade-row > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.trade-toggle {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 66px;
}

.trade-toggle input {
  width: 16px;
  height: 16px;
}

.trade-toggle span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.disabled-trade {
  opacity: 0.6;
  background: rgba(255, 255, 255, 0.52);
}

.dividend-receipt-row {
  grid-template-columns: minmax(0, 1fr) auto auto auto auto auto;
}

.quick-amount {
  display: grid;
  gap: 3px;
  min-width: 132px;
}

.quick-amount span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.quick-amount input {
  width: 132px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-align: right;
}

.trade-row span,
.impact-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.trade-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.remove-trade {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.operate-trade,
.edit-trade,
.remove-trade {
  width: 96px;
  min-width: 96px;
  white-space: nowrap;
  justify-self: stretch;
}

.operate-trade {
  border: 1px solid rgba(0, 113, 227, 0.24);
  background: rgba(0, 113, 227, 0.09);
  color: var(--accent);
}

.edit-trade {
  border: 1px solid rgba(60, 60, 67, 0.18);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
}

.impact-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.impact-row span {
  font-weight: 760;
}

.watch-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(230px, 0.52fr);
  gap: 18px;
  align-items: start;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.watch-row.reached {
  border-left-color: var(--good);
}

.watch-row p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.watch-row .row-main,
.watch-row .row-sub {
  gap: 12px;
}

.watch-prices {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(246, 247, 249, 0.72);
  color: var(--muted);
  font-size: 12px;
}

.watch-prices span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.watch-prices strong {
  color: var(--ink);
}

.watch-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.watch-actions button {
  min-height: 30px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 12px;
}

.watch-status-tabs {
  margin: -4px 0 14px;
}

.table-wrap {
  overflow: auto;
}

.patrimony-wrap {
  overflow-x: visible;
}

table {
  width: 100%;
  min-width: 1480px;
  border-collapse: separate;
  border-spacing: 0;
}

.patrimony-wrap table {
  min-width: 0;
  table-layout: auto;
}

.patrimony-wrap th,
.patrimony-wrap td {
  padding: 10px 8px;
  font-size: 12px;
}

.patrimony-wrap th {
  font-size: 10px;
}

.patrimony-wrap .sort-button {
  font-size: 10px;
  line-height: 1.15;
}

.patrimony-wrap .row-actions {
  display: grid;
  gap: 5px;
  min-width: 76px;
}

.patrimony-wrap .row-actions button {
  min-height: 27px;
  padding: 0 7px;
  font-size: 11px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

tbody tr.row-alt > td {
  background: rgba(246, 247, 249, 0.72);
}

tbody tr.local-row > td {
  background: rgba(0, 113, 227, 0.04);
}

tbody tr.position-row:hover > td,
tbody tr.sale-row:hover > td {
  background: rgba(0, 113, 227, 0.055);
}

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

.ticker {
  font-weight: 800;
}

.local-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

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

.details-row td {
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
  font-size: 13px;
}

.details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
}

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

.month-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.month-card-head,
.month-card-events div {
  display: grid;
  align-items: center;
  gap: 8px;
}

.month-card-head {
  grid-template-columns: minmax(0, 1fr) auto;
  color: var(--ink);
  font-weight: 820;
}

.month-card-events div {
  grid-template-columns: 0.9fr 1fr 1fr;
}

.month-card-events div.month-event-row {
  grid-template-columns: minmax(70px, 0.9fr) minmax(82px, 1fr) minmax(82px, 1fr) auto;
}

.month-card-head strong,
.month-card-head small {
  display: block;
}

.month-card-head span,
.month-card-events strong {
  text-align: right;
}

.month-card-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.month-total {
  display: grid;
  gap: 2px;
  text-align: right;
}

.month-total small {
  max-width: 120px;
  text-align: right;
}

.month-total span {
  color: var(--ink);
  font-weight: 820;
}

.month-card-events {
  display: grid;
  gap: 6px;
}

.month-card-events div {
  color: var(--muted);
  font-size: 12px;
}

.month-card-events span:first-child {
  color: var(--ink);
  font-weight: 760;
}

.dividend-plan-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.dividend-plan-actions button {
  display: inline-grid;
  width: 18px;
  height: 18px;
  min-height: 0;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(0, 113, 227, 0.26);
  border-radius: 4px;
  background: rgba(0, 113, 227, 0.07);
  color: var(--accent);
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
}

/* La riga di un pagamento con previsione deve restare alta come le altre:
   senza questo la colonna dei pulsanti allargava lo spazio verticale e i mesi
   pieni di previsioni scorrevano per pagine. Il margine negativo riassorbe i
   due pixel che i pulsanti aggiungono ancora. */
.month-event-row .dividend-plan-actions,
.event-row .dividend-plan-actions {
  margin: -1px 0;
}

.month-event-row:has(.dividend-plan-actions) {
  align-items: center;
}

.strong-num {
  color: var(--ink);
  font-weight: 820;
}

.news-grid {
  display: grid;
  gap: 18px;
}

.news-sector-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.news-sector-filters button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.news-sector-filters button.active {
  border-color: rgba(0, 113, 227, 0.24);
  background: rgba(0, 113, 227, 0.12);
  color: var(--accent);
}

.news-group {
  display: grid;
  gap: 12px;
}

.news-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.news-group-title strong {
  font-size: 15px;
}

.news-group-title span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.news-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.news-card {
  display: grid;
  gap: 10px;
  min-height: 230px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.news-card strong,
.news-card span {
  display: block;
}

.news-card span,
.news-card p {
  color: var(--muted);
  font-size: 13px;
}

.news-card p {
  margin: 0;
}

.news-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: end;
}

.news-headlines {
  display: grid;
  gap: 8px;
}

.news-headlines a {
  display: grid;
  gap: 3px;
  color: var(--ink);
  text-decoration: none;
}

.news-headlines a span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
  order: 1;
}

.news-headlines a small {
  color: var(--muted);
  font-size: 12px;
  order: 2;
}

.news-headlines a em {
  color: var(--muted);
  display: -webkit-box;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
  overflow: hidden;
  order: 3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.news-actions a {
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent);
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
}

@media (max-width: 1180px) {
  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* I numeri lunghi si restringono invece di sfondare il riquadro. */
.metric strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.metric small {
  display: block;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .layout,
  .chart-grid,
  .news-grid,
  .news-group-grid,
  .performance-history-cards,
  .month-grid,
  .alert-list.compact,
  .alert-category-grid,
  .trade-form,
  .lookthrough-row-form,
  .trade-scenario-panel .panel-head {
    grid-template-columns: 1fr;
  }

  .alert-category-card:last-child {
    grid-column: auto;
  }

  .scenario-name,
  .scenario-tools,
  .instrument-tools {
    width: 100%;
  }

  .instrument-tools {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status {
    justify-content: flex-start;
  }

  .performance-panel {
    margin-inline: 0;
  }

  .performance-controls {
    justify-items: stretch;
    min-width: 0;
    width: 100%;
  }

  .performance-mode-tabs,
  .performance-tabs {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .topbar {
    gap: 14px;
    padding: 18px 14px 12px;
  }

  .eyebrow {
    font-size: 11px;
  }

  h1 {
    font-size: 38px;
    line-height: 0.96;
  }

  .version-badge {
    display: table;
    margin: 10px 0 0;
    max-width: 100%;
  }

  .status {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 7px;
  }

  .status span,
  .status-action,
  .status-menu summary {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-inline: 10px;
    text-align: center;
  }

  .status span:nth-of-type(n+5) {
    display: none;
  }

  .status .sr-status {
    display: none;
  }

  .status-menu-panel {
    left: auto;
    right: 0;
  }

  .app-tabs {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 9px 14px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app-tabs::-webkit-scrollbar {
    display: none;
  }

  .app-tabs button,
  .nav-group > button {
    min-height: 40px;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .nav-submenu {
    left: auto;
    right: 0;
    min-width: min(86vw, 280px);
  }

  main {
    padding: 16px 12px 28px;
  }

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

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

  .metric.primary {
    grid-column: span 2;
  }

  .metric strong {
    font-size: 26px;
    line-height: 1.08;
    overflow-wrap: anywhere;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .panel {
    border-radius: 10px;
    padding: 16px;
  }

  .cloud-backup-row {
    grid-template-columns: 1fr;
  }

  .cloud-backup-actions {
    justify-content: stretch;
  }

  .cloud-backup-actions button {
    flex: 1 1 120px;
  }

  .search {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .search input {
    width: 100%;
    min-height: 42px;
  }

  .app-tabs,
  .segmented {
    overflow-x: auto;
  }

  .trade-row,
  .impact-row,
  .operation-row,
  .movement-row,
  .lookthrough-row-form,
  .watch-row,
  .operation-history-head,
  .operation-history-row {
    grid-template-columns: 1fr;
  }

  .movement-amount,
  .movement-state {
    justify-self: start;
    text-align: left;
  }

  .row-actions,
  .watch-actions {
    justify-content: flex-start;
  }

  .trade-actions {
    flex-direction: column;
  }

  .trade-actions button,
  .row-actions button,
  .watch-actions button,
  .form-actions button,
  .status-action {
    min-height: 42px;
  }

  .chart-grid {
    gap: 8px;
  }

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

  .chart-box canvas,
  #allocationChart {
    max-height: 240px;
  }

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

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

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .patrimony-wrap {
    overflow-x: hidden;
  }

  .fineco-summary-wrap {
    overflow-x: hidden;
  }

  .fineco-summary-wrap table {
    min-width: 0;
  }

  .fineco-summary-wrap thead {
    display: none;
  }

  #patrimonyCurrencySummary {
    display: grid;
    gap: 10px;
  }

  #patrimonyCurrencySummary tr {
    display: grid;
    gap: 8px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
  }

  #patrimonyCurrencySummary td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 0;
    border: 0;
    text-align: right;
  }

  #patrimonyCurrencySummary td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
    text-align: left;
  }

  #positionsTable,
  #salesTable,
  #lookthroughSummaryTable,
  #marketSymbolTable {
    display: grid;
    gap: 10px;
  }

  .patrimony-wrap table,
  #salesPage table,
  #lookthroughSummaryPage table,
  #qualityPage table {
    min-width: 0;
  }

  .patrimony-wrap thead,
  #salesPage thead,
  #lookthroughSummaryPage thead,
  #qualityPage thead {
    display: none;
  }

  #positionsTable tr:not(.details-row),
  #salesTable tr,
  #lookthroughSummaryTable tr,
  #marketSymbolTable tr {
    display: grid;
    gap: 8px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  }

  #positionsTable tr.details-row {
    display: table-row;
  }

  #positionsTable tr.details-row td {
    display: block;
    padding: 10px 0 14px;
    border: 0;
  }

  #positionsTable td,
  #salesTable td,
  #lookthroughSummaryTable td,
  #marketSymbolTable td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 0;
    border: 0;
    text-align: right;
    font-size: 13px;
  }

  #positionsTable td::before,
  #salesTable td::before,
  #lookthroughSummaryTable td::before,
  #marketSymbolTable td::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 780;
    text-align: left;
    text-transform: uppercase;
  }

  #positionsTable td:nth-child(1)::before { content: "Ticker"; }
  #positionsTable td:nth-child(2)::before { content: "Nome"; }
  #positionsTable td:nth-child(3)::before { content: "Pezzi"; }
  #positionsTable td:nth-child(4)::before { content: "Classe"; }
  #positionsTable td:nth-child(5)::before { content: "Area"; }
  #positionsTable td:nth-child(6)::before { content: "Settore"; }
  #positionsTable td:nth-child(7)::before { content: "Valore"; }
  #positionsTable td:nth-child(8)::before { content: "Valore + div."; }
  #positionsTable td:nth-child(9)::before { content: "Peso"; }
  #positionsTable td:nth-child(10)::before { content: "Peso + div."; }
  #positionsTable td:nth-child(11)::before { content: "P/L no div."; }
  #positionsTable td:nth-child(12)::before { content: "P/L no div. %"; }
  #positionsTable td:nth-child(13)::before { content: "P/L con div."; }
  #positionsTable td:nth-child(14)::before { content: "P/L con div. %"; }
  #positionsTable td:nth-child(15)::before { content: "Dividendi"; }

  #positionsTable td:last-child {
    display: block;
    text-align: left;
  }

  #positionsTable .row-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 4px;
  }

  #salesTable td:nth-child(1)::before { content: "Ticker"; }
  #salesTable td:nth-child(2)::before { content: "Nome"; }
  #salesTable td:nth-child(3)::before { content: "Pezzi"; }
  #salesTable td:nth-child(4)::before { content: "Prezzo acq."; }
  #salesTable td:nth-child(5)::before { content: "Costo"; }
  #salesTable td:nth-child(6)::before { content: "Prezzo vendita"; }
  #salesTable td:nth-child(7)::before { content: "Ricavo"; }
  #salesTable td:nth-child(8)::before { content: "Guad. lordo"; }
  #salesTable td:nth-child(9)::before { content: "Tassa"; }
  #salesTable td:nth-child(10)::before { content: "Guad. netto"; }
  #salesTable td:nth-child(11)::before { content: "Guad. netto %"; }
  #salesTable td:nth-child(12)::before { content: "Dividendi"; }
  #salesTable td:nth-child(13)::before { content: "Valuta"; }
  #salesTable td:nth-child(14)::before { content: "Classe"; }

  #lookthroughSummaryTable td:nth-child(1)::before { content: "Voce"; }
  #lookthroughSummaryTable td:nth-child(2)::before { content: "Peso EUR"; }
  #lookthroughSummaryTable td:nth-child(3)::before { content: "Peso %"; }
  #lookthroughSummaryTable td:nth-child(4)::before { content: "Presente in"; }

  #marketSymbolTable td:nth-child(1)::before { content: "Strumento"; }
  #marketSymbolTable td:nth-child(2)::before { content: "ISIN"; }
  #marketSymbolTable td:nth-child(3)::before { content: "Valuta"; }
  #marketSymbolTable td:nth-child(4)::before { content: "Mercato"; }
  #marketSymbolTable td:nth-child(5)::before { content: "Provider"; }
  #marketSymbolTable td:nth-child(6)::before { content: "Prezzo"; }
  #marketSymbolTable td:nth-child(7)::before { content: "Valore"; }
  #marketSymbolTable td:nth-child(8)::before { content: "Stato"; }
  #marketSymbolTable td:nth-child(9)::before { content: "Note"; }

  .news-group-grid {
    grid-template-columns: 1fr;
  }

  .notification-panel {
    left: 12px;
    right: 12px;
    bottom: 76px;
    width: auto;
  }
}

/* Valore nella valuta dello strumento, sotto quello in euro nella stessa cella.
   Non una colonna in piu': lo scorrimento orizzontale rende la tabella
   inservibile su telefono. */
.ccy-sub {
  display: block;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted, #6b7280);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

/* Matrice delle sovrapposizioni: l'intensita' del colore rende leggibile a
   colpo d'occhio dove due strumenti si duplicano, senza dover confrontare
   decine di percentuali una per una. */
.overlap-matrix { border-collapse: collapse; font-size: 12px; }
.overlap-matrix th,
.overlap-matrix td { padding: .3rem .45rem; text-align: right; white-space: nowrap; border-bottom: 1px solid rgba(148,163,184,.25); }
.overlap-matrix thead th { font-weight: 500; font-size: 11px; }
.overlap-matrix tbody th { text-align: left; font-weight: 600; }
/* Il colore lo mette overlapCellStyle riga per riga: qui resta solo cio' che
   vale per tutte le celle. Le cifre allineate servono a confrontarle a
   colpo d'occhio incolonnate. */
.overlap-cell { font-variant-numeric: tabular-nums; border-radius: 3px; }
.overlap-strong { font-weight: 600; }
.overlap-self { color: rgba(148,163,184,.7); }

/* Copertura della composizione accanto a ogni strumento nella matrice. */
.overlap-coverage { display: block; font-size: 10px; font-weight: 400; color: rgba(100,116,139,.85); font-variant-numeric: tabular-nums; }
.overlap-thin { color: #b45309; }
.overlap-corner { font-size: 10px; font-weight: 400; color: rgba(100,116,139,.85); text-align: left; }
.overlap-partial { display: block; font-size: 11px; color: #b45309; }

/* Tabella della concentrazione, sopra la classifica. */
.concentration-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.concentration-table th,
.concentration-table td { padding: .35rem .55rem; text-align: right; border-bottom: 1px solid rgba(148,163,184,.25); }
.concentration-table thead th { font-weight: 500; font-size: 11px; color: rgba(100,116,139,.9); }
.concentration-table tbody th { text-align: left; font-weight: 600; }
.concentration-tight { color: #b45309; font-weight: 600; }

/* Pannello dello strumento da valutare, in Simulazioni. */
.candidate-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
.candidate-grid textarea { width: 100%; font-family: inherit; font-size: 12.5px; }
.candidate-verdict { padding: .5rem .6rem; margin-bottom: .5rem; border-radius: 8px; background: rgba(37,99,235,.08); font-size: 13px; }
@media (max-width: 860px) { .candidate-grid { grid-template-columns: 1fr; } }

/* Pannello rischio in Performance. */
.risk-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.risk-table th, .risk-table td { padding: .4rem .55rem; border-bottom: 1px solid rgba(148,163,184,.25); text-align: left; }
.risk-table th { font-weight: 500; width: 34%; }
.risk-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; width: 18%; }
.risk-rate { min-width: 220px; }
.risk-rate input { width: 100%; }

/* Colonna dei riferimenti nel pannello rischio. Il pallino compare solo dove
   esiste un "meglio" riconosciuto: per Beta, correlazione e volatilita' presa
   da sola non c'e', e colorarli darebbe un giudizio senza fondamento. */
.risk-table td.risk-scale { font-size: 12px; color: rgba(100,116,139,.95); }
.risk-dot { display: inline-block; width: 13px; height: 13px; border-radius: 50%; margin-right: 8px; vertical-align: -2px; flex: 0 0 auto; }
.risk-good { background: #2e7d4f; }
.risk-fair { background: #b7a125; }
.risk-weak { background: #c2761f; }
.risk-bad { background: #b3352d; }
.risk-range { display: inline; }

/* Le colonne stanno strette a sinistra: con larghezze percentuali generose
   restava un vuoto largo fra etichetta, valore e didascalia. */
.risk-table th { width: 1%; white-space: nowrap; padding-right: 1.5rem; }
.risk-table td.num { width: 1%; white-space: nowrap; padding-right: 1.5rem; }
.risk-table td.muted { width: 1%; white-space: nowrap; padding-right: 2rem; }
.risk-table td.risk-scale { width: auto; }
.risk-panel { margin-bottom: 26px; }

@media (max-width: 980px) {
  .risk-table td.muted,
  .risk-table td.risk-scale { white-space: normal; }
}

/* Voci che l'app non ha saputo attribuire e aspettano una decisione: il peso
   senza settore e le aziende che non ha trovato negli altri documenti. */
.riga-da-assegnare td input { color: #b3352d; font-weight: 600; }
.riga-da-assegnare td:first-child::before { content: "! "; color: #b3352d; font-weight: 700; }

/* Nomi doppi da unire dopo un'importazione. Le righe vanno a capo da sole
   cosi' su smartphone non compare lo scorrimento orizzontale. */
.merge-box { margin: .6rem 0 .2rem; padding: .6rem .7rem; border: 1px solid rgba(148,163,184,.45); border-radius: 10px; background: rgba(248,250,252,.7); }
.merge-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .35rem 0; border-top: 1px solid rgba(148,163,184,.25); }
.merge-row:first-of-type { border-top: 0; }
.merge-row input[type="checkbox"] { width: 17px; height: 17px; margin: 0 .2rem 0 0; flex: none; cursor: pointer; }
.merge-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: 0 0 .5rem; border-bottom: 1px solid rgba(148,163,184,.35); margin-bottom: .3rem; }
.merge-actions button { padding: .25rem .7rem; font-size: 12.5px; }
.merge-conteggio { font-size: 12.5px; color: rgba(100,116,139,.95); font-variant-numeric: tabular-nums; }

/* Ricerca e rinomina di una singola azienda in tutto il look-through. */
/* Lo stacco sotto e' quello che separa le sezioni del riquadro: senza, la
   ricerca sembrava incollata ai campi Ticker e Nome strumento. */
.rename-box { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .6rem 0 1.15rem; }
.rename-box input { flex: 1 1 200px; min-width: 0; padding: .3rem .5rem; font-size: 13px; }
.rename-box button { padding: .3rem .7rem; font-size: 12.5px; white-space: nowrap; }
/* Incollare la ripartizione dal sito dell'emittente. Sta chiusa finche' non
   serve: e' la scorciatoia per i fondi che i settori non li pubblicano in un
   file, non un passaggio della procedura normale. */
.paste-box { margin: 0 0 1.15rem; padding: .5rem .7rem; border: 1px solid rgba(148,163,184,.35); border-radius: 8px; }
.paste-box > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; }
.paste-box .panel-note { margin: .5rem 0 .4rem; }
.paste-box textarea { width: 100%; box-sizing: border-box; padding: .35rem .5rem; font-size: 12.5px; font-family: inherit; resize: vertical; }
.paste-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.paste-box button { padding: .3rem .7rem; font-size: 12.5px; white-space: nowrap; }
/* Il confronto con la ripartizione dell'emittente: due colonne di numeri e lo
   scarto. Chi supera mezzo punto va guardato, il resto e' arrotondamento. */
.paste-compare { width: 100%; border-collapse: collapse; margin-top: .7rem; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.paste-compare th, .paste-compare td { padding: .22rem .4rem; border-bottom: 1px solid rgba(148,163,184,.25); }
.paste-compare th { text-align: left; font-size: 11.5px; color: rgba(100,116,139,.95); }
.paste-compare th.num, .paste-compare td.num { text-align: right; }
.paste-compare tfoot td { font-weight: 600; border-bottom: none; }
.paste-compare td.scarto-forte { font-weight: 600; color: #b45309; }

.merge-from, .merge-to { font-size: 12.5px; }
.merge-to { font-weight: 600; }
/* Da dove viene il nome: l'indizio che permette di decidere senza cercare. */
.merge-dove { display: block; font-size: 11px; font-weight: 400; color: rgba(100,116,139,.95); font-variant-numeric: tabular-nums; }
.merge-arrow { font-size: 11.5px; color: rgba(100,116,139,.95); }
.merge-row button { padding: .2rem .55rem; font-size: 12px; }

/* Copertura della composizione durante la modifica dei pesi. */
.coverage-note { font-size: 12.5px; margin: .3rem 0 0; font-variant-numeric: tabular-nums; }
.coverage-ok { color: rgba(100,116,139,.95); }
/* Quando la somma dei pesi non fa cento la nota deve saltare all'occhio: e'
   il segnale che nella composizione c'e' un errore. */
.coverage-over,
.coverage-low { font-weight: 600; padding: .18rem .4rem; border-radius: 5px; display: inline-block; }
.coverage-over { color: #b3352d; background: rgba(179,53,45,.09); }
.coverage-low { color: #b45309; background: rgba(180,83,9,.09); }

/* Promemoria sull'eta' del tasso privo di rischio. */
.rate-age { display: block; font-size: 11.5px; margin-top: .25rem; color: rgba(100,116,139,.95); }
.rate-due { color: #b45309; }
.rate-old { color: #b3352d; font-weight: 600; }

/* Pulsante di importazione della composizione da file. */
/* Le quattro azioni sulla composizione, in un riquadro due per due come le
   schede Aziende/Geografia/Settori, cosi' restano allineate anche quando
   vanno a capo su smartphone. */
/* I due riquadri a destra del titolo devono avere la stessa altezza e partire
   dalla stessa riga: erano uno centrato e l'altro in alto, e si vedeva. */
.panel-head .holdings-import,
.panel-head .segmented { align-self: stretch; }

.holdings-import {
  /* Non si restringe mai: le note sotto il titolo possono essere lunghe, ma i
     pulsanti devono restare leggibili e affiancati due a due. */
  flex: none;
  display: grid;
  align-content: center;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 248, 250, 0.86);
}
.holdings-import button {
  min-height: 32px;
  padding: 0 12px;
  width: 100%;
  white-space: nowrap;
}

/* I tre gruppi della tabella rischio e rendimento: una riga di intestazione
   che separa senza aggiungere altezza, cosi' quindici righe si leggono a
   colpo d'occhio invece che come un elenco unico. */
.risk-group th { padding-top: .9rem; font-size: 11.5px; letter-spacing: .04em;
  text-transform: uppercase; color: rgba(100,116,139,.95); border-bottom: 1px solid rgba(148,163,184,.35); }
.risk-group:first-child th { padding-top: .2rem; }

/* La Classifica: il filtro accanto alle schede, e la barra che divide quello
   che hai comprato da quello che arriva dagli ETF. */
.summary-controls { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.only-etf { padding: .25rem .7rem; font-size: 12.5px; white-space: nowrap; }
.only-etf.active { background: rgba(24,95,165,.12); border-color: rgba(24,95,165,.45); }
.split-bar { display: flex; gap: 1px; height: 5px; margin-top: 3px; justify-content: flex-end; }
.split-own { background: #185FA5; border-radius: 2px; }
.split-etf { background: #85B7EB; border-radius: 2px; }

/* Il selettore dell'anno in Totali per strumento, in testa al pannello
   accanto al titolo. */
.total-div-year {
  flex: 0 0 auto;
  min-width: 0;
}

.total-div-year select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel, transparent);
  color: inherit;
  font: inherit;
  font-size: 14px;
}


/* ORDINAMENTO CHE NON SPOSTA LE COLONNE
   Ogni intestazione ordinabile tiene da parte lo spazio della freccia, anche
   quando l'ordinamento e' su un'altra colonna: senza, la colonna che riceveva
   l'indicatore si allargava e tutte le altre scalavano di lato. */
.sort-button::after,
.sale-sort-button::after,
.total-div-sort-button::after,
.lookthrough-sort-button::after,
.lookthrough-summary-sort-button::after {
  content: "";
  display: inline-block;
  width: 12px;
  text-align: center;
  font-size: 10px;
}

/* Larghezze dichiarate per Totali per strumento. Con `table-layout: fixed` il
   browser smette di misurare il contenuto riga per riga: le colonne restano
   dove sono anche quando l'ordinamento porta in cima un numero piu' lungo. */
.total-div-table {
  table-layout: fixed;
  width: 100%;
}

.tdiv-tick { width: 15%; }
.tdiv-eur { width: 22%; }
.tdiv-pct { width: 14%; }
.tdiv-tot { width: 15%; }
.tdiv-var { width: 12%; }





/* Anno e ricerca sulla stessa riga, in testa al calendario: il contenitore
   non deve andare a capo e non deve restringersi sotto il suo contenuto. */
.calendar-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.calendar-tools .search {
  flex: 0 0 auto;
}

.calendar-year select {
  /* Stessa altezza dell'input della ricerca, che ne ha una minima: senza,
     i due campi affiancati risultano sfalsati. */
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel, transparent);
  color: inherit;
  font: inherit;
  font-size: 14px;
}

.calendar-tools .search {
  align-items: center;
}

/* La casella del lordo su una riga sola: pallino, testo e spiegazione di
   seguito, senza andare a capo dentro la colonna. */
.field-check {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.field-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}

.field-check > span {
  display: inline;
  font-size: 13px;
}

.field-check span small {
  font-weight: 400;
  opacity: 0.7;
}


/* La casella sta in un modulo a griglia: senza questo occupa una colonna sola
   e la spiegazione va a capo tre volte. */
.trade-form .field-check {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-height: 0;
}

.trade-form .field-check > span {
  display: inline;
  white-space: normal;
}

/* In testa al pannello il titolo si prende lo spazio che avanza: il gruppo di
   anno e ricerca deve restare della sua misura, altrimenti si impila. */
.panel-head .calendar-tools {
  flex: 0 0 auto;
  min-width: max-content;
}


/* SEZIONI RICHIUDIBILI
   Il titolo fa da interruttore: una freccia lo dice, e una barra di colore a
   sinistra separa una sezione dall'altra meglio di un fondino alternato, che
   con le sezioni chiuse finirebbe a caso. */
.titolo-sezione {
  position: relative;
  padding-left: 22px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 15px;
  font-weight: 800;
}

/* Il puntatore e la freccia solo dove c'e' qualcosa da chiudere: altrove
   indicherebbero un comando che non esiste. */
.sezione-richiudibile > .panel-head h2 {
  cursor: pointer;
  user-select: none;
}

.titolo-sezione::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 1.1em;
  transform: translateY(-50%);
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.75;
}

.sezione-richiudibile > .panel-head h2::after {
  content: "\25BE";
  margin-left: 8px;
  font-size: 11px;
  opacity: 0.55;
  display: inline-block;
  transition: transform 0.15s ease;
}

.sezione-richiudibile.chiusa > .panel-head h2::after {
  transform: rotate(-90deg);
}

.sezione-richiudibile.chiusa > .panel-head h2::before {
  opacity: 0.35;
}

.sezione-richiudibile > .panel-head h2:hover::after {
  opacity: 0.9;
}

.sezione-richiudibile.chiusa > :not(.panel-head) {
  display: none;
}

/* Della sezione chiusa resta il solo nome: la spiegazione e i comandi
   dell'intestazione servono quando la si usa, non quando e' via. */
.sezione-richiudibile.chiusa > .panel-head .panel-note,
.sezione-richiudibile.chiusa > .panel-head > :not(:first-child) {
  display: none;
}

.sezione-richiudibile.chiusa {
  padding-bottom: 14px;
}

.sezione-richiudibile.chiusa > .panel-head {
  margin-bottom: 0;
}


/* Le schede dell'allocazione sono undici e a misura piena non ci stanno in una
   riga: qui, e solo qui, si stringono margini e testo. Restano libere di
   andare a capo, perche' su una finestra stretta due righe leggibili sono
   meglio di una riga che deborda. */
/* La barra passa sotto il titolo: accanto le restavano 832 pixel per undici
   schede che ne chiedono mille, e l'unico modo di stringerle fin li' sarebbe
   stato un testo da otto punti. Sotto ha tutta la larghezza del riquadro. */
.allocation-head {
  flex-wrap: wrap;
}

.allocation-head > h2 {
  flex-basis: 100%;
}

#allocationTabs {
  flex-basis: 100%;
  gap: 3px;
  padding: 6px;
}

#allocationTabs button {
  padding: 0 6px;
  font-size: 11.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}


/* I RIQUADRI DELLA GIORNATA
   Verde quando sale, rosso quando scende: tinte spente, perche' stanno in alto
   nella pagina e si guardano ogni giorno. Il testo e' bianco su tutti e due,
   che a quelle saturazioni e' l'unico modo di avere lo stesso contrasto. */
.performance-day-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 10px 0 4px;
}

.day-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.day-card span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.day-card strong {
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.day-card small {
  font-size: 11px;
  opacity: 0.8;
  line-height: 1.35;
}

.day-su {
  background: #3f8f5f;
  color: #ffffff;
}

.day-giu {
  background: #b25050;
  color: #ffffff;
}

/* Finche' la chiusura di ieri non e' arrivata il riquadro resta neutro: un
   verde o un rosso su un dato che non c'e' sarebbe una bugia. */
.day-card-vuota {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
  color: var(--muted);
}


/* LE DUE TABELLE CHE SI LEGGONO DI PIU'
   Stato patrimoniale e Totali per strumento avevano un corpo da nota a pie' di
   pagina. Qui si alza, con selettori piu' specifici di quelli della Plancia
   chiara perche' quella resta in coda e non si tocca.

   Le intestazioni salgono meno delle celle: sono in maiuscolo, dove un punto
   in piu' pesa il doppio, e sono loro a dettare la larghezza delle colonne. */
.table-wrap.patrimony-wrap th,
.table-wrap.patrimony-wrap td {
  padding: 6px 6px;
  font-size: 12.5px;
}

/* Le intestazioni restano dov'erano: in maiuscolo dettano la larghezza di ogni
   colonna, e alzarle avrebbe allargato la tabella di centoventi pixel senza
   rendere piu' leggibile un solo numero. */
.table-wrap.patrimony-wrap th {
  font-size: 10px;
}

.table-wrap.patrimony-wrap .sort-button {
  font-size: 10px;
}

#totalDividendsTable td {
  font-size: 13px;
  padding-top: 7px;
  padding-bottom: 7px;
}

#totalDividendsHead th,
#totalDividendsHead .total-div-sort-button {
  font-size: 11px;
}


/* GLI STRUMENTI A CONFRONTO
   Ognuno tiene la sua analisi intera, percio' servono un'intestazione che dica
   di chi si sta parlando e una riga che separi un blocco dall'altro: sono
   lunghi e si somigliano. */
.candidato-blocco + .candidato-blocco {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px solid var(--line);
}

.candidato-testa {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.candidato-testa strong {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.candidato-testa .muted {
  font-size: 12px;
}

.candidato-togli {
  margin-left: auto;
  min-height: 24px;
  padding: 0 8px;
  font-size: 14px;
  line-height: 1;
}

/* ============================================================
   PLANCIA CHIARA
   La veste dell'app, su tutte le pagine. Sostituisce la prova a due varianti:
   il confronto e' stato fatto e la chiara ha vinto, perche' Strawberry Fields si guarda
   di giorno e accanto a Fineco, che e' bianco.
   Resta aggiunta in coda al foglio: per tornare a com'era prima basta
   cancellare da qui in giu'.
   ============================================================ */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #1c2024;
  --muted: #656d76;
  --line: #d8dee4;
  --accent: #0969da;
  --accent-2: #1a7f37;
  --good: #1a7f37;
  --bad: #cf222e;
  --warn: #9a6700;
  --shadow: none;
  --plancia-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
}

body {
  background: #ffffff;
}

/* Le superfici si distinguono con una linea, non con un riempimento: su fondo
   bianco il grigio delle vecchie card diventava sporco. */
.panel,
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: none;
}

.metric.primary {
  background: var(--surface);
  border-color: var(--accent);
}

.topbar {
  padding-top: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

nav.app-tabs {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

/* I numeri incolonnati: e' il motivo per cui Plancia esiste. `tabular-nums`
   da' a tutte le cifre la stessa larghezza, cosi' 13.538 e 9.876 hanno le
   unita' sotto le unita' e l'ordine di grandezza si vede senza leggere. */
.metric strong,
td,
.num,
.performance-total {
  font-family: var(--plancia-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.metric strong {
  font-weight: 600;
  margin: 8px 0 5px;
}

.metric {
  min-height: 96px;
  padding: 13px;
}

.metric > span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Righe compatte: 27px invece di 46. E' quello che decide se i 57 titoli
   stanno in due schermate o in quattro. */
th,
td {
  padding: 6px 10px;
  font-size: 12px;
  vertical-align: middle;
}

th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}

.patrimony-wrap th,
.patrimony-wrap td {
  padding: 5px 7px;
  font-size: 11px;
}

.panel {
  padding: 14px 16px;
}

.panel-head {
  margin-bottom: 10px;
}

h2 {
  font-size: 15px;
  font-weight: 600;
}

.panel-note {
  font-size: 12px;
}

main {
  padding-top: 16px;
}

.metrics {
  gap: 10px;
}

/* Le pulsantiere e i gruppi di schede: niente riquadro grigio attorno, basta
   il bordo dei pulsanti stessi. */
.holdings-import,
.segmented,
.mini-tabs {
  background: transparent;
  border-color: var(--line);
}

.segmented button {
  background: #ffffff;
  border: 1px solid var(--line);
}

/* Quello che segnala dove sei resta pieno e scuro: e' l'unica cosa che deve
   saltare all'occhio. */
.segmented button.active,
nav.app-tabs button.active,
.lookthrough-instrument.active,
button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}
