/* QuantoPago — iOS/Wallet look. Neutral grays, category colors as the only content color, one action blue.
   Blue is darkened from iOS #007AFF (4.0:1 on white) to #0066CC (5.6:1) to pass WCAG AA on small text. */

:root {
  --bg: #f2f2f7;            /* grouped background */
  --surface: #ffffff;       /* grouped cell */
  --surface-2: #e5e5ea;     /* pressed / selected cell */
  --fill: rgb(118 118 128 / .12);
  --fill-strong: rgb(118 118 128 / .2);
  --sep: rgb(60 60 67 / .2);
  --text: #000000;
  --muted: #636366;
  --accent: #0066cc;        /* links, tinted text */
  --accent-fill: #0066cc;   /* filled buttons, white text 5.6:1 */
  --on-accent: #ffffff;
  --accent-soft: rgb(0 102 204 / .12);
  --warn: #b25000;
  --danger: #d70015;
  --danger-soft: rgb(215 0 21 / .1);
  --track: rgb(118 118 128 / .16);
  --chart: #c7c7cc;
  --seg-on: #ffffff;
  --bar: rgb(249 249 249 / .82);
  --card-bg: linear-gradient(150deg, #48484a 0%, #2c2c2e 55%, #1c1c1e 100%);
  --shadow-lg: 0 10px 30px rgb(0 0 0 / .12), 0 1px 3px rgb(0 0 0 / .06);
  color-scheme: light;

  --font: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ui: var(--font);
  --font-display: var(--font);
  --r-s: 8px;
  --r-m: 10px;
  --r-l: 12px;
  --r-card: 18px;
  --ease: cubic-bezier(.32, .72, 0, 1); /* iOS sheet curve */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e;
    --fill: rgb(118 118 128 / .24); --fill-strong: rgb(118 118 128 / .36); --sep: rgb(84 84 88 / .6);
    --text: #ffffff; --muted: #98989f;
    --accent: #0a84ff; --accent-fill: #0066cc; --on-accent: #ffffff; --accent-soft: rgb(10 132 255 / .18);
    --warn: #ffb340; --danger: #ff6961; --danger-soft: rgb(255 105 97 / .16);
    --track: rgb(118 118 128 / .3); --chart: #48484a; --seg-on: #636366; --bar: rgb(22 22 23 / .8);
    --card-bg: linear-gradient(150deg, #505053 0%, #3a3a3c 55%, #2c2c2e 100%);
    --shadow-lg: 0 10px 30px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e;
  --fill: rgb(118 118 128 / .24); --fill-strong: rgb(118 118 128 / .36); --sep: rgb(84 84 88 / .6);
  --text: #ffffff; --muted: #98989f;
  --accent: #0a84ff; --accent-fill: #0066cc; --on-accent: #ffffff; --accent-soft: rgb(10 132 255 / .18);
  --warn: #ffb340; --danger: #ff6961; --danger-soft: rgb(255 105 97 / .16);
  --track: rgb(118 118 128 / .3); --chart: #48484a; --seg-on: #636366; --bar: rgb(22 22 23 / .8);
  --card-bg: linear-gradient(150deg, #505053 0%, #3a3a3c 55%, #2c2c2e 100%);
  --shadow-lg: 0 10px 30px rgb(0 0 0 / .6);
  color-scheme: dark;
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 17px/1.4 var(--font); letter-spacing: -.01em; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1, .display { font-size: 2.125rem; font-weight: 700; letter-spacing: -.025em; }   /* iOS large title 34 */
h2 { font-size: 1.375rem; font-weight: 700; letter-spacing: -.02em; }              /* title 2 */
h3 { font-size: 1.0625rem; font-weight: 600; }                                     /* headline */
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: .9375rem; }
.num, .amount { font-variant-numeric: tabular-nums; }
.amount { font-weight: 700; letter-spacing: -.02em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: grid; gap: var(--gap, 16px); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--gap, 8px); align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--r-l);
  font: 600 1.0625rem/1 var(--font); letter-spacing: -.01em; text-decoration: none; cursor: pointer;
  background: var(--fill); color: var(--accent);
  transition: opacity .15s, background-color .15s;
}
.btn:hover { text-decoration: none; background: var(--fill-strong); }
.btn:active { opacity: .6; }
.btn-accent, .btn-primary { background: var(--accent-fill); color: var(--on-accent); }
.btn-accent:hover, .btn-primary:hover { background: var(--accent-fill); opacity: .88; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--fill); }
.btn-danger { background: var(--fill); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; font-size: 1.375rem; font-weight: 400; }
.btn-icon svg { width: 22px; height: 22px; }
.btn-lg { min-height: 50px; }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* ---- fields ---- */
.field { display: grid; gap: 6px; }
.field > label, .label, legend.label { font-size: .8125rem; font-weight: 400; color: var(--muted); padding: 0 4px; }
legend.label { margin-bottom: 6px; }
.input, .select, .field :is(input:not([type=checkbox], [type=radio], [type=color]), select, textarea), .filters :is(input, select) {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: var(--r-m);
  background: var(--fill); color: var(--text); font: inherit;
}
::placeholder { color: var(--muted); opacity: 1; }
:is(.input, .select, .field :is(input, select, textarea), .filters :is(input, select)):focus { outline: none; box-shadow: 0 0 0 3px var(--accent); }
.field.error :is(input, select, textarea), .field.error .input { box-shadow: inset 0 0 0 2px var(--danger); }
.field .hint { font-size: .8125rem; color: var(--muted); padding: 0 4px; }
.field.error .hint { color: var(--danger); }
.field.check { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 12px; }
.field.check > label { font-size: 1.0625rem; color: var(--text); padding: 0; }
.field.check input { width: 22px; height: 22px; accent-color: var(--accent-fill); }
.field.check .hint { flex-basis: 100%; }
.field input[type="color"] { width: 64px; height: 44px; padding: 4px; border: 0; border-radius: var(--r-m); background: var(--fill); }
.amount-input { position: relative; }
.amount-input input, .field .amount-input input { font: 700 2.25rem/1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.02em; padding: 14px 16px 14px 46px; min-height: 68px; text-align: left; }
.amount-input::before { content: "€"; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font: 600 1.5rem var(--font); color: var(--muted); pointer-events: none; }
.field .amount-sm input { font-size: 1.25rem; min-height: 44px; padding-block: 8px; }
.amount-sm::before { font-size: 1.125rem; }
.date-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.field .date-pick input { flex: 1 1 150px; width: auto; }
.date-pick .chip { min-height: 44px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---- segmented control ---- */
.seg, .seg-full { display: inline-flex; justify-self: start; padding: 2px; gap: 2px; border-radius: 9px; background: var(--fill); }
.seg a, .seg button, .seg-full label { min-height: 32px; padding: 0 14px; border: 0; border-radius: 7px; background: none; color: var(--text); font: 500 .875rem var(--font); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; }
.seg [aria-current], .seg [aria-pressed="true"], .seg-full label:has(input:checked) { background: var(--seg-on); font-weight: 600; box-shadow: 0 3px 8px rgb(0 0 0 / .12), 0 1px 1px rgb(0 0 0 / .04); }
.seg-full { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
.seg-full label:has(:focus-visible) { outline: 3px solid var(--accent); }

/* ---- grouped containers (iOS inset grouped) ---- */
.card { background: var(--surface); border-radius: var(--r-l); padding: 16px; }
.card-list { padding: 0; overflow: hidden; }
a.card-link { display: block; color: inherit; text-decoration: none; transition: background-color .15s; }
a.card-link:hover { background: var(--surface-2); }
a.card-link .title { font-weight: 600; }

/* ---- rows ---- */
.rows { list-style: none; margin: 0; padding: 0; }
.row { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 60px; padding: 10px 16px; color: inherit; }
.rows > li + li > .row::before, .rows > .row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: var(--inset, 64px); border-top: .5px solid var(--sep); }
.row-simple { grid-template-columns: minmax(0, 1fr) auto; min-height: 48px; --inset: 16px; }
.row.row-simple .meta { white-space: normal; }
.row .title { display: block; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { display: block; font-size: .9375rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
a.row { text-decoration: none; transition: background-color .15s; }
a.row:hover { background: var(--surface-2); text-decoration: none; }
a.row:active { background: var(--surface-2); }
.badge { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: .75rem; font-weight: 600; background: var(--fill); color: var(--muted); vertical-align: 1px; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

/* category icon: solid tile + white glyph, like iOS Settings */
.cat-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--c, #8e8e93); color: #fff; font-size: .8125rem; font-weight: 600; }
.cat-icon svg { width: 20px; height: 20px; }
.cat-icon-s { width: 24px; height: 24px; border-radius: 6px; }
.cat-icon-s svg { width: 15px; height: 15px; }
.cat-inline { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }

/* category chip */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px 0 10px; border: 0; border-radius: 999px; background: var(--fill); color: var(--text); font: 500 .9375rem var(--font); cursor: pointer; }
.chip svg { width: 16px; height: 16px; color: var(--c, var(--muted)); }
.chip:hover { background: var(--fill-strong); }
.chip[aria-pressed="true"], .chip:has(input:checked) { background: color-mix(in srgb, var(--c, var(--accent)) 18%, transparent); box-shadow: inset 0 0 0 2px var(--c, var(--accent)); font-weight: 600; }
.chip[type="button"] { padding: 0 14px; }
.chip:has(:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- budget bar: --p = % spent, --pace = % of month gone ---- */
.budget { display: grid; gap: 8px; }
.budget > .spread { flex-wrap: wrap; gap: 2px 12px; }
.budget > .spread > * { white-space: nowrap; }
.budget-track { position: relative; height: 6px; border-radius: 3px; background: var(--track); }
.budget-fill { position: absolute; inset: 0 auto 0 0; width: min(var(--p, 0) * 1%, 100%); border-radius: inherit; background: var(--bar-fill, var(--accent)); transition: width .5s var(--ease); }
.budget[data-state="warn"] .budget-fill { background: var(--warn); }
.budget[data-state="over"] .budget-fill { background: var(--danger); }
.budget-pace { position: absolute; top: -3px; bottom: -3px; left: calc(var(--pace, 0) * 1%); width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text); opacity: .5; }
.budget[data-state="over"] .budget-value { color: var(--danger); }
.budget[data-state="warn"] .budget-value { color: var(--warn); }

/* ---- shell: translucent tab bar on phones, sidebar on desktop ---- */
.shell { min-height: 100dvh; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.page { --w: 720px; }
.page-wide { --w: 1080px; }
.main, .topbar { width: min(100% - 32px, var(--w)); margin-inline: auto; }
.main { padding-block: 8px 32px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 52px; padding-top: max(8px, env(safe-area-inset-top)); }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.tabbar { position: fixed; inset: auto 0 0 0; z-index: 10; display: flex; justify-content: space-around; padding: 6px 4px calc(4px + env(safe-area-inset-bottom)); background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--sep); }
.tabbar a { flex: 1; display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 50px; color: var(--muted); font-size: .6875rem; font-weight: 500; letter-spacing: 0; text-decoration: none; }
.tabbar a[aria-current] { color: var(--accent); }
.tabbar svg { width: 24px; height: 24px; }
.desk-only, .tabbar .brand { display: none; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font: 700 1.0625rem var(--font); letter-spacing: -.02em; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 700; color: var(--muted); }
.logo { display: block; flex: none; width: 28px; height: 28px; }
.brand-lg { font-size: 1.5rem; }
.brand-lg .logo { width: 40px; height: 40px; }

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); padding-bottom: 0; }
  .tabbar { position: sticky; top: 0; height: 100dvh; flex-direction: column; justify-content: flex-start; gap: 2px; padding: 20px 12px; border-top: 0; border-right: .5px solid var(--sep); background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .tabbar .brand { display: flex; padding: 4px 10px 20px; }
  .tabbar a { flex: none; grid-auto-flow: column; justify-content: start; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: var(--r-s); color: var(--text); font-size: .9375rem; font-weight: 400; }
  .tabbar a svg { width: 20px; height: 20px; color: var(--accent); }
  .tabbar a:hover { background: var(--fill); text-decoration: none; }
  .tabbar a[aria-current] { background: var(--fill-strong); color: var(--text); font-weight: 600; }
  .tabbar .brand:hover { background: none; }
  .tabbar .desk-only { display: grid; }
  .nav-bottom { margin-top: auto; }
  .topbar { padding-top: 16px; }
  .topbar .brand { visibility: hidden; }
  .main { padding-block: 8px 48px; }
}

/* account menu */
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; width: 36px; height: 36px; margin: 4px; display: grid; place-items: center; border-radius: 999px; background: var(--fill-strong); color: var(--text); font-weight: 600; font-size: .8125rem; letter-spacing: 0; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 240px; display: grid; overflow: hidden; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-lg); }
.menu-pop > * + * { border-top: .5px solid var(--sep); }
.menu-pop a, .menu-pop button { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 16px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); text-decoration: none; }
.menu-pop form button { color: var(--danger); }
.menu-user { padding: 10px 16px; font-size: .8125rem; }

