/* ===========================================================
   Shared app components
   =========================================================== */

/* ---------- Screen container + transitions ------------------ */
.screens {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  will-change: transform, opacity;
}

.screen.is-hidden {
  display: none;
}

/* push (navigate forward) — iOS slide from right */
@keyframes push-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
@keyframes push-out {
  from {
    transform: translateX(0);
    filter: brightness(1);
  }
  to {
    transform: translateX(-28%);
    filter: brightness(0.86);
  }
}
@keyframes pop-in {
  from {
    transform: translateX(-28%);
    filter: brightness(0.86);
  }
  to {
    transform: translateX(0);
    filter: brightness(1);
  }
}
@keyframes pop-out {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}
@keyframes modal-in {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
@keyframes modal-out {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(100%);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.anim-push-in {
  animation: push-in var(--dur) var(--ease-ios) both;
  z-index: 20;
}
.anim-push-out {
  animation: push-out var(--dur) var(--ease-ios) both;
  z-index: 10;
}
.anim-pop-in {
  animation: pop-in var(--dur) var(--ease-ios) both;
  z-index: 10;
}
.anim-pop-out {
  animation: pop-out var(--dur) var(--ease-ios) both;
  z-index: 20;
}
.anim-modal-in {
  animation: modal-in var(--dur) var(--ease-ios) both;
  z-index: 30;
}
.anim-modal-out {
  animation: modal-out var(--dur) var(--ease-ios) both;
  z-index: 30;
}
.anim-fade-in {
  animation: fade-in 300ms linear both;
  z-index: 20;
}
.anim-fade-out {
  animation: fade-out 300ms linear both;
  z-index: 10;
}

/* ---------- Scrollable body -------------------------------- */
.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.scroll::-webkit-scrollbar {
  display: none;
}

.pad-top-safe {
  padding-top: var(--safe-top);
}

.pad-bottom-safe {
  padding-bottom: calc(var(--safe-bottom) + 12px);
}

.pad-bottom-tab {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
}

/* ---------- Nav bar ---------------------------------------- */
.navbar {
  flex: none;
  padding-top: var(--safe-top);
  height: calc(var(--safe-top) + 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 16px;
  padding-right: var(--gutter);
  background: transparent;
  position: relative;
  z-index: 40;
}

.navbar.on-color {
  color: #fff;
}

.nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
  letter-spacing: -0.3px;
  padding: 6px 8px 6px 0;
}

.nav-back svg {
  flex: none;
}

.nav-action {
  font-size: 17px;
  letter-spacing: -0.3px;
  color: var(--enel-magenta);
  padding: 6px 0;
}

.navbar.on-color .nav-action {
  color: #fff;
}

/* ---------- Buttons ---------------------------------------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  border-radius: 26px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  transition: transform 120ms var(--ease-ios), opacity 160ms linear,
    background-color 160ms linear;
}

.btn:active {
  transform: scale(0.975);
}

.btn-primary {
  background: var(--enel-magenta);
  color: #fff;
}

.btn-primary:disabled,
.btn-primary.is-disabled {
  background: #fb87ac;
  cursor: default;
}

.btn-primary.is-disabled:active {
  transform: none;
}

.btn-white {
  background: #fff;
  color: var(--enel-magenta);
}

.btn-outline-white {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
}

.btn-pill-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 26px;
  border-radius: 22px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
  border: 1.5px solid rgba(255, 255, 255, 0.92);
  color: #fff;
}

.btn-pill-sm:active {
  transform: scale(0.97);
}

.link-underline {
  display: block;
  margin: 0 auto;
  font-size: 15px;
  letter-spacing: -0.2px;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 10px 4px;
}

.cta-dock {
  flex: none;
  padding: 0 var(--gutter) calc(var(--safe-bottom) + 8px);
  background: transparent;
}

.cta-dock .link-underline {
  margin-top: 6px;
}

/* ---------- Form fields (iOS underline style) --------------- */
.field {
  margin-top: 28px;
}

.field-label {
  font-size: 13px;
  letter-spacing: -0.1px;
  color: var(--ink-4);
  margin-bottom: 6px;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--ink-5);
  padding-bottom: 8px;
}

.field-row.focused {
  border-bottom-color: var(--enel-magenta);
}

.field-row input {
  flex: 1;
  font-size: 19px;
  letter-spacing: -0.3px;
  color: var(--ink);
  caret-color: var(--enel-magenta);
  min-width: 0;
}

.field-row input::placeholder {
  color: var(--ink-5);
}

.field-row .eye {
  flex: none;
  color: var(--ink-2);
  display: flex;
  padding: 2px;
}

.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
  text-align: right;
}

