/* ===== RESET & VARS ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:      #0f0f13;
    --bg2:     #1a1a22;
    --bg3:     #23232f;
    --border:  #2e2e3e;
    --text:    #e8e8f0;
    --muted:   #888899;
    --primary: #6c63ff;
    --primary-h:#5a52e8;
    --green:   #22c55e;
    --red:     #ef4444;
    --yellow:  #f59e0b;
    --radius:  10px;
}

body { background:var(--bg); color:var(--text); font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; font-size:14px; line-height:1.6; min-height:100vh; }
a { color:var(--primary); text-decoration:none; }
a:hover { text-decoration:underline; }

/* ===== NAVBAR ===== */
.navbar { background:var(--bg2); border-bottom:1px solid var(--border); padding:0 24px; display:flex; align-items:center; justify-content:space-between; height:54px; position:sticky; top:0; z-index:100; }
.nav-brand { font-weight:700; font-size:17px; color:var(--primary); letter-spacing:-.3px; text-decoration:none; }
.nav-links { display:flex; align-items:center; gap:2px; }
.nav-link { color:var(--muted); padding:5px 11px; border-radius:6px; font-size:13px; transition:all .15s; }
.nav-link:hover { background:var(--bg3); color:var(--text); text-decoration:none; }
.nav-link.active { background:var(--primary); color:#fff; }
.nav-logout { margin-left:8px; border:1px solid var(--border); }

/* ===== CONTAINER ===== */
.container { max-width:1280px; margin:0 auto; padding:24px; }

/* ===== FLASH ===== */
.flashes { margin-bottom:16px; }
.flash { background:var(--bg3); border-left:3px solid var(--primary); padding:10px 14px; border-radius:6px; margin-bottom:6px; font-size:13px; }

/* ===== AUTH ===== */
.auth-box { max-width:400px; margin:60px auto 0; background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius); padding:36px; }
.auth-box h2 { margin-bottom:24px; }
.auth-box label { display:block; font-size:12px; color:var(--muted); margin:14px 0 4px; }
.auth-footer { margin-top:20px; text-align:center; color:var(--muted); font-size:13px; }

/* ===== MONTH NAV ===== */
.month-nav { display:flex; align-items:center; gap:16px; margin-bottom:20px; }
.month-nav h2 { font-size:22px; font-weight:700; }

/* ===== ASSIGN BANNER ===== */
.assign-banner { border-radius:var(--radius); padding:20px 24px; margin-bottom:24px; display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:12px; border:1px solid; }
.assign-ok    { background:rgba(34,197,94,.1);  border-color:var(--green);  }
.assign-zero  { background:rgba(108,99,255,.1); border-color:var(--primary); }
.assign-over  { background:rgba(239,68,68,.1);  border-color:var(--red);   }
.assign-main { display:flex; flex-direction:column; }
.assign-label { font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; margin-bottom:4px; }
.assign-value { font-size:32px; font-weight:800; line-height:1; }
.assign-ok .assign-value  { color:var(--green); }
.assign-zero .assign-value { color:var(--primary); }
.assign-over .assign-value { color:var(--red); }
.assign-detail { display:flex; flex-wrap:wrap; gap:10px 18px; font-size:13px; color:var(--muted); align-items:center; }
.assign-detail-label { font-weight:600; color:var(--text); font-size:11px; text-transform:uppercase; letter-spacing:.04em; }
.assign-detail-sep { color:var(--border); font-size:16px; margin:0 4px; }

/* ===== TWO COL LAYOUT ===== */
.two-col { display:grid; grid-template-columns:1fr 360px; gap:24px; align-items:start; }
.col-wide  { display:flex; flex-direction:column; gap:0; }
.col-narrow { display:flex; flex-direction:column; gap:0; }
@media(max-width:960px) { .two-col { grid-template-columns:1fr; } }

/* ===== CARDS ===== */
.card { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius); padding:18px 20px; margin-bottom:16px; }
.card-warning { border-color:var(--yellow); background:rgba(245,158,11,.06); }
.card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; padding-bottom:12px; border-bottom:1px solid var(--border); gap:8px; }
.card-header h3 { font-size:14px; font-weight:600; }
.page-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:20px; flex-wrap:wrap; gap:12px; }
.page-header h2 { font-size:22px; }

