/* Bilancio — stile essenziale: quasi monocromo, un solo accento, cifre grandi, tanto respiro. */
@font-face {
  font-family: "Geist";
  src: url("/static/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --ground: #F4F4F2;
  --surface: #FFFFFF;
  --sunken: #E9E9E6;
  --ink: #0E0E0E;
  --muted: #6B6B67;
  --faint: #9A9A95;
  --line: #E4E4E0;
  --line-soft: #EFEFEC;
  --accent: #D40000;
  --accent-soft: #FBE8E7;
  --accent-ink: #B00000;
  --on-accent: #FFFFFF;
  --income: #157A46;
  --warn: #A15C00;
  --saving: #3F55A6;
  --hero: #0E0E0E;
  --on-hero: #F4F4F2;
  --hero-muted: #A9A9A4;
  --chart-1: #D40000;
  --chart-2: #0E0E0E;
  --chart-3: #8E8E89;
  --chart-4: #C8C8C3;
  --chart-other: #E2E2DE;
  --bar-bg: rgba(244, 244, 242, 0.94);
  --shadow: 0 10px 30px rgba(14, 14, 14, .12);
  --font: "Geist", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --radius-card: 22px;
  --radius-control: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 66px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0B0B0B;
    --surface: #161616;
    --sunken: #1F1F1F;
    --ink: #F2F2F0;
    --muted: #9C9C97;
    --faint: #6E6E69;
    --line: #272727;
    --line-soft: #1E1E1E;
    --accent: #F2382C;
    --accent-soft: #3A1412;
    --accent-ink: #FF6B61;
    --income: #45C482;
    --warn: #E5AE4E;
    --saving: #97A7EC;
    --hero: #1D1D1D;
    --on-hero: #F2F2F0;
    --hero-muted: #9C9C97;
    --chart-1: #F2382C;
    --chart-2: #F2F2F0;
    --chart-3: #8A8A84;
    --chart-4: #4A4A47;
    --chart-other: #2C2C2A;
    --bar-bg: rgba(11, 11, 11, 0.92);
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* come un'app: niente zoom con le dita né doppio tocco (lo scorrimento resta) */
html { -webkit-text-size-adjust: 100%; touch-action: pan-x pan-y; }
button, a, input, select, label { touch-action: manipulation; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--income); }
.neg { color: var(--accent-ink); }
.sav { color: var(--saving); }
.muted { color: var(--muted); }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 20px) 20px calc(var(--tabbar-h) + var(--safe-bottom) + 36px);
  min-height: 100vh;
}
.boot { padding: 40vh 0; text-align: center; color: var(--muted); }

/* ---------- icone */
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tile {
  width: 44px; height: 44px; border-radius: var(--radius-control); flex: none;
  display: grid; place-items: center; background: var(--sunken); color: var(--ink);
}
.tile .ico { width: 20px; height: 20px; }
.tile .emoji { font-size: 20px; line-height: 1; }
.tile.warn { background: var(--accent-soft); color: var(--accent-ink); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--ink); color: var(--ground);
  font: 600 16px var(--font); text-decoration: none;
}
.avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.avatar.alt { background: var(--chart-3); color: #FFFFFF; }

/* ---------- intestazioni */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.top .hello { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.top .hello small { font-size: 13px; color: var(--muted); letter-spacing: .01em; }
.top .hello b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.title { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.head { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; }
.head .title { flex: 1; min-width: 0; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--ink);
  display: grid; place-items: center; cursor: pointer; text-decoration: none; flex: none;
}
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.boxed { background: var(--surface); border: 1px solid var(--line); }
.month-nav { display: flex; align-items: center; gap: 0; }
.month-nav span { font-size: 15px; font-weight: 500; min-width: 0; white-space: nowrap; }
.month-nav .icon-btn { width: 36px; color: var(--muted); }
.link { font-size: 14px; color: var(--muted); text-decoration: none; background: none; border: 0; padding: 8px 0; cursor: pointer; }
.link.strong { color: var(--ink); font-weight: 500; }

/* ---------- disponibile */
.hero { display: flex; flex-direction: column; gap: 6px; margin-bottom: 26px; }
.hero .label { font-size: 15px; color: var(--muted); }
.hero .amount { font-size: clamp(44px, 13vw, 56px); font-weight: 600; letter-spacing: -.045em; line-height: 1; }
.hero .amount.long { font-size: clamp(30px, 9vw, 40px); }
.hero .amount.neg { color: var(--accent-ink); }
.hero .sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.hero .sub b { color: var(--ink); font-weight: 600; }
.spark { display: block; width: 100%; height: 70px; margin-top: 14px; overflow: visible; }
.spark .base { stroke: var(--line); stroke-width: 1; }
.spark .line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark .zero { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.spark-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--accent); }
.spark-wrap { position: relative; }
.spark-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* ---------- azioni rapide */
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 26px; }
.quick button, .quick a {
  display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; border: 0; padding: 0;
  color: var(--ink); font-size: 13px; text-decoration: none; cursor: pointer;
}
.quick .circle {
  width: 58px; height: 58px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center;
}
.quick button:active .circle, .quick a:active .circle { transform: scale(.95); }

