/* ============================================================== *
 * REDESIGN OTTANIO V2 — FONTI INFORMATIVE / AdE (2026-05-03)
 * Riferimento: docs/grafici/DeskControl Fonti AdE - Handoff.md
 * Riferimento visivo: docs/grafici/DeskControl Fonti AdE.html
 * Scope: redesign sub-tab AdE dentro Fonti informative.
 * ============================================================== */

:root {
  /* Palette serie grafici (in aggiunta agli ott-* gia' globali) */
  --series-1: #0E3B45;  /* ottanio base */
  --series-2: #3B7C8C;  /* ottanio mid */
  --series-3: #7BB0BC;  /* ottanio light */
  --series-4: #C7891B;  /* ocra (terzo livello) */
  --series-5: #890103;  /* rosso DC (sparingly) */

  /* Delta semaforo */
  --pos: #0F9D58;       --pos-bg: #E6F4EC;
  --neg: #C0392B;       --neg-bg: #FBE9E7;
  --warn-bg: #FBF1DC;   /* --warn gia' definito su :root */

  /* Grid e ink (gia' ott-200 / ott-500 / ink — alias semantici per chart) */
  --grid: #E4E9EF;
  --label: #64748B;
}

/* ====================================================
 * CONTAINER FONTI AdE
 * ==================================================== */

#fonti-panel-ade.fonti-tab-panel.active {
  display: flex !important;
  flex-direction: column;
  background: var(--ott-50);
  padding: 0;
  overflow-y: auto;
  height: 100%;
}

/* ====================================================
 * CONTEXT BAR (5 celle separate da divider) — STICKY
 * ==================================================== */

.ade-ctxbar {
  display: flex;
  align-items: center;
  padding: 8px 18px;
  /* Colore primario brand (canonico, sempre settato da brand.js).
     MC = teal #0e3b45, DC = slate #0f172a, palette tenant via JSONB. */
  background: var(--brand-base, var(--ott-base));
  border-bottom: 1px solid rgba(0, 0, 0, 0.20);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.ade-ctx {
  padding: 0 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.10);
  min-width: 0;
}
.ade-ctx:first-child { padding-left: 0; }
.ade-ctx:last-of-type { border-right: 0; }
.ade-ctx__lbl {
  font-family: var(--ff-body);
  font-size: 9.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
  line-height: 1.1;
}
.ade-ctx__v {
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  line-height: 1.25;
}
/* Denominazione con piu' testo: ridotto + word-wrap soft */
.ade-ctx[data-ade-ctx="descr"] .ade-ctx__v {
  font-size: 11.5px;
  font-weight: 500;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 220px;
}
.ade-ctx__v.mono {
  font-family: var(--ff-mono);
  font-size: 11.5px;
}
.ade-ctxbar__spacer { flex: 1; }
.ade-ctxbar__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-family: var(--ff-body);
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}
.ade-ctxbar__pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--pos);
}
.ade-ctxbar__icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 8px;
  transition: background 100ms, color 100ms;
}
.ade-ctxbar__icon-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.ade-ctxbar__icon-btn svg { width: 14px; height: 14px; }

/* Toggle "Area zona OMI" — compact, no border/background */
.ade-ctxbar__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-left: 12px;
  user-select: none;
  padding: 0;
  background: transparent;
  border: 0;
}
.ade-ctxbar__toggle input { position: absolute; opacity: 0; pointer-events: none; }
.ade-ctxbar__toggle-slider {
  position: relative;
  width: 26px;
  height: 14px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  transition: background 150ms;
  flex-shrink: 0;
}
.ade-ctxbar__toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: transform 150ms;
}
.ade-ctxbar__toggle input:checked ~ .ade-ctxbar__toggle-slider {
  background: var(--brand-base, var(--ott-base));
}
.ade-ctxbar__toggle input:checked ~ .ade-ctxbar__toggle-slider::before {
  transform: translateX(12px);
}
.ade-ctxbar__toggle-lbl {
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
}