/* fake caret so decorative fields still read as "focused" */
.caret {
  display: inline-block;
  width: 2px;
  height: 22px;
  background: var(--enel-magenta);
  vertical-align: -4px;
  animation: blink 1.06s steps(1, end) infinite;
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* ---------- Checkbox --------------------------------------- */
.check-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 10px 0;
  cursor: pointer;
}

.check-box {
  flex: none;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--ink-4);
  border-radius: 3px;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms var(--ease-ios), border-color 160ms var(--ease-ios);
}

.check-box svg {
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 140ms ease, transform 220ms var(--ease-ios);
}

.check-row.checked .check-box {
  background: var(--ink);
  border-color: var(--ink);
}

.check-row.checked .check-box svg {
  opacity: 1;
  transform: scale(1);
}

.check-text {
  font-size: 16px;
  letter-spacing: -0.2px;
}

.check-sub {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-3);
}

/* ---------- List rows (iOS grouped) ------------------------- */
.section-head {
  background: var(--bg-section);
  padding: 18px var(--gutter) 12px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.35px;
  border-bottom: 1px solid var(--line-soft);
}

.list {
  background: #fff;
}

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--line-soft);
  background: #fff;
  width: 100%;
  text-align: left;
  transition: background 120ms linear;
}

.row:active {
  background: #ededed;
}

.row-icon {
  flex: none;
  width: 26px;
  height: 24px;
  color: var(--enel-magenta);
  display: flex;
  align-items: center;
  justify-content: center;
}

.row-icon .asset-ico,
.row-icon svg {
  height: auto;
  width: auto;
  max-height: 22px;
  max-width: 26px;
}

.row-main {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

.row-title {
  display: block;
  font-size: 17px;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-sub {
  display: block;
  margin-top: 2px;
  font-size: 13.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-trail {
  display: block;
  text-align: right;
  flex: 0 0 auto;
  min-width: 0;
}

.row-trail-title {
  display: block;
  font-size: 17px;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.row-trail-sub {
  display: block;
  margin-top: 2px;
  font-size: 13.5px;
  color: var(--enel-green);
  white-space: nowrap;
}

.chevron {
  flex: none;
  color: #c4c4c6;
  display: flex;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 5px var(--gutter);
  font-size: 16px;
  letter-spacing: -0.2px;
  color: var(--ink-3);
}

.kv span:last-child {
  color: var(--ink-3);
  text-align: right;
}

/* ---------- Colored page header (pink hero) ----------------- */
.hero-head {
  flex: none;
  background: linear-gradient(
    180deg,
    var(--enel-magenta) 0%,
    var(--enel-magenta-dark) 100%
  );
  color: #fff;
  padding: var(--safe-top) var(--gutter) 26px;
}

.hero-head .hero-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.8px;
}

.hero-head .hero-sub {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: -0.2px;
  color: rgba(255, 255, 255, 0.92);
}

/* ---------- Tab bar ---------------------------------------- */
.tabbar {
  flex: none;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid rgba(0, 0, 0, 0.09);
  padding-left: 6px;
  padding-right: 6px;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  /* the exported icons carry their own colour; the label matches it */
  color: #404040;
  padding-top: 6px;
}

.tab .tab-label {
  font-size: 10.5px;
  letter-spacing: -0.05px;
}

.tab.active {
  color: var(--enel-magenta);
}

.tab:active {
  opacity: 0.55;
}

/* ---------- Supply / info cards ----------------------------- */
.card {
  border-radius: var(--radius-card);
  background: #fff;
  overflow: hidden;
}

.card-shadow {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
}

/* ---------- Bar chart (capsule bars with cap dot) ----------- */
.barchart {
  display: flex;
  align-items: flex-end;
  gap: var(--bar-gap, 22px);
  height: var(--chart-h, 90px);
  padding: 0 4px;
}

.bar {
  flex: 1;
  border-radius: 999px;
  background: var(--bar-color, var(--enel-green-soft));
  position: relative;
  min-width: 12px;
  max-width: 22px;
  transform-origin: bottom;
  animation: bar-rise 620ms var(--ease-ios) both;
}

.bar::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
}

@keyframes bar-rise {
  from {
    transform: scaleY(0.05);
    opacity: 0;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* ---------- Consumption chart (Fornitura) ------------------- */
.vchart {
  --tone: #65b7e1;      /* Luce */
  --tone-dark: #2454f1;
  position: relative;
  height: 250px;
  margin: 0 var(--gutter);
}

.vchart[data-palette="green"] {
  --tone: #71bc66;      /* Gas */
  --tone-dark: #3d8a5e;
}

.vchart-axis {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--axis-y);
  height: 1px;
  background: var(--line);
}

.vchart-cols {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 22px;
}

.vcol {
  flex: 1;
  position: relative;
  height: 100%;
  padding: 0;
}

/* capsule bar, growing from the axis */
.vbar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  border-radius: 999px;
  background: var(--tone);
  animation: bar-rise 620ms var(--ease-ios) both;
  transition: background-color 200ms linear;
}

.vbar.up {
  bottom: calc(100% - var(--axis-y));
  height: var(--len);
  transform-origin: bottom;
}

.vbar.down {
  top: var(--axis-y);
  height: var(--len);
  transform-origin: top;
}

.vbar .vcap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.vbar.up .vcap {
  top: 6px;
}

.vbar.down .vcap {
  bottom: 6px;
}

/* a zero period has no bar — it sits on the axis as a ring */
.vdot {
  position: absolute;
  left: 50%;
  top: var(--axis-y);
  transform: translate(-50%, -50%);
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 4px solid var(--tone);
  background: #fff;
  transition: border-color 200ms linear;
}

.vcol.sel .vbar,
.vcol.sel .vdot {
  background: var(--tone-dark);
}

.vcol.sel .vdot {
  border-color: var(--tone-dark);
  background: #fff;
}

/* ---------- Chart tooltip ---------------------------------- */
.vtip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  padding: 9px 14px 10px;
  border-radius: 8px;
  background: var(--tone-dark);
  color: #fff;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 180ms linear, transform 280ms var(--ease-ios),
    left 280ms var(--ease-ios), top 280ms var(--ease-ios);
}

.vtip.show {
  opacity: 1;
  transform: none;
}

.vtip-label {
  display: block;
  font-size: 14px;
  letter-spacing: -0.1px;
  color: rgba(255, 255, 255, 0.8);
}

.vtip-value {
  display: block;
  margin-top: 1px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.vtip-arrow {
  position: absolute;
  bottom: -7px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--tone-dark);
}

/* ---------- Page dots -------------------------------------- */
.dots {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
}

.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d8d8d8;
  transition: background 240ms linear, transform 240ms var(--ease-ios);
}