/* ---------- schede */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 20px; margin-bottom: 14px;
}
.card.flush { padding: 6px 16px; }
.card.dark { background: var(--hero); color: var(--on-hero); border-color: var(--hero); }
.card.dashed { background: transparent; border-style: dashed; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
a.card, button.card { display: block; width: 100%; text-align: left; text-decoration: none; color: inherit; cursor: pointer; font: inherit; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 0 8px; }
.section-title h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }

.calc { list-style: none; margin: 0; padding: 0; }
.calc li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 15px; }
.calc li > span:first-child { color: var(--muted); }
.calc .num { font-weight: 600; }
.calc .total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.calc .total > span:first-child { color: var(--ink); font-weight: 600; }
.split-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kv { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kv small { font-size: 13px; color: var(--muted); }
.kv b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 14px 0 8px; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--ink); }
.meter.two { display: flex; gap: 2px; background: transparent; height: 8px; }
.meter.two > i:last-child { flex: 1; background: var(--chart-4); }
.note { font-size: 13.5px; color: var(--muted); margin: 10px 0 0; }
.note b { color: var(--ink); font-weight: 600; }
.card.dark .note, .card.dark small { color: var(--hero-muted); }

/* ---------- torta */
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut { width: 112px; height: 112px; flex: none; display: block; }
.donut circle { fill: none; stroke-width: 14; }
.donut .track { stroke: var(--line); }
.donut .d-k { font: 500 10px var(--font); fill: var(--muted); text-anchor: middle; }
.donut .d-v { font: 600 16px var(--font); fill: var(--ink); text-anchor: middle; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.legend li.tap { cursor: pointer; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend b { font-weight: 600; }

/* ---------- righe */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 10px 0; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0;
  background: none; width: 100%; text-align: left; color: inherit; font: inherit;
}
.rows > .row:last-child, .rows > li:last-child .row { border-bottom: 0; }
/* swipe verso sinistra per eliminare: la riga scorre e scopre il pulsante rosso */
.rows li.swipeable { position: relative; overflow: hidden; }
.rows li.swipeable .row { position: relative; background: var(--surface); transition: transform .22s ease; touch-action: pan-y; }
.swipe-del {
  position: absolute; top: 1px; bottom: 1px; right: 0; width: 88px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--on-accent); font: inherit; font-size: 14px; font-weight: 600;
  visibility: hidden;
}
.rows li.swiping .swipe-del { visibility: visible; }
.row.tap { cursor: pointer; }
.row.tap:active { opacity: .6; }
.row .main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row .title { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.row .meta.warn { color: var(--accent-ink); font-weight: 500; }
.row .amt { font-size: 16px; font-weight: 600; text-align: right; white-space: nowrap; }
.row .amt small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.row .bar { grid-column: 2 / 4; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.row .bar > i { display: block; height: 100%; border-radius: 3px; background: var(--ink); }
.row .bar.warn > i { background: var(--warn); }
.row .bar.over > i { background: var(--accent); }
.row .bar.save > i { background: var(--saving); }
.row .budget { grid-column: 2 / 4; font-size: 12.5px; color: var(--muted); margin-top: -2px; }
.row .budget.over { color: var(--accent-ink); }
.row .budget.warn { color: var(--warn); }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--ink); color: var(--ground);
  font-size: 11px; font-weight: 600; line-height: 1.5;
}
.day { display: flex; justify-content: space-between; padding: 12px 0 4px; font-size: 13px; color: var(--muted); }
.rec { width: 13px; height: 13px; vertical-align: -2px; margin-left: 4px; fill: none; stroke: var(--faint); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.empty { color: var(--muted); padding: 18px 0 6px; font-size: 15px; margin: 0; }
.empty b { color: var(--ink); }

/* ---------- filtri */
.search {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: var(--radius-control);
  background: var(--sunken); color: var(--muted); margin-bottom: 12px;
}
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--ink); font-size: 16px; }
/* sotto i 16px l'iPhone ingrandisce la pagina quando si tocca il campo */
.pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px 14px; padding: 0 20px; }
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex: none; height: 36px; padding: 0 16px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.pill[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: var(--radius-control); background: var(--sunken); }
.seg button { height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 15px; font-weight: 500; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* ---------- grafico dell'anno */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 11px var(--font); fill: var(--muted); }
.chart .inc { fill: var(--income); }
.chart .exp { fill: var(--ink); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .cur text { fill: var(--ink); font-weight: 600; }
.legend-inline { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend-inline i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.months { width: 100%; font-variant-numeric: tabular-nums; border-collapse: collapse; font-size: 14px; }
table.months th { text-align: right; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 6px 0 6px 8px; border-bottom: 1px solid var(--line); }
table.months th:first-child, table.months td:first-child { text-align: left; padding-left: 0; }
table.months td { text-align: right; padding: 10px 0 10px 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.months tr.tap { cursor: pointer; }
table.months tfoot td { font-weight: 600; border-bottom: 0; }

/* ---------- menu raggruppati (Altro) */
.menu { list-style: none; margin: 0 0 14px; padding: 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.menu li + li { border-top: 1px solid var(--line-soft); }
.menu a, .menu button {
  display: flex; width: 100%; align-items: center; gap: 14px; padding: 14px 0; background: none; border: 0;
  text-decoration: none; cursor: pointer; text-align: left; color: var(--ink); font-size: 16px;
}
.menu .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.menu .hint { font-size: 13px; color: var(--muted); }
.menu .chev { color: var(--faint); }
.menu .danger, .link.danger { color: var(--accent-ink); }
.menu-title { font-size: 13px; color: var(--muted); margin: 20px 4px 8px; text-transform: none; }
.help { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.help ol { padding-left: 20px; margin: 6px 0; }
.banner { background: var(--sunken); color: var(--ink); border-radius: var(--radius-control); padding: 12px 14px; margin-bottom: 18px; font-size: 14px; }
.banner.alert { background: var(--accent-soft); }

/* ---------- barra in basso */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding: 0 8px var(--safe-bottom);
  background: var(--bar-bg); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0;
  text-decoration: none; font-size: 11px; color: var(--muted);
}
.tabbar a .ico { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.fab {
  justify-self: center; width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: var(--on-accent); display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(212, 0, 0, .28); transform: translateY(-8px);
}
.fab .ico { width: 26px; height: 26px; stroke-width: 2.2; }
.fab:active { transform: translateY(-8px) scale(.94); }

/* ---------- fogli a comparsa */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; opacity: 0; transition: opacity .2s ease; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  max-width: 560px; margin: 0 auto; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--ground); border-radius: 26px 26px 0 0;
  padding: 10px 20px 0;
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
.sheet.open { transform: translateY(0); }
.sheet.full { height: calc(100dvh - var(--safe-top) - 12px); max-height: none; display: flex; flex-direction: column; overflow: hidden; }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 8px; flex: none; }
.sheet-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 14px; flex: none; }
.sheet-top h2 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; }
.sheet-top .link { justify-self: start; font-size: 16px; }
.sheet-top .right { justify-self: end; }
.sheet-body { padding-bottom: calc(var(--safe-bottom) + 20px); }
.sheet-actions {
  position: sticky; bottom: 0; z-index: 1; margin: 8px -20px 0; padding: 12px 20px calc(var(--safe-bottom) + 14px);
  background: var(--ground); border-top: 1px solid var(--line);
}
.sheet:has(.sheet-actions) .sheet-body { padding-bottom: 0; }

/* ---------- inserimento con tastierino */
.entry { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; padding-bottom: calc(var(--safe-bottom) + 14px); }
.entry .amount-view { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0 0; }
.entry .amount-big { font-size: clamp(48px, 15vw, 66px); font-weight: 600; letter-spacing: -.05em; line-height: 1.05; }
.entry .amount-big.long { font-size: clamp(34px, 10vw, 46px); }
.entry .amount-big.pos { color: var(--income); }
.entry .amount-hint { font-size: 14px; color: var(--muted); min-height: 20px; text-align: center; }
.chips-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 2px 20px; flex: none; }
.chips-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 15px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.chip .ico { width: 16px; height: 16px; }
.chip small { font-size: 12px; color: var(--muted); font-weight: 400; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.chip[aria-pressed="true"] small { color: inherit; opacity: .7; }
.opts { display: flex; gap: 8px; flex: none; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; }
.opts::-webkit-scrollbar { display: none; }
.opt {
  position: relative; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.opt .ico { width: 15px; height: 15px; }
.opt[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.opt input[type="date"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; font-size: 16px; }
.note-input { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; font-size: 16px; flex: none; }
.entry .spacer { flex: 1; min-height: 0; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; flex: none; }
.key {
  height: clamp(46px, 7.2vh, 58px); border: 0; border-radius: 16px; background: transparent; color: var(--ink);
  font-size: 26px; font-weight: 500; cursor: pointer; display: grid; place-items: center; touch-action: manipulation;
}
.key:active { background: var(--sunken); }
.key .ico { width: 26px; height: 26px; }
.entry .form-error { margin: 0; text-align: center; }

/* ---------- moduli */
.field { margin-bottom: 16px; }
.field > label, .field > .label { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.input, select.input {
  width: 100%; height: 50px; border-radius: var(--radius-control); border: 1px solid var(--line);
  background: var(--surface); padding: 0 14px; font-size: 16px; color: var(--ink);
}
.input:focus { outline: none; border-color: var(--ink); }
.icon-name { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; }
.icon-name .input.icon { text-align: center; font-size: 22px; }
.amount-wrap { position: relative; }
.amount-input {
  width: 100%; border: 0; border-bottom: 2px solid var(--line); background: transparent; border-radius: 0;
  font: 600 42px/1.1 var(--font); letter-spacing: -.03em; padding: 6px 36px 8px 0;
}
.amount-input:focus { outline: none; border-bottom-color: var(--ink); }
.amount-wrap .cur { position: absolute; right: 2px; bottom: 12px; font-size: 24px; font-weight: 600; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 16px; }
.switch-row .hint { font-size: 13px; color: var(--muted); display: block; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 16px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

.btn {
  width: 100%; height: 54px; border-radius: 16px; border: 0; cursor: pointer;
  background: var(--ink); color: var(--ground); font-size: 16.5px; font-weight: 600; text-decoration: none;
  display: grid; place-items: center;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.accent { background: var(--accent); color: var(--on-accent); }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--accent-ink); border: 1px solid var(--line); }
.btn.small { height: 44px; font-size: 15px; border-radius: 14px; }
.btn + .btn { margin-top: 10px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-row .btn + .btn { margin-top: 0; }
.form-error { color: var(--accent-ink); font-size: 14px; margin: -4px 0 12px; }

/* ---------- accesso */
.login { min-height: 82vh; display: flex; flex-direction: column; justify-content: center; padding-top: 24px; }
.login .mark { width: 60px; height: 60px; border-radius: 16px; margin-bottom: 22px; }
.login h1 { font-size: 34px; font-weight: 600; letter-spacing: -.035em; margin: 0 0 6px; line-height: 1.1; }
.login > p { color: var(--muted); margin: 0 0 28px; }
.login .link { margin-top: 14px; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.login .help .link { margin: 0; padding: 0; font-size: inherit; }

.card.account-card { display: flex; align-items: center; gap: 14px; }
.account-card .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.account-card b { font-weight: 600; font-size: 17px; }
.account-card small { font-size: 13px; color: var(--muted); }
.link-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-control);
  padding: 12px 14px; font-size: 14px; word-break: break-all; user-select: all; -webkit-user-select: all;
}

/* ---------- coppia */
.balance-card .label { font-size: 14px; color: var(--hero-muted); }
.balance-card .big { font-size: 46px; font-weight: 600; letter-spacing: -.04em; line-height: 1.05; margin: 4px 0 6px; }
.balance-card .btn { margin-top: 16px; }
.pair { display: flex; }
.pair .avatar { border: 2px solid var(--ground); }
.pair .avatar + .avatar { margin-left: -10px; }

/* ---------- conti collegati */
.card.bank-card { display: flex; align-items: center; gap: 14px; }
.bank-card .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bank-card b { font-weight: 600; font-size: 16px; }
.bank-card small { font-size: 13px; color: var(--muted); }
.bank-card .chev { color: var(--faint); }
.lead { font-size: 19px; line-height: 1.4; letter-spacing: -.015em; margin: 0 0 10px; }
.label-sm { font-size: 13.5px; color: var(--muted); margin: 0 0 8px; }
.steps { list-style: none; counter-reset: step; margin: 0 0 8px; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 26px 44px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -3px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600;
}
.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 31px; bottom: 6px; width: 1px; background: var(--line); }
.steps b { font-size: 16px; font-weight: 600; }
.steps span { font-size: 14px; color: var(--muted); }
.steps .link { padding: 4px 0 0; }
.copy-row {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 6px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.copy-row:active { opacity: .6; }
.copy-row .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.steps .copy-row span { color: inherit; }
.copy-row .k { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted) !important; }
.copy-row .v { font-size: 13.5px; word-break: break-all; }
.copy-row .act { flex: none; font-size: 13px; font-weight: 600; }
a.row { color: inherit; text-decoration: none; }
.row.acc-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 14px; }
.tile img { width: 28px; height: 28px; object-fit: contain; border-radius: 7px; }
.features { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.features li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.35; }
.features .ico { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--muted); }
.plan-card .price { font-size: 14px; color: var(--muted); white-space: nowrap; }
.plan-card.on { border-color: var(--ink); }
.plan-card .btn + .btn { margin-top: 10px; }
.plan-status { display: flex; gap: 8px; align-items: center; margin: 0; font-weight: 600; font-size: 15px; }
.plan-status .ico { width: 18px; height: 18px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; margin: 4px 0 18px; font-size: 14px; line-height: 1.45; color: var(--muted); cursor: pointer; }
.recat-row { cursor: pointer; }
.recat-row input { width: 22px; height: 22px; margin: 0; accent-color: var(--ink); }
.check-row input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--ink); }
.tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--sunken); color: var(--muted); }
.tag.warn { background: var(--accent-soft); color: var(--accent-ink); }
.note.warn { color: var(--accent-ink); }
.row .amt.off { color: var(--faint); text-decoration: line-through; font-weight: 500; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { display: flex; flex-direction: column; gap: 8px; }
.choice button {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 16px;
  border-radius: var(--radius-control); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15.5px; text-align: left; cursor: pointer;
}
.choice button b { font-weight: 500; }
.choice button small { font-size: 13px; color: var(--muted); }
.choice button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.ib-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; margin: 0 0 18px; }
.ib-head .amount-big { font-size: 46px; font-weight: 600; letter-spacing: -.045em; line-height: 1.1; }
.ib-head .amount-big.pos { color: var(--income); }
.ib-head b { font-size: 17px; font-weight: 600; margin-top: 6px; }
.ib-head small { font-size: 13px; color: var(--muted); max-width: 34ch; }
.bank-sheet { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.bank-sheet .ctrl { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 8px; flex: none; }
.bank-sheet .search { margin: 0; }
.bank-sheet select.input { height: 46px; padding: 0 10px; font-size: 16px; }
.bank-sheet .list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -20px; padding: 0 20px calc(var(--safe-bottom) + 16px); }
.bank-sheet .menu-title:first-child { margin-top: 4px; }

/* ---------- avvisi */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px); z-index: 40;
  transform: translate(-50%, 8px); opacity: 0; transition: opacity .18s, transform .18s;
  background: var(--ink); color: var(--ground); padding: 12px 18px; border-radius: 14px; font-size: 14.5px; font-weight: 500;
  max-width: calc(100vw - 32px); box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop, .toast, .switch span, .switch span::after { transition: none; }
}
@media (min-width: 600px) {
  .app { padding-top: 40px; }
}

/* barra sottile in alto mentre una schermata aspetta il server (solo se ci mette più di un attimo) */
body.loading::before {
  content: ""; position: fixed; z-index: 100; top: env(safe-area-inset-top, 0); left: 0; height: 2px; width: 40%;
  background: var(--ink); opacity: .55; animation: loadbar 1s ease-in-out infinite;
}
@keyframes loadbar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { body.loading::before { animation: none; width: 100%; opacity: .25; } }
.warn-text { color: var(--accent-ink); }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-reason { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.check-head { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.check-items { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; color: var(--muted); }
.check-items li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.check-items li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* campanella delle notifiche, accanto al pallino del nome */
.top-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.bell { position: relative; }
.bell-dot {
  position: absolute; top: 6px; left: 23px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
  background: var(--accent); color: #FFFFFF; font: 600 10px/15px var(--font); font-style: normal; text-align: center;
  border: 2px solid var(--ground); box-sizing: content-box;
}
.notif-list .row.is-new .title { font-weight: 600; }
.new-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; align-self: center; }
.email-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface);
  text-align: left; cursor: pointer; min-height: 50px;
}
.email-row .txt { display: flex; flex-direction: column; min-width: 0; }
.email-row .k { font-size: 13px; color: var(--muted); }
.email-row .v { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.email-row .link { padding: 0; flex: none; }