/* Mini select dropdown per Serie OMI tipologia + stato */
.ade-mini-select {
  height: 28px;
  background: var(--ott-50);
  border: 1px solid var(--ott-200);
  border-radius: 6px;
  font-family: var(--ff-body);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  padding: 0 24px 0 8px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><polyline points='0,0 5,6 10,0' fill='none' stroke='%2364748B' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 7px center;
  transition: background-color 100ms, border-color 100ms;
}
.ade-mini-select:hover { background-color: var(--paper); border-color: var(--ott-300); }
.ade-mini-select:focus { outline: none; border-color: var(--ott-base); box-shadow: var(--rd-focus-ring); }

/* Multi-filter chips per tabella valori OMI */
.ade-omi-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  background: var(--ott-50);
  border-bottom: 1px solid var(--ott-200);
  align-items: center;
}
.ade-omi-filters__lbl {
  font-family: var(--ff-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--ott-500);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 4px;
}
.ade-omi-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: var(--paper);
  border: 1px solid var(--ott-200);
  border-radius: 999px;
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 500;
  color: var(--ott-500);
  cursor: pointer;
  transition: background 100ms, border-color 100ms, color 100ms;
}
.ade-omi-filter-chip:hover { border-color: var(--ott-300); }
.ade-omi-filter-chip.is-on {
  background: var(--ott-base);
  border-color: var(--ott-base);
  color: #fff;
}
.ade-omi-filter-chip__sep {
  width: 1px;
  height: 16px;
  background: var(--ott-200);
  margin: 0 4px;
}

/* ====================================================
 * BODY
 * ==================================================== */

.ade-body {
  padding: 18px 20px 24px;
  background: var(--ott-50);
}

/* ====================================================
 * KPI ROW (4 tile)
 * ==================================================== */

.ade-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.ade-kpi {
  background: var(--paper);
  border: 1px solid var(--ott-200);
  border-radius: 10px;
  padding: 14px 16px;
}
.ade-kpi__hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.ade-kpi__lbl {
  font-family: var(--ff-body);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ott-500);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ade-kpi__pct {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}
.ade-kpi__pct.up { color: var(--pos); background: var(--pos-bg); }
.ade-kpi__pct.down { color: var(--neg); background: var(--neg-bg); }
.ade-kpi__pct.flat { color: var(--ott-500); background: var(--ott-100); }
.ade-kpi__v {
  font-family: var(--ff-mono);
  font-weight: 600;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 2px;
}
.ade-kpi__v small {
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ott-500);
  margin-left: 3px;
}
.ade-kpi__sub {
  font-family: var(--ff-body);
  font-size: 11px;
  color: var(--ott-500);
  min-height: 16px;
}
.ade-kpi__sub strong {
  color: var(--ink);
  font-weight: 500;
  font-family: var(--ff-mono);
}
.ade-kpi__spk {
  margin-top: 14px;
  height: 32px;
  display: block;
  overflow: hidden;
}
.ade-kpi__spk svg { display: block; overflow: hidden; }

/* ====================================================
 * GRID LAYOUT CARD
 * ==================================================== */

.ade-grid-1-1 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.ade-grid-1-6 {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

/* ====================================================
 * PANEL TITLE (con barretta verticale ottanio)
 * ==================================================== */

.ade-panel-title {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: 15px;
  color: var(--ott-deep);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 10px;
}
.ade-panel-title::before {
  content: "";
  width: 3px;
  height: 18px;
  background: var(--ott-base);
  border-radius: 2px;
}
.ade-panel-title__meta {
  margin-left: auto;
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 500;
  color: var(--ott-500);
}

/* ====================================================
 * CARD GRAFICO
 * ==================================================== */

.ade-card {
  background: var(--paper);
  border: 1px solid var(--ott-200);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}
.ade-card__hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--ott-100);
}
.ade-card__ttl {
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 700;
  color: var(--ott-700);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ade-card__sub {
  font-family: var(--ff-body);
  font-size: 11px;
  color: var(--ott-500);
  font-weight: 400;
  margin-left: 6px;
}
.ade-card__hd-actions {
  display: flex;
  gap: 4px;
}
.ade-card__body {
  padding: 14px 14px 16px;
  flex: 1;
}
.ade-card__body.no-pad { padding: 0; }

/* Icon button card header */
.ade-iconbtn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--ott-500);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 100ms;
}
.ade-iconbtn:hover { background: var(--ott-50); color: var(--ott-base); }
.ade-iconbtn svg { width: 13px; height: 13px; }

