:root {
  --bg: oklch(97.3% 0.012 75);
  --surface: oklch(99% 0.004 80);
  --sidebar: oklch(23% 0.025 55);
  --sidebar-active: oklch(30% 0.035 55);
  --sidebar-text: oklch(88% 0.015 70);
  --sidebar-text-dim: oklch(64% 0.02 65);
  --text: oklch(23% 0.02 50);
  --text-muted: oklch(52% 0.02 55);
  --border: oklch(90% 0.012 70);
  --accent: oklch(68% 0.16 55);
  --accent-strong: oklch(56% 0.16 48);
  --accent-tint: oklch(94% 0.035 60);
  --expense: oklch(58% 0.16 30);
  --expense-strong: oklch(50% 0.17 28);
  --expense-tint: oklch(94% 0.03 30);
  --savings: oklch(58% 0.09 148);
  --savings-tint: oklch(94% 0.03 148);
  --gold: oklch(76% 0.1 85);
  --gold-tint: oklch(95% 0.035 85);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Karla', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { color: var(--accent); }

.icon {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px; flex: 0 0 264px;
  background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 28px 18px;
  position: sticky; top: 0; height: 100vh;
  /* Se le voci di menu (es. "Inviti", mostrata solo a volte) superano
     l'altezza dello schermo, resta sempre possibile scorrere fino in fondo
     invece di perdere l'accesso alla scheda utente/selettore di gruppo. */
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 28px; }
.brand-badge {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--sidebar-active);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.brand-badge .icon { width: 19px; height: 19px; }
.brand-name { font-family: 'Instrument Serif', Georgia, serif; font-style: italic; font-size: 23px; color: oklch(97% 0.01 70); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  font-size: 14.5px; font-weight: 500; color: var(--sidebar-text-dim);
  background: none; border: none; text-align: left; cursor: pointer; width: 100%;
}
.nav-item.active { background: var(--sidebar-active); color: oklch(97% 0.015 70); }
.sidebar-spacer { flex: 1; }

.user-card { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: oklch(28% 0.02 55); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-tint); color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 auto;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 13.5px; font-weight: 600; color: oklch(96% 0.01 70); }
.user-role { font-size: 11.5px; color: var(--sidebar-text-dim); margin-top: 1px; }

