/* =====================================================================
   Rottamazione dei tributi locali: pop-up all'ingresso e voce di menu con
   il piccolo "New" (stile Apple), piu' i contenuti della sezione "Il tuo
   Comune ha aderito?" (pagina Guide e scheda dell'area clienti).
   File aggiuntivo: per tornare indietro basta non caricarlo. Pensato prima
   per il telefono (campi a 16px, aree di tocco da 44px, margini di sicurezza).
   ===================================================================== */

/* ---------- Voce di menu con il piccolo "New" ---------- */
.rot-new {
  position: relative;
  top: -0.55em;
  display: inline-block;
  margin-left: 0.34em;
  padding: 0.22em 0.52em 0.24em;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--asser-primary, #7d445e), var(--asser-secondary, #4b2338));
  box-shadow: 0 2px 6px rgba(75, 35, 56, 0.24);
  color: #fff;
  font-family: inherit;
  font-size: 0.6rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.rot-new[hidden] {
  display: none;
}

/*
 * Con la voce in piu' il menu in alto e' piu' largo: tra 1061 e 1180 px (dove i collegamenti secondari a destra tornano
 * visibili) si nascondono come gia' avviene fino a 1060 px, cosi' nulla si sovrappone.
 */
@media (min-width: 1061px) and (max-width: 1180px) {
  .portal-nav--rot .portal-nav__actions > a:not(.portal-button):not(.portal-nav__login) {
    display: none;
  }
}

/* ---------- Pop-up ---------- */
html.rot-pop-lock {
  overflow: hidden;
}

.rot-pop {
  --rot-ink: #1d1d1f;
  --rot-sub: #515154;
  --rot-mute: #6e6e73;
  --rot-line: rgba(29, 29, 31, 0.1);
  --rot-accent: var(--asser-primary, #7d445e);
  --rot-accent-2: var(--asser-secondary, #4b2338);
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 1rem;
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  color: var(--rot-ink);
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.rot-pop[hidden] {
  display: none;
}

.rot-pop__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(29, 29, 31, 0.4);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.rot-pop.is-open .rot-pop__backdrop {
  opacity: 1;
}

.rot-pop__sheet {
  position: relative;
  box-sizing: border-box;
  width: min(440px, 100%);
  max-height: 92vh;
  max-height: min(92dvh, 720px);
  padding: 1.75rem 1.5rem 0.9rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 30px 80px rgba(0, 0, 0, 0.28);
  text-align: center;
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity 0.28s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rot-pop.is-open .rot-pop__sheet {
  opacity: 1;
  transform: none;
}

.rot-pop__sheet:focus {
  outline: none;
}

.rot-pop__x {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(120, 120, 128, 0.14);
  color: var(--rot-sub);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

/* area di tocco da 44px senza ingrandire il pulsante */
.rot-pop__x::after {
  content: "";
  position: absolute;
  inset: -6px;
}

.rot-pop__x:hover {
  background: rgba(120, 120, 128, 0.24);
}

.rot-pop__x:active {
  transform: scale(0.92);
}

.rot-pop__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 0.9rem;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--rot-accent), var(--rot-accent-2));
  box-shadow: 0 10px 22px rgba(75, 35, 56, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: #fff;
}

.rot-pop__kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem 0.55rem;
  margin: 0 0 0.35rem;
  color: var(--rot-accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.rot-pop__chip {
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  background: rgba(214, 124, 15, 0.14);
  color: #8a4b00;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
}

.rot-pop__title {
  margin: 0;
  color: var(--rot-ink);
  font-family: "Sora", "Manrope", ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(1.3rem, 4.6vw, 1.55rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.rot-pop__count {
  display: inline-block;
  margin: 0.7rem 0 0;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.12);
  color: var(--rot-sub);
  font-size: 0.8rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.rot-pop__count:empty {
  display: none;
}

.rot-pop[data-urgent="1"] .rot-pop__count {
  background: rgba(215, 0, 21, 0.1);
  color: #b4132a;
}

.rot-pop__lead {
  margin: 0.8rem 0 1.1rem;
  color: var(--rot-sub);
  font-size: 0.94rem;
  line-height: 1.5;
}

.rot-pop__form {
  margin: 0;
}

.rot-pop__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.rot-pop__row {
  display: flex;
  gap: 0.5rem;
}

.rot-pop__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.rot-pop__field svg {
  position: absolute;
  top: 50%;
  left: 0.9rem;
  color: var(--rot-mute);
  pointer-events: none;
  transform: translateY(-50%);
}

.rot-pop__field input {
  display: block;
  width: 100%;
  height: 48px;
  box-sizing: border-box;
  margin: 0;
  padding: 0 0.9rem 0 2.55rem;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(120, 120, 128, 0.12);
  color: var(--rot-ink);
  font: inherit;
  font-size: 1rem; /* 16px: su iPhone evita lo zoom automatico */
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.rot-pop__field input::placeholder {
  color: #85858b;
  opacity: 1;
}

.rot-pop__field input:focus {
  outline: none;
  border-color: rgba(125, 68, 94, 0.55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(125, 68, 94, 0.16);
}

.rot-pop__go {
  flex: none;
  height: 48px;
  padding: 0 1.3rem;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--rot-accent), var(--rot-accent-2));
  box-shadow: 0 8px 18px rgba(75, 35, 56, 0.24);
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.rot-pop__go:hover {
  box-shadow: 0 12px 24px rgba(75, 35, 56, 0.3);
  transform: translateY(-1px);
}

.rot-pop__go:active {
  transform: scale(0.97);
}

.rot-pop__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 0.35rem;
  color: var(--rot-accent);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.rot-pop__more:hover {
  text-decoration: underline;
}

.rot-pop__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.4rem -1.5rem 0;
  padding: 0.3rem 1.5rem 0;
  border-top: 1px solid var(--rot-line);
}

.rot-pop__never,
.rot-pop__later {
  min-height: 48px;
  margin: 0;
  padding: 0 0.2rem;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.rot-pop__never {
  color: var(--rot-mute);
  font-size: 0.86rem;
  font-weight: 600;
}

.rot-pop__later {
  color: var(--rot-accent);
  font-size: 0.97rem;
  font-weight: 700;
}

.rot-pop__never:hover,
.rot-pop__later:hover {
  text-decoration: underline;
}

.rot-pop__x:focus-visible,
.rot-pop__go:focus-visible,
.rot-pop__more:focus-visible,
.rot-pop__never:focus-visible,
.rot-pop__later:focus-visible {
  outline: 3px solid rgba(125, 68, 94, 0.4);
  outline-offset: 2px;
  border-radius: 8px;
}

/* telefono: foglio che sale dal basso, come i fogli di iOS */
@media (max-width: 599px) {
  .rot-pop {
    align-items: flex-end;
    padding: 0;
  }

  .rot-pop__sheet {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    padding: 1.6rem 1.25rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
    padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 28px 28px 0 0;
    transform: translateY(100%);
  }

  /* la maniglia in alto: solo decorazione */
  .rot-pop__sheet::before {
    content: "";
    position: absolute;
    top: 0.5rem;
    left: 50%;
    width: 36px;
    height: 5px;
    border-radius: 3px;
    background: rgba(60, 60, 67, 0.28);
    transform: translateX(-50%);
  }

  .rot-pop__icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
  }

  .rot-pop__foot {
    margin-right: -1.25rem;
    margin-left: -1.25rem;
    padding-right: 1.25rem;
    padding-left: 1.25rem;
  }
}

@media (max-width: 380px) {
  .rot-pop__row {
    flex-direction: column;
  }

  .rot-pop__go {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rot-pop__backdrop,
  .rot-pop__sheet {
    transition: opacity 0.15s ease;
  }

  .rot-pop__sheet,
  .rot-pop.is-open .rot-pop__sheet {
    transform: none;
  }

  .rot-pop__x,
  .rot-pop__go {
    transition: none;
  }
}

@media print {
  .rot-pop {
    display: none;
  }
}

/* ---------- Sezione "Il tuo Comune ha aderito?": dati chiave ---------- */
.enti-check__stamp {
  margin: 0.5rem 0 0;
  color: var(--asser-muted, #726b67);
  font-size: 0.78rem;
  line-height: 1.55;
}

.enti-check__facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.enti-check__facts li {
  display: grid;
  gap: 0.15rem;
  align-content: start;
  min-width: 0;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(75, 35, 56, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.enti-check__facts strong {
  color: var(--asser-secondary, #4b2338);
  font-family: "Sora", "Manrope", ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(1.3rem, 2.6vw, 1.85rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.enti-check__facts span {
  color: var(--asser-text, #252129);
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.3;
}

.enti-check__facts small {
  color: var(--asser-muted, #726b67);
  font-size: 0.76rem;
  line-height: 1.45;
}

/* ---------- Calendario con stato ---------- */
.enti-check__timeline {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.enti-check__timeline li {
  position: relative;
  transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.enti-check__timeline li.is-done {
  background: rgba(255, 255, 255, 0.5);
}

.enti-check__timeline li.is-done strong {
  color: var(--asser-muted, #726b67);
}

.enti-check__timeline li.is-now {
  border-color: rgba(125, 68, 94, 0.5);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(125, 68, 94, 0.12), 0 10px 24px rgba(75, 35, 56, 0.08);
}

.enti-check__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  justify-self: start;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.enti-check__badge:empty {
  display: none;
}

.is-done > .enti-check__badge {
  background: rgba(31, 138, 76, 0.12);
  color: #1a7a43;
}

.is-done > .enti-check__badge::before {
  content: "✓";
}

.is-now > .enti-check__badge {
  background: rgba(125, 68, 94, 0.12);
  color: var(--asser-primary, #7d445e);
}

/* ---------- Schede informative ---------- */
.enti-check__learn-title {
  margin: 0 0 0.8rem;
  color: var(--asser-secondary, #4b2338);
  font-family: "Sora", "Manrope", ui-sans-serif, system-ui, sans-serif;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.enti-info {
  overflow: hidden;
  border: 1px solid rgba(75, 35, 56, 0.12);
  border-radius: 18px;
  background: #fff;
}

.enti-info details + details {
  border-top: 1px solid rgba(75, 35, 56, 0.1);
}

.enti-info summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 52px;
  padding: 0.85rem 1.15rem;
  color: var(--asser-secondary, #4b2338);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.enti-info summary::-webkit-details-marker {
  display: none;
}

.enti-info summary::after {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.15rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.55;
  transform: rotate(45deg);
  transition: transform 0.25s ease;
}

.enti-info details[open] > summary::after {
  transform: rotate(-135deg);
}

.enti-info summary:hover {
  background: rgba(75, 35, 56, 0.03);
}

.enti-info summary:focus-visible {
  outline: 3px solid rgba(125, 68, 94, 0.4);
  outline-offset: -3px;
}

.enti-info__body {
  max-width: 72ch;
  padding: 0 1.15rem 1.1rem;
  color: var(--asser-text, #252129);
  font-size: 0.9rem;
  line-height: 1.65;
}

.enti-info__body p {
  margin: 0 0 0.7rem;
}

.enti-info__body p:last-child {
  margin-bottom: 0;
}

/* ---------- Invito ad analizzare i documenti ---------- */
.enti-check__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 1.5rem;
  padding: 1.1rem 1.25rem;
  border-radius: 18px;
  background: rgba(125, 68, 94, 0.07);
}

.enti-check__cta > div {
  flex: 1 1 280px;
  min-width: 0;
}

.enti-check__cta strong {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--asser-secondary, #4b2338);
  font-size: 1rem;
}

.enti-check__cta p {
  margin: 0;
  color: var(--asser-muted, #726b67);
  font-size: 0.86rem;
  line-height: 1.55;
}

.enti-check__cta .portal-button {
  flex: none;
}

@media (max-width: 560px) {
  .enti-check__cta .portal-button {
    width: 100%;
  }
}

/* ---------- Fonti ---------- */
.enti-check__sources-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
}

.enti-check__sources-grid > section {
  min-width: 0;
}

.enti-check__sources-h {
  margin: 0 0 0.45rem;
  color: var(--asser-primary, #7d445e);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.enti-check__sources ul {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding-left: 1.05rem;
}

.enti-check__sources li {
  color: var(--asser-muted, #726b67);
  font-size: 0.82rem;
  line-height: 1.5;
}

.enti-check__sources a {
  color: var(--asser-primary, #7d445e);
  font-weight: 650;
  overflow-wrap: anywhere;
}

@media (max-width: 880px) {
  .enti-check__timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .enti-check__facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.6rem;
  }

  .enti-check__facts li {
    padding: 0.85rem 1rem;
  }

  .enti-check__facts strong {
    font-size: 1.35rem;
  }

  .enti-check__sources-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .enti-check__timeline {
    grid-template-columns: minmax(0, 1fr);
  }

  .enti-info summary {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .enti-info__body {
    padding-right: 1rem;
    padding-left: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .enti-check__timeline li,
  .enti-info summary::after {
    transition: none;
  }
}

/* Dopo la chiusura del pop-up il fuoco della tastiera torna all'inizio della pagina (il contenitore non e' un comando: niente contorno) */
.asser-ai-app:focus {
  outline: none;
}