.dots i.on {
  background: var(--enel-magenta);
  transform: scale(1.06);
}

/* ---------- Horizontal carousel ---------------------------- */
.hscroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  /* snap-align works off the scrollport, so the gutter must be declared
     as scroll-padding too — otherwise the first card loses its inset. */
  padding: 0 var(--gutter);
  scroll-padding-left: var(--gutter);
  scroll-padding-right: var(--gutter);
  scrollbar-width: none;
  cursor: grab;
}

.hscroll.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
}

.hscroll.dragging * {
  pointer-events: none;
}

.hscroll::-webkit-scrollbar {
  display: none;
}

.hscroll > * {
  scroll-snap-align: start;
  flex: none;
}

/* ---------- Asset placeholder ------------------------------ */
.ph {
  position: relative;
  background: repeating-linear-gradient(
      -45deg,
      rgba(0, 0, 0, 0.045) 0 10px,
      rgba(0, 0, 0, 0.09) 10px 20px
    ),
    #cfd3d6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ph::after {
  content: attr(data-ph);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.4);
  text-align: center;
  padding: 0 8px;
}

.ph.on-dark::after {
  color: rgba(255, 255, 255, 0.75);
}

.ph.on-dark {
  background: repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.07) 0 10px,
      rgba(255, 255, 255, 0.14) 10px 20px
    ),
    #6d7378;
}

/* ---------- iOS keyboard ----------------------------------- */
.keyboard {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: #d1d3d9;
  height: var(--kb-h);
  padding: 8px 3px calc(var(--safe-bottom) + 4px);
  transform: translateY(100%);
  transition: transform 300ms var(--ease-ios);
  user-select: none;
}

.keyboard.up {
  transform: translateY(0);
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 11px;
}

.kb-row:last-of-type {
  margin-bottom: 4px;
}

.key {
  height: 42px;
  min-width: 32px;
  flex: 1;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 400;
  color: #000;
}

.key:active {
  background: #b8bcc4;
}