/* ---- page parts ---- */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 4px; }
.spread > a.small, .link { color: var(--accent); font-weight: 400; }
.month-nav { display: flex; align-items: center; gap: 2px; }
.month-label { min-width: 132px; text-align: center; font-weight: 600; text-transform: capitalize; }
.summary-line { padding: 0 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input { flex: 1 1 200px; }
.filters select { flex: 1 1 160px; }
@media (min-width: 640px) { .filters select { flex: 0 1 220px; } }
.disclosure summary { cursor: pointer; padding: 8px 4px; color: var(--accent); font-size: .9375rem; }

/* day groups: header outside, one inset group per day */
.days { display: grid; gap: 22px; }
.day-group { display: grid; gap: 6px; }
.day-head { display: flex; justify-content: space-between; padding: 0 16px; font-size: .8125rem; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }

.delta { font-size: .9375rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.delta.up { color: var(--warn); }

/* ---- the Wallet card (Home hero) ---- */
.hero {
  --text: #ffffff; --muted: rgb(235 235 245 / .8); --track: rgb(255 255 255 / .2); --bar-fill: #ffffff;
  --warn: #ffd60a; --danger: #ff6961; --accent: #ffffff; --fill: rgb(255 255 255 / .14);
  position: relative; overflow: hidden; display: grid; gap: 14px; padding: 20px 22px 22px; border-radius: var(--r-card);
  background: var(--card-bg); color: var(--text); box-shadow: 0 1px 0 rgb(255 255 255 / .12) inset, 0 12px 28px -12px rgb(0 0 0 / .45);
}
.hero a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgb(255 255 255 / .4); }
.hero-top { display: flex; justify-content: space-between; align-items: center; font-size: .9375rem; font-weight: 600; }
.hero-top .logo { width: 24px; height: 24px; }
.hero-label { font-size: .9375rem; color: var(--muted); }
.hero-amount { display: block; font-size: clamp(2.5rem, 11vw, 3.25rem); line-height: 1.05; letter-spacing: -.035em; }
.hero-stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 14px; border-top: .5px solid rgb(255 255 255 / .2); }
.hero-stats dt { font-size: .8125rem; color: var(--muted); }
.hero-stats dd { margin: 2px 0 0; font-size: 1.0625rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.hero .budget-value b { font-weight: 600; }
.hero .budget .budget-value, .hero .delta { color: var(--muted); } /* status shows on the bar only */
.hero .budget > .spread { font-size: .9375rem; }

/* horizontal bars ("Dove vanno i soldi") */
.hbar { display: grid; gap: 6px; }
.hbar-track { height: 6px; border-radius: 3px; background: var(--track); }
.hbar-track i { display: block; height: 100%; min-width: 4px; border-radius: 3px; background: var(--c, var(--accent)); }
.row-bar { grid-template-columns: auto minmax(0, 1fr); --inset: 64px; }
.row-bar .spread { font-size: 1.0625rem; }
.hbar .spread > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- column charts ---- */
.cols { position: relative; display: flex; align-items: flex-end; gap: 3px; height: 140px; margin-top: 30px; }
.cols-wide { gap: 12px; height: 160px; }
.col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; outline: none; text-decoration: none; }
.col:hover { text-decoration: none; }
.col i { display: block; width: 100%; height: 0; min-height: 2px; border-radius: 4px 4px 1px 1px; background: var(--chart); transition: background-color .12s; }
.col.is-now i { background: var(--accent); }
.col:hover i, .col:focus-visible i { background: var(--text); }
.col::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 5; padding: 5px 9px; border-radius: 8px; background: var(--text); color: var(--bg); font-size: .75rem; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .1s; }
.col:hover::after, .col:focus-visible::after { opacity: 1; }
.col:nth-child(-n+4)::after { left: 0; transform: none; }
.col:nth-last-child(-n+4)::after { left: auto; right: 0; transform: none; }
.cols-wide .col::after { bottom: auto; top: -30px; }
.ref-line { position: absolute; left: 0; right: 0; z-index: 1; border-top: 1px dashed var(--muted); pointer-events: none; }
.ref-line span { position: absolute; right: 0; bottom: 4px; font-size: .6875rem; font-weight: 600; color: var(--muted); }
.axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.axis-even { gap: 12px; }
.axis-even span { flex: 1; text-align: center; text-transform: capitalize; }

