/* ============================================================
   Acqua — sezione front-end cliente su base fatturata
   Dipende da riepilogo.css: riusa .dmr-* (card, tabelle, chip, righe, note)
   e aggiunge la parte specifica .aqm-*.
   ============================================================ */

/* ---- filtri ---- */
.aqm-filters {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 10px; background: var(--dmr-zebra, #fbfbf9);
}
.aqm-filters label { display: flex; align-items: center; gap: 9px; margin: 0; }
.aqm-fsep { width: 1px; align-self: stretch; background: var(--dmr-line, #e6e9f0); }
.aqm select {
  appearance: none; border: 0; border-radius: 8px;
  background-color: var(--dmr-cream, #f4f2ec); color: var(--dmr-ink, #0f2244);
  font: inherit; font-size: 12.5px; font-weight: 700; padding: 8px 30px 8px 12px;
  cursor: pointer; max-width: 340px; line-height: 1.4;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230f2244' stroke-width='2.4' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
  transition: background-color .2s ease;
}
.aqm select:hover { background-color: var(--dmr-cream-2, #e8e5db); }
.aqm select:focus-visible { outline: 2px solid var(--dmr-ink, #0f2244); outline-offset: 2px; }
.aqm-chip-iva {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px;
  border-radius: 8px; background: var(--dmr-cream, #f4f2ec);
  font-size: 11.5px; font-weight: 700; color: var(--dmr-ink, #0f2244); white-space: nowrap;
}
.aqm-chip-iva svg { color: var(--dmr-mut, #66708a); }

/* ---- eroe: cisterna + cifra + misure ---- */
.aqm-hero {
  position: relative; overflow: hidden; padding: 30px 34px 28px;
  transition: transform .26s cubic-bezier(.16, 1, .3, 1), box-shadow .26s ease;
}
.aqm-hero:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 9px rgba(15, 34, 68, .06), 0 24px 52px -14px rgba(15, 34, 68, .2);
}
.aqm-shine {
  position: absolute; top: 0; bottom: 0; left: 0; width: 130px; pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(125,184,232,.16), rgba(255,255,255,0));
  animation: aqmShine 9s cubic-bezier(.4, 0, .6, 1) 1.1s infinite;
}
@keyframes aqmShine {
  0% { transform: translateX(-140%) skewX(-18deg) }
  42%, 100% { transform: translateX(220%) skewX(-18deg) }
}
.aqm-hero-grid {
  position: relative; display: grid;
  grid-template-columns: 158px minmax(0, 1fr) minmax(0, .9fr);
  gap: 34px; align-items: stretch;
}

/* ---- la cisterna ---- */
.aqm-tankwrap { position: relative; display: flex; flex-direction: column; }
.aqm-halo {
  position: absolute; left: -16px; right: -16px; top: 24px; bottom: 34px;
  border-radius: 50%; filter: blur(18px); pointer-events: none;
  background: radial-gradient(closest-side, rgba(74,144,208,.28), rgba(74,144,208,0));
  animation: aqmHalo 7s ease-in-out infinite;
}
@keyframes aqmHalo {
  0%, 100% { opacity: .28; transform: scale(1) }
  50% { opacity: .5; transform: scale(1.06) }
}
.aqm-tank {
  position: relative; flex: 1; min-height: 300px;
  border: 1.5px solid #cfd6e4; border-radius: 8px; overflow: hidden;
  background: linear-gradient(180deg, #fbfdff 0%, #f2f7fc 100%);
  box-shadow: inset 0 1px 3px rgba(15, 34, 68, .06);
}
.aqm-level { position: absolute; left: 0; right: 0; bottom: 0; min-height: 16px; }
.aqm-body { position: absolute; inset: 0; background: linear-gradient(180deg, #4a90d0 0%, #2f6db8 100%); }
.aqm-surf {
  position: absolute; left: 0; top: -10px; width: 100%; height: 16px;
  overflow: visible; z-index: 3;
}
@keyframes aqmWaveA { from { transform: translateX(0) } to { transform: translateX(-120px) } }
@keyframes aqmWaveB { from { transform: translateX(-120px) } to { transform: translateX(0) } }
.aqm-w1 { animation: aqmWaveA 7s linear infinite }
.aqm-w2 { animation: aqmWaveB 11s linear infinite }
/* Le bolle salgono dentro il liquido: bottom in % del riempimento. */
@keyframes aqmBubble {
  0% { bottom: -8%; opacity: 0; transform: scale(.45) }
  14% { opacity: .62 }
  82% { opacity: .28 }
  100% { bottom: 104%; opacity: 0; transform: scale(1.2) }
}
.aqm-bub {
  position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .7);
  animation-name: aqmBubble; animation-timing-function: ease-in;
  animation-iteration-count: infinite;
}
/* Le luci stanno sul VETRO, non sul liquido: una striscia dentro l'acqua legge
   come un segno, non come un riflesso. */
.aqm-glass-a {
  position: absolute; left: 9%; top: 6px; bottom: 6px; width: 26px; border-radius: 13px;
  filter: blur(5px); pointer-events: none; z-index: 7;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.42) 42%, rgba(255,255,255,.06));
}
.aqm-glass-b {
  position: absolute; right: 11%; top: 10px; bottom: 10px; width: 9px; border-radius: 6px;
  filter: blur(3px); pointer-events: none; z-index: 7;
  background: linear-gradient(90deg, rgba(255,255,255,.22), rgba(255,255,255,0));
}
.aqm-inner {
  position: absolute; inset: 0; border-radius: 7px; pointer-events: none; z-index: 6;
  box-shadow: inset 0 0 22px rgba(15, 34, 68, .07);
}
.aqm-ref {
  position: absolute; left: 0; right: 0; height: 0;
  border-top: 2px dashed var(--dmr-ink, #0f2244); opacity: .55; z-index: 4;
}
.aqm-ref-lab {
  position: absolute; left: 7px; padding: 2px 6px; border-radius: 5px;
  background: rgba(255, 255, 255, .88); font-size: 9.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--dmr-ink, #0f2244);
  white-space: nowrap; z-index: 5;
}
/* Le tacche cadono dentro o fuori l'acqua secondo il livello: sotto serve
   inchiostro chiaro, sopra scuro. Mai sotto 10,5px. */
.aqm-tick { position: absolute; right: 0; width: 9px; height: 1px; background: #b9c4d6; z-index: 4; }
.aqm-tick.in { background: rgba(255, 255, 255, .5); }
.aqm-tick-lab {
  position: absolute; right: 14px; font-size: 10.5px; font-weight: 700;
  color: var(--dmr-mut, #66708a); font-variant-numeric: tabular-nums; z-index: 4;
}
.aqm-tick-lab.in { color: rgba(255, 255, 255, .92); }
.aqm-tank-cap {
  margin-top: 11px; text-align: center; font-size: 10.5px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--dmr-mut, #66708a);
}

/* ---- cifra e misure ---- */
.aqm-hero-main { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.aqm-big { display: flex; align-items: baseline; gap: 9px; margin-top: 14px; flex-wrap: wrap; min-width: 0; }
.aqm-big span {
  font-size: 64px; line-height: 1.02; font-weight: 700; letter-spacing: -.038em;
  font-variant-numeric: tabular-nums; color: var(--dmr-ink, #0f2244);
}
.aqm-big b { font-size: 24px; font-weight: 600; color: var(--dmr-mut, #66708a); }
.aqm-hero-d { display: flex; align-items: center; gap: 11px; margin-top: 16px; flex-wrap: wrap; }
.aqm-hero-d em {
  font-style: normal; font-size: 13px; font-weight: 500; color: var(--dmr-mut, #66708a);
}
.aqm-hero-p {
  margin: 16px 0 0; font-size: 14px; font-weight: 500; color: var(--dmr-mut, #66708a);
  line-height: 1.5; max-width: 440px; text-wrap: pretty;
}
.aqm-hero-side {
  display: flex; flex-direction: column; justify-content: center;
  padding-left: 32px; border-left: 1px solid var(--dmr-line, #e6e9f0); min-width: 0;
}
.aqm-hero-side > div { padding: 18px 0; border-bottom: 1px solid var(--dmr-line, #e6e9f0); }
.aqm-hero-side > div:first-child { padding-top: 0; }
.aqm-hero-side > div:last-child { padding-bottom: 0; border-bottom: 0; }
.aqm-side-v { display: flex; align-items: baseline; gap: 5px; margin-top: 9px; }
.aqm-side-v span {
  font-size: 24px; font-weight: 700; letter-spacing: -.02em;
  color: var(--dmr-ink, #0f2244); font-variant-numeric: tabular-nums;
}
.aqm-side-v b { font-size: 13px; font-weight: 600; color: var(--dmr-mut, #66708a); }
.aqm-hero-side em {
  display: block; margin-top: 5px; font-size: 11.5px; font-weight: 500; font-style: normal;
  color: var(--dmr-mut, #66708a); font-variant-numeric: tabular-nums;
}

/* ---- la fattura: si sfoglia ---- */
.aqm-bill {
  position: relative; overflow: hidden; perspective: 1700px; padding: 26px 28px 22px;
  transition: transform .26s cubic-bezier(.16, 1, .3, 1), box-shadow .26s ease;
}
.aqm-bill:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 9px rgba(15, 34, 68, .06), 0 22px 48px -14px rgba(15, 34, 68, .19);
}
/* Il foglio parte invisibile: se il JS non gira non copre niente. */
.aqm-page {
  position: absolute; inset: 0; z-index: 9; border-radius: 12px; opacity: 0;
  transform-origin: left center; backface-visibility: hidden; pointer-events: none;
  box-shadow: 14px 0 34px -8px rgba(15, 34, 68, .26);
  background: repeating-linear-gradient(180deg, rgba(15,34,68,.05) 0 1px, rgba(0,0,0,0) 1px 15px),
              linear-gradient(100deg, #ffffff 0%, #f7fafd 58%, #e7eff8 100%);
}
@keyframes aqmPage {
  0% { opacity: 1; transform: rotateY(0deg) }
  62% { opacity: .96 }
  100% { opacity: 0; transform: rotateY(-122deg) }
}
/* I tre keyframe che acqua.js assegna leggendo data-dmr-anim. */
@keyframes aqmLevel { from { transform: translateY(100%) } to { transform: translateY(0) } }
@keyframes aqmGrow { from { transform: scaleY(0) } to { transform: scaleY(1) } }
.aqm-bill-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.aqm-bill-sub {
  margin-top: 7px; font-size: 13.5px; font-weight: 500;
  color: var(--dmr-mut, #66708a); font-variant-numeric: tabular-nums;
}
.aqm-badges { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.aqm-nat {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.aqm-nat i { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.aqm-nat2 {
  display: inline-flex; align-items: center; padding: 6px 11px; border-radius: 8px;
  background: #fef3e2; color: #b45309; font-size: 11.5px; font-weight: 700;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.aqm-natnote {
  margin-top: 14px; padding: 12px 14px; border-radius: 9px;
  font-size: 12.5px; font-weight: 500; line-height: 1.5;
}
.aqm-bill-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 34px; align-items: flex-start; margin-top: 18px;
}
.aqm-bill-big { display: flex; align-items: baseline; gap: 8px; }
.aqm-bill-big span {
  font-size: 52px; line-height: 1.04; font-weight: 700; letter-spacing: -.035em;
  font-variant-numeric: tabular-nums; color: var(--dmr-ink, #0f2244);
}
.aqm-bill-big b { font-size: 21px; font-weight: 600; color: var(--dmr-mut, #66708a); }
.aqm-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.aqm-stats > div { padding: 0 18px; }
.aqm-stats > div.bl { border-left: 1px solid var(--dmr-line, #e6e9f0); }
.aqm-stat-v { display: flex; align-items: baseline; gap: 4px; margin-top: 8px; }
.aqm-stat-v span {
  font-size: 19px; font-weight: 700; letter-spacing: -.02em;
  color: var(--dmr-ink, #0f2244); font-variant-numeric: tabular-nums;
}
.aqm-stat-v b { font-size: 11.5px; font-weight: 600; color: var(--dmr-mut, #66708a); }
.aqm-stat-d { margin-top: 4px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- i periodi dentro la fattura ---- */
.aqm-segs { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--dmr-line, #e6e9f0); }
.aqm-seglist { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; min-width: 640px; }
.aqm-seg {
  grid-template-columns: minmax(130px, 1.3fr) 112px 60px 84px 96px 92px;
  gap: 12px; padding: 12px;
}
.aqm-seg.odd { background: var(--dmr-zebra, #fbfbf9); }
.aqm-seg-t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.aqm-seg-t b {
  font-size: 12.5px; font-weight: 700; color: var(--dmr-ink, #0f2244);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.aqm-seg-p {
  font-size: 12px; font-weight: 500; color: var(--dmr-mut, #66708a);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.aqm-seg .mut { font-size: 12px; font-weight: 500; color: var(--dmr-mut, #66708a); }
.aqm-seg .num { font-size: 13px; font-weight: 700; color: var(--dmr-ink, #0f2244); }
.aqm-segnote {
  margin-top: 14px; padding: 12px 14px; border-radius: 9px; background: #fef3e2;
  font-size: 12.5px; font-weight: 500; color: #8a5a12; line-height: 1.5;
}

/* ---- timeline: corsie d'acqua ---- */
.aqm-tl-mesi {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  padding-left: 132px; margin-bottom: 8px;
}
.aqm-tl-mesi div {
  text-align: center; font-size: 10.5px; font-weight: 600;
  color: var(--dmr-mut, #66708a); border-left: 1px solid #f0f2f7;
}
.aqm-lane-row { display: flex; align-items: stretch; margin-bottom: 9px; }
.aqm-lane-lab {
  width: 132px; flex-shrink: 0; padding-right: 12px;
  display: flex; flex-direction: column; justify-content: center;
}
.aqm-lane-lab span {
  font-size: 12px; font-weight: 700; color: var(--dmr-ink, #0f2244);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.aqm-lane-lab em {
  font-size: 11px; font-weight: 600; font-style: normal;
  color: var(--dmr-mut, #66708a); font-variant-numeric: tabular-nums;
}
.aqm-lane {
  position: relative; flex: 1; min-width: 0; height: 74px; border-radius: 6px; overflow: hidden;
  background: linear-gradient(180deg, #fcfdfe 0%, #f5f9fd 100%);
}
.aqm-gl { position: absolute; top: 0; bottom: 0; width: 1px; background: #f0f2f7; }
.aqm-waterline {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, rgba(125,184,232,.15), rgba(47,109,184,.5), rgba(125,184,232,.15));
}
@keyframes aqmDrip {
  0% { transform: translateY(-14px) scaleY(.6); opacity: 0 }
  18% { opacity: .5 }
  72% { opacity: .32 }
  100% { transform: translateY(76px) scaleY(1.5); opacity: 0 }
}
.aqm-drip {
  position: absolute; top: 0; border-radius: 50% 50% 48% 48%;
  background: rgba(122, 178, 226, .75); animation-name: aqmDrip;
  animation-timing-function: cubic-bezier(.45, 0, .75, .4); animation-iteration-count: infinite;
}
/* Colonne d'acqua: chiaro in superficie, profondo sul fondo, pelo bianco sopra. */
.aqm-seg-bar {
  position: absolute; bottom: 0; min-height: 3px; border-radius: 3px 3px 0 0;
  border-top: 1.5px solid rgba(255, 255, 255, .75); border-right: 1px solid #fff;
  transform-origin: bottom; transition: opacity .2s ease, box-shadow .2s ease;
}
.aqm-lane:hover .aqm-seg-bar { opacity: .4; }
.aqm-lane .aqm-seg-bar:hover { opacity: 1; box-shadow: 0 -4px 14px rgba(47, 109, 184, .45); }
.aqm-gap {
  position: absolute; top: 6px; bottom: 6px; border-radius: 4px; border: 1px solid #f0b8b8;
  background: repeating-linear-gradient(45deg, #fdecec, #fdecec 3px, #ffffff 3px, #ffffff 6px);
}

/* ---- segnalazioni ---- */
.aqm-anom {
  grid-template-columns: 112px minmax(0, 1.05fr) minmax(0, 1.4fr) 116px;
  gap: 14px; padding: 13px 12px;
}
.aqm-anom.odd { background: var(--dmr-zebra, #fbfbf9); }
.aqm-tag {
  display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 6px;
  justify-self: start; font-size: 10.5px; font-weight: 700; white-space: nowrap;
}
.aqm-a-t { min-width: 0; }
.aqm-a-t b {
  display: block; font-size: 13px; font-weight: 700; color: var(--dmr-ink, #0f2244);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.aqm-a-t em {
  display: block; margin-top: 2px; font-size: 11.5px; font-weight: 500; font-style: normal;
  color: var(--dmr-mut, #66708a); font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.aqm-a-m {
  font-size: 12.5px; font-weight: 500; color: var(--dmr-txt, #3c4760);
  line-height: 1.4; text-wrap: pretty;
}
.aqm-anom .num { font-size: 13px; font-weight: 700; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .aqm-bub, .aqm-drip, .aqm-shine, .aqm-halo, .aqm-w1, .aqm-w2 { animation: none; }
  .aqm-bub, .aqm-drip { opacity: 0; }
  .aqm-page { display: none; }
}

/* ---- responsive: le soglie sono dove il contenuto si rompe ---- */
@media (max-width: 1200px) {
  .aqm-hero-grid { grid-template-columns: 158px minmax(0, 1fr); }
  .aqm-hero-side {
    grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 26px;
    padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--dmr-line, #e6e9f0); margin-top: 6px;
  }
  .aqm-hero-side > div { flex: 1; min-width: 150px; border: 0; padding: 0; }
}
@media (max-width: 1100px) {
  .aqm-anom { grid-template-columns: 100px minmax(0, 1fr) 104px; gap: 12px; }
  .aqm-a-m { display: none; }
  .aqm-bill-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
}
@media (max-width: 900px) {
  .aqm-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  /* v5.118.0 — In colonna unica la cisterna restava incollata a sinistra, con la
     colonna larga tutta la pagina e un vuoto a destra. Misurato: a 375px la
     cisterna e' 220px in una colonna da 283. Centrata. */
  /* `width:100%` serve: senza, togliendo lo stiramento della griglia con
     margin-inline:auto l'elemento si restringeva al contenuto (misurato: 62px). */
  .aqm-tankwrap { width: 100%; max-width: 220px; margin-inline: auto; }
  .aqm-big span { font-size: 44px; }
  .aqm-filters { gap: 14px; }
  .aqm-fsep { display: none; }
  .aqm select { max-width: 100%; }
}
/* v5.118.0 — La timeline sotto i 600px non aveva spazio: l'etichetta di corsia
   occupa 132px fissi, e a 320px alla corsia ne restavano 128 per dodici mesi. Un
   periodo di due giorni e' lo 0,5% della larghezza, cioe' mezzo pixel: invisibile.
   Sotto quella soglia l'etichetta va sopra e la corsia prende tutta la riga. */
@media (max-width: 600px) {
  .aqm-lane-row { flex-direction: column; align-items: stretch; gap: 6px; margin-bottom: 16px; }
  .aqm-lane-lab {
    width: auto; padding-right: 0;
    flex-direction: row; align-items: baseline; justify-content: space-between; gap: 10px;
  }
  .aqm-lane-lab em { flex-shrink: 0; }
  /* `flex:1` in colonna calcola su base zero e azzerava l'altezza: qui la corsia
     non deve piu' crescere, ha la sua altezza fissa. */
  .aqm-lane { flex: none; width: 100%; height: 88px; }
}

@media (max-width: 480px) {
  .aqm-big span { font-size: 34px; }
  .aqm-bill-big span { font-size: 34px; }
  .aqm-stats { grid-template-columns: minmax(0, 1fr); }
  .aqm-stats > div.bl { border-left: 0; border-top: 1px solid var(--dmr-line, #e6e9f0); padding-top: 14px; margin-top: 14px; }
}