/* ====================================================
 * SEGMENTED CONTROL (Normale/Ottimo/Scadente)
 * ==================================================== */

.ade-seg {
  display: inline-flex;
  background: var(--ott-50);
  border: 1px solid var(--ott-200);
  border-radius: 7px;
  padding: 2px;
}
.ade-seg button {
  background: transparent;
  border: 0;
  padding: 4px 10px;
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--ott-500);
  border-radius: 5px;
  cursor: pointer;
  transition: background 100ms, color 100ms;
}
.ade-seg button.is-on {
  background: var(--paper);
  color: var(--ott-base);
  box-shadow: var(--rd-shadow-sm);
}

/* ====================================================
 * LEGEND
 * ==================================================== */

.ade-legend {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.ade-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-body);
  font-size: 11.5px;
  color: var(--ott-500);
}
.ade-legend__sw {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.ade-legend__sw.line {
  height: 2px;
  width: 14px;
  border-radius: 0;
}
.ade-legend__sw.dashed {
  height: 0;
  width: 14px;
  border-top: 2px dashed currentColor;
}
.ade-legend__right {
  margin-left: auto;
  font-family: var(--ff-mono);
  font-size: 11.5px;
  color: var(--ott-500);
}

/* ====================================================
 * METRIC ROW (4-cell strip dentro card)
 * ==================================================== */

.ade-mrow {
  display: flex;
  border: 1px solid var(--ott-200);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}
.ade-mrow__cell {
  flex: 1;
  padding: 10px 12px;
  border-right: 1px solid var(--ott-200);
}
.ade-mrow__cell:last-child { border-right: 0; }
.ade-mrow__lbl {
  font-family: var(--ff-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--ott-500);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.ade-mrow__v {
  font-family: var(--ff-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--ott-base);
}
.ade-mrow__v.up { color: var(--pos); }
.ade-mrow__v.down { color: var(--neg); }

/* ====================================================
 * DEFINITION LIST (NTN context)
 * ==================================================== */

.ade-dlist {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 12px;
  margin: 0;
}
.ade-dlist dt {
  font-family: var(--ff-body);
  color: var(--ott-500);
  font-weight: 500;
}
.ade-dlist dd {
  margin: 0;
  font-family: var(--ff-mono);
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}
.ade-dlist dd .muted {
  color: var(--ott-500);
  font-weight: 500;
}
.ade-dlist dd.text {
  font-family: var(--ff-body);
  font-weight: 500;
}

/* ====================================================
 * INFO BANNER (ocra warning)
 * ==================================================== */

.ade-info-banner {
  background: var(--warn-bg);
  border-left: 3px solid var(--warn);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--ff-body);
  font-size: 12px;
  color: var(--ott-700);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
}
.ade-info-banner svg {
  flex-shrink: 0;
  color: var(--warn);
  width: 14px;
  height: 14px;
  margin-top: 2px;
}

/* ====================================================
 * DENSE TABLE
 * ==================================================== */

.ade-tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--ff-body);
  font-size: 12px;
  table-layout: fixed;
}
.ade-tbl thead th {
  text-align: left;
  padding: 8px 8px;
  background: var(--ott-50);
  color: var(--ott-500);
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ott-200);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ade-tbl thead th.r { text-align: right; }
.ade-tbl tbody td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--ott-100);
  color: var(--ink);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
