/* ============================================================
   Panoramica: la pagina d'ingresso del cliente.

   Palette e tipografia arrivano da frontend.css tramite le variabili --dm-*,
   ma ogni valore ha il proprio fallback: il foglio funziona anche da solo.
   Le classi hanno tutte prefisso .dmp-, gli attributi data-dmp-*.
   ============================================================ */

.dmp {
  --dmp-navy: var(--dm-heading, #0f2244);
  --dmp-blue: #2f6db8;
  --dmp-sky: #7db8e8;
  --dmp-lime: #c3ec2e;
  --dmp-olive: #41541a;
  --dmp-ink: var(--dm-heading, #0f2244);
  --dmp-mut: var(--dm-text-muted, #66708a);
  --dmp-line: var(--dm-border, #e6e9f0);
  --dmp-sand: #f4f2ec;
  --dmp-up: var(--dm-danger, #dc2626);
  --dmp-down: var(--dm-success, #16a34a);
  /* Inchiostri sul fondo navy: tutti sopra 4,5:1 sul #0f2244. */
  --dmp-onnavy: #9fb4d4;
  --dmp-onnavy-2: #8ba2c4;
  --dmp-grid: #7d93b5;
  display: flex;
  flex-direction: column;
  gap: 22px;
  color: var(--dmp-mut);
}

.dmp *, .dmp *::before, .dmp *::after { box-sizing: border-box; }
.dmp button { font-family: inherit; }

.dmp-card {
  border-radius: 12px;
  background: var(--dm-card, #ffffff);
  box-shadow: 0 1px 2px rgba(15, 34, 68, .05), 0 12px 32px -12px rgba(15, 34, 68, .14);
  padding: 24px 26px 22px;
}
.dmp-kick {
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--dmp-mut);
}
.dmp-h2 {
  margin: 8px 0 0; font-size: 19px; line-height: 1.2;
  font-weight: 700; letter-spacing: -.02em; color: var(--dmp-ink);
}
.dmp-num { font-variant-numeric: tabular-nums; }

/* ---------- pastiglie e tab ---------- */

.dmp-tabs { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--dmp-sand); }
.dmp-tab {
  padding: 7px 13px; border: 0; border-radius: 7px; background: transparent;
  font-size: 12px; font-weight: 700; color: var(--dmp-mut); cursor: pointer;
  transition: background .22s ease, color .22s ease;
}
.dmp-tab:hover { background: rgba(15, 34, 68, .06); }
.dmp-tab[aria-pressed="true"] { background: var(--dmp-navy); color: #ffffff; }
.dmp-tab:focus-visible { outline: 2px solid var(--dmp-navy); outline-offset: 2px; }

.dmp-pill {
  padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.dmp-pill.up { background: #fdecec; color: var(--dmp-up); }
.dmp-pill.down { background: #e9f7ee; color: var(--dmp-down); }

/* ============================================================
   Testa: il pannello navy
   ============================================================ */

.dmp-hero {
  position: relative; overflow: hidden; border-radius: 14px;
  background: var(--dmp-navy);
  box-shadow: 0 1px 2px rgba(15, 34, 68, .18), 0 22px 50px -18px rgba(15, 34, 68, .5);
}
/* Il nodo del marchio, in filigrana. Un richiamo, non una decorazione. */
.dmp-hero-mark {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; opacity: .5;
}
.dmp-hero-pad { position: relative; padding: 26px 30px 0; }
.dmp-hero-foot { position: relative; margin-top: 22px; padding: 0 30px 22px; }

.dmp-hero-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px 24px; flex-wrap: wrap;
}
.dmp-hero-kick {
  font-size: 11px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--dmp-onnavy);
}
.dmp-ctrls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; row-gap: 10px; }

/* I tre controlli hanno la stessa altezza: allineati su una riga sola. */
.dmp-step, .dmp-cmp, .dmp-seg { height: 36px; border-radius: 10px; background: rgba(255, 255, 255, .08); }
.dmp-step { display: flex; align-items: center; gap: 2px; padding: 0 3px; }
.dmp-step-b {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: #ffffff; cursor: pointer;
  transition: background .18s ease;
}
.dmp-step-b:hover { background: rgba(255, 255, 255, .12); }
.dmp-step-b[disabled] { color: rgba(255, 255, 255, .25); cursor: default; }
.dmp-step-b[disabled]:hover { background: transparent; }
.dmp-step-lab { min-width: 132px; text-align: center; font-size: 14px; font-weight: 700; color: #ffffff; }

.dmp-cmp { display: inline-flex; align-items: center; gap: 9px; padding: 0 12px; }
.dmp-cmp-k {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dmp-onnavy-2); white-space: nowrap;
}
.dmp-cmp-v { font-size: 12.5px; font-weight: 700; color: #ffffff; white-space: nowrap; }

.dmp-seg { position: relative; display: flex; padding: 3px; }
.dmp-seg-i {
  position: absolute; top: 3px; bottom: 3px; border-radius: 8px; background: #ffffff;
  transition: left .3s cubic-bezier(.16, 1, .3, 1);
}
.dmp-seg-b {
  position: relative; z-index: 1; display: inline-flex; align-items: center;
  padding: 0 15px; border: 0; background: transparent;
  font-size: 12.5px; font-weight: 700; color: #dce6f4; cursor: pointer;
  transition: color .2s ease;
}
.dmp-seg-b[aria-pressed="true"] { color: var(--dmp-navy); }

/* ---------- KPI ---------- */

.dmp-kpis { display: flex; align-items: flex-end; gap: 24px 40px; flex-wrap: wrap; margin-top: 24px; }
.dmp-big { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.dmp-big-n {
  font-size: 56px; line-height: 1.02; font-weight: 700; letter-spacing: -.038em;
  color: #ffffff; font-variant-numeric: tabular-nums;
}
.dmp-big-u { font-size: 22px; font-weight: 600; color: var(--dmp-onnavy); }
.dmp-big-d {
  margin-left: 4px; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 8px; font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* Sul navy i rossi e i verdi da fondo chiaro non tengono: tinte schiarite. */
.dmp-big-d.up { background: rgba(255, 120, 120, .2); color: #ffb3b3; }
.dmp-big-d.down { background: rgba(120, 230, 160, .2); color: #a8ecc0; }
.dmp-big-s { margin-top: 10px; font-size: 13.5px; font-weight: 500; color: var(--dmp-onnavy); font-variant-numeric: tabular-nums; }

.dmp-kpi-row { display: flex; align-items: stretch; margin-left: auto; }
.dmp-kpi { padding: 0 24px; border-left: 1px solid rgba(255, 255, 255, .13); }
.dmp-kpi:last-child { padding-right: 0; }
.dmp-kpi-k {
  font-size: 10.5px; font-weight: 700; letter-spacing: .11em;
  text-transform: uppercase; color: var(--dmp-onnavy-2);
}
.dmp-kpi-v { margin-top: 9px; display: flex; align-items: baseline; gap: 6px; }
.dmp-kpi-v > b {
  font-size: 24px; font-weight: 700; letter-spacing: -.025em;
  color: #ffffff; font-variant-numeric: tabular-nums;
}
.dmp-kpi-v > span { font-size: 13px; font-weight: 600; color: var(--dmp-onnavy); }
.dmp-kpi-d { margin-top: 5px; font-size: 12.5px; font-weight: 500; color: var(--dmp-onnavy); font-variant-numeric: tabular-nums; }
.dmp-kpi-d.up { font-weight: 700; color: #ff9d9d; }
.dmp-kpi-d.down { font-weight: 700; color: #b6f0c4; }

/* ---------- legenda e grafico ---------- */

.dmp-leg { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.dmp-leg-l { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.dmp-leg-i { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: #dce6f4; }
.dmp-leg-i.prev { font-weight: 500; color: var(--dmp-onnavy); }
.dmp-leg-i.fc { color: var(--dmp-lime); }
.dmp-leg-k { width: 16px; height: 2.5px; border-radius: 2px; background: var(--dmp-sky); }
.dmp-leg-i.prev .dmp-leg-k { height: 0; border-top: 2px dashed rgba(255, 255, 255, .5); background: none; }
.dmp-leg-i.fc .dmp-leg-k { height: 0; border-top: 2px dashed var(--dmp-lime); background: none; }

.dmp-seg-d { position: relative; display: flex; padding: 3px; height: 34px; border-radius: 9px; background: rgba(255, 255, 255, .08); }
.dmp-seg-d .dmp-seg-i { background: rgba(255, 255, 255, .16); }
.dmp-seg-d .dmp-seg-b { padding: 0 13px; font-size: 11.5px; color: var(--dmp-onnavy); }
.dmp-seg-d .dmp-seg-b[aria-pressed="true"] { color: #ffffff; }
.dmp-ghost {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 9px; background: transparent;
  font-size: 11.5px; font-weight: 700; color: #ffffff; cursor: pointer;
  transition: background .18s ease;
}
.dmp-ghost:hover { background: rgba(255, 255, 255, .1); }

.dmp-plot { position: relative; height: 262px; }
.dmp-plot-g { position: absolute; left: 0; right: 56px; height: 1px; background: rgba(255, 255, 255, .08); }
.dmp-plot-y {
  position: absolute; right: 0; font-size: 10.5px; font-weight: 600;
  color: var(--dmp-grid); font-variant-numeric: tabular-nums;
}
.dmp-plot-a { position: absolute; left: 0; right: 56px; top: 0; bottom: 0; cursor: crosshair; }
.dmp-plot-a svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dmp-band { fill: rgba(255, 255, 255, .055); transition: x .4s cubic-bezier(.16, 1, .3, 1), width .4s cubic-bezier(.16, 1, .3, 1); }
.dmp-line { fill: none; stroke: var(--dmp-sky); stroke-width: 2.8; stroke-linecap: round; }
.dmp-line-prev { fill: none; stroke: rgba(255, 255, 255, .5); stroke-width: 1.7; stroke-dasharray: 5 5; transition: opacity .28s ease; }
.dmp-plot-a:hover .dmp-line-prev { opacity: .55; }
.dmp-line-fc { fill: none; stroke: var(--dmp-lime); stroke-width: 2.8; stroke-dasharray: 6 6; stroke-linecap: round; }

.dmp-dot { position: absolute; width: 0; height: 0; }
.dmp-dot > i {
  position: absolute; left: -6px; top: -6px; width: 12px; height: 12px;
  border-radius: 50%; background: #ffffff; box-shadow: 0 0 0 3px var(--dmp-navy);
}
.dmp-dot.fc > i { left: -5px; top: -5px; width: 10px; height: 10px; background: var(--dmp-lime); }
.dmp-tip {
  position: absolute; padding: 9px 13px; border-radius: 9px; background: #ffffff;
  box-shadow: 0 10px 26px -8px rgba(0, 0, 0, .5); white-space: nowrap; z-index: 3;
}
.dmp-tip.left { right: 16px; bottom: -18px; }
.dmp-tip-k { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--dmp-mut); }
.dmp-tip-v { margin-top: 4px; font-size: 15px; font-weight: 700; color: var(--dmp-ink); font-variant-numeric: tabular-nums; }
.dmp-tip-s { margin-top: 3px; font-size: 11.5px; font-weight: 500; color: var(--dmp-mut); font-variant-numeric: tabular-nums; }
.dmp-tip.fc { left: 16px; top: -16px; padding: 7px 11px; border-radius: 8px; background: var(--dmp-lime); box-shadow: none; }
.dmp-tip.fc .dmp-tip-k { color: var(--dmp-olive); font-size: 10px; }
.dmp-tip.fc .dmp-tip-v { margin-top: 3px; font-size: 13.5px; color: var(--dmp-ink); }

.dmp-cross { position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; }
.dmp-cross > .l { position: absolute; left: -.5px; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .28); }
.dmp-cross > .p { position: absolute; left: -4px; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: rgba(255, 255, 255, .55); }

.dmp-xaxis { display: grid; grid-template-columns: repeat(12, 1fr); padding-right: 56px; padding-top: 11px; }
.dmp-xaxis > div { text-align: center; font-size: 11px; font-weight: 600; color: var(--dmp-grid); transition: color .2s ease; }
.dmp-xaxis > div.in { color: #c3d3e8; }
.dmp-xaxis > div.act { font-weight: 700; color: #ffffff; }
.dmp-xaxis > div.fc { color: var(--dmp-lime); }

/* ---------- tabella dei dodici mesi, sul navy ---------- */

.dmp-mtbl { overflow-x: auto; }
.dmp-mtbl-g { display: grid; grid-template-columns: minmax(120px, 1.4fr) repeat(3, minmax(96px, 1fr)); min-width: 560px; align-items: center; }
.dmp-mtbl-g > span {
  padding: 10px 12px; font-size: 13px; font-weight: 600; text-align: right;
  color: #ffffff; border-bottom: 1px solid rgba(255, 255, 255, .07);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.dmp-mtbl-g > span.h {
  padding: 0 12px 10px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dmp-onnavy-2);
  border-bottom: 1px solid rgba(255, 255, 255, .18);
}
.dmp-mtbl-g > span.l { text-align: left; }
.dmp-mtbl-g > span.z { background: rgba(255, 255, 255, .04); }
.dmp-mtbl-g > span.mut { font-weight: 500; color: var(--dmp-onnavy); }
.dmp-mtbl-g > span.up { font-weight: 700; color: #ff9d9d; }
.dmp-mtbl-g > span.down { font-weight: 700; color: #b6f0c4; }
.dmp-mtbl-g > span.fc { color: var(--dmp-lime); }
.dmp-mtbl-g > span.na { color: var(--dmp-grid); }

/* ============================================================
   Commodity Pulse e Previsione
   ============================================================ */

.dmp-pulse { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }

.dmp-mat {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  min-height: 228px; padding: 20px 20px 0; border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 34, 68, .06), 0 10px 26px -12px rgba(15, 34, 68, .22);
  transition: box-shadow .22s ease, transform .22s ease;
}
.dmp-mat:hover {
  box-shadow: 0 4px 10px rgba(15, 34, 68, .1), 0 22px 44px -16px rgba(15, 34, 68, .3);
  transform: translateY(-2px);
}
.dmp-mat:focus-visible { outline: 2px solid var(--dmp-navy); outline-offset: 3px; }
.dmp-mat.energia { background: var(--dmp-navy); color: #ffffff; }
.dmp-mat.gas { background: var(--dmp-blue); color: #ffffff; }
.dmp-mat.acqua { background: var(--dmp-sky); color: var(--dmp-navy); }
.dmp-mat.fc { background: var(--dmp-lime); color: var(--dmp-navy); }

/* L'emblema e' una filigrana: i dati vengono prima. */
.dmp-emb {
  position: absolute; z-index: 0; right: 16px; top: 16px; width: 30px; height: 30px;
  pointer-events: none; opacity: .34; transition: opacity .25s ease;
}
.dmp-mat:hover .dmp-emb { opacity: .6; }
.dmp-emb svg { width: 100%; height: 100%; display: block; }

/* v5.131.1 — L'emblema resta assoluto in alto a destra. La regola generica qui
   sotto ha la stessa specificita' di .dmp-emb e arrivava dopo: rimetteva la
   filigrana nel flusso, cioe' in cima a sinistra dentro la colonna flex. */
.dmp-mat > *:not(.dmp-emb) { position: relative; z-index: 1; }
.dmp-mat-k { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }

/* v5.132.0 — Acqua per periodo di fattura: l'etichetta che dichiara la natura del
   numero, e la riga in fondo con le date vere e la quota che entra nel totale. */
.dmp-mat-tag {
  padding: 2px 7px; border-radius: 5px; background: rgba(15, 34, 68, .3);
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em;
}
.dmp-mat.acqua .dmp-mat-tag { background: rgba(15, 34, 68, .16); }
.dmp-mat-per {
  margin-top: 12px; padding-top: 11px; border-top: 1px solid rgba(255, 255, 255, .16);
  font-size: 11.5px; font-weight: 600; line-height: 1.45; font-variant-numeric: tabular-nums;
}
.dmp-mat.acqua .dmp-mat-per { border-top-color: rgba(15, 34, 68, .14); }
.dmp-mat-per > em { display: block; margin-top: 3px; font-style: normal; font-weight: 500; opacity: .78; }
.dmp-mat-v { display: flex; align-items: baseline; gap: 6px; margin-top: 16px; }
.dmp-mat-v > b { font-size: 33px; line-height: 1.04; font-weight: 700; letter-spacing: -.032em; font-variant-numeric: tabular-nums; }
.dmp-mat-v > span { font-size: 15px; font-weight: 600; }
.dmp-mat-q { margin-top: 5px; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.dmp-mat-r { display: flex; align-items: center; gap: 8px; margin-top: 13px; flex-wrap: wrap; }
.dmp-mat-d { padding: 3px 8px; border-radius: 6px; background: rgba(15, 34, 68, .32); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dmp-mat.acqua .dmp-mat-d, .dmp-mat.fc .dmp-mat-d { background: rgba(15, 34, 68, .14); }
.dmp-mat-vs { font-size: 12px; font-weight: 500; }
.dmp-mat-sh { margin-left: auto; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

.dmp-spark { position: relative; margin: auto -20px 0; height: 64px; }
.dmp-spark svg { display: block; width: 100%; height: 64px; }
.dmp-spark-a { fill: rgba(255, 255, 255, .14); }
.dmp-mat.acqua .dmp-spark-a { fill: rgba(15, 34, 68, .1); }
.dmp-spark-l { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; transition: stroke-width .22s ease; }
.dmp-mat:hover .dmp-spark-l { stroke-width: 2.9; }
.dmp-spark-d { position: absolute; right: 20px; width: 0; height: 0; }
.dmp-spark-d > i { position: absolute; left: -3.5px; top: -3.5px; width: 7px; height: 7px; border-radius: 50%; background: currentColor; transition: transform .25s ease; }
.dmp-mat:hover .dmp-spark-d > i { transform: scale(1.45); }
.dmp-spark-d > em { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: currentColor; animation: dmpPulse 3.2s ease-in-out infinite; }

.dmp-mat-cta {
  display: flex; align-items: center; gap: 7px; padding: 13px 0;
  border-top: 1px solid rgba(255, 255, 255, .18);
  font-size: 12.5px; font-weight: 700;
}
.dmp-mat.acqua .dmp-mat-cta, .dmp-mat.fc .dmp-mat-cta { border-top-color: rgba(15, 34, 68, .18); }
.dmp-mat-cta svg { transition: transform .22s ease; }
.dmp-mat:hover .dmp-mat-cta svg { transform: translateX(3px); }

/* ---------- previsione ---------- */

.dmp-fc-rows { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.dmp-fc-row { display: flex; align-items: center; gap: 8px; }
.dmp-fc-range { margin-top: auto; padding: 18px 0; }
.dmp-fc-k { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 9px; }
.dmp-fc-bar { position: relative; height: 6px; border-radius: 3px; background: rgba(15, 34, 68, .16); }
.dmp-fc-bar > i { position: absolute; left: 0; top: 0; height: 6px; width: 100%; border-radius: 3px; background: rgba(15, 34, 68, .42); transform-origin: left; }
.dmp-fc-bar > em { position: absolute; top: -5px; width: 3px; height: 16px; border-radius: 2px; background: var(--dmp-navy); }
.dmp-fc-ends { display: flex; justify-content: space-between; margin-top: 9px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dmp-fc-note { margin-top: 12px; font-size: 11.5px; font-weight: 500; line-height: 1.5; text-wrap: pretty; }

/* ============================================================
   Insights
   ============================================================ */

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

/* v5.131.2 — Niente filetto di colore in testa e niente fondi pastello: le card
   usano il vocabolario del resto della pagina — fondo sabbia come le pastiglie
   dei tab, filetto hairline, pallino di stato come le righe Performance, chip
   dello scostamento come nelle tabelle. Il colore sta nel pallino e nel chip,
   non addosso alla card. */
.dmp-ins-c {
  display: flex; flex-direction: column;
  padding: 15px 16px 14px; border-radius: 10px;
  background: var(--dmp-sand); border: 1px solid transparent;
  transition: border-color .2s ease, background .2s ease;
}
.dmp-ins-c:hover { background: #efece4; border-color: rgba(15, 34, 68, .1); }

.dmp-ins-h { display: flex; align-items: center; gap: 8px; }
.dmp-ins-h > i { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: #8fa0bf; }
.dmp-ins-c.warn .dmp-ins-h > i { background: var(--dmp-up); }
.dmp-ins-c.good .dmp-ins-h > i { background: var(--dmp-down); }
.dmp-ins-c.fc .dmp-ins-h > i   { background: var(--dmp-lime); }
.dmp-ins-k { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dmp-mut); }

.dmp-ins-t {
  margin-top: 11px; font-size: 15px; font-weight: 700; color: var(--dmp-ink);
  line-height: 1.25; letter-spacing: -.01em; text-wrap: pretty;
}
.dmp-ins-r { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.dmp-ins-r > span.n { font-size: 12.5px; font-weight: 600; color: var(--dmp-mut); font-variant-numeric: tabular-nums; }
.dmp-pill.fc { background: #eef7cf; color: var(--dmp-olive); }
.dmp-pill.flat { background: rgba(15, 34, 68, .07); color: #55658a; }

.dmp-ins-x { margin-top: 10px; font-size: 12.5px; font-weight: 500; color: #3c4760; line-height: 1.5; text-wrap: pretty; }

.dmp-ins-f {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: auto; padding-top: 13px;
  font-size: 11.5px; font-weight: 600; color: var(--dmp-mut); font-variant-numeric: tabular-nums;
}
.dmp-ins-f > i {
  display: block; flex: 1; max-width: 74px; height: 3px; border-radius: 2px;
  background: rgba(15, 34, 68, .1); overflow: hidden;
}
.dmp-ins-f > i > em { display: block; height: 100%; border-radius: 2px; background: #8fa0bf; transform-origin: 0 50%; }

/* ============================================================
   Distribuzione e performance
   ============================================================ */

.dmp-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.dmp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }

.dmp-tm { position: relative; width: 100%; aspect-ratio: 16 / 11; min-height: 260px; }
.dmp-tile {
  position: absolute; padding: 2px;
  transition: left .38s cubic-bezier(.16, 1, .3, 1), top .38s cubic-bezier(.16, 1, .3, 1),
              width .38s cubic-bezier(.16, 1, .3, 1), height .38s cubic-bezier(.16, 1, .3, 1);
}
.dmp-tile > div {
  width: 100%; height: 100%; overflow: hidden; display: flex; flex-direction: column;
  justify-content: flex-end; padding: 10px 11px; border-radius: 7px;
  transition: filter .2s ease;
}
.dmp-tile > div:hover { filter: brightness(1.12); }
.dmp-tile-n { font-size: 11.5px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dmp-tile-v { margin-top: 4px; font-size: 17px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dmp-tile-q { margin-top: 2px; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* v5.131.1 — Un cliente con una sola struttura (o una sola materia nel filtro)
   riempiva il riquadro di navy pieno: una tessera al 100% non e' un grafico.
   Al suo posto un pannello che dice il numero e cosa rappresenta. */
.dmp-solo {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 260px; padding: 26px 28px; border-radius: 10px;
  background: linear-gradient(155deg, var(--dmp-navy) 0%, #1b3c6d 100%); color: #ffffff;
}
.dmp-solo-k { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dmp-onnavy); }
.dmp-solo-n { margin-top: 10px; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.dmp-solo-v { display: flex; align-items: baseline; gap: 8px; margin-top: 14px; }
.dmp-solo-v > b { font-size: 40px; line-height: 1; font-weight: 700; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.dmp-solo-v > span { font-size: 17px; font-weight: 600; color: var(--dmp-onnavy); }
.dmp-solo-r { display: flex; align-items: center; gap: 9px; margin-top: 16px; flex-wrap: wrap; }
.dmp-solo-r .dmp-pill.up { background: rgba(220, 38, 38, .24); color: #ffc9c9; }
.dmp-solo-r .dmp-pill.down { background: rgba(22, 163, 74, .24); color: #b7efc9; }
.dmp-solo-q { font-size: 12.5px; font-weight: 600; color: var(--dmp-onnavy); }
.dmp-solo-x {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .14);
  font-size: 12.5px; font-weight: 500; line-height: 1.55; color: var(--dmp-onnavy); max-width: 48ch;
}

.dmp-prow, .dmp-phead {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) 92px 74px 62px 18px;
  gap: 10px; align-items: center;
}
.dmp-phead { padding: 0 10px 9px; border-bottom: 1px solid var(--dmp-line); }
.dmp-phead > span { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dmp-mut); }
.dmp-prow {
  position: relative; padding: 12px 10px; border-radius: 8px;
  text-decoration: none; transition: background .2s ease;
}
.dmp-prow:hover { background: #f1f4fa; }
.dmp-prow-n { font-size: 12.5px; font-weight: 700; color: #8fa0bf; font-variant-numeric: tabular-nums; }
.dmp-prow-s { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.dmp-prow-s > span { font-size: 13.5px; font-weight: 600; color: var(--dmp-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dmp-dot-s { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; }
.dmp-vuoto { padding: 26px 10px; font-size: 13px; font-weight: 500; color: var(--dmp-mut); }

/* ============================================================
   Dettaglio strutture
   ============================================================ */

.dmp-det-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 20px; flex-wrap: wrap; margin-bottom: 18px; }
.dmp-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dmp-search { position: relative; display: inline-flex; align-items: center; }
.dmp-search svg { position: absolute; left: 11px; pointer-events: none; }
.dmp-search input {
  width: 220px; padding: 9px 12px 9px 33px; border: 1px solid var(--dmp-line);
  border-radius: 9px; background: #ffffff; font-family: inherit; font-size: 12.5px;
  font-weight: 500; color: var(--dmp-ink); outline: none; transition: border-color .18s ease;
}
.dmp-search input:focus { border-color: var(--dmp-navy); }

.dmp-legend { display: flex; align-items: center; gap: 15px; font-size: 12px; font-weight: 600; color: var(--dmp-mut); margin-bottom: 14px; }
.dmp-legend > button { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.dmp-legend i { width: 8px; height: 8px; border-radius: 2px; }
.dmp-legend .n { margin-left: auto; font-weight: 500; font-variant-numeric: tabular-nums; }

.dmp-tw { overflow-x: auto; }
.dmp-tw-in { min-width: 640px; }
.dmp-drow, .dmp-dhead, .dmp-dfoot {
  display: grid; grid-template-columns: minmax(0, 1.7fr) 104px minmax(90px, 1fr) 54px 82px 20px;
  gap: 14px; align-items: center;
}
.dmp-dhead { padding: 0 12px 9px; border-bottom: 1px solid var(--dmp-line); }
.dmp-dhead > span { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dmp-mut); }
.dmp-drow {
  position: relative; padding: 13px 12px; border-radius: 8px;
  text-decoration: none; transition: background .2s ease;
}
.dmp-drow.z { background: #fbfbf9; }
.dmp-drow:hover { background: #f1f4fa; }
.dmp-drow-i { position: absolute; left: 0; top: 9px; bottom: 9px; width: 2.5px; border-radius: 2px; background: var(--dmp-navy); opacity: 0; transform: scaleY(.4); transition: opacity .22s ease, transform .22s ease; }
.dmp-drow:hover .dmp-drow-i { opacity: 1; transform: scaleY(1); }
.dmp-drow-s { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.dmp-drow-s > span { font-size: 14px; font-weight: 600; color: var(--dmp-ink); line-height: 1.3; text-wrap: pretty; }
.dmp-drow-e { font-size: 14px; font-weight: 700; color: var(--dmp-ink); text-align: right; font-variant-numeric: tabular-nums; }
.dmp-comp { display: flex; gap: 2px; height: 7px; transform-origin: left; }
.dmp-comp > i { height: 7px; border-radius: 2px; transition: opacity .22s ease; }
.dmp-comp > i.e { background: var(--dmp-navy); }
.dmp-comp > i.g { background: var(--dmp-blue); }
.dmp-comp > i.a { background: var(--dmp-sky); }
.dmp-comp.dim-e > i.g, .dmp-comp.dim-e > i.a { opacity: .18; }
.dmp-comp.dim-g > i.e, .dmp-comp.dim-g > i.a { opacity: .18; }
.dmp-comp.dim-a > i.e, .dmp-comp.dim-a > i.g { opacity: .18; }
.dmp-drow-q { font-size: 12.5px; font-weight: 500; color: var(--dmp-mut); text-align: right; font-variant-numeric: tabular-nums; }
.dmp-drow-d { font-size: 12.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.dmp-drow-d.up { color: var(--dmp-up); }
.dmp-drow-d.down { color: var(--dmp-down); }
.dmp-chev { opacity: .4; transition: opacity .22s ease, transform .22s ease; }
.dmp-drow:hover .dmp-chev, .dmp-prow:hover .dmp-chev { opacity: 1; transform: translateX(4px); }
.dmp-dfoot { padding: 16px 12px 4px; margin-top: 6px; border-top: 1px solid var(--dmp-line); }
.dmp-more {
  margin-top: 16px; padding: 10px 16px; border: 0; border-radius: 9px;
  background: var(--dmp-sand); color: var(--dmp-ink); font-size: 12.5px;
  font-weight: 700; cursor: pointer; transition: background .2s ease, transform .2s ease;
}
.dmp-more:hover { background: #e8e5db; transform: translateY(-1px); }

/* ============================================================
   Animazioni d'ingresso
   ------------------------------------------------------------
   Le regole stanno qui, ma e' il JS che le assegna: un fill-mode
   backwards dichiarato nel foglio lascerebbe la pagina invisibile
   ogni volta che la timeline non avanza (stampa, scheda in secondo
   piano, export PDF).
   ============================================================ */

@keyframes dmpUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes dmpFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dmpPop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@keyframes dmpRise { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
@keyframes dmpFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes dmpDash { from { stroke-dashoffset: 2200; } to { stroke-dashoffset: 0; } }
@keyframes dmpPulse { 0%, 100% { opacity: .25; transform: scale(1); } 50% { opacity: .8; transform: scale(1.7); } }

/* ============================================================
   Responsive: sotto i 900px la composizione cambia davvero
   ============================================================ */

@media (max-width: 1280px) {
  .dmp-pulse { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .dmp-split { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .dmp-card, .dmp-hero-pad { padding-left: 18px; padding-right: 18px; }
  .dmp-ins { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .dmp-hero-foot { padding-left: 18px; padding-right: 18px; }
  .dmp-kpi-row { margin-left: 0; width: 100%; }
  .dmp-kpi { flex: 1; padding-left: 16px; padding-right: 16px; }
  .dmp-kpi:first-child { padding-left: 0; border-left: 0; }
  .dmp-plot { height: 196px; }
  .dmp-xaxis { font-size: 9.5px; padding-right: 44px; }
  .dmp-tm { aspect-ratio: 4 / 5; min-height: 340px; }
  .dmp-tw-in { min-width: 0; }
  /* Le tabelle perdono le colonne secondarie invece di scorrere. */
  .dmp-drow, .dmp-dhead, .dmp-dfoot { grid-template-columns: minmax(0, 1fr) 96px 70px; gap: 10px; }
  .dmp-drow > *:nth-child(3), .dmp-dhead > *:nth-child(3), .dmp-dfoot > *:nth-child(3),
  .dmp-drow > *:nth-child(4), .dmp-dhead > *:nth-child(4), .dmp-dfoot > *:nth-child(4),
  .dmp-drow > *:nth-child(6), .dmp-dhead > *:nth-child(6), .dmp-dfoot > *:nth-child(6) { display: none; }
  .dmp-prow, .dmp-phead { grid-template-columns: minmax(0, 1fr) 92px 70px; gap: 10px; }
  .dmp-prow > *:nth-child(1), .dmp-phead > *:nth-child(1),
  .dmp-prow > *:nth-child(5), .dmp-phead > *:nth-child(5),
  .dmp-prow > *:nth-child(6), .dmp-phead > *:nth-child(6) { display: none; }
}
@media (max-width: 640px) {
  .dmp-pulse { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .dmp-big-n { font-size: 38px; }
  .dmp-plot { height: 168px; }
  .dmp-search input { width: 100%; }
  .dmp-tools { width: 100%; }
  .dmp-search { flex: 1; }
}

/* ---------- stampa e movimento ridotto ---------- */

@media print {
  .dmp-hero { box-shadow: none; }
  .dmp-card { box-shadow: none; border: 1px solid var(--dmp-line); }
  .dmp-spark-d > em, .dmp-more, .dmp-tools, .dmp-tabs { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .dmp *, .dmp *::before, .dmp *::after { animation: none !important; transition: none !important; }
}

/* Ripiego senza JS */
.dmp-fb { width: 100%; border-collapse: collapse; }
.dmp-fb th, .dmp-fb td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--dmp-line); font-size: 13px; }
