/* Casa Dolce Casa — minimal, morbido, un po' giocoso */
:root {
  --bg: #D6E6EF; --bg-2: #C9DCE7; --ink: #3A3A42; --muted: #6E7385;
  --night: #23253D; --night-2: #2F3252; --card: #FFFFFF; --cream: #FFFCF6; --line: #E7ECF2; --row: #F5F8FB;
  --teal: #4CC9B8; --lilac: #A99CF0; --mustard: #F2C14E; --peach: #F7A27B; --sky: #7FB7E3; --rose: #EF8FA8;
  --up: #C9603F; --down: #2E9C8C; --danger: #D0533F;
  --r: 22px; --r-sm: 14px;
  --shadow: 0 10px 30px -14px rgba(35, 37, 61, .28);
  --serif: "DM Serif Display", Georgia, serif;
  --label: "Libre Baskerville", Georgia, serif;
  --sans: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.45; }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; line-height: 1.1; }
h1 { font-size: 34px; }
h2 { font-size: 22px; margin-bottom: 12px; }
.num { font-variant-numeric: tabular-nums lining-nums; font-weight: 700; white-space: nowrap; }
.eyebrow { font-family: var(--label); text-transform: uppercase; letter-spacing: .2em; font-size: 11px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.up { color: var(--up); } .down { color: var(--down); }
.ok-text { color: var(--down); font-weight: 700; }
.link { color: var(--night); font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--mustard); }
.link-btn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; opacity: .7; padding: 4px; }
.link-btn:hover { opacity: 1; }

/* ---------- struttura ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--night); color: #DADCF0; padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand span { font-family: var(--serif); font-size: 22px; line-height: .92; color: #fff; max-width: 120px; }
.side-nav { margin-top: 26px; display: flex; flex-direction: column; gap: 3px; }
.side-nav a { display: flex; gap: 11px; align-items: center; padding: 10px 14px; border-radius: var(--r-sm); text-decoration: none; font-weight: 600; transition: background .15s; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); }
.side-nav a.on { background: var(--night-2); color: #fff; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.side-add { margin-top: 18px; }
.me { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.me-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.me small { display: block; opacity: .6; }
.main { padding: 28px 32px 60px; min-width: 0; }
.m-head, .tabbar { display: none; }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; color: var(--night); flex: none; text-decoration: none; }
.avatar.who { width: 26px; height: 26px; font-size: 12px; }
.avatar-lg { width: 54px; height: 54px; font-size: 22px; }

/* ---------- intestazione e filtri ---------- */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill { position: relative; display: inline-flex; align-items: center; gap: 4px; background: var(--card); border-radius: 999px; padding: 0 14px; height: 40px; font-weight: 700; font-size: 14px; box-shadow: 0 2px 0 rgba(35, 37, 61, .06); text-decoration: none; }
.pill b { color: var(--muted); font-weight: 600; }
.pill select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; font: inherit; color: var(--ink); padding: 0 16px 0 2px; cursor: pointer; max-width: 190px; }
.pill::after { content: "▾"; position: absolute; right: 12px; font-size: 11px; color: var(--muted); pointer-events: none; }
.pill-nav { padding: 0 15px; font-size: 20px; }
.pill-nav::after { content: none; }