.key.wide {
  flex: 1.5;
  background: #adb3bd;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

.key.space {
  flex: 5;
}

.key.mod {
  font-size: 15px;
  font-weight: 400;
}

.kb-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 0;
  color: #3c3c40;
}

.kb-spacer {
  height: var(--kb-h);
  flex: none;
}

/* ---------- Toast ------------------------------------------ */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 76px);
  transform: translate(-50%, 12px);
  background: rgba(28, 28, 30, 0.92);
  color: #fff;
  font-size: 14px;
  letter-spacing: -0.1px;
  padding: 11px 18px;
  border-radius: 20px;
  z-index: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms linear, transform 300ms var(--ease-ios);
  backdrop-filter: blur(14px);
  max-width: 320px;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Tab bar badge ----------------------------------- */
.tab-ico {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 23px;
}

.tab-ico img {
  display: block;
  height: 100%;
  width: auto;
}

.tab-ico.badged::after {
  content: "";
  position: absolute;
  top: -2px;
  right: 1px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--enel-magenta);
}

.unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--enel-magenta);
  margin-right: 9px;
  vertical-align: 1px;
}

.row-title.is-unread {
  font-weight: 700;
}

/* ---------- Compact magenta page header --------------------- */
.page-head {
  background: linear-gradient(180deg, var(--enel-magenta) 0%, #ec0f5e 100%);
  color: #fff;
  padding: 0 var(--gutter) 22px;
}

.page-head-bar {
  height: calc(var(--safe-top) + 40px);
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-back {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px 6px 0;
  color: #fff;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.page-action {
  font-size: 16px;
  letter-spacing: -0.2px;
  color: #fff;
  padding: 6px 0;
}

.page-head h1 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.6px;
  padding-top: 4px;
}

/* ---------- Sheet (modal) header ---------------------------- */
.s-sheet {
  background: #fff;
}

.sheet-head {
  flex: none;
  background: var(--enel-magenta);
  color: #fff;
  padding-top: var(--safe-top);
  height: calc(var(--safe-top) + 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 20px;
  padding-right: 20px;
}

.sheet-x {
  display: flex;
  color: #fff;
  padding: 4px;
}

.sheet-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.sheet-body {
  padding: 22px var(--gutter) 0;
}

.sheet-h1 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.5px;
  color: var(--enel-magenta);
}

.sheet-p {
  margin-top: 16px;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -0.2px;
}

.sheet-note {
  margin-top: 24px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-3);
}

/* ---------- FAQ --------------------------------------------- */
.faq-body {
  padding: 26px var(--gutter) 0;
}

.faq-q {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.4px;
  color: var(--enel-magenta);
}

.faq-q + .faq-a {
  margin-top: 12px;
}

.faq-a {
  font-size: 15.5px;
  line-height: 1.5;
  letter-spacing: -0.1px;
}

.faq-a + .faq-q {
  margin-top: 30px;
}

/* ---------- Read-only data field ---------------------------- */
.dfield {
  display: block;
  padding: 10px 0 12px;
}

.dfield-label {
  display: block;
  font-size: 12.5px;
  letter-spacing: -0.05px;
  color: var(--ink-4);
}

.dfield-value {
  display: block;
  margin-top: 3px;
  font-size: 17px;
  letter-spacing: -0.3px;
}

/* ---------- Editable field ---------------------------------- */
.efield {
  display: block;
  padding-top: 18px;
}

.efield-label {
  display: block;
  font-size: 12.5px;
  letter-spacing: -0.05px;
  color: var(--ink-4);
  margin-bottom: 4px;
}

.efield-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 7px;
}

.efield-row input {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  letter-spacing: -0.3px;
}

.efield-row input::placeholder {
  color: var(--ink-5);
}

.efield-caret {
  display: flex;
  color: var(--ink-4);
}

.edit-h2 {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.4px;
  color: var(--enel-magenta);
}

.edit-h2:not(:first-child) {
  margin-top: 34px;
}

/* ---------- Checkbox list ----------------------------------- */
.cbx-list {
  margin-top: 12px;
}

.cbx {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  cursor: pointer;
}

.cbx-box {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1.5px solid var(--ink-4);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms var(--ease-ios), border-color 160ms var(--ease-ios);
}

.cbx-box svg {
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 140ms ease, transform 220ms var(--ease-ios);
}

.cbx.on .cbx-box {
  background: var(--ink);
  border-color: var(--ink);
}

.cbx.on .cbx-box svg {
  opacity: 1;
  transform: scale(1);
}

