/* Unhook: stile dell'app.
   Palette: menta #74d3ae, felce #678d58, salvia #a6c48a, crema #f6e7cb, rosa antico #dd9787.
   I toni "deep" sono derivati dalla palette per avere testo leggibile (contrasto AA). */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/plus-jakarta-sans.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --bg: #fbf5e9;
  --cream: #f6e7cb;
  --surface: #fffcf5;
  --surface2: #f3ead8;
  --line: #e6d8bb;
  --ink: #1f2b1b;
  --muted: #5c6b55;
  --fern: #678d58;
  --fern-deep: #3f5a35;
  --mint: #74d3ae;
  --sage: #a6c48a;
  --rose: #dd9787;
  --rose-deep: #a34a3d;
  --amber-deep: #8a5d24;
  --shadow: 0 1px 2px rgb(63 90 53 / .06), 0 8px 24px rgb(63 90 53 / .07);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 66px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
a { color: var(--fern-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--fern); outline-offset: 2px; }

/* ---------- Struttura ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: rgb(251 245 233 / .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { width: 30px; height: 30px; }
.wordmark { font-family: var(--font-display); font-weight: 600; font-size: 1.45rem; letter-spacing: -.03em; line-height: 1; }
.tag-alpha {
  font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--rose-deep); background: rgb(221 151 135 / .18); border-radius: 99px; padding: 2px 8px;
}
.saved-pill {
  font-size: .78rem; font-weight: 700; color: var(--fern-deep);
  background: rgb(116 211 174 / .28); padding: 5px 11px; border-radius: 99px; white-space: nowrap;
}

main {
  max-width: 560px; margin: 0 auto;
  padding: 18px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 100px);
}
main:focus { outline: none; }
.loading { padding: 48px 16px; text-align: center; color: var(--muted); }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 5;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding-bottom: var(--safe-bottom);
  background: rgb(255 252 245 / .94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  position: relative; height: var(--tabbar-h); background: none; border: 0;
  display: grid; place-items: center; align-content: center; gap: 3px;
  color: var(--muted); font-size: .72rem; font-weight: 700;
}
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tabbar [aria-current="page"] { color: var(--fern-deep); }
.tabbar [aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 50%; translate: -50% 0;
  width: 36px; height: 3px; border-radius: 0 0 3px 3px; background: var(--fern);
}

.fab {
  position: fixed; z-index: 6;
  right: max(16px, calc(50% - 280px + 16px));
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  width: 60px; height: 60px; border-radius: 20px; border: 0;
  display: grid; place-items: center;
  background: var(--fern-deep);
  box-shadow: 0 12px 28px rgb(63 90 53 / .35);
  transition: transform .15s;
}
.fab:active { transform: scale(.94); }
.fab svg { width: 26px; height: 26px; stroke: var(--cream); stroke-width: 2.6; stroke-linecap: round; fill: none; }
body:has(dialog[open]) .fab { visibility: hidden; }

.toast {
  position: fixed; left: 50%; z-index: 20;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 90px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  width: max-content; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--cream); font-weight: 600; font-size: .9rem;
  padding: 11px 18px; border-radius: 14px; box-shadow: var(--shadow);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* Via gli stili di base dei popover (tutto lo schermo, bordo), restando nella stessa posizione. */
.toast[popover] { inset: auto auto calc(var(--tabbar-h) + var(--safe-bottom) + 90px) 50%; margin: 0; border: 0; overflow: visible; }

/* ---------- Tipografia ed elementi comuni ---------- */
h1, h2, .display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.eyebrow { font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--fern); }
.section-title { margin: 26px 0 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 18px; border-radius: 14px;
  font-weight: 700; text-decoration: none; text-align: center;
  border: 1px solid transparent; background: var(--surface2); color: var(--ink);
  transition: transform .12s, box-shadow .12s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--fern-deep); color: var(--cream); box-shadow: 0 8px 20px rgb(63 90 53 / .25); }
