/* Dividi un conto: la prova. Pensata prima per il telefono: niente riquadri fissi che cambiano
   altezza mentre scorri (facevano saltare la pagina), un solo editor di spesa aperto alla volta. */

.calc-note { margin: -4px 4px 16px; font-size: 15px; }
.calc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.calc > *, .cstep { min-width: 0; }
.cstep h3 { display: flex; align-items: center; gap: 10px; font-size: 19px; margin: 0 4px 12px; }
.cstep h3 .n { width: 28px; height: 28px; border-radius: 50%; background: var(--blue-soft); color: var(--blue-text); display: grid; place-items: center; font-size: 14px; flex: none; }
.calc-in { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; min-width: 0; }

@media (min-width: 900px) {
  .calc { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; gap: 40px; }
  /* sul computer il conto resta accanto: è una colonna a parte, non cambia mai altezza */
  .result { position: sticky; top: 80px; }
}

/* ── 1 · persone ── */
.pchips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { display: inline-flex; align-items: center; gap: 8px; background: var(--neutral); border-radius: 999px; padding: 4px 6px 4px 4px; font-weight: 700; font-size: 15px; max-width: 100%; }
.pchip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; padding-right: 6px; }
.pchip .x { width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--page); color: var(--soft); font-size: 17px; line-height: 1; display: grid; place-items: center; flex: none; padding: 0; }
.face.sm { width: 30px; height: 30px; font-size: 13px; }
.face.xs { width: 24px; height: 24px; font-size: 11px; }
.addp { display: flex; gap: 8px; margin-top: 12px; }
.addp .input { flex: 1; min-width: 0; }
.addp .btn { flex: none; }

/* ── 2 · spese ── */
.exp { background: var(--page); border-radius: var(--r-xl); box-shadow: inset 0 0 0 1px var(--border); margin-bottom: 10px; overflow: hidden; }
.exp.open { box-shadow: inset 0 0 0 1.5px var(--blue); }
.ehead { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; background: none; border: 0; text-align: left; color: var(--ink); min-height: 64px; }
.ehead .petal { background: var(--lilac); }
.ehead .tt { min-width: 0; flex: 1; }
.ehead .t { font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ehead .s { font-size: 13px; color: var(--soft); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ehead .a { font-weight: 800; font-size: 17px; white-space: nowrap; }
.ehead .chev { color: var(--muted); flex: none; transition: transform .2s; }
.exp.open .ehead .chev { transform: rotate(180deg); }

.ebody { padding: 2px 14px 14px; }
.frow { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 8px; }
.amtwrap { display: flex; align-items: center; gap: 4px; background: var(--neutral); border-radius: var(--r-md); padding: 0 12px; min-height: 48px; border: 1.5px solid transparent; }
.amtwrap:focus-within { border-color: var(--blue); background: var(--page); }
.amtwrap input { width: 100%; min-width: 0; border: 0; background: transparent; outline: none; text-align: right; font-weight: 800; font-size: 17px; padding: 0; }
.amtwrap span { color: var(--soft); font-weight: 700; }
.lab { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 16px 2px 8px; }
.lab .link { text-transform: none; letter-spacing: 0; font-size: 14px; }
.fpick { display: flex; flex-wrap: wrap; gap: 6px; }
.fp { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 4px 12px 4px 4px; background: var(--neutral); font-weight: 700; font-size: 14px; color: var(--soft); min-height: 40px; max-width: 100%; }
.fp span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp:not(.on) .face { filter: grayscale(1); opacity: .45; }
.fp.on { background: var(--blue-soft); color: var(--blue-text); box-shadow: inset 0 0 0 1.5px var(--blue); }
.segwrap { margin-top: 16px; }
.pcs { display: grid; gap: 8px; margin-top: 10px; }
.pc { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; }
.pc .amtwrap { margin-left: auto; width: 96px; min-height: 42px; }
.pctot { font-size: 13px; font-weight: 800; margin: 6px 2px 0; text-align: right; }
.ok { color: var(--green); } .warn { color: var(--amber); }

.items { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.items .hint { margin: 8px 0; }
.item { background: var(--surface); border-radius: 14px; padding: 10px; margin-bottom: 8px; display: grid; gap: 8px; }
.hint { font-size: 13.5px; color: var(--soft); }
.ebar { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 12px; }
.del { color: var(--red); font-size: 14px; }

/* ── 3 · il conto ── */
.res .res-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.res .tot { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.res .state { font-size: 13px; font-weight: 800; text-align: right; max-width: 55%; }
.ptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-top: 14px; }
.ptile { background: var(--chip); border-radius: 16px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.ptile .face { width: 32px; height: 32px; font-size: 14px; margin-bottom: 4px; }
.ptile b { font-size: 13.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptile .part { font-weight: 800; font-size: 16px; }
.ptile .net { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.tr { margin-top: 10px; }
.tr .kicker { margin-bottom: 4px; }
.tr .hint { margin-top: 8px; }
.none { color: var(--soft); font-weight: 600; text-align: center; margin-top: 10px; }
.result > .btn { margin-top: 12px; }

/* la pillola in basso: solo telefono, solo mentre il conto non si vede */
.peek {
  position: fixed; left: 16px; right: 16px; z-index: 25;
  bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--ink); color: var(--page); border-radius: 999px; padding: 12px 18px;
  font-size: 14.5px; font-weight: 700; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .45);
  transition: opacity .2s, transform .2s;
}
.peek:hover { text-decoration: none; }
.peek b { color: var(--blue-soft); white-space: nowrap; }
.peek.off { opacity: 0; transform: translateY(12px); pointer-events: none; }
html.in-app .peek { bottom: calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .peek { display: none; } }

.app-hint { display: flex; gap: 14px; align-items: center; color: var(--ink); }
.app-hint:hover { text-decoration: none; }
.app-hint .t { font-weight: 800; font-size: 17px; }
.app-hint .s { font-size: 14px; color: var(--soft); font-weight: 500; }
.app-hint .arrow { margin-left: auto; flex: none; color: var(--blue-text); }

/* i link interni (#prova, #result) non finiscono sotto la testata fissa */
#prova, #result { scroll-margin-top: 76px; }
html.in-app #prova, html.in-app #result { scroll-margin-top: 12px; }