/* Card OMI valori semestre: forziamo fitting, no scroll-x.
   Colonne: Tipologia (40%) - Stato (20%) - Compr.€/MQ (20%) - Loc.€/MQ (20%) */
.ade-card[data-ade-card="omi-table"] {
  overflow: hidden;
  min-width: 0;
}
.ade-card[data-ade-card="omi-table"] .ade-card__body {
  overflow: hidden;
  padding: 0;
}
.ade-card[data-ade-card="omi-table"] .ade-tbl {
  font-size: 11.5px;
  table-layout: fixed;
}
.ade-card[data-ade-card="omi-table"] .ade-tbl colgroup col,
.ade-card[data-ade-card="omi-table"] .ade-tbl thead th:nth-child(1),
.ade-card[data-ade-card="omi-table"] .ade-tbl tbody td:nth-child(1) { width: 40%; }
.ade-card[data-ade-card="omi-table"] .ade-tbl thead th:nth-child(2),
.ade-card[data-ade-card="omi-table"] .ade-tbl tbody td:nth-child(2) { width: 20%; }
.ade-card[data-ade-card="omi-table"] .ade-tbl thead th:nth-child(3),
.ade-card[data-ade-card="omi-table"] .ade-tbl tbody td:nth-child(3) { width: 20%; text-align: right; }
.ade-card[data-ade-card="omi-table"] .ade-tbl thead th:nth-child(4),
.ade-card[data-ade-card="omi-table"] .ade-tbl tbody td:nth-child(4) { width: 20%; text-align: right; }
.ade-card[data-ade-card="omi-table"] .ade-tbl tbody td:nth-child(1) {
  white-space: normal;
  word-break: break-word;
  font-size: 11px;
  line-height: 1.3;
}
.ade-card[data-ade-card="omi-table"] .ade-tbl .ade-badge {
  font-size: 9.5px;
  padding: 2px 6px;
  letter-spacing: 0.02em;
}
.ade-card[data-ade-card="omi-table"] .ade-tbl tbody td.r,
.ade-card[data-ade-card="omi-table"] .ade-tbl tbody td:nth-child(3),
.ade-card[data-ade-card="omi-table"] .ade-tbl tbody td:nth-child(4) {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  white-space: nowrap;
}
.ade-tbl tbody tr:hover { background: var(--ott-50); }
.ade-tbl tbody tr:last-child td { border-bottom: 0; }
.ade-tbl td.r {
  text-align: right;
  font-family: var(--ff-mono);
}
.ade-tbl td.up { color: var(--pos); font-weight: 600; }
.ade-tbl td.down { color: var(--neg); font-weight: 600; }
.ade-tbl td.muted { color: var(--ott-500); }

/* ====================================================
 * BADGE (status)
 * ==================================================== */

.ade-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-family: var(--ff-body);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.ade-badge--ok { background: var(--pos-bg); color: var(--pos); }
.ade-badge--warn { background: var(--warn-bg); color: var(--warn); }
.ade-badge--err { background: var(--neg-bg); color: var(--neg); }
.ade-badge--neutral { background: var(--ott-100); color: var(--ott-base); }

/* ====================================================
 * HORIZONTAL BAR LIST (Mix commerciale)
 * ==================================================== */