/* ===== BUDGET GROUP ===== */
.budget-group { }
.budget-row { display:grid; grid-template-columns:180px 1fr auto; gap:10px; align-items:center; padding:7px 0; border-bottom:1px solid var(--border); }
.budget-row:last-of-type { border-bottom:none; }
.budget-row-name { font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.budget-row-nums { display:flex; align-items:center; gap:6px; font-size:13px; justify-content:flex-end; }
.grp-totals { font-size:13px; }
.inline-budget-form { display:inline; }
.budget-input { width:90px; padding:3px 6px; font-size:13px; background:var(--bg3); border:1px solid var(--border); border-radius:5px; color:var(--text); text-align:right; }
.budget-input:focus { outline:none; border-color:var(--primary); }
@media(max-width:600px) { .budget-row { grid-template-columns:1fr; gap:4px; } }

/* ===== PROGRESS BAR ===== */
.progress-bar { background:var(--bg3); border-radius:99px; height:10px; overflow:visible; position:relative; }
.progress-fill { height:100%; background:var(--primary); border-radius:99px; transition:width .3s; overflow:hidden; }
.progress-warn { background:var(--yellow) !important; }
.progress-income { background:var(--green) !important; }
.progress-today-marker {
    position:absolute; top:-2px; bottom:-2px; width:2px;
    background:rgba(255,255,255,.85); border-radius:1px;
    box-shadow:0 0 3px rgba(0,0,0,.4);
    pointer-events:none; z-index:2;
}
.progress-over { background:var(--red); }

/* ===== ACCOUNT ROW ===== */
.account-row { display:flex; justify-content:space-between; align-items:center; padding:9px 0; border-bottom:1px solid var(--border); }
.account-row:last-child { border-bottom:none; }

/* ===== TX ROW (compact) ===== */
.tx-row { display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-bottom:1px solid var(--border); gap:8px; }
.tx-row:last-child { border-bottom:none; }
.tx-row-right { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.tx-actions { display:flex; gap:4px; opacity:0; transition:opacity .15s; }
.tx-row:hover .tx-actions { opacity:1; }

/* ── budget remaining ── */
.budget-remaining { font-size:11px; margin-top:2px; }

/* ── group collapse ── */
.grp-toggle { font-size:14px; line-height:1; padding:2px 6px; transition:transform .2s; }
.budget-group.collapsed .grp-toggle { transform:rotate(-90deg); }
.budget-group.collapsed .budget-row,
.budget-group.collapsed .form-toggle,
.budget-group.collapsed .grp-add-form { display:none !important; }

/* ===== TABLES ===== */
.table { width:100%; border-collapse:collapse; font-size:13px; margin-bottom:12px; }
.table th { text-align:left; color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.5px; padding:5px 8px; border-bottom:1px solid var(--border); font-weight:500; }
.table td { padding:8px; border-bottom:1px solid var(--border); vertical-align:middle; }
.table tr:last-child td { border-bottom:none; }
.table tr:hover td { background:var(--bg3); }

/* ===== FORMS ===== */
input, select, textarea { background:var(--bg3); border:1px solid var(--border); border-radius:6px; color:var(--text); padding:7px 10px; font-size:13px; font-family:inherit; width:100%; transition:border-color .15s; }
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--primary); }
input::placeholder { color:var(--muted); }

.form-group { display:flex; flex-direction:column; gap:4px; }
.form-group label { font-size:12px; color:var(--muted); font-weight:500; }
.form-stack { display:flex; flex-direction:column; gap:10px; }
.form-row { display:flex; gap:8px; flex-wrap:wrap; align-items:flex-end; padding:8px 0; }
.form-row input, .form-row select { flex:1; min-width:100px; width:auto; }
.form-row-2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }

.form-toggle { border-top:1px solid var(--border); padding-top:10px; margin-top:6px; }
.form-toggle summary { cursor:pointer; color:var(--primary); font-size:13px; font-weight:500; list-style:none; padding:3px 0; }
.form-toggle summary::-webkit-details-marker { display:none; }
.form-toggle[open] summary { margin-bottom:8px; }