/* ---------- bottoni ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--night); color: #fff; border: 0; border-radius: 999px; padding: 12px 22px; font: 800 15px var(--sans); cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -10px rgba(35, 37, 61, .6); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-small { padding: 9px 16px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--card); color: var(--night); box-shadow: inset 0 0 0 2px var(--line); }
.btn-danger { background: #FBE4DF; color: var(--danger); }
.btn-add { background: var(--mustard); color: var(--night); }
.btn-add span { font-size: 20px; line-height: 1; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; text-decoration: none; background: var(--row); }
.icon-btn:hover { background: #E9EEF5; }

/* ---------- card e kpi ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 20px 22px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { background: var(--card); border-radius: var(--r); padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .eyebrow { padding-right: 34px; }
.kpi .v { font-size: clamp(22px, 2.1vw, 30px); margin-top: 6px; }
.kpi .v-cat { font-family: var(--serif); font-weight: 400; font-size: 24px; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.blob { position: absolute; right: -18px; top: -18px; width: 70px; height: 70px; border-radius: 50%; opacity: .32; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-wide-left { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.span2 { grid-column: 1 / -1; }

/* ---------- grafici ---------- */
.donut-row { display: flex; gap: 22px; align-items: center; }
.donut { width: 170px; height: 170px; flex: none; }
.donut-v { font: 800 5px var(--sans); fill: var(--ink); }
.donut-s { font: 2.6px var(--sans); fill: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.legend li:last-child { border: 0; }
.legend a { text-decoration: none; min-width: 0; }
.legend .num { margin-left: auto; }
.legend .muted + .num { margin-left: 8px; }
.legend li .muted.small:first-of-type { margin-left: auto; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 11px 3px 4px; font-size: 13px; font-weight: 700; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip i, .chip-ic { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-style: normal; font-size: 12px; flex: none; }
.chip-ic { width: 34px; height: 34px; font-size: 16px; }

.bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; height: 240px; align-items: end; }
.bar-col { display: flex; flex-direction: column; align-items: center; height: 100%; text-decoration: none; min-width: 0; }
.bar-val { font-size: 11px; color: var(--muted); height: 16px; overflow: hidden; }
.bar-pair { flex: 1; width: 100%; display: flex; justify-content: center; align-items: flex-end; gap: 3px; padding-top: 4px; }
.bar { width: 42%; max-width: 22px; border-radius: 8px 8px 4px 4px; min-height: 3px; transition: opacity .15s; }
.bar-cur { background: var(--teal); }
.bar-prev { background: #DCE3EE; }
.bar-col:hover .bar-cur { opacity: .8; }
.bar-lab { font-family: var(--label); text-transform: uppercase; font-size: 10px; letter-spacing: .08em; color: var(--muted); margin-top: 6px; }
.legend-inline { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.legend-inline i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; margin-left: 6px; }
.sw-cur { background: var(--teal); } .sw-prev { background: #DCE3EE; }

/* ---------- consigli ---------- */
.tips { display: flex; flex-direction: column; gap: 10px; }
.tip { display: flex; gap: 12px; background: var(--cream); border-radius: 16px; padding: 12px 14px; font-size: 14px; line-height: 1.45; }
.tip .ic { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: #F3EFE6; }
.tip-up .ic { background: #FDE7DC; } .tip-down .ic { background: #DDF5F1; } .tip-tip .ic { background: #FCF1D6; } .tip-info .ic { background: #E2EEF9; }

/* ---------- tabelle (sfondo chiaro, numeri ben leggibili) ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { font-family: var(--label); text-transform: uppercase; letter-spacing: .14em; font-size: 10px; color: var(--muted); font-weight: 400; text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: var(--row); }
.table .amt { text-align: right; font-size: 16px; }
.table .c { text-align: center; }
.table .actions { width: 44px; text-align: right; }
.total-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.big { font-size: 26px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* nota: tooltip su desktop, pop-up su mobile */
.note { position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: #EEF0FF; border: 0; cursor: pointer; font-size: 14px; padding: 0; }
.note .tt { position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%) translateY(4px); background: var(--night); color: #fff; padding: 9px 12px; border-radius: 12px; font: 600 13px/1.4 var(--sans); width: max-content; max-width: 260px; text-align: left; white-space: pre-line; opacity: 0; pointer-events: none; transition: .18s; z-index: 20; }
.note .tt::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--night); }
@media (hover: hover) {
  .note:hover .tt, .note:focus-visible .tt { opacity: 1; transform: translateX(-50%) translateY(0); }
  .m-list .note .tt { left: auto; right: -8px; transform: translateY(4px); }
  .m-list .note:hover .tt { transform: none; }
  .m-list .note .tt::after { left: auto; right: 16px; }
}
/* sui touch la nota si apre nel pop-up: il tooltip non serve */
@media (hover: none) { .note .tt { display: none; } }

/* lista compatta (mobile) */
.m-list { list-style: none; margin: 0; padding: 0; display: none; }
.m-list li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.m-list li:last-child { border: 0; }
.m-list .t { flex: 1; min-width: 0; text-decoration: none; }
.m-list .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-list small { display: block; color: var(--muted); font-size: 12px; }
.m-list-always { display: block; }

.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.empty span { font-size: 34px; display: block; }
.empty p { margin: 6px 0 14px; }

/* ---------- calendario ---------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal > b { font-family: var(--label); font-weight: 400; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-align: center; padding: 4px 0; }
.day { min-height: 78px; border-radius: 14px; background: var(--row); padding: 7px 8px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; transition: background .15s; }
a.day:hover { background: #EBF0F6; }
.day .n { font-weight: 800; font-size: 14px; }
.day.off { background: transparent; color: #B4B9C7; }
.day.today { box-shadow: inset 0 0 0 2px var(--night); }
.day.sel { background: #FFF6DE; }
.day.has { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.day.has.sel { background: #FFF6DE; }
.day.today.has { box-shadow: inset 0 0 0 2px var(--night); }
.ds { display: flex; gap: 3px; flex-wrap: wrap; }
.ds i { width: 8px; height: 8px; border-radius: 50%; }
.day .sum { font-size: 12px; margin-top: auto; color: var(--ink); }

/* ---------- moduli ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-card { max-width: 640px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field label, .field legend { font-weight: 800; font-size: 14px; padding: 0; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.field-row .field-sm { flex: 0 0 96px; }
input[type=text], input[type=email], input[type=password], input[type=date], input:not([type]), input[inputmode], select, textarea {
  font: 600 16px var(--sans); color: var(--ink); background: var(--row); border: 2px solid transparent; border-radius: var(--r-sm); padding: 11px 14px; width: 100%; transition: border-color .15s, background .15s;
}
.pill select { width: auto; background: transparent; border: 0; padding: 0 16px 0 2px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--lilac); background: #fff; }
textarea { resize: vertical; min-height: 80px; }
.has-error input, .has-error textarea { border-color: #F0B3A6; background: #FFF6F3; }
.err { color: var(--danger); font-size: 13px; font-weight: 700; margin: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--night); }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.amount-input { position: relative; max-width: 260px; }
.amount-input input { font-size: 30px; font-weight: 800; padding: 12px 44px 12px 16px; font-variant-numeric: tabular-nums; }
.amount-input span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 800; color: var(--muted); }
.danger-zone { margin-top: 22px; padding-top: 16px; border-top: 1px dashed var(--line); }
.hp { position: absolute; left: -9999px; }

.cat-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-opt input { position: absolute; opacity: 0; pointer-events: none; }
.cat-opt span { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--row); font-weight: 700; font-size: 14px; cursor: pointer; transition: .15s; box-shadow: inset 0 0 0 2px transparent; }
.cat-opt i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; background: var(--c); font-size: 13px; }
.cat-opt input:checked + span { background: var(--t); box-shadow: inset 0 0 0 2px var(--c); }
.cat-opt input:focus-visible + span { outline: 3px solid var(--lilac); }

.swatch-pick, .icon-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch-pick input, .icon-pick input { position: absolute; opacity: 0; pointer-events: none; }
.swatch-pick span { display: block; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 3px #fff, 0 0 0 3px transparent; transition: .12s; }
.swatch-pick input:checked + span { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--night); }
.swatch-sm span { width: 20px; height: 20px; }
.icon-pick span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--row); font-size: 18px; cursor: pointer; }
.icon-pick input:checked + span { background: #FFF2CC; box-shadow: inset 0 0 0 2px var(--mustard); }

/* categorie e famiglia */
.cat-list, .people { list-style: none; margin: 0 0 12px; padding: 0; }
.cat-list li, .people li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cat-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-actions { margin-left: auto; }
.archived { opacity: .55; }
.inline-edit { background: var(--row); border-radius: 16px; padding: 14px; margin: 10px 0; }
.inline-edit input, .inline-edit .icon-pick span { background: #fff; }
.cat-list .form-actions { margin-top: 6px; }
.person { display: flex; gap: 12px; align-items: flex-start; }
.person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.person-opts { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; font-size: 13px; }
.person-opts select { width: auto; padding: 7px 10px; font-size: 14px; }

/* messaggi */
.flash { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-radius: 16px; padding: 12px 16px; margin-bottom: 16px; font-weight: 700; background: #fff; }
.flash-success { background: #DDF5F1; color: #1F6F64; }
.flash-error { background: #FBE4DF; color: #9C3A28; }
.flash-info { background: #E2EEF9; color: #2C5C86; }
.flash-x { background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }

/* fogli (menu "Altro" e note su mobile) */
.sheet-wrap { position: fixed; inset: 0; background: rgba(35, 37, 61, .38); display: grid; place-items: end center; padding: 14px; z-index: 50; animation: fade .15s; }
.sheet { background: var(--card); border-radius: 26px; padding: 20px; width: 100%; max-width: 480px; margin-bottom: calc(env(safe-area-inset-bottom) + 84px); animation: rise .2s ease-out; }
.note-text { margin: 8px 0 0; font-size: 16px; line-height: 1.5; white-space: pre-line; }
.sheet-nav { display: flex; flex-direction: column; margin-top: 8px; }
.sheet-nav a, .sheet-nav button { display: flex; gap: 12px; align-items: center; padding: 13px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; font: 700 16px var(--sans); color: var(--ink); text-decoration: none; width: 100%; cursor: pointer; }
.sheet-nav form:last-child button { border-bottom: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 901px) { .sheet { margin-bottom: auto; margin-top: auto; } .sheet-wrap { place-items: center; } }

/* ---------- accesso ---------- */
body.guest { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.guest-box { width: 100%; max-width: 400px; }
.guest-brand { text-align: center; margin-bottom: 22px; }
.guest-brand h1 { font-size: 40px; line-height: .92; margin: 8px 0 8px; }
.guest .card { padding: 26px; box-shadow: var(--shadow); }

/* ---------- tablet ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2, .grid-wide-left, .cal-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .app { display: block; padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
  .side { display: none; }
  .m-head { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 14px) 16px 6px; }
  .m-head .brand { gap: 8px; }
  .m-head .brand span { font-size: 16px; color: var(--ink); max-width: none; line-height: 1; }
  .m-head .avatar { width: 32px; height: 32px; }
  .main { padding: 10px 16px 30px; }
  h1 { font-size: 28px; }
  .top { margin-bottom: 16px; }
  .filters { width: 100%; }
  .pill { height: 38px; padding: 0 12px; font-size: 13px; }
  .pill select { max-width: 130px; }
  .pill-nav { font-size: 22px; padding: 0 16px; }
  .tabbar { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 10px); background: var(--card); border-radius: 24px; justify-content: space-around; align-items: center; padding: 8px 4px; box-shadow: 0 10px 28px -10px rgba(35, 37, 61, .45); z-index: 40; }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 1px; font: 700 11px var(--sans); color: var(--muted); text-decoration: none; background: none; border: 0; padding: 2px 6px; cursor: pointer; }
  .tabbar span { font-size: 18px; filter: grayscale(.6); }
  .tabbar .on { color: var(--night); }
  .tabbar .on span { filter: none; }
  .tabbar .fab { width: 56px; height: 56px; border-radius: 50%; background: var(--mustard); color: var(--night); font-size: 30px; font-weight: 800; margin-top: -34px; display: grid; place-items: center; box-shadow: 0 8px 18px -6px rgba(242, 193, 78, .9); padding: 0; }
  .card { padding: 16px; border-radius: 20px; }
  .kpi { padding: 14px 16px; }
  .kpi .v { font-size: 22px; }
  .table-wrap { display: none; }
  .m-list { display: block; }
  .donut-row { flex-direction: column; align-items: stretch; }
  .donut { align-self: center; }
  .bars { height: 190px; gap: 3px; }
  .bar-val { display: none; }
  .bar-lab { font-family: var(--sans); font-weight: 700; font-size: 9px; letter-spacing: 0; }
  .day { min-height: 54px; padding: 5px; border-radius: 10px; }
  .day .sum { display: none; }
  .ds i { width: 6px; height: 6px; }
  .field-row { flex-direction: column; }
  .field-row .field-sm { flex: auto; }
  .flash { margin-bottom: 12px; }
}
@media (max-width: 420px) {
  .kpis, .kpis-3 { grid-template-columns: minmax(0, 1fr); }
  .kpi .v { font-size: 26px; }
}
@media (min-width: 421px) and (max-width: 900px) {
  .kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis-3 .kpi .v { font-size: 18px; }
}

/* "+ Nuova categoria" dentro i moduli */
.cat-new span { box-shadow: inset 0 0 0 2px var(--line); background: #fff; }
.cat-new i { color: #fff; font-weight: 800; }
.new-cat { display: none; flex-direction: column; gap: 10px; background: var(--row); border-radius: 16px; padding: 14px; margin-top: 10px; }
.new-cat input { background: #fff; }
.new-cat .icon-pick span { background: #fff; }
.field:has(input[name=category_id][value=new]:checked) .new-cat { display: flex; }

/* spese fisse */
.rec-badge { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 8px; background: #EEF0FF; font-size: 12px; margin-left: 4px; vertical-align: middle; }
.recurring-hint { background: #EEF0FF; border-radius: 12px; padding: 9px 12px; margin: 0; }
.seg { display: inline-flex; background: var(--row); border-radius: 999px; padding: 4px; gap: 4px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 16px; border-radius: 999px; font-weight: 800; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg input:checked + span { background: var(--night); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--lilac); }
.rec-list { list-style: none; margin: 0; padding: 0; }
.rec-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rec-list li:last-child { border: 0; }
.rec-main { flex: 1; min-width: 0; }
.rec-main b { display: block; }
.rec-main small { display: block; color: var(--muted); font-size: 13px; }
.rec-side { text-align: right; }
.rec-side small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.status { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-paid { background: #DDF5F1; color: #1F6F64; }
.status-next { background: #FCF1D6; color: #8A6510; }
.status-pause { background: #EEF0F5; color: var(--muted); }
.rec-total { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 2px solid var(--line); margin-top: 6px; padding-top: 12px; font-size: 14px; }
.rec-total b { font-size: 16px; }