.logout-form { margin-left: auto; flex: 0 0 auto; }
.logout-btn {
  width: 30px; height: 30px; border-radius: 8px; border: none;
  background: none; color: var(--sidebar-text-dim); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.logout-btn:hover { background: oklch(35% 0.02 55); color: oklch(96% 0.01 70); }
.logout-btn .icon { width: 16px; height: 16px; }

.content { flex: 1; min-width: 0; padding: 36px 40px 48px; }

/* ---------- Mobile nav (topbar + off-canvas sidebar) ---------- */
.mobile-topbar { display: none; }
.mobile-menu-btn {
  width: 38px; height: 38px; border-radius: 10px; border: none; background: none;
  color: var(--sidebar-text); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.sidebar-close-btn { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 860px) {
  .mobile-topbar {
    display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 40;
    background: var(--sidebar); padding: 10px 14px; box-shadow: 0 1px 0 oklch(0% 0 0 / .15);
  }
  .mobile-topbar .brand { padding: 4px 0; }
  .mobile-topbar .brand-name { font-size: 20px; }

  .sidebar-overlay.is-open {
    display: block; position: fixed; inset: 0; background: oklch(15% 0.01 55 / .5); z-index: 45;
  }

  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50; width: 82vw; max-width: 300px;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: 0 0 40px oklch(0% 0 0 / .25);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-brand-desktop { display: none; }
  .sidebar-close-btn { display: flex; align-self: flex-end; margin-bottom: 12px; }

  .content { padding: 20px 16px 32px; }
  .form-row { grid-template-columns: 1fr; }
}

.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.page-title { font-family: 'Instrument Serif', Georgia, serif; font-size: 34px; font-weight: 400; margin: 0 0 4px; }
.page-sub { font-size: 14.5px; color: var(--text-muted); margin: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; border: none; border-radius: 10px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 11px 18px;
}
.btn-primary { background: var(--accent-strong); color: white; }

/* ---------- Stat cards ---------- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; margin-bottom: 6px; }
.stat-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; padding: 3px 8px; border-radius: 100px; }
.stat-delta .icon { width: 12px; height: 12px; stroke-width: 2.2; }
.stat-delta.up { background: var(--savings-tint); color: var(--savings); }
.stat-delta.neutral { background: oklch(94% 0.005 70); color: var(--text-muted); }

/* ---------- Panels / lists ---------- */
.bottom-row { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .bottom-row { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px; }
.panel-title { font-size: 15px; font-weight: 700; margin: 0 0 18px; }

/* Sezioni chiudibili di Impostazioni (Funzioni, Reset, Elimina account): il
   titolo è anche l'interruttore, chiuse di default per accorciare la pagina. */
details.form-card > summary.panel-title {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    padding: 2px 0;
}
details.form-card > summary.panel-title::-webkit-details-marker { display: none; }
details.form-card > summary.panel-title::after {
    content: "";
    width: 8px; height: 8px;
    flex-shrink: 0;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform .15s ease;
}
details.form-card[open] > summary.panel-title::after { transform: rotate(-135deg); }
details.form-card[open] > summary.panel-title { margin-bottom: 6px; }

.empty-state { text-align: center; padding: 24px 8px; color: var(--text-muted); font-size: 13.5px; }

.activity-row { display: flex; align-items: center; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-row:last-child { border-bottom: none; padding-bottom: 0; }
.activity-row:first-child { padding-top: 0; }
.activity-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.activity-main { flex: 1; min-width: 0; }
.activity-name { font-size: 13.5px; font-weight: 600; margin-bottom: 5px; }
.activity-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 600; padding: 2.5px 8px; border-radius: 100px; }
.tag.family { background: var(--gold-tint); color: oklch(50% 0.1 85); }
.tag.person { background: oklch(93% 0.01 60); color: var(--text-muted); }
.activity-right { text-align: right; flex: 0 0 auto; }
.activity-amount { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 3px; }
.activity-amount.neg { color: var(--expense); }
.activity-amount.pos { color: var(--savings); }
.activity-date { font-size: 11.5px; color: var(--text-muted); }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.blob-1 { width: 520px; height: 520px; background: oklch(85% 0.08 60); top: -140px; left: -120px; }
.blob-2 { width: 460px; height: 460px; background: oklch(88% 0.06 145); bottom: -160px; right: -100px; }
.blob-3 { width: 340px; height: 340px; background: oklch(90% 0.05 85); bottom: 60px; left: 8%; opacity: .4; }

.login-card {
  position: relative; width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 22px; padding: 44px 40px 36px;
  box-shadow: 0 24px 60px -20px oklch(30% 0.03 55 / .18); text-align: center;
}
.login-card .brand-badge { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 18px; background: var(--accent-tint); }
.login-card .brand-badge .icon { width: 28px; height: 28px; }
.login-card .brand-name { font-size: 32px; color: var(--text); margin-bottom: 10px; }
.tagline { font-size: 14.5px; color: var(--text-muted); line-height: 1.55; margin: 0 0 30px; padding: 0 8px; }

.google-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: white; border: 1px solid var(--border); border-radius: 12px; padding: 13px 16px;
  font-family: inherit; font-size: 14.5px; font-weight: 600; color: var(--text); cursor: pointer;
  box-shadow: 0 1px 2px oklch(30% 0.02 55 / .06);
}

.trust-row { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 22px; font-size: 12.5px; color: var(--text-muted); }
.trust-row .icon { width: 14px; height: 14px; color: var(--savings); }

.login-error {
  background: var(--expense-tint); color: var(--expense-strong);
  border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 20px; text-align: left;
}

.footer-note { position: fixed; bottom: 24px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--text-muted); }

/* ---------- Buttons (extra variants) ---------- */
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-outline { background: none; color: var(--text); border: 1px solid var(--border); }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Alerts ---------- */
.alert { border-radius: 12px; padding: 12px 16px; font-size: 13.5px; margin-bottom: 18px; }
.alert-success { background: var(--savings-tint); color: oklch(38% 0.09 148); }
.alert-error { background: var(--expense-tint); color: var(--expense-strong); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Hero card (expenses/income totals) ---------- */
.hero-card {
  border-radius: 20px; padding: 26px 30px; display: flex; align-items: center;
  justify-content: space-between; color: white; margin-bottom: 18px; flex-wrap: wrap; gap: 14px;
}
.hero-card.expense { background: linear-gradient(120deg, var(--expense-strong), var(--expense) 75%); }
.hero-card.income { background: linear-gradient(120deg, oklch(48% 0.1 148), var(--savings) 75%); }
.hero-label { font-size: 13px; opacity: .85; margin-bottom: 8px; }
.hero-figure { font-size: 36px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

/* ---------- Scorciatoie spesa (bottoni a tocco singolo) ---------- */
.shortcut-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.shortcut-btn { padding: 8px 16px; font-size: 13.5px; }

/* ---------- Category summary cards ---------- */
.cat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.cat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.cat-card-icon { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.cat-card-label { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.cat-card-value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Toolbar (search + filters) ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 10px 14px; color: var(--text-muted); }
.search-box input { border: none; outline: none; background: none; font-family: inherit; font-size: 14px; color: var(--text); flex: 1; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pill {
  display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; padding: 9px 14px;
  border-radius: 100px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
}
.filter-pill.active { background: var(--accent-strong); color: white; border-color: var(--accent-strong); }

/* ---------- List panel (transaction rows) ---------- */
.list-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.list-header { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.list-header > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row { display: flex; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--border); gap: 14px; flex-wrap: wrap; }
.list-row:last-child { border-bottom: none; }
.row-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--expense-tint); color: var(--expense); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.row-icon.income { background: var(--savings-tint); color: var(--savings); }
.row-main { flex: 1; min-width: 160px; }
.row-name { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.row-note { font-size: 12px; color: var(--text-muted); margin: -3px 0 6px; }
.row-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tag.cat-need { background: var(--expense-tint); color: var(--expense-strong); }
.tag.cat-wants { background: var(--gold-tint); color: oklch(50% 0.1 85); }
.tag.cat-savings { background: var(--savings-tint); color: var(--savings); }
.tag.cat-income { background: var(--savings-tint); color: var(--savings); }
.tag.cat-custom { background: var(--accent-tint); color: var(--accent-strong); }
.row-recurring { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); }
.row-recurring .icon { width: 12px; height: 12px; }
.row-date { width: 100px; flex: 0 0 auto; font-size: 13px; color: var(--text-muted); }
.row-amount { width: 100px; flex: 0 0 auto; text-align: right; font-size: 15px; font-weight: 700; color: var(--expense); font-variant-numeric: tabular-nums; }
.row-amount.income { color: var(--savings); }
.row-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.row-actions a, .row-actions button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; }
.row-actions .icon { width: 14px; height: 14px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; gap: 6px; padding: 18px; }
.pagination a, .pagination span { padding: 7px 12px; border-radius: 8px; font-size: 13px; color: var(--text-muted); border: 1px solid var(--border); }
.pagination .active-page { background: var(--accent-strong); color: white; border-color: var(--accent-strong); }

/* ---------- Forms ---------- */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px 30px; max-width: 560px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border);
  font-family: inherit; font-size: 14px; color: var(--text); background: white;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.form-help { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--expense-strong); margin-top: 5px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }

/* ---------- Import page ---------- */
.upload-box {
  border: 1.5px dashed var(--border); border-radius: 14px; padding: 32px; text-align: center;
  background: var(--surface); margin-bottom: 18px; cursor: pointer;
  display: block; position: relative; transition: border-color .15s, background .15s;
}
.upload-box:hover { border-color: var(--accent); }
.upload-box.is-dragover { border-color: var(--accent-strong); background: var(--accent-tint); }
.upload-box .icon { display: block; margin-left: auto; margin-right: auto; }

/* ---------- Goals ---------- */
.goals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.goal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px; }
.goal-card.is-completed { border-color: var(--savings); }
.goal-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.goal-icon {
  width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  display: flex; align-items: center; justify-content: center; color: white;
}
.goal-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.priority-tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 100px; display: inline-block; }
.priority-tag.priority-low { background: oklch(93% 0.01 60); color: var(--text-muted); }
.priority-tag.priority-medium { background: var(--gold-tint); color: oklch(50% 0.1 85); }
.priority-tag.priority-high { background: var(--expense-tint); color: var(--expense-strong); }
.goal-card-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.goal-progress-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; margin-bottom: 7px; }
.goal-progress-row strong { font-size: 15px; }
.goal-progress-track { height: 8px; border-radius: 100px; background: var(--border); overflow: hidden; margin-bottom: 12px; }
.goal-progress-fill { height: 100%; border-radius: 100px; background: var(--savings); }
.goal-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.goal-meta .icon { width: 13px; height: 13px; }
.goal-progress-form { display: flex; gap: 8px; }
.goal-progress-form input {
  flex: 1; min-width: 0; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border);
  font-family: inherit; font-size: 13.5px; color: var(--text);
}
.goal-completed-badge { display: flex; align-items: center; gap: 7px; color: var(--savings); font-size: 13.5px; font-weight: 600; }
.goal-completed-badge .icon { width: 16px; height: 16px; }

