@font-face { font-family: "DM Sans"; font-weight: 400; font-display: swap; src: url("/fonts/dm-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 500; font-display: swap; src: url("/fonts/dm-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 700; font-display: swap; src: url("/fonts/dm-sans-latin-700-normal.woff2") format("woff2"); }
/* Layout: fondo chiaro con grandi schede morbide, pulsanti tondi e facce disegnate per le persone.
   Due soli colori, blu e rosa, più i neutri tinti di blu. Di Spuntalo resta solo il font. */
:root {
  color-scheme: light;
  --bg: #edf0fb; --card: #ffffff; --soft: #dfe4f7;
  --text: #12163a; --muted: #5b618a;
  --blue: #2438e8; --on-blue: #ffffff; --blue-soft: rgba(255, 255, 255, .22); --on-blue-soft: #dbe0ff;
  --pink: #f7cbe6; --on-pink: #12163a; --link: #2438e8;
  --scrim: rgba(18, 22, 58, .4);
  --shadow: 0 12px 28px rgba(36, 56, 232, .16);
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1228; --card: #1a1e3c; --soft: #272c54; --text: #eef0fb; --muted: #a2a8cf;
    --blue: #3f52f5; --link: #b3bdff; --scrim: rgba(0, 0, 0, .6); --shadow: 0 12px 28px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1228; --card: #1a1e3c; --soft: #272c54; --text: #eef0fb; --muted: #a2a8cf;
  --blue: #3f52f5; --link: #b3bdff; --scrim: rgba(0, 0, 0, .6); --shadow: 0 12px 28px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { position: fixed; inset: 0; width: 100%; margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
#scroller { position: fixed; inset: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
button, input { font: inherit; color: inherit; }
button, a { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button { cursor: pointer; }
svg { display: block; flex-shrink: 0; }
ul { list-style: none; margin: 0; padding: 0; }
p, h1, h2 { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.wrap {
  max-width: 560px; margin: 0 auto; width: 100%;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.page { padding-block: calc(14px + env(safe-area-inset-top, 0px)) 112px; display: grid; gap: 14px; }

/* pulsanti tondi */
.round { display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; background: var(--card); color: var(--text); }
.round.pink { width: 44px; height: 44px; background: var(--pink); color: var(--on-pink); }
.bar { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; align-items: center; gap: 8px; min-height: 52px; }
.bar p { text-align: center; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-pill { justify-self: center; padding: 6px 14px; border-radius: 999px; background: var(--pink); color: var(--on-pink); font-size: 14px; font-weight: 500; }

/* casa */
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.hello { font-size: 34px; line-height: 1.08; font-weight: 700; letter-spacing: -.035em; }
.hello span { display: block; color: var(--muted); font-weight: 400; letter-spacing: -.025em; }
.go-dot { flex-shrink: 0; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--blue-soft); }
.sec h2 { font-size: 18px; line-height: 1.2; font-weight: 700; letter-spacing: -.015em; }
.new-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 104px; padding: 0 22px 0 26px; border: 0; border-radius: 34px; background: var(--blue); color: var(--on-blue); font-size: 26px; font-weight: 700; letter-spacing: -.025em; text-align: left; box-shadow: var(--shadow); }
.new-btn .go-dot { width: 56px; height: 56px; }
.pill { flex-shrink: 0; padding: 5px 12px; border-radius: 999px; background: var(--soft); font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill.open { background: var(--pink); color: var(--on-pink); }
.small { margin-top: 8px; font-size: 13px; color: var(--muted); }
.small a { color: inherit; }
.sec { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; margin-top: 4px; }
.stack { display: flex; }
.stack .face { margin-left: -9px; border-radius: 13px; box-shadow: 0 0 0 2px var(--bg); }
.stack .face:first-child { margin-left: 0; }

/* conto */
.total-card { display: grid; gap: 16px; padding: 22px; border: 0; border-radius: 30px; background: var(--blue); color: var(--on-blue); width: 100%; text-align: left; }
.total-card small { display: block; font-size: 15px; color: var(--on-blue-soft); }
.total-card .amount-big { display: block; margin-top: 2px; font-size: clamp(46px, 15vw, 64px); line-height: 1; font-weight: 700; letter-spacing: -.045em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.total-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--on-blue-soft); }
.total-card .stack .face { box-shadow: 0 0 0 2px var(--blue); }
.sample { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 18px; border-radius: 999px; background: var(--pink); color: var(--on-pink); font-size: 14px; }
.sample button { flex-shrink: 0; min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--card); color: var(--text); font-size: 14px; font-weight: 700; }
.rows { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 76px; padding: 12px 16px 12px 12px; border: 0; border-radius: 24px; background: var(--card); text-align: left; }
.row-text { flex: 1; min-width: 0; }
.row-text b { display: block; font-size: 16px; font-weight: 500; line-height: 1.25; overflow-wrap: anywhere; }
.row-text small { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.money { flex-shrink: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-card { padding: 22px; border-radius: 30px; background: var(--pink); color: var(--on-pink); }
.empty-card b { display: block; font-size: 20px; line-height: 1.2; letter-spacing: -.02em; }
.empty-card p { margin-top: 4px; font-size: 15px; }
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding-block: 10px calc(14px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}
.main-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; max-width: 524px; min-height: 60px; margin: 0 auto; padding: 0 20px; border: 0; border-radius: 999px; background: var(--blue); color: var(--on-blue); font-size: 17px; font-weight: 700; text-decoration: none; box-shadow: var(--shadow); }

/* passi */
.screen { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100%); z-index: 6; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); padding-top: env(safe-area-inset-top, 0px); }
.screen-body { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 14px; padding-block: 14px 20px; }
.screen-end { flex-shrink: 0; padding-block: 10px calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--bg); }
.kb .screen-end { padding-block: 8px; }
.kb .q { font-size: 28px; }
.q { margin-top: 8px; font-size: 34px; line-height: 1.08; font-weight: 700; letter-spacing: -.035em; text-wrap: balance; }
.people { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.who { display: grid; justify-items: center; gap: 6px; min-width: 0; padding: 12px 6px 10px; border: 0; border-radius: 22px; background: var(--card); font-size: 14px; font-weight: 500; }
.who span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who[aria-pressed="true"] { background: var(--blue); color: var(--on-blue); font-weight: 700; }
.who-all { grid-column: 1 / -1; min-height: 52px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--card); font-weight: 700; }
.who-all[aria-pressed="true"] { background: var(--blue); color: var(--on-blue); }
.input { display: grid; gap: 4px; font-size: 14px; font-weight: 500; color: var(--muted); }
.input input { width: 100%; height: 56px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--card); color: var(--text); font-size: 16px; }
.input input::placeholder { color: var(--muted); }
.adder { display: flex; align-items: flex-end; gap: 8px; }
.adder .input { flex: 1; min-width: 0; }
.adder .round { width: 56px; height: 56px; background: var(--blue); color: var(--on-blue); }
.amount-card { display: flex; align-items: baseline; gap: 8px; padding: 20px 22px; border-radius: 30px; background: var(--card); }
.amount-card input { flex: 1; min-width: 0; width: 100%; height: 64px; padding: 0; border: 0; background: none; font-size: 54px; font-weight: 700; letter-spacing: -.04em; font-variant-numeric: tabular-nums; outline: none; }
.amount-card input::placeholder { color: var(--soft); }
.amount-card span { font-size: 32px; font-weight: 700; color: var(--muted); }
.amount-card:focus-within { outline: 2px solid var(--link); outline-offset: 1px; }
.ideas { display: flex; flex-wrap: wrap; gap: 8px; }
.ideas button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--soft); font-size: 14px; }
.each { font-size: 15px; color: var(--muted); }

/* risultato */
.state-card { padding: 20px; border-radius: 30px; background: var(--pink); color: var(--on-pink); }
.state-card small { display: block; font-size: 14px; }
.state-card b { display: block; margin-top: 2px; font-size: 24px; line-height: 1.15; letter-spacing: -.025em; }
.segs { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; margin-top: 14px; }
.segs i { height: 8px; border-radius: 4px; background: var(--card); }
.segs i.on { background: var(--blue); }
.tick { position: relative; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 2px solid var(--muted); border-radius: 50%; background: none; color: transparent; }
.tick::before { content: ""; position: absolute; inset: -6px; }
.tick[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.move { flex-wrap: wrap; }
.move .row-text a { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--text); font-size: 13px; font-weight: 500; text-decoration: none; }
.move.done { background: none; box-shadow: inset 0 0 0 1.5px var(--soft); }
.move.done b, .move.done .money { color: var(--muted); }
.move.done .money { text-decoration: line-through; }
.add-pay { color: var(--link); font-weight: 700; }
.fold { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 48px; padding: 0 6px; border: 0; background: none; color: var(--muted); font-size: 14px; font-weight: 500; text-align: left; }
.fold svg { transition: transform .2s; }
.fold[aria-expanded="true"] svg { transform: rotate(180deg); }
.detail { display: grid; gap: 12px; }
.detail li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.detail li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.detail b { display: block; color: var(--text); font-size: 15px; }
.detail .money { font-size: 14px; color: var(--text); }
.bubble { padding: 16px 18px; border-radius: 22px; background: var(--card); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.share { display: flex; align-items: center; gap: 8px; }
.share .main-btn { flex: 1; min-width: 0; margin: 0; }
.share .round { width: 60px; height: 60px; }

.toast { position: fixed; left: 50%; top: calc(var(--vvt, 0px) + var(--vvh, 100vh) - 146px - env(safe-area-inset-bottom, 0px)); z-index: 30; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 22px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500; text-align: center; box-shadow: var(--shadow); }

/* fogli */
.scrim { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100%); z-index: 10; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); }
.sheet {
  display: grid; gap: 12px; width: 100%; max-width: 560px; max-height: 94%; overflow-y: auto; overscroll-behavior: contain;
  padding-block: 22px calc(20px + env(safe-area-inset-bottom, 0px));
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  border-radius: 32px 32px 0 0; background: var(--bg);
  animation: up .2s ease;
}
.sheet form { display: grid; gap: 12px; }
@keyframes up { from { transform: translateY(24px); } }
@keyframes enter { from { opacity: 0; transform: translateX(18px); } }
@keyframes pop { 40% { transform: scale(1.07); } }
.enter { animation: enter .22s ease-out; }
.just { animation: pop .24s ease-out; }
.who, .chip, .who-all, .tick, .round, .row, .main-btn, .new-btn, .btn, .ideas button { transition: transform .12s ease, background-color .15s ease, color .15s ease, border-color .15s ease; }
.who:active, .chip:active, .who-all:active, .tick:active, .round:active, .row:active, .main-btn:active, .new-btn:active, .btn:active, .ideas button:active { transform: scale(.96); }
.sheet h2 { font-size: 24px; line-height: 1.15; letter-spacing: -.025em; }
.sheet p { font-size: 15px; color: var(--muted); }
.fields { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { max-width: 100%; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--card); font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--blue); color: var(--on-blue); font-weight: 700; }
.cap { font-size: 14px; font-weight: 500; color: var(--muted); }
.actions { display: grid; gap: 4px; }
.btn { min-height: 56px; border: 0; border-radius: 999px; background: var(--blue); color: var(--on-blue); font-size: 16px; font-weight: 700; }
.btn.quiet { background: none; color: var(--muted); font-weight: 500; }
.btn.danger { background: var(--pink); color: var(--on-pink); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