.cbx-label {
  font-size: 15.5px;
  line-height: 1.35;
  letter-spacing: -0.15px;
}

.privacy-block {
  margin-top: 30px;
}

.privacy-text {
  margin: 4px 0 0 32px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-3);
}

.privacy-text a {
  display: block;
  margin-top: 2px;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--ink-2);
}

/* ---------- Sì / No radios ---------------------------------- */
.radio-block {
  padding: 10px 0 4px;
}

.radio-label {
  display: block;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.radio-label:empty {
  display: none;
}

.radio-row {
  display: flex;
  gap: 34px;
}

.radio {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  letter-spacing: -0.2px;
  cursor: pointer;
}

.radio-mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-4);
  display: flex;
  position: relative;
  transition: border-color 160ms linear;
}

.radio-mark::after {
  content: "";
  position: absolute;
  inset: 3.5px;
  border-radius: 50%;
  background: var(--ink);
  transform: scale(0);
  transition: transform 200ms var(--ease-ios);
}

.radio.on .radio-mark {
  border-color: var(--ink);
}

.radio.on .radio-mark::after {
  transform: scale(1);
}

.consent-group {
  padding: 20px 0 14px;
  border-bottom: 1px solid var(--line-soft);
}

.consent-value {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-4);
  margin-bottom: 10px;
}

.consent-value b {
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.consent-link {
  font-size: 13px;
  color: var(--ink-3);
  padding: 0 0 4px;
  text-align: left;
}

.contact-block {
  padding-bottom: 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

.contact-block.last {
  border-bottom: none;
}

.kv.small {
  padding: 3px 0;
  font-size: 13px;
}

.legal-small {
  margin-top: 22px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-4);
}

.legal-body {
  margin-top: 14px;
  font-size: 14.5px;
  line-height: 1.55;
  letter-spacing: -0.1px;
  color: var(--ink-2);
}

/* ---------- Overlay: magenta panel over a dimmed screen ------ */
.ov {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  animation: fade-in 220ms linear both;
}

.ov[hidden] {
  display: none;
}

.ov-inner {
  flex: none;
  width: 100%;
  color: #fff;
  background: linear-gradient(180deg, var(--enel-magenta) 0%, #e2005a 100%);
  padding: calc(var(--safe-top) + 40px) var(--gutter) 32px;
  animation: ov-drop 380ms var(--ease-ios) both;
}

@keyframes ov-drop {
  from {
    transform: translateY(-18px);
    opacity: 0;
  }
}

.ov-inner h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.ov-inner p {
  margin: 12px 0 26px;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.1px;
}

.ov-inner .btn + .btn {
  margin-top: 12px;
}

/* the scrim above does the dimming, so nothing else to do here */

/* ---------- Exported-asset icons ---------------------------- */
.asset-ico {
  display: block;
  height: var(--ico-h, 22px);
  width: auto;
}

/* status colours on list rows */
.row-sub.red {
  color: var(--enel-red);
}

.row-trail-sub.red {
  color: var(--enel-red);
}

.row-trail-sub.green {
  color: var(--enel-green);
}

/* ---------- Numeric keypad (functional) --------------------- */
.numpad {
  flex: none;
  background: #d1d3d9;
  padding: 8px 6px calc(var(--safe-bottom) + 6px);
  user-select: none;
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 6px;
}

.numkey {
  height: 44px;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 90ms linear;
}

.numkey:active {
  background: #b8bcc4;
}

.numkey.is-blank {
  background: none;
  box-shadow: none;
  pointer-events: none;
}

.numkey.is-flat {
  background: none;
  box-shadow: none;
  color: #2c2c30;
}

.numkey.is-flat:active {
  background: rgba(0, 0, 0, 0.08);
}

.numkey-d {
  font-size: 23px;
  font-weight: 400;
}

.numkey-l {
  margin-top: 2px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.2px;
}

/* ---------- Reading fields (OTP-style) ---------------------- */
.autofields {
  margin-top: 8px;
}

.autofield {
  display: block;
  padding-top: 22px;
  cursor: pointer;
}

.autofield-label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-4);
  margin-bottom: 6px;
}