/* ---------- Famiglia ---------- */
.inline-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.member-email { font-size: 12.5px; color: var(--text-muted); }
.form-group input:disabled { background: oklch(96% 0.006 60); color: var(--text-muted); }

/* ---------- Scadenze ---------- */
.hero-note { font-size: 13px; opacity: .9; margin-top: 8px; }
.pay-col-date { width: 92px; flex: 0 0 auto; font-size: 13px; color: var(--text-muted); text-transform: capitalize; }
.pay-col-amount { width: 92px; flex: 0 0 auto; text-align: right; }
.pay-col-cumulative { width: 92px; flex: 0 0 auto; text-align: right; font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.list-header .pay-col-amount, .list-header .pay-col-cumulative { font-size: inherit; color: inherit; }
.list-row.is-overdue .pay-col-date { color: var(--expense-strong); font-weight: 600; }
.list-row.is-paid { opacity: .6; }
.list-row.is-paid .row-name { text-decoration: line-through; }
.list-row.is-paid .row-icon { background: var(--savings-tint); color: var(--savings); }
.pay-slot { width: 236px; flex: 0 0 auto; }
.row-end { display: flex; align-items: center; gap: 12px; margin-left: auto; flex: 0 0 auto; }
.pay-form { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.pay-form .btn { white-space: nowrap; }
.pay-form input { width: 104px; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border); font-family: inherit; font-size: 13.5px; color: var(--text); }
@media (max-width: 860px) {
  .pay-col-cumulative, .list-header .pay-col-cumulative { display: none; }
  .list-header .pay-col-date, .list-header .pay-col-amount { display: none; }
  .row-end { flex: 1 0 100%; justify-content: space-between; margin-left: 0; }
  .pay-slot { width: auto; }
  .pay-slot:empty, .list-header .pay-slot { display: none; }
}

/* ---------- Scadenze: copertura del saldo ---------- */
.coverage { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; border-radius: 14px; padding: 14px 18px; margin-bottom: 16px; font-size: 13.5px; }
.coverage-text { display: flex; flex-direction: column; gap: 3px; flex: 1 1 260px; }
.coverage-text span { font-size: 12.5px; opacity: .85; }
.coverage.is-ok { background: var(--savings-tint); color: oklch(38% 0.09 148); }
.coverage.is-short { background: var(--expense-tint); color: var(--expense-strong); }
.coverage.is-unknown { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.coverage-form { display: flex; gap: 8px; align-items: center; }
.coverage-form input { width: 120px; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border); font-family: inherit; font-size: 13.5px; color: var(--text); background: var(--surface); }
.list-row.is-short .pay-col-cumulative { color: var(--expense-strong); font-weight: 600; }

/* Cumulato: colonna a larghezze ampie, riga di dettaglio sotto i ~1180px (e su telefono) */
.cum-inline { display: none; font-size: 11.5px; color: var(--text-muted); }
@media (max-width: 1180px) {
  .pay-col-cumulative, .list-header .pay-col-cumulative { display: none; }
  .list-header .pay-col-date, .list-header .pay-col-amount { display: none; }
  .cum-inline { display: inline; }
}
.list-row.is-short .cum-inline { color: var(--expense-strong); font-weight: 600; }
.hero-unit { font-size: 16px; font-weight: 500; opacity: .85; }
.tabs-nav a.filter-pill { text-decoration: none; display: inline-block; }
.suggestions summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.suggestions .form-help { margin: 8px 0 14px; }
.suggestion-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- Selettore vista condivisa / riservata ---------- */
.view-bar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 22px; }
.view-switch { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 100px; padding: 3px; }
.view-switch button { border: none; background: none; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-muted); padding: 7px 16px; border-radius: 100px; cursor: pointer; }
.view-switch button.active { background: var(--accent-strong); color: white; }
.view-hint { font-size: 12.5px; color: var(--text-muted); }
.tag.private { background: oklch(93% 0.01 60); color: var(--text-muted); }

/* ---------- Reset dei dati ---------- */
.btn-danger { background: var(--expense-strong); color: white; }
.danger-zone { border-color: oklch(82% 0.06 25); }
.form-group label.reset-option { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; margin: 0; font-weight: 400; }
.reset-option input { margin-top: 3px; }
.reset-option.is-empty { opacity: .55; }
.reset-count { display: block; font-size: 12px; color: var(--text-muted); font-weight: 400; margin-top: 1px; }
.import-summary { display: grid; grid-template-columns: 1fr repeat(3, 92px); font-size: 14px; }
.import-summary > * { padding: 9px 6px; border-bottom: 1px solid var(--border); }
.import-summary .is-head { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.import-summary .num { text-align: right; }
@media (max-width: 560px) { .import-summary { grid-template-columns: 1fr repeat(3, 62px); font-size: 13px; } }

/* ---------- Finestra di conferma ---------- */
.confirm-dialog { border: none; border-radius: 16px; padding: 0; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px oklch(20% 0.03 50 / .35); }
.confirm-dialog::backdrop { background: oklch(20% 0.03 50 / .45); }
.confirm-body { padding: 24px 24px 20px; margin: 0; }
.confirm-title { font-size: 17px; font-weight: 700; margin: 0 0 8px; line-height: 1.3; }
.confirm-message { font-size: 14px; color: var(--text-muted); line-height: 1.5; margin: 0 0 22px; }
.confirm-message:empty { display: none; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.coverage-form { flex-wrap: wrap; }
.coverage-note { flex: 1 0 100%; font-size: 11.5px; color: var(--text-muted); margin-top: -2px; }
.coverage-note a { color: inherit; text-decoration: underline; }

/* ---------- Elimina account ---------- */
.login-status { background: var(--savings-tint); color: oklch(38% 0.09 148); border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.delete-list { margin: 0 0 16px; padding-left: 20px; font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ---------- Conti ---------- */
.account-amount { text-align: right; flex: 0 0 auto; min-width: 150px; }
.account-value { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.account-value.debt { color: var(--expense); }
.account-date { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.delta-up { color: var(--savings); font-weight: 600; }
.delta-down { color: var(--expense-strong); font-weight: 600; }
.plain-link { color: inherit; text-decoration: none; }
.plain-link:hover { text-decoration: underline; }
.form-group textarea { width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border); font-family: inherit; font-size: 14px; color: var(--text); background: var(--surface); resize: vertical; }
.header-actions form { margin: 0; }

/* ---------- Conti: interruttore "Nel saldo" e riga informativa ---------- */
.available-note { font-size: 13px; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; line-height: 1.5; }
.available-note strong { color: var(--text); }
.available-note a { color: var(--accent-strong); }
.count-toggle { display: flex; align-items: center; gap: 8px; margin: 0; flex: 0 0 auto; }
.switch { width: 38px; height: 22px; border-radius: 100px; border: none; background: oklch(85% 0.01 60); position: relative; cursor: pointer; padding: 0; transition: background .15s; }
.switch.is-on { background: var(--savings); }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; transition: left .15s; box-shadow: 0 1px 2px oklch(20% 0.02 50 / .3); }
.switch.is-on .switch-knob { left: 19px; }
.switch-label { font-size: 12px; color: var(--text-muted); }

/* ---------- Conti: matita per aggiornare il saldo ---------- */
.quick-balance { flex: 0 0 auto; display: flex; align-items: center; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; }
.icon-btn:hover { color: var(--accent-strong); border-color: var(--accent-strong); }
.icon-btn .icon { width: 15px; height: 15px; }
.icon-btn[hidden] { display: none; }
.quick-form { display: flex; align-items: center; gap: 6px; margin: 0; }
.quick-form[hidden] { display: none; }
.quick-form input { width: 130px; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border); font-family: inherit; font-size: 13.5px; color: var(--text); }

.tag.owner { background: var(--accent-tint); color: var(--accent-strong); }

/* ---------- Cruscotto: menu Aggiungi ---------- */
.add-menu { position: relative; }
.add-menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.add-menu > summary::-webkit-details-marker { display: none; }
.add-menu > summary::after { content: ''; border: 4px solid transparent; border-top-color: currentColor; margin: 4px 0 0 4px; }
.add-menu[open] > summary::after { border-top-color: transparent; border-bottom-color: currentColor; margin: -4px 0 0 4px; }
.add-menu-list { position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px oklch(20% 0.03 50 / .18); z-index: 20; display: flex; flex-direction: column; }
.add-menu-list a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500; }
.add-menu-list a:hover { background: var(--accent-tint); color: var(--accent-strong); }
.add-menu-list .icon { width: 16px; height: 16px; }

/* ---------- Simulazione dei saldi ---------- */
.sim-banner { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; background: oklch(93% 0.07 85); color: oklch(35% 0.07 70); border: 1px solid oklch(80% 0.09 85); border-radius: 12px; padding: 10px 16px; margin-bottom: 16px; font-size: 13px; line-height: 1.45; box-shadow: 0 6px 18px oklch(20% 0.03 50 / .12); }
.sim-banner form { margin: 0; }
.tag.sim { background: oklch(93% 0.07 85); color: oklch(38% 0.08 70); font-weight: 600; }
.sim-btn.is-active { color: oklch(45% 0.11 70); border-color: oklch(75% 0.1 85); background: oklch(95% 0.05 85); }

.sim-banner > div { flex: 1 1 420px; }
.sim-banner form { flex: 0 0 auto; }

/* ---------- Condivisione a persone specifiche ---------- */
.sharing-people { margin-top: 6px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.sharing-people[hidden] { display: none; }
.sharing-member { padding: 4px 0; }
.sharing-adults { margin-top: 8px; padding: 6px 12px; font-size: 12.5px; }
.tag.people { background: oklch(94% 0.03 250); color: oklch(40% 0.08 250); }

.bottom-row.single { grid-template-columns: 1fr; }