.btn-danger { background: var(--rose); color: var(--ink); box-shadow: 0 8px 20px rgb(221 151 135 / .35); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ok { background: rgb(116 211 174 / .25); color: var(--fern-deep); border-color: rgb(103 141 88 / .35); }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link-btn { background: none; border: 0; color: var(--fern-deep); font-weight: 700; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.ic {
  --c: var(--fern);
  width: 46px; height: 46px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  background: var(--c); color: #fff; font-weight: 800; font-size: 1.1rem;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .06);
}
.ic svg { width: 56%; height: 56%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Righe di filtri: scorrono a destra e sinistra (dito, rotellina, trascinamento o frecce: js/scroller.js). */
#push-upsell .small { margin-top: 4px; }
#push-upsell .btn { margin-top: 12px; }
.chips-wrap { position: relative; }
.catalog-cats { margin-top: 14px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; overscroll-behavior-x: contain; }
.chips::-webkit-scrollbar { display: none; }
.chips.dragging { cursor: grabbing; user-select: none; }
.chips.dragging .chip { pointer-events: none; }
/* Sfumatura sul lato dove c'è ancora qualcosa da vedere. */
.chips-wrap.can-left .chips { mask-image: linear-gradient(to right, transparent, #000 32px); }
.chips-wrap.can-right .chips { mask-image: linear-gradient(to left, transparent, #000 32px); }
.chips-wrap.can-left.can-right .chips { mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
.chips-nav {
  display: none; position: absolute; top: calc(50% - 2px); translate: 0 -50%; z-index: 1;
  width: 34px; height: 34px; border-radius: 50%; place-items: center;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink);
}
.chips-nav svg { width: 16px; height: 16px; }
.chips-nav.prev { left: -4px; }
.chips-nav.prev svg { rotate: 180deg; }
.chips-nav.next { right: -4px; }
/* Le frecce servono a chi usa il mouse: col dito si scorre e basta. */
@media (hover: hover) and (pointer: fine) {
  .chips-wrap.can-left .chips-nav.prev, .chips-wrap.can-right .chips-nav.next { display: grid; }
}
.chip {
  flex: none; padding: 8px 14px; border-radius: 99px; font-size: .85rem; font-weight: 700;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--fern-deep); border-color: var(--fern-deep); color: var(--cream); }
.chip .count { opacity: .75; margin-left: 4px; }

/* ---------- Home ---------- */
.summary {
  position: relative; overflow: hidden;
  border-radius: 24px; padding: 20px;
  color: var(--cream);
  background:
    radial-gradient(260px 160px at 100% 0%, rgb(116 211 174 / .35), transparent 70%),
    radial-gradient(200px 140px at 0% 110%, rgb(221 151 135 / .35), transparent 70%),
    linear-gradient(135deg, var(--fern), var(--fern-deep));
  box-shadow: 0 16px 36px rgb(63 90 53 / .28);
}
.summary .label { font-size: .85rem; opacity: .85; }
.summary .big { display: block; font-family: var(--font-display); font-size: 2.6rem; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; margin: 4px 0; }
.summary .sub { font-size: .88rem; opacity: .85; }
.summary .saved { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgb(246 231 203 / .25); font-size: .9rem; font-weight: 600; color: #bff0dc; }

.urgent-box { margin-top: 16px; border: 1px solid rgb(221 151 135 / .6); background: rgb(221 151 135 / .14); border-radius: var(--radius); padding: 14px 16px; }
.urgent-box h2 { font-family: var(--font-ui); font-size: .9rem; font-weight: 800; color: var(--rose-deep); margin-bottom: 6px; letter-spacing: 0; }
.urgent-box ul { list-style: none; display: grid; gap: 2px; }
.urgent-box button { width: 100%; text-align: left; background: none; border: 0; display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: .92rem; font-weight: 600; }
.urgent-box button span:last-child { color: var(--rose-deep); text-align: right; }

.filters { margin-top: 22px; }
.item-list { list-style: none; display: grid; gap: 10px; margin-top: 8px; }
.item {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
  box-shadow: var(--shadow);
  transition: transform .12s;
}
.item:active { transform: scale(.99); }
.item.is-done { opacity: .6; box-shadow: none; }
.item .info { flex: 1; min-width: 0; }
.item .info b { display: block; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { font-size: .8rem; color: var(--muted); }
.status.soon { color: var(--amber-deep); font-weight: 600; }
.status.urgent, .status.overdue { color: var(--rose-deep); font-weight: 700; }
.status.done { color: var(--fern-deep); }
.gate-forgot { display: block; margin: 2px auto 0; }
.code-input { font-size: 1.6rem; font-weight: 700; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
/* Carta "Ti è già arrivato?" (rincaro del listino) e "È il piano X?" */
.price-card { margin-top: 16px; display: grid; gap: 8px; border: 1px solid rgb(103 141 88 / .4); background: rgb(116 211 174 / .16); border-radius: var(--radius); padding: 14px 16px; }
.price-card h2 { font-family: var(--font-ui); font-size: .95rem; font-weight: 800; color: var(--fern-deep); letter-spacing: 0; }
.price-card p { font-size: .92rem; }
.price-card a { color: var(--fern-deep); font-weight: 600; }
.price-actions { display: grid; gap: 8px; margin-top: 4px; }
.price-actions.two { grid-template-columns: 1fr 1fr; }
.price-actions .btn { min-height: 44px; padding: 10px 14px; }
.rise { display: block; font-size: .76rem; font-weight: 700; color: var(--rose-deep); }
.shared-note { display: block; font-size: .76rem; color: var(--muted); }
.item .price { text-align: right; font-weight: 800; font-size: .92rem; white-space: nowrap; }
.item .price small { color: var(--muted); font-weight: 500; }
.pill {
  display: inline-block; margin-top: 5px; font-size: .72rem; font-weight: 800; color: var(--ink);
  background: var(--rose); padding: 3px 10px; border-radius: 99px;
}
.pill.renew { background: var(--sage); }
.pill.none { background: var(--mint); }

.empty { text-align: center; padding: 28px 8px; }
.empty .art { width: 96px; height: 96px; margin: 0 auto 18px; }
.empty h1 { font-size: 1.8rem; }
.empty p { color: var(--muted); margin: 10px auto 24px; max-width: 34ch; }
.empty .btn { margin: 4px; }

/* ---------- Catalogo ---------- */
.search {
  width: 100%; min-height: 50px; padding: 12px 14px 12px 44px; border-radius: 14px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c6b55' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cpath d='m20 20-4.5-4.5'/%3E%3C/svg%3E") no-repeat 13px 50% / 20px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.store-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.store-cards button { text-align: left; background: rgb(166 196 138 / .22); border: 1px solid rgb(103 141 88 / .25); border-radius: var(--radius); padding: 12px 14px; font-size: .82rem; color: var(--muted); }
.store-cards b { display: block; font-size: .95rem; color: var(--ink); }
.cat-group h2 { font-family: var(--font-ui); font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--fern); margin: 24px 0 8px; }

/* ---------- Bottom sheet (dialog) ---------- */
dialog.sheet {
  margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92dvh;
  border: 0; border-radius: 26px 26px 0 0;
  background: var(--bg); color: var(--ink);
  padding: 0 16px calc(22px + var(--safe-bottom));
  overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 -10px 40px rgb(31 43 27 / .2);
}
dialog.sheet[open] { animation: sheet-in .24s cubic-bezier(.2, .8, .2, 1); }
dialog.sheet::backdrop { background: rgb(31 43 27 / .42); backdrop-filter: blur(2px); }
@keyframes sheet-in { from { transform: translateY(48px); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }

.sheet-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 12px;
  padding: 20px 0 14px; background: var(--bg);
}
.sheet-head::before {
  content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 4px; border-radius: 4px; background: var(--line);
}
.sheet-head .titles { flex: 1; min-width: 0; }
.sheet-head h2 { font-size: 1.4rem; }
.sheet-head p { font-size: .85rem; color: var(--muted); }
.close-btn {
  width: 42px; height: 42px; flex: none; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center;
}
.close-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.sheet-body { display: grid; gap: 16px; }

.facts { display: grid; }
.facts .row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.facts .row:last-child { border-bottom: 0; }
.facts .row > span:first-child { color: var(--muted); flex: none; }
.facts .row > span:last-child { text-align: right; font-weight: 600; }
.facts .hl { color: var(--amber-deep); }
.facts .bad { color: var(--rose-deep); }
.facts .ok { color: var(--fern-deep); font-weight: 700; }
.facts .ok .link-btn { padding: 0; font-weight: 600; }
/* Già pagato + Ho disdetto: due pulsanti affiancati; durante una prova resta solo Ho disdetto, a tutta larghezza */
.pay-row:has(> :only-child) { grid-template-columns: 1fr; }

.guide { display: grid; gap: 14px; }
.guide h3 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em; }
.methods { display: flex; flex-wrap: wrap; gap: 6px; }
.method { font-size: .76rem; font-weight: 800; padding: 4px 11px; border-radius: 99px; background: rgb(166 196 138 / .35); color: var(--fern-deep); }
.steps { list-style: none; counter-reset: step; display: grid; gap: 12px; }
.steps li { counter-increment: step; display: flex; gap: 12px; font-size: .95rem; }
.steps li::before {
  content: counter(step); flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: .8rem; font-weight: 800;
  background: var(--fern-deep); color: var(--cream);
}
.tips { list-style: none; display: grid; gap: 8px; font-size: .88rem; color: var(--muted); }
.tips li { display: flex; gap: 9px; }
.tips li::before { content: "!"; flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 800; background: rgb(221 151 135 / .3); color: var(--rose-deep); margin-top: 1px; }
.notice-box { border-radius: 14px; padding: 12px 14px; font-size: .9rem; background: rgb(116 211 174 / .2); border: 1px solid rgb(103 141 88 / .3); }
.notice-box.warn { background: rgb(221 151 135 / .16); border-color: rgb(221 151 135 / .55); }
.guide-actions { display: grid; gap: 10px; }
.verified { font-size: .78rem; color: var(--muted); text-align: center; }
.verified a { color: var(--muted); }
.verified.report { margin-top: -4px; }
.verified.report a { color: var(--fern-deep); font-weight: 600; }
details.more { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface); }
details.more summary { cursor: pointer; font-weight: 700; font-size: .92rem; }
details.more[open] summary { margin-bottom: 12px; }
.sheet-actions { display: grid; gap: 10px; padding-top: 6px; }

/* ---------- Form ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-size: .85rem; font-weight: 700; color: var(--muted); }
.field .hint { font-size: .78rem; color: var(--muted); }
.form input:not([type=radio], [type=checkbox]), .form select, .form textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
}
.form textarea { min-height: 90px; resize: vertical; }
.form input:user-invalid { border-color: var(--rose-deep); background: rgb(221 151 135 / .12); }
.form .error-msg { display: none; font-size: .8rem; font-weight: 600; color: var(--rose-deep); }
.form input:user-invalid ~ .error-msg { display: block; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface2); }
.segmented label { position: relative; display: grid; place-items: center; min-height: 42px; border-radius: 12px; font-weight: 700; font-size: .9rem; color: var(--muted); cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--fern); }
.check { display: flex; align-items: center; gap: 10px; font-size: .92rem; min-height: 40px; }
.check input { width: 20px; height: 20px; accent-color: var(--fern-deep); }
.form.is-deadline .only-sub { display: none; }
.form.is-sub .only-deadline { display: none; }
.form-actions { display: grid; gap: 10px; margin-top: 4px; }

.picker-list { list-style: none; display: grid; gap: 8px; }
.picker-list button { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.picker-list .ic { width: 38px; height: 38px; border-radius: 11px; font-size: .95rem; }
.picker-list small { display: block; color: var(--muted); font-size: .78rem; }

.letter-preview { font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; font-size: .8rem; line-height: 1.5; min-height: 340px !important; white-space: pre-wrap; }

/* ---------- Profilo / impostazioni ---------- */
.settings { display: grid; gap: 4px; }
.settings .card { display: grid; gap: 14px; }
.settings .card p { font-size: .9rem; color: var(--muted); }
.perm { font-size: .85rem; font-weight: 700; }
.perm.ok { color: var(--fern-deep); }
.perm.no { color: var(--rose-deep); }
.danger-zone .btn, .btn-delete-account { border-color: rgb(163 74 61 / .4); color: var(--rose-deep); }
.btn-delete-account { margin-top: 10px; }

@media (min-width: 600px) {
  dialog.sheet { margin: auto; border-radius: 26px; max-height: 88dvh; }
}

/* ---------- Stampa della lettera di disdetta ---------- */
#print-area { display: none; }
@media print {
  @page { margin: 2cm; }
  body.printing > :not(#print-area) { display: none !important; }
  body.printing { background: #fff; min-height: 0; }
  body.printing #print-area { display: block; white-space: pre-wrap; color: #000; font: 12pt/1.55 Georgia, "Times New Roman", serif; }
}

/* ---------- Piano Free: fascia fissa in cima (non si chiude) ---------- */
.plan-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 10px 7px 16px;
  background: var(--cream); border-top: 1px solid var(--line);
  font-size: .82rem; line-height: 1.25;
}
.plan-strip-text { min-width: 0; color: var(--ink); }
.plan-strip em { font-style: normal; font-weight: 700; color: var(--rose-deep); }
.plan-strip-cta {
  flex: none; min-height: 34px; padding: 0 14px; border-radius: 99px; border: 0;
  background: var(--fern-deep); color: var(--cream); font-weight: 700; font-size: .8rem; white-space: nowrap;
}
.plan-strip.full { background: rgb(221 151 135 / .28); }
@media (min-width: 600px) { .plan-strip { justify-content: center; gap: 16px; } }

/* ---------- Schermata di accesso (senza account l'app non si apre) ---------- */
body.gated .tabbar, body.gated .fab, body.gated .saved-pill, body.gated .plan-strip { display: none !important; }
body.gated main { max-width: 440px; padding-bottom: calc(var(--safe-bottom) + 40px); }
.gate { display: grid; gap: 14px; padding-top: 10px; }
.gate .art { width: 72px; height: 72px; margin: 6px auto 2px; }
.gate h1 { font-size: 2rem; text-align: center; }
.gate .lead { text-align: center; color: var(--muted); max-width: 34ch; margin: 0 auto 4px; }
.gate-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface2); }
.gate-switch button { min-height: 44px; border: 0; border-radius: 12px; background: none; font-weight: 700; font-size: .92rem; color: var(--muted); }
.gate-switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.gate-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .82rem; }
.gate-or::before, .gate-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.gate-terms { align-items: flex-start; font-size: .88rem; color: var(--muted); }
.gate-terms input { flex: none; margin-top: 2px; }
.gate-plans { text-align: center; color: var(--muted); max-width: 40ch; margin: 2px auto 0; }
.gate .hint { font-weight: 400; }
#gate-submit:disabled { opacity: .6; cursor: wait; }
.gate-export { display: grid; gap: 12px; font-size: .9rem; color: var(--muted); }

/* ---------- Scelta del piano ---------- */
.plans { gap: 12px; }
.plan-card { display: grid; gap: 12px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.plan-card.plus { border-color: rgb(103 141 88 / .55); background: linear-gradient(180deg, rgb(116 211 174 / .16), var(--surface) 60%); }
.plan-card header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.plan-card h3 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; }
.plan-price { font-size: .88rem; color: var(--muted); }
.plan-price b { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; color: var(--ink); }
.plan-features { list-style: none; display: grid; gap: 7px; font-size: .92rem; }
.plan-features li { display: flex; gap: 9px; align-items: flex-start; }
.plan-features svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--fern); }
.plan-tag { justify-self: start; font-size: .76rem; font-weight: 800; padding: 4px 11px; border-radius: 99px; background: rgb(166 196 138 / .35); color: var(--fern-deep); }
.plan-buy { display: grid; gap: 8px; }
.plan-buy .btn:disabled { opacity: .6; cursor: wait; }
.plan-note { color: var(--muted); text-align: center; }

/* Family: persone nel riquadro del Profilo e link di invito */
.family-list { list-style: none; margin: 4px 0 10px; padding: 0; display: grid; gap: 8px; }
.family-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface2); }
.family-who { display: grid; min-width: 0; }
.family-who b, .family-who .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.btn-small { min-height: 38px; padding: 0 14px; flex: none; }
.family-link { margin: 12px 0; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 14px; background: var(--surface2); font-size: .9rem; word-break: break-all; user-select: all; }

/* ---------- Riepilogo spesa ---------- */
.summary-link {
  position: absolute; top: 16px; right: 16px; /* nell'angolo in alto a destra del riquadro, staccato dai numeri */
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid rgb(246 231 203 / .45);
  background: rgb(246 231 203 / .12); color: var(--cream); font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer;
}
.summary-link:hover { background: rgb(246 231 203 / .22); }
@media (max-width: 480px) { .summary-link { top: 12px; right: 12px; min-height: 34px; padding: 6px 12px; font-size: .82rem; } }
.summary-link .tag { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--mint); color: var(--ink); }
.report section + section { margin-top: 22px; }
.report h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; margin-bottom: 10px; }
.bars { list-style: none; display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 9.5rem) 1fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-label small, .bar-amount small, .report-top small { color: var(--muted); font-weight: 500; margin-left: 3px; }
.bar { height: 10px; border-radius: 999px; background: var(--surface2); overflow: hidden; }
.bar > span { display: block; height: 100%; width: var(--w); border-radius: inherit; background: linear-gradient(90deg, var(--sage), var(--fern)); }
.bar-row.peak .bar > span { background: linear-gradient(90deg, var(--rose), var(--rose-deep)); }
.bar-amount { font-weight: 700; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.report-top { list-style: none; display: grid; gap: 6px; counter-reset: top; }
.report-top button {
  width: 100%; display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: .92rem; color: var(--ink); cursor: pointer; text-align: left;
}
.report-top button > span:first-child::before { counter-increment: top; content: counter(top) ". "; color: var(--muted); font-weight: 700; }
.report-top button > span:last-child { font-weight: 700; white-space: nowrap; }

/* Avvisi in più (piano Pro) nell'editor */
.extra-reminders { border: 0; padding: 0; margin: 0; min-width: 0; }
.extra-reminders legend { font-weight: 700; font-size: .9rem; margin-bottom: 4px; padding: 0; }
.check-row { display: flex; flex-wrap: wrap; gap: 0 16px; }

/* Stampa del riepilogo della spesa (piano Pro) */
@media print {
  body.printing #print-area.print-report { white-space: normal; font: 11pt/1.45 Georgia, "Times New Roman", serif; }
  .print-report h1 { font-size: 16pt; margin: 0 0 4pt; }
  .print-report h2 { font-size: 12pt; margin: 14pt 0 4pt; }
  .print-report table { width: 100%; border-collapse: collapse; }
  .print-report td, .print-report th { text-align: left; padding: 3pt 6pt; border-bottom: 0.5pt solid #bbb; }
  .print-report td:not(:first-child), .print-report th:not(:first-child) { text-align: right; }
}

/* Lettera completa (piano Pro): impaginazione da lettera vera nel PDF */
@media print {
  body.printing #print-area.print-letter { white-space: normal; font: 11.5pt/1.5 Georgia, "Times New Roman", serif; padding: 6mm 4mm; }
  .print-letter p { white-space: pre-line; margin: 0 0 11pt; text-align: justify; }
  .print-letter .pl-from { text-align: left; }
  .print-letter .pl-to { margin: 8mm 0 10mm auto; width: 55%; text-align: left; }
  .print-letter .pl-subject { font-weight: 700; text-align: left; }
  .print-letter .pl-sign { margin-top: 14mm; text-align: right; }
}
@media print { .print-letter .pl-list { text-align: left; } }

/* Lettura di email e fatture (piano Pro) */
.ai-start .tag, .summary-link .tag { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--mint); color: var(--ink); }
.ai-start { margin-bottom: 12px; }
.ai-drop { display: grid; gap: 4px; place-items: center; text-align: center; padding: 22px 14px; border: 2px dashed var(--line); border-radius: 18px; background: var(--surface); cursor: pointer; margin-bottom: 14px; }
.ai-drop.over { border-color: var(--fern); background: rgb(116 211 174 / .12); }
.ai-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ai-consent { align-items: flex-start; font-size: .84rem; margin: 6px 0 12px; }
.ai-read .btn { margin-top: 8px; }
.ai-read pre { white-space: pre-wrap; font-size: .78rem; max-height: 200px; overflow: auto; background: var(--surface2); padding: 10px; border-radius: 10px; }

/* Avviso di aggiornamento dell'app Android (www/js/update.js) */
.update-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  display: grid; gap: 12px; padding: 16px; border-radius: 20px;
  background: var(--surface, #fffcf5); border: 1px solid var(--line); box-shadow: 0 18px 40px -18px rgb(31 43 27 / .45);
}
.update-bar p { margin: 0; display: grid; gap: 4px; }
.update-bar small { color: var(--muted); }
.update-bar div { display: flex; gap: 8px; justify-content: flex-end; }
@media (min-width: 720px) { .update-bar { left: auto; width: 420px; } }

/* App del Play Store (www/js/canale.js): niente pulsanti per comprare o gestire i piani con Stripe. */
.canale-play [data-action="plans"]:not(.keep), .canale-play [data-action^="buy-"], .canale-play [data-action="manage-plan"] { display: none !important; }