.ade-barH {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ade-barH__row {
  display: grid;
  grid-template-columns: 140px 1fr 60px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.ade-barH__lbl {
  color: var(--ink);
  font-family: var(--ff-body);
}
.ade-barH__lbl small {
  display: block;
  color: var(--ott-500);
  font-size: 10.5px;
  font-weight: 500;
}
.ade-barH__bar {
  height: 10px;
  background: var(--ott-100);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.ade-barH__fill {
  height: 100%;
  border-radius: 3px;
}
.ade-barH__v {
  font-family: var(--ff-mono);
  font-weight: 600;
  font-size: 12px;
  text-align: right;
  color: var(--ink);
}

/* ====================================================
 * BAR COMPARE (Zona vs Comune)
 * ==================================================== */

.ade-bcmp {
  margin-bottom: 14px;
}
.ade-bcmp__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.ade-bcmp__lbl {
  font-family: var(--ff-body);
  font-size: 11.5px;
  color: var(--ott-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ade-bcmp__nums {
  font-family: var(--ff-body);
  font-size: 11px;
  color: var(--ott-500);
}
.ade-bcmp__nums strong {
  font-family: var(--ff-mono);
  color: var(--ink);
  font-weight: 600;
}
.ade-bcmp__bars {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}
.ade-bcmp__bar {
  height: 14px;
  background: var(--ott-100);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.ade-bcmp__fill {
  position: absolute;
  inset: 0;
  border-radius: 3px;
}
.ade-bcmp__fill--zona { background: var(--ott-base); }
.ade-bcmp__fill--comune { background: var(--ott-300); }

/* ====================================================
 * STABILITY GRID (2x4 cells)
 * ==================================================== */

.ade-stab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.ade-stab-cell {
  padding: 11px 14px;
  border-right: 1px solid var(--ott-100);
  border-bottom: 1px solid var(--ott-100);
}
.ade-stab-cell:nth-child(2n) { border-right: 0; }
.ade-stab-cell:nth-last-child(-n+2) { border-bottom: 0; }
.ade-stab-cell__lbl {
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 500;
  color: var(--ott-500);
  margin-bottom: 4px;
}
.ade-stab-cell__v {
  font-family: var(--ff-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--ott-base);
}
.ade-stab-cell__v.up { color: var(--pos); }
.ade-stab-cell__v.down { color: var(--neg); }

/* ====================================================
 * QUADRANT CHART (Crescita YoY)
 * ==================================================== */

.ade-quadrant {
  position: relative;
  height: 240px;
  background: linear-gradient(180deg, #FAFBFC 0%, white 100%);
  border-radius: 6px;
  border: 1px dashed var(--ott-200);
}
.ade-quadrant__axis-x,
.ade-quadrant__axis-y {
  position: absolute;
  background: var(--ott-300);
}
.ade-quadrant__axis-x { left: 0; right: 0; top: 50%; height: 1px; }
.ade-quadrant__axis-y { top: 0; bottom: 0; left: 50%; width: 1px; }
.ade-quadrant__lbl {
  position: absolute;
  font-family: var(--ff-body);
  font-size: 10px;
  color: var(--ott-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ade-quadrant__pt {
  position: absolute;
  border-radius: 999px;
}
.ade-quadrant__pt--peer {
  width: 7px;
  height: 7px;
  background: var(--ott-300);
  transform: translate(-50%, -50%);
}
.ade-quadrant__pt--trail {
  width: 6px;
  height: 6px;
  background: var(--ott-200);
  transform: translate(-50%, -50%);
}
.ade-quadrant__pt--now {
  width: 12px;
  height: 12px;
  background: var(--ott-base);
  border: 2px solid white;
  box-shadow: 0 0 0 3px rgba(14,59,69,0.15);
  transform: translate(-50%, -50%);
  z-index: 3;
}
.ade-quadrant__caption {
  padding: 10px 12px;
  background: var(--ott-50);
  border-radius: 6px;
  margin-top: 10px;
  font-family: var(--ff-body);
  font-size: 11.5px;
  color: var(--ott-500);
  line-height: 1.5;
}
.ade-quadrant__caption strong {
  color: var(--ink);
  font-weight: 600;
}

/* ============================================================
   OMI Capoluoghi — restyling Ottanio v2 sul markup legacy
   (#capoluoghiSection mounted in .ade-cap-mount)
   ============================================================ */

.ade-cap-mount {
  padding: 0;
  border: 1px solid var(--ott-200);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.ade-cap-mount #capoluoghiSection {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}
.ade-cap-mount #capoluoghiSection > .section-title-row { display: none; }
.ade-cap-mount #capoluoghiBody { padding: 14px 16px; }
.ade-cap-mount .cap-status {
  font-family: var(--ff-body);
  font-size: 12px;
  color: var(--ott-500);
  padding: 14px 0;
}
.ade-cap-mount .cap-status.error { color: var(--neg); }

.ade-cap-mount .fonti-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.ade-cap-mount .cap-block {
  border: 1px solid var(--ott-200);
  border-radius: 10px;
  background: #fff;
  padding: 14px 16px;
  min-width: 0;
}
.ade-cap-mount .cap-block.span-2 { grid-column: span 2; }

.ade-cap-mount .cap-table-title {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 10px;
}
.ade-cap-mount .chart-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.ade-cap-mount .chart-title-row .cap-table-title { margin-bottom: 0; }
.ade-cap-mount .chart-max-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--ott-200);
  background: var(--ott-50);
  color: var(--ott-500);
  cursor: pointer;
  font-size: 12px;
}
.ade-cap-mount .chart-max-btn:hover {
  border-color: var(--brand-base);
  color: var(--brand-base);
  background: #fff;
}

.ade-cap-mount .cap-kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-family: var(--ff-body);
  font-size: 12.5px;
  border-bottom: 1px dashed var(--ott-100);
}
.ade-cap-mount .cap-kv:last-child { border-bottom: 0; }
.ade-cap-mount .cap-key {
  color: var(--ott-500);
  font-weight: 500;
}
.ade-cap-mount .cap-kv > span:last-child {
  color: var(--ink);
  font-weight: 600;
  font-family: var(--ff-mono);
  text-align: right;
}

.ade-cap-mount .cap-chart {
  width: 100%;
  min-height: 180px;
  background: var(--ott-50);
  border-radius: 8px;
  padding: 8px;
  overflow: hidden;
}
.ade-cap-mount .cap-chart svg { width: 100%; height: auto; display: block; }
.ade-cap-mount .cap-chart-empty {
  padding: 30px 12px;
  text-align: center;
  color: var(--ott-500);
  font-size: 12px;
}

.ade-cap-mount .cap-istat-row {
  margin-top: 8px;
  font-family: var(--ff-body);
  font-size: 11.5px;
  color: var(--ott-500);
}
.ade-cap-mount .cap-istat-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.ade-cap-mount .cap-istat-row input[type="checkbox"] {
  accent-color: var(--brand-base);
}

.ade-cap-mount .ntn-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-family: var(--ff-body);
  font-size: 11px;
  color: var(--ott-500);
}
.ade-cap-mount .ntn-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ade-cap-mount .ntn-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.ade-cap-mount .cap-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.ade-cap-mount .cap-kpi {
  border: 1px solid var(--ott-200);
  border-radius: 8px;
  background: var(--ott-50);
  padding: 10px 11px;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.ade-cap-mount .cap-kpi:hover {
  border-color: var(--brand-base);
  background: #fff;
}
.ade-cap-mount .cap-kpi-label {
  font-family: var(--ff-body);
  font-size: 10.5px;
  color: var(--ott-500);
  font-weight: 500;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.ade-cap-mount .cap-kpi-value {
  font-family: var(--ff-mono);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  line-height: 1.2;
}
.ade-cap-mount .cap-kpi-value .cap-kpi-unit {
  font-size: 11px;
  color: var(--ott-500);
  font-weight: 500;
  margin-left: 2px;
}
.ade-cap-mount .cap-kpi-sub {
  font-family: var(--ff-body);
  font-size: 10.5px;
  color: var(--ott-500);
  font-weight: 500;
  margin-top: 4px;
  line-height: 1.35;
  min-height: 14px;
}
.ade-cap-mount .cap-kpi-bar {
  margin-top: 6px;
  height: 3px;
  background: var(--ott-200);
  border-radius: 2px;
  overflow: hidden;
}
.ade-cap-mount .cap-kpi-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--brand-base);
  border-radius: 2px;
  transition: width 240ms ease;
}
.ade-cap-mount .cap-kpi-bar-fill.is-pos { background: #15803d; }
.ade-cap-mount .cap-kpi-bar-fill.is-neg { background: #b91c1c; }
.ade-cap-mount .cap-kpi-bar-fill.is-warn { background: #d97706; }
.ade-cap-mount .cap-kpi-bar-fill.is-neutral { background: var(--brand-base); }

.ade-cap-mount .cap-quadrant-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--ott-50);
  border: 1px solid var(--ott-200);
  border-left: 3px solid var(--neg);
  border-radius: 8px;
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ott-700);
  text-align: left;
}
.ade-cap-mount .cap-quadrant-label::before {
  content: "⚠";
  color: var(--neg);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  flex-shrink: 0;
}
.ade-cap-mount .cap-quadrant-label strong { font-weight: 700; color: var(--ink); }

/* Override legenda swatches (markup ha colori inline #157601/#2563eb/#f97316).
   Mappa al sistema design Ottanio v2 senza toccare il markup. */
.ade-cap-mount .ntn-legend-swatch[style*="#157601"] { background: #0E3B45 !important; }
.ade-cap-mount .ntn-legend-swatch[style*="#2563eb"] { background: #7BB0BC !important; }
.ade-cap-mount .ntn-legend-swatch[style*="#f97316"] { background: #031C23 !important; }
.ade-cap-mount .ntn-legend-swatch[style*="#e31c18"] { background: #C0392B !important; }
.ade-cap-mount .ntn-legend-swatch[style*="#0f766e"] { background: #0E3B45 !important; }
.ade-cap-mount .ntn-legend-swatch[style*="#94a3b8"] { background: #CBD5E0 !important; }

/* Cerchi punti chart YoY: cursor pointer + transition per hover */
.ade-cap-mount .cap-yoy-point {
  cursor: pointer;
  transition: r 120ms ease;
}
.ade-cap-mount .cap-yoy-point:hover { r: 5; }

/* Punto zona Quadrante: pulse halo (CSS only) */
.ade-cap-mount .cap-quadrant-point { transition: transform 150ms; transform-origin: center; transform-box: fill-box; }
.ade-cap-mount .cap-quadrant-point:hover { transform: scale(1.15); }

.ade-cap-mount .cap-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--ott-200);
  border-radius: 8px;
}
.ade-cap-mount .cap-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--ff-body);
  font-size: 12px;
}
.ade-cap-mount .cap-table thead th {
  background: var(--ott-50);
  border-bottom: 1px solid var(--ott-200);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--ott-500);
  letter-spacing: 0.01em;
  font-size: 10.5px;
  text-transform: uppercase;
}
.ade-cap-mount .cap-table tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--ott-100);
  color: var(--ink);
  font-family: var(--ff-mono);
  font-size: 12px;
}
.ade-cap-mount .cap-table tbody tr:last-child td { border-bottom: 0; }
.ade-cap-mount .cap-table tbody tr:hover td { background: var(--ott-50); }
.ade-cap-mount .cap-table .cap-table-up { color: var(--pos); }
.ade-cap-mount .cap-table .cap-table-down { color: var(--neg); }

@media (max-width: 900px) {
  .ade-cap-mount .fonti-grid { grid-template-columns: 1fr; }
  .ade-cap-mount .cap-block.span-2 { grid-column: auto; }
  .ade-cap-mount .cap-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Insight popup capoluoghi: restyling Ottanio v2 */
.cap-insight-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 9998;
}
.cap-insight-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 540px);
  max-height: 86vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--ott-200);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  padding: 22px 24px 24px;
  z-index: 9999;
  font-family: var(--ff-body);
}
.cap-insight-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font-size: 16px;
  color: var(--ott-500);
  cursor: pointer;
}
.cap-insight-close:hover { background: var(--ott-50); color: var(--ink); }
.cap-insight-title {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 14px;
  padding-right: 30px;
}
.cap-insight-chart { margin: 8px 0 12px; }
.cap-insight-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ott-500);
  line-height: 1.5;
}