/* Ricorrenza toggle */
.recurring-toggle { padding:10px 0 4px; }
.toggle-label { display:flex; align-items:center; gap:8px; cursor:pointer; font-size:13px; }
.toggle-label input[type=checkbox] { width:auto; cursor:pointer; }
.recurring-box { background:var(--bg3); border:1px solid var(--border); border-radius:8px; padding:14px; margin-top:4px; }

.filter-form { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.filter-form select { width:auto; min-width:140px; }

.settings-preview { padding:9px 12px; background:var(--bg3); border-radius:6px; margin:6px 0 12px; font-size:13px; color:var(--muted); }

/* ===== BUTTONS ===== */
.btn { display:inline-flex; align-items:center; gap:5px; padding:7px 14px; border-radius:6px; font-size:13px; font-weight:500; font-family:inherit; cursor:pointer; border:1px solid transparent; transition:all .15s; text-decoration:none; white-space:nowrap; }
.btn:hover { text-decoration:none; }
.btn-primary { background:var(--primary); color:#fff; border-color:var(--primary); }
.btn-primary:hover { background:var(--primary-h); }
.btn-ghost { background:transparent; color:var(--muted); border-color:var(--border); }
.btn-ghost:hover { background:var(--bg3); color:var(--text); }
.btn-danger { background:transparent; color:var(--red); border-color:var(--red); }
.btn-danger:hover { background:var(--red); color:#fff; }
.btn-full { width:100%; justify-content:center; }
.btn-sm  { padding:5px 10px; font-size:12px; }
.btn-xs  { padding:2px 7px;  font-size:11px; border-radius:4px; }

/* ===== BADGES ===== */
.badge { display:inline-block; padding:2px 7px; border-radius:99px; font-size:11px; font-weight:500; background:var(--bg3); border:1px solid var(--border); white-space:nowrap; }
.badge-green  { background:rgba(34,197,94,.15);  border-color:var(--green);  color:var(--green);  }
.badge-red    { background:rgba(239,68,68,.15);   border-color:var(--red);    color:var(--red);    }
.badge-yellow { background:rgba(245,158,11,.15);  border-color:var(--yellow); color:var(--yellow); }
.badge-orange { background:rgba(249,115,22,.15);  border-color:#f97316;       color:#f97316;       }
.text-orange  { color:#f97316; }
.badge-xs     { padding:1px 5px; font-size:10px; }

/* ===== UTILITIES ===== */
.text-green   { color:var(--green); }
.text-red     { color:var(--red); }
.text-yellow  { color:var(--yellow); }
.text-primary { color:var(--primary); }
.text-muted   { color:var(--muted); }
.fw-bold    { font-weight:600; }
.empty { color:var(--muted); font-style:italic; text-align:center; padding:16px 0; font-size:13px; }

code.invite-link { font-size:11px; background:var(--bg3); padding:3px 6px; border-radius:4px; word-break:break-all; color:var(--primary); }
h2 { font-size:20px; margin-bottom:18px; }
h4 { font-size:13px; color:var(--muted); margin:14px 0 8px; }
small { font-size:11px; color:var(--muted); }

/* ═══════════ WORKSPACE + TRANSACTION TYPE TABS ═══════════ */

.workspace-switcher { display:flex;gap:2px;background:rgba(255,255,255,.04);border:1px solid var(--border);border-radius:10px;padding:3px; }
.ws-form { margin:0; }
.ws-btn { display:flex;align-items:center;gap:5px;padding:5px 12px;border-radius:7px;border:none;background:transparent;color:var(--muted);font-size:12px;font-weight:600;cursor:pointer;transition:all .15s;white-space:nowrap; }
.ws-btn:hover { background:rgba(255,255,255,.06);color:var(--text); }
.ws-active { background:var(--primary)!important;color:#fff!important;box-shadow:0 2px 8px rgba(108,99,255,.35); }
.ws-icon { font-size:14px; }
.ws-label { display:inline; }
.ws-badge { display:inline-flex;align-items:center;gap:5px;background:rgba(108,99,255,.1);border:1px solid rgba(108,99,255,.3);color:var(--primary);border-radius:20px;padding:3px 10px;font-size:12px;font-weight:700; }

/* Month nav */
.month-nav { display:flex;align-items:center;justify-content:space-between;margin-bottom:16px; }
.month-nav h2 { font-size:20px;margin:0; }

/* Transaction type tabs */
.tx-type-tabs { display:grid;grid-template-columns:1fr 1fr;gap:4px;margin-bottom:2px; }
.tx-tab { padding:7px 6px;border:1px solid var(--border);border-radius:7px;background:var(--bg3);color:var(--muted);font-size:11px;font-weight:600;cursor:pointer;transition:all .15s;text-align:center; }
.tx-tab:hover { border-color:var(--primary);color:var(--text); }
.tx-tab-active { background:var(--primary)!important;border-color:var(--primary)!important;color:#fff!important; }

/* Account groups */
.account-group { margin-bottom:6px; }
.account-group-header { display:flex;justify-content:space-between;align-items:center;padding:6px 0 3px;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;color:var(--muted);border-bottom:1px solid var(--border);margin-bottom:2px; }
.account-negative { background:rgba(239,68,68,.05);border-radius:5px; }
.badge-family { background:rgba(108,99,255,.12);border-color:var(--primary);color:var(--primary); }
.badge-primary { background:rgba(108,99,255,.18);border-color:var(--primary);color:var(--primary); }
.badge-red { background:rgba(239,68,68,.15);border-color:var(--red);color:var(--red); }
.badge-yellow { background:rgba(251,191,36,.15);border-color:var(--yellow);color:var(--yellow); }
.acc-type-desc { font-size:11px;color:var(--muted);background:var(--bg);border-radius:5px;padding:5px 8px;margin-top:-4px;line-height:1.4; }
.alert-negative { display:flex;align-items:center;gap:8px;flex-wrap:wrap;background:rgba(239,68,68,.1);border:1px solid var(--red);border-radius:var(--radius);padding:10px 16px;margin-bottom:16px;font-size:13px;color:var(--red); }

/* Quick add */
.quick-add-btn { background:var(--primary)!important;color:#fff!important;border-color:var(--primary)!important;font-size:14px!important;font-weight:700!important;min-width:26px;justify-content:center; }
.note-tags { display:flex;flex-wrap:wrap;gap:4px;margin-top:5px; }
.note-tag { background:var(--bg3);border:1px solid var(--border);border-radius:5px;padding:3px 7px;font-size:14px;cursor:pointer;transition:all .15s; }
.note-tag:hover { background:var(--primary);border-color:var(--primary);transform:scale(1.1); }

/* Forecast */
.forecast-card { border-color:rgba(108,99,255,.3); }
.forecast-grid { display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:8px; }
.forecast-item { background:var(--bg3);border-radius:8px;padding:12px;text-align:center; }
.forecast-label { font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.4px;margin-bottom:3px; }
.forecast-value { font-size:19px;font-weight:800;line-height:1.1; }
.forecast-sub { font-size:10px;color:var(--muted);margin-top:3px; }
.forecast-warn { background:rgba(239,68,68,.1);border:1px solid var(--red);border-radius:6px;padding:7px 12px;font-size:12px;color:var(--red);margin-top:6px; }

/* ===== OBIETTIVI ===== */
.goal-card { padding:16px 20px; }
.goal-card-header { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.goal-card-actions { display:flex; gap:6px; flex-shrink:0; align-items:center; }
.goal-icon { font-size:28px; line-height:1; flex-shrink:0; }
.goal-name { font-size:15px; font-weight:700; }
.goal-meta { font-size:11px; color:var(--muted); margin-top:2px; }
.goal-progress-bar { background:var(--bg3); border-radius:99px; height:12px; overflow:hidden; position:relative; }
.goal-progress-fill { height:100%; border-radius:99px; transition:width .4s ease; }
.goal-progress-labels { display:flex; justify-content:space-between; align-items:center; margin-top:5px; }
.goal-metrics { display:grid; grid-template-columns:repeat(auto-fit,minmax(110px,1fr)); gap:10px; margin-top:14px; padding-top:14px; border-top:1px solid var(--border); }
.goal-metric { text-align:center; background:var(--bg3); border-radius:8px; padding:8px 10px; }
.goal-metric-label { font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin-bottom:4px; }
.goal-metric-value { font-size:14px; font-weight:700; }

/* ===== BUDGET OVER ALERT ICON ===== */
.budget-alert-icon {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    position:relative;
    font-size:13px;
    color:var(--yellow);
    margin-left:4px;
    cursor:default;
    line-height:1;
    vertical-align:middle;
}
.budget-alert-icon::after {
    content:'!';
    position:absolute;
    font-size:7px;
    font-weight:900;
    color:var(--red);
    top:50%;
    left:50%;
    transform:translate(-50%,-44%);
    pointer-events:none;
}
.loan-preview { background:var(--bg3);border:1px solid var(--border);border-radius:8px;padding:12px;margin:8px 0; }
.loan-preview-row { display:flex;justify-content:space-between;align-items:center;font-size:13px;padding:3px 0; }
.recurring-box { background:var(--bg3);border:1px solid var(--border);border-radius:8px;padding:12px;margin-top:4px; }

@media (max-width:600px) {
    .ws-label { display:none; }
    .ws-btn { padding:6px 8px; }
    .brand-text { display:none; }
    .nav-links .nav-link:not(.nav-logout):not([href="/settings"]) { display:none; }
    .tx-type-tabs { grid-template-columns:1fr 1fr; }
}

/* ═══ ADD-GROUP PANEL ═══ */
.add-group-panel { border-style:dashed; border-color:rgba(108,99,255,.3); }
.add-group-header { font-size:13px;font-weight:700;color:var(--muted);margin-bottom:12px;display:flex;align-items:center;gap:6px; }
.add-group-grid { display:grid;grid-template-columns:repeat(3,1fr);gap:8px; }
.add-group-tile { background:var(--bg);border:1px solid var(--border);border-radius:9px;padding:10px 12px;text-align:left;font-size:13px;font-weight:600;color:var(--text);cursor:pointer;transition:all .15s;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.add-group-tile:hover { border-color:var(--primary);background:rgba(108,99,255,.07);color:var(--primary);transform:translateY(-1px); }

@keyframes slideDown { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:translateY(0)} }

@media (max-width:600px) {
  .add-group-grid { grid-template-columns:repeat(2,1fr); }
  .add-group-tile { font-size:12px;padding:8px 10px; }
}

/* ═══ REPORT / PATRIMONIO ═══ */
.report-kpis { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:24px; }
@media(max-width:860px)  { .report-kpis { grid-template-columns:repeat(2,1fr); } }
@media(max-width:480px)  { .report-kpis { grid-template-columns:1fr 1fr; gap:10px; } }

.kpi-card { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius); padding:18px 20px; }
.kpi-card.kpi-green { border-color:var(--green);  background:rgba(34,197,94,.07); }
.kpi-card.kpi-red   { border-color:var(--red);    background:rgba(239,68,68,.07); }
.kpi-label { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; margin-bottom:6px; }
.kpi-value { font-size:24px; font-weight:800; line-height:1.1; margin-bottom:4px; }
.kpi-sub   { font-size:11px; color:var(--muted); }

/* ════════════════════════════════════════════════
   MOBILE LAYOUT — Beyond Budget style
   ════════════════════════════════════════════════ */

/* Visibility helpers */
.mobile-only  { display:none !important; }
.desktop-only { display:block; }
.navbar.desktop-only { display:flex; }

/* ── MOBILE TOP BAR ── */
.mobile-topbar {
    background:var(--bg2); border-bottom:1px solid var(--border);
    padding:0 16px; height:56px;
    align-items:center; justify-content:space-between;
    position:sticky; top:0; z-index:200; gap:12px;
    width:100%;
}
.mobile-brand { font-weight:800; font-size:18px; color:var(--primary); text-decoration:none; white-space:nowrap; flex-shrink:0; }
.mobile-topbar-center { flex:1; display:flex; align-items:center; justify-content:center; }
.mobile-month-nav { display:flex; align-items:center; gap:10px; }
.mobile-month-label { font-size:15px; font-weight:700; white-space:nowrap; text-transform:capitalize; color:var(--text); }
.month-arrow {
    background:rgba(255,255,255,.06); border:1px solid var(--border); border-radius:8px;
    color:var(--text); width:32px; height:32px;
    display:flex; align-items:center; justify-content:center;
    font-size:18px; text-decoration:none; transition:background .15s; flex-shrink:0;
}
.month-arrow:hover { background:var(--bg3); text-decoration:none; }
.mobile-notif-btn {
    position:relative; background:transparent; border:none;
    color:var(--muted); font-size:20px; cursor:pointer;
    width:40px; height:40px; border-radius:8px;
    display:flex; align-items:center; justify-content:center;
    flex-shrink:0; transition:color .15s;
}
.mobile-notif-btn:hover { color:var(--text); }
.notif-badge {
    position:absolute; top:2px; right:2px;
    background:var(--red); color:#fff;
    font-size:9px; font-weight:700; border-radius:50%;
    width:15px; height:15px;
    display:flex; align-items:center; justify-content:center;
    pointer-events:none;
}

/* ── WORKSPACE TABS (mobile) ── */
.mobile-ws-tabs {
    background:var(--bg2); border-bottom:1px solid var(--border);
    padding:0 4px; gap:0;
    overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch;
    position:sticky; top:56px; z-index:190; width:100%;
}
.mobile-ws-tabs::-webkit-scrollbar { display:none; }
.ws-tab-form { flex-shrink:0; margin:0; }
.mobile-ws-tab {
    display:flex; align-items:center; gap:5px;
    padding:12px 14px; border:none; background:transparent;
    color:var(--muted); font-size:13px; font-weight:600;
    cursor:pointer; border-bottom:2px solid transparent;
    transition:all .15s; white-space:nowrap; font-family:inherit;
}
.mobile-ws-tab:hover { color:var(--text); }
.mobile-ws-active { color:var(--primary) !important; border-bottom-color:var(--primary) !important; }

/* ── BOTTOM NAV ── */
.bottom-nav {
    position:fixed; bottom:0; left:0; right:0;
    background:var(--bg2); border-top:1px solid var(--border);
    padding:0 4px; padding-bottom:env(safe-area-inset-bottom);
    height:64px; align-items:center; justify-content:space-around; z-index:300;
}
.bottom-nav-item {
    display:flex; flex-direction:column; align-items:center; gap:2px;
    padding:4px 8px; border:none; background:transparent;
    color:var(--muted); font-size:10px; font-weight:600;
    text-decoration:none; cursor:pointer; border-radius:8px;
    transition:color .15s; position:relative; flex:1; font-family:inherit;
    min-width:0;
}
.bottom-nav-item:hover { color:var(--text); text-decoration:none; }
.bnav-active { color:var(--primary) !important; }
.bnav-icon { font-size:22px; line-height:1; }
.bnav-label { font-size:10px; font-weight:600; white-space:nowrap; }
.bnav-badge {
    position:absolute; top:0; right:8px;
    background:var(--red); color:#fff; font-size:9px; font-weight:700;
    border-radius:50%; width:15px; height:15px;
    display:flex; align-items:center; justify-content:center;
}
.bottom-nav-fab {
    width:56px; height:56px; border-radius:50%;
    background:var(--primary); border:none; color:#fff;
    font-size:32px; line-height:1; cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    box-shadow:0 4px 16px rgba(108,99,255,.55);
    transition:transform .15s, box-shadow .15s;
    margin-top:-20px; flex-shrink:0; font-family:inherit;
}
.bottom-nav-fab:hover  { transform:scale(1.06); box-shadow:0 6px 22px rgba(108,99,255,.65); }
.bottom-nav-fab:active { transform:scale(0.94); }

/* ── BOTTOM SHEET ── */
.bottom-sheet-overlay {
    position:fixed; inset:0; background:rgba(0,0,0,.65);
    z-index:400; opacity:0; pointer-events:none; transition:opacity .25s;
}
.bottom-sheet-overlay.open { opacity:1; pointer-events:all; }
.bottom-sheet {
    position:fixed; bottom:0; left:0; right:0;
    background:var(--bg2); border-radius:20px 20px 0 0;
    z-index:500; transform:translateY(100%);
    transition:transform .3s cubic-bezier(.32,1,.23,1);
    max-height:92dvh; display:flex; flex-direction:column;
}
.bottom-sheet.open { transform:translateY(0); }
.bottom-sheet-handle {
    width:40px; height:4px; background:var(--border);
    border-radius:2px; margin:12px auto 4px; flex-shrink:0;
}
.bottom-sheet-header {
    display:flex; justify-content:space-between; align-items:center;
    padding:8px 20px 12px; border-bottom:1px solid var(--border); flex-shrink:0;
}
.bottom-sheet-header h3 { font-size:16px; font-weight:700; }
.bottom-sheet-content {
    overflow-y:auto; padding:16px 20px;
    padding-bottom:calc(20px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling:touch; flex:1;
}

/* ── ALTRO SHEET MENU ── */
.altro-item {
    display:flex; align-items:center; gap:14px;
    padding:15px 0; border-bottom:1px solid var(--border);
    font-size:15px; font-weight:500; color:var(--text);
    text-decoration:none; cursor:pointer; background:transparent;
    border-left:none; border-right:none; border-top:none;
    width:100%; font-family:inherit; text-align:left;
    transition:color .15s;
}
.altro-item:last-child { border-bottom:none; }
.altro-item:hover { color:var(--primary); text-decoration:none; }
.altro-item-icon { font-size:20px; flex-shrink:0; }

/* ── HERO CARD ── */
.hero-card {
    background:linear-gradient(135deg, var(--bg2) 0%, #1b1b2e 100%);
    border:1px solid var(--border); border-radius:20px;
    padding:20px; margin-bottom:14px; position:relative; overflow:hidden;
}
.hero-card::before {
    content:''; position:absolute; top:-50px; right:-50px;
    width:180px; height:180px;
    background:radial-gradient(circle, rgba(108,99,255,.18) 0%, transparent 70%);
    pointer-events:none;
}
.hero-top { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:16px; }
.hero-left { flex:1; min-width:0; }
.hero-label { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.6px; margin-bottom:4px; font-weight:600; }
.hero-amount { font-size:clamp(32px,10vw,48px); font-weight:800; line-height:1; letter-spacing:-1.5px; margin-bottom:6px; white-space:nowrap; }
.text-white { color:#fff; }
.hero-sub { font-size:12px; color:var(--muted); display:flex; gap:10px; flex-wrap:wrap; }
.hero-chart-wrap {
    flex-shrink:0; width:84px; height:84px; position:relative;
}
.hero-chart-center {
    position:absolute; inset:0;
    display:flex; align-items:center; justify-content:center; flex-direction:column;
    pointer-events:none;
}
.hero-chart-pct { font-size:15px; font-weight:800; line-height:1; }
.hero-chart-sub { font-size:8px; color:var(--muted); text-transform:uppercase; letter-spacing:.3px; }
.hero-progress-wrap { margin-top:4px; }
.hero-progress-label { display:flex; justify-content:space-between; font-size:11px; color:var(--muted); margin-bottom:5px; }
.hero-progress-bar { height:6px; background:rgba(255,255,255,.08); border-radius:99px; overflow:hidden; }
.hero-progress-fill { height:100%; border-radius:99px; transition:width .4s; }
.hero-stats { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:12px; }
.hero-stat { background:rgba(255,255,255,.04); border-radius:10px; padding:9px 12px; }
.hero-stat-label { font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:.4px; margin-bottom:2px; }
.hero-stat-value { font-size:16px; font-weight:700; }

/* ── MOBILE CATEGORY LIST ── */
.mobile-cat-section {
    background:var(--bg2); border:1px solid var(--border);
    border-radius:14px; overflow:hidden; margin-bottom:10px;
}
.mobile-cat-section-header {
    display:flex; align-items:center; gap:8px;
    padding:12px 14px; border-bottom:1px solid var(--border);
    cursor:pointer; background:transparent; width:100%;
    text-align:left; font-size:13px; font-weight:700; color:var(--text);
    border-left:none; border-right:none; border-top:none; font-family:inherit;
    transition:background .1s;
}
.mobile-cat-section-header:active { background:rgba(255,255,255,.03); }
.mobile-cat-section-title { flex:1; display:flex; align-items:center; gap:6px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mobile-cat-section-total { font-size:12px; font-weight:700; flex-shrink:0; }
.mobile-cat-section-arrow { color:var(--muted); font-size:11px; flex-shrink:0; transition:transform .2s; }
.mobile-cat-section-arrow.collapsed { transform:rotate(-90deg); }
.mobile-cat-item {
    display:flex; align-items:center; gap:10px;
    padding:11px 14px; border-bottom:1px solid var(--border);
    transition:background .1s;
}
.mobile-cat-item:last-child { border-bottom:none; }
.mobile-cat-item:active { background:rgba(255,255,255,.03); }
.mobile-cat-icon {
    width:36px; height:36px; border-radius:10px;
    background:rgba(108,99,255,.12);
    display:flex; align-items:center; justify-content:center;
    font-size:17px; flex-shrink:0;
}
.mobile-cat-body { flex:1; min-width:0; }
.mobile-cat-name { font-size:13px; font-weight:600; margin-bottom:5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mobile-cat-bar { height:4px; background:rgba(255,255,255,.08); border-radius:99px; overflow:hidden; }
.mobile-cat-bar-fill { height:100%; border-radius:99px; transition:width .3s; }
.mobile-cat-right { display:flex; flex-direction:column; align-items:flex-end; gap:3px; flex-shrink:0; min-width:68px; }
.mobile-cat-amount { font-size:16px; font-weight:800; line-height:1; }
.mobile-cat-sub { font-size:10px; color:var(--muted); }
.mobile-cat-fab {
    width:30px; height:30px; border-radius:50%;
    background:var(--primary); border:none; color:#fff;
    font-size:20px; line-height:1; cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    flex-shrink:0; box-shadow:0 2px 8px rgba(108,99,255,.4);
    transition:transform .15s; font-family:inherit;
}
.mobile-cat-fab:active { transform:scale(0.88); }

/* ── MOBILE TX FORM (bottom sheet) ── */
.mtx-tabs { display:grid; grid-template-columns:1fr 1fr 1fr; gap:5px; margin-bottom:14px; }
.mtx-tab {
    padding:10px 6px; border:1px solid var(--border);
    border-radius:10px; background:var(--bg3); color:var(--muted);
    font-size:12px; font-weight:600; cursor:pointer;
    transition:all .15s; text-align:center; font-family:inherit;
}
.mtx-tab:hover { border-color:var(--primary); color:var(--text); }
.mtx-tab-active { background:var(--primary) !important; border-color:var(--primary) !important; color:#fff !important; }
.mtx-amount-input {
    font-size:28px !important; font-weight:800 !important;
    text-align:center; padding:12px !important;
    border-radius:12px !important; letter-spacing:-0.5px;
}
.mtx-submit {
    font-size:16px; padding:15px; border-radius:14px;
    width:100%; margin-top:4px;
}

/* ── RESPONSIVE BREAKPOINTS ── */
@media (max-width:768px) {
    /* wrapper contenuto mobile → colonna singola */
    .mobile-only               { display:block !important; }
    /* eccezioni: elementi che devono restare flex */
    .mobile-topbar.mobile-only { display:flex !important; }
    .mobile-ws-tabs.mobile-only{ display:flex !important; }
    .bottom-nav.mobile-only    { display:flex !important; }

    .desktop-only { display:none !important; }

    body { padding-bottom:72px; }
    .container { padding:12px 14px 24px; max-width:100%; }

    /* elementi desktop nascosti su mobile */
    .month-nav     { display:none !important; }
    .assign-banner { display:none !important; }

    /* Flash e alert compatti */
    .flash          { font-size:12px; padding:8px 12px; }
    .alert-negative { font-size:12px; padding:8px 12px; margin-bottom:10px; }

    /* Card border-radius mobile */
    .card { border-radius:14px; }

    /* Hero card full width */
    .hero-card { width:100%; box-sizing:border-box; }

    /* Sezioni categoria full width */
    .mobile-cat-section { width:100%; box-sizing:border-box; }
}