.autofield-row {
  display: flex;
  align-items: center;
  min-height: 30px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.autofield-digits {
  font-size: 22px;
  letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
}

.autofield .caret {
  opacity: 0;
}

.autofield.focused .autofield-row {
  border-bottom-color: var(--enel-magenta);
}

.autofield.focused .caret {
  opacity: 1;
}

/* ---------- Reading summary --------------------------------- */
.reading-block {
  margin-top: 26px;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
}

.reading-block h3 {
  margin: 14px 0 6px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.reading-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  font-size: 15px;
}

.reading-label {
  color: var(--ink-4);
}

.reading-value {
  font-variant-numeric: tabular-nums;
}

/* ---------- Result screen ----------------------------------- */
.result-body {
  padding: 46px var(--gutter) 0;
}

.result-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 40px;
  animation: pop 620ms var(--ease-ios) both;
}

.result-ring svg {
  width: 46px;
  height: auto;
}

.result-body h1 {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.result-body p {
  margin-top: 16px;
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- Rateizzazione ----------------------------------- */
.rate-list {
  margin-top: 26px;
}

.rate-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}

.rate-item .cbx-box {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border: 1.5px solid var(--ink-4);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rate-item .cbx-box svg {
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 140ms ease, transform 220ms var(--ease-ios);
}

.rate-item.on .cbx-box {
  background: var(--ink);
  border-color: var(--ink);
}

.rate-item.on .cbx-box svg {
  opacity: 1;
  transform: scale(1);
}

.rate-item.locked {
  opacity: 0.85;
}

.rate-item.locked .cbx-box {
  border-color: var(--ink-5);
}

.rate-main {
  flex: 1;
  min-width: 0;
}

.rate-num {
  display: block;
  font-size: 15.5px;
  letter-spacing: -0.1px;
}

.rate-sub {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-4);
}

.rate-trail {
  flex: none;
  text-align: right;
}

.rate-amount {
  display: block;
  font-size: 15.5px;
  letter-spacing: -0.2px;
}

.rate-state {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.rate-state.green {
  color: var(--enel-green);
}
.rate-state.orange {
  color: var(--enel-orange);
}
.rate-state.red {
  color: var(--enel-red);
}

.rate-block {
  padding: 14px var(--gutter) 18px;
  border-bottom: 1px solid var(--line-soft);
}

.rate-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  font-size: 15.5px;
  letter-spacing: -0.1px;
}

.rate-line.strong {
  font-weight: 700;
  padding-top: 10px;
}

.rate-note {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-4);
}

.rate-rule {
  height: 1px;
  background: var(--line-soft);
  margin: 10px 0;
}

.rate-instal + .rate-instal {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.rate-instal-head {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.1px;
  margin-bottom: 2px;
}

/* ---------- Outline magenta button + chips ------------------ */
/* secondary — magenta stroke on white, magenta label */
.btn-secondary,
.btn-outline-magenta {
  background: #fff;
  color: var(--enel-magenta);
  border: 1.5px solid var(--enel-magenta);
  margin-top: 10px;
}

.btn-secondary:active,
.btn-outline-magenta:active {
  background: #fff2f6;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.chip {
  height: 34px;
  padding: 0 16px;
  border-radius: 17px;
  border: 1px solid var(--line);
  background: #fafafa;
  font-size: 14px;
  letter-spacing: -0.1px;
  transition: background 120ms linear, border-color 120ms linear;
}

.chip:active {
  background: #efefef;
  border-color: var(--ink-5);
}

/* the rename sheet uses a real input — allow typing */
.efield-row input[data-name] {
  cursor: text;
}

/* ---------- Digit-cell reading field (OTP shape) ------------- */
.otp {
  display: block;
  padding-top: 26px;
  cursor: pointer;
}

.otp-label {
  display: block;
  font-size: 13px;
  color: var(--ink-4);
  margin-bottom: 12px;
}

.otp-cells {
  display: flex;
  gap: 12px;
}

.otp-cell {
  flex: 1;
  max-width: 62px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f2f2f4;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  transition: background 160ms linear, border-color 160ms linear,
    transform 200ms var(--ease-ios);
}

.otp-cell.filled {
  background: #fff;
  border-color: var(--line);
  animation: otp-pop 260ms var(--ease-ios) both;
}

.otp-cell.active {
  background: #fff;
  border-color: var(--enel-magenta);
}

@keyframes otp-pop {
  0% {
    transform: scale(0.88);
  }
  70% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

/* ---------- Sticky pay dock (unpaid bill) ------------------- */
.pay-dock {
  flex: none;
  padding: 12px var(--gutter) calc(var(--safe-bottom) + 10px);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  animation: dock-in 380ms var(--ease-ios) both;
}

@keyframes dock-in {
  from {
    transform: translateY(100%);
  }
}