/* ---- messages, empty ---- */
.alert { padding: 12px 16px; border-radius: var(--r-l); background: var(--surface); font-size: .9375rem; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.empty { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 28px 16px; color: var(--muted); }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left)); }
.login form { width: min(100%, 380px); }
.login-card { aspect-ratio: 1.586; align-content: space-between; } /* credit-card proportions */
.login-card h1 { font-size: 1.75rem; }

/* ---- home dashboard: one column on phones, two from 1100px ---- */
.dash { display: grid; gap: 32px; }
.dash-col { display: contents; }
.o-1 { order: 1; } .o-2 { order: 2; } .o-3 { order: 3; } .o-4 { order: 4; } .o-5 { order: 5; }
@media (min-width: 1100px) {
  .dash { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
  .dash-col { display: grid; gap: 32px; align-content: start; }
  .dash-side { position: sticky; top: 24px; }
}

/* ---- add sheet: bottom sheet on phones, centred on desktop ---- */
.sheet { width: min(100%, 560px); max-width: 100%; max-height: 92dvh; margin: auto auto 0; padding: 22px max(16px, env(safe-area-inset-left)) calc(20px + env(safe-area-inset-bottom)); border: 0; border-radius: 14px 14px 0 0; background: var(--surface); color: var(--text); overflow-y: auto; }
.sheet::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--fill-strong); }
.sheet::backdrop { background: rgb(0 0 0 / .4); }
.sheet[open] { animation: sheet-in .4s var(--ease); }
.sheet h2 { font-size: 1.0625rem; font-weight: 600; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@media (min-width: 640px) {
  .sheet { margin: auto; border-radius: 14px; padding: 24px; box-shadow: var(--shadow-lg); }
  .sheet::before { display: none; }
  .sheet[open] { animation: pop-in .25s var(--ease); }
}
@keyframes pop-in { from { transform: scale(.96); opacity: 0; } }
.kind-text, .kind-only, .kind-help { display: none; }
.kind-text[data-kind="spesa"] { display: inline; }
.entry:has([name=kind][value=ricorrente]:checked) .kind-text[data-kind="spesa"],
.entry:has([name=kind][value=ammortamento]:checked) .kind-text[data-kind="spesa"] { display: none; }
.entry:has([name=kind][value=ricorrente]:checked) .kind-text[data-kind="ricorrente"],
.entry:has([name=kind][value=ammortamento]:checked) .kind-text[data-kind="ammortamento"] { display: inline; }
.entry:has([name=kind][value=ricorrente]:checked) :is(.kind-only, .kind-help)[data-kind="ricorrente"],
.entry:has([name=kind][value=ammortamento]:checked) :is(.kind-only, .kind-help)[data-kind="ammortamento"] { display: grid; }
.kind-help { margin-top: -6px; }

/* ---- toasts ---- */
.toasts { position: fixed; z-index: 60; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
@media (min-width: 960px) { .toasts { left: auto; right: 24px; bottom: 24px; justify-items: end; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 480px; min-height: 48px; padding: 6px 6px 6px 18px; border-radius: 14px; background: rgb(44 44 46 / .94); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); color: #fff; font-size: .9375rem; box-shadow: 0 8px 24px rgb(0 0 0 / .25); transition: opacity .3s, transform .3s var(--ease); animation: toast-in .35s var(--ease); }
.toast-error { background: #c4001a; }
.toast-hide { opacity: 0; transform: translateY(8px); }
.toast-action { min-height: 36px; padding: 0 12px; border: 0; border-radius: var(--r-s); background: none; color: #64b5ff; font: 600 .9375rem var(--font); cursor: pointer; }
@keyframes toast-in { from { transform: translateY(16px); opacity: 0; } }

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