/* ─────────────────────────────────────────────────────────────────────────────
   Moneto Portal — identita' visiva (stile A+C, 26-nov-2026)
   Il menu laterale laguna (sempre scuro) porta il marchio; il contenuto respira
   su una superficie chiara e usa colori pastello CON un significato:
   acqua = quanto puoi spendere, sole = entrate, pesca = uscite/avvisi, lilla = altro.
   Titoli e cifre in Bricolage Grotesque, testo in Figtree.
   ───────────────────────────────────────────────────────────────────────── */

:root {
    --lagoon: #062F3D;      /* menu laterale, blocco del saldo */
    --lagoon-2: #0B4152;
    --teal: #0077A3;        /* marchio, azioni */
    --current: #19B6D1;     /* accento chiaro */
    --foam: #F3F8F9;
    --ink: #0E2A33;
    --ink-soft: #2C4B54;
    --kelp: #2E9D4A;        /* entrate */
    --coral: #D9483F;       /* uscite */

    /* pastelli con significato (+ il loro inchiostro leggibile) */
    --aqua: #D5F3EF;  --aqua-ink: #0B6B63;
    --sun: #FFF1BF;   --sun-ink: #6B5200;
    --peach: #FFE2D3; --peach-ink: #A2431B;
    --lilac: #E7E4FF; --lilac-ink: #4B3FB0;
    --ring-track: rgba(255, 255, 255, .85);

    --surface: #FFFFFF;
    --surface-2: var(--foam);
    --line: rgba(6, 47, 61, .09);
    --line-strong: rgba(6, 47, 61, .18);
    --muted: #587580;

    --font: "Figtree", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
    --display: "Bricolage Grotesque", "Figtree", "Segoe UI", system-ui, sans-serif;
    --radius-xl: 26px;
    --radius-l: 20px;
    --radius-m: 14px;
    --radius-s: 10px;
    --shadow-soft: 0 1px 2px rgba(6, 47, 61, .04), 0 12px 32px -24px rgba(6, 47, 61, .35);
}

[data-theme="dark"] {
    --surface: #0F2630;
    --surface-2: #08191F;
    --ink: #E3F1F5;
    --ink-soft: #B9D3DA;
    --line: rgba(227, 241, 245, .09);
    --line-strong: rgba(227, 241, 245, .2);
    --muted: #8FB0BA;
    --lagoon: #04222C;
    /* pastelli scuri: stessa tinta, profondi, inchiostro chiaro */
    --aqua: #0E3B3A;  --aqua-ink: #7FE0D2;
    --sun: #3A3214;   --sun-ink: #F5D36B;
    --peach: #43251C; --peach-ink: #FFB394;
    --lilac: #262446; --lilac-ink: #B9B1FF;
    --ring-track: rgba(255, 255, 255, .12);
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -24px rgba(0, 0, 0, .8);
}

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--surface-2);
    color: var(--ink);
    font-family: var(--font);
    font-feature-settings: "tnum" 1, "lnum" 1; /* cifre allineate: e' un'app di numeri */
    -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--current); outline-offset: 2px; }

/* ── Caricamento iniziale ─────────────────────────────────────────────────── */
.portal-loading {
    height: 100vh;
    display: grid;
    place-items: center;
    background: var(--lagoon);
}
.portal-loading img { animation: portal-breathe 1.4s ease-in-out infinite alternate; }
@keyframes portal-breathe { from { opacity: .4; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }

/* ── Accesso: palcoscenico + modulo ───────────────────────────────────────── */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    background: var(--surface);
}

.auth-stage {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(120% 80% at 10% 110%, rgba(25, 182, 209, .28), transparent 60%),
        radial-gradient(90% 70% at 100% 0%, rgba(0, 119, 163, .45), transparent 65%),
        var(--lagoon);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 56px;
    isolation: isolate;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -.01em;
    color: #fff;
    text-decoration: none;
}

/* La corrente: due nastri che scorrono e si intrecciano (entrate e uscite, tu e chi vive con te). */
.auth-flow {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}
.auth-flow svg { position: absolute; left: 0; width: 200%; height: 100%; }
.flow-a { top: 6%; animation: flow 26s linear infinite; }
.flow-b { top: 18%; animation: flow 38s linear infinite reverse; opacity: .8; }
.flow-c { top: 30%; animation: flow 52s linear infinite; opacity: .5; }
@keyframes flow { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.auth-claim { max-width: 600px; }
.auth-claim h1 {
    font-size: clamp(40px, 4.6vw, 68px);
    line-height: .98;
    letter-spacing: -.035em;
    font-weight: 800;
    font-stretch: 112%;
    margin: 0 0 20px;
    text-wrap: balance;
}
.auth-claim p {
    font-size: 17px;
    line-height: 1.55;
    max-width: 38ch;
    margin: 0;
    color: rgba(255, 255, 255, .78);
}

.auth-panel {
    display: flex;
    flex-direction: column;
    padding: 32px 48px;
    background: var(--surface);
}
.auth-panel-top { display: flex; justify-content: flex-end; }
.auth-form {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    max-width: 400px;
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.auth-form h2 {
    font-size: 30px;
    font-weight: 750;
    letter-spacing: -.02em;
    margin: 0;
}
.auth-form .lead { color: var(--muted); margin: -8px 0 6px; line-height: 1.5; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.auth-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.auth-providers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.provider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 44px;
    border-radius: var(--radius-m);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font: 600 14px var(--font);
    text-decoration: none;
    transition: border-color .15s, background .15s;
}
.provider:hover { border-color: var(--teal); background: var(--surface-2); }
.provider svg { width: 18px; height: 18px; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-submit { height: 46px; font-size: 15px; }
.auth-alt { text-align: center; color: var(--muted); font-size: 14px; }
.auth-alt a, .auth-link { color: var(--teal); font-weight: 600; text-decoration: none; }
[data-theme="dark"] .auth-alt a, [data-theme="dark"] .auth-link { color: var(--current); }
.auth-legal {
    display: flex;
    gap: 18px;
    justify-content: center;
    font-size: 12px;
}
.auth-legal a { color: var(--muted); text-decoration: none; }

.notice {
    border-radius: var(--radius-m);
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.45;
    border: 1px solid transparent;
}
.notice-error { background: rgba(229, 72, 77, .08); border-color: rgba(229, 72, 77, .35); color: #B4232A; }
.notice-ok { background: rgba(46, 157, 74, .08); border-color: rgba(46, 157, 74, .35); color: #1E6E33; }
[data-theme="dark"] .notice-error { color: #FF9A9E; }
[data-theme="dark"] .notice-ok { color: #8BE0A2; }
.notice-info { background: rgba(25, 182, 209, .10); border-color: rgba(25, 182, 209, .40); color: #0B5F7A; }
[data-theme="dark"] .notice-info { color: #8FDDEB; }

.otp input { letter-spacing: .5em; font-size: 22px; text-align: center; }

@media (max-width: 900px) {
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth-stage { min-height: 240px; padding: 28px 24px; }
    .auth-claim h1 { font-size: 40px; }
    .auth-claim p { display: none; }
    .auth-panel { padding: 24px 20px 32px; }
}

/* ── Struttura dell'app ───────────────────────────────────────────────────── */
.shell-header {
    display: flex;
    flex: 1;
    min-width: 0;
    align-items: center;
    gap: 12px;
    height: 100%;
    padding: 0 16px;
    background: var(--lagoon);
    color: #fff;
}
.shell-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -.01em;
}
.shell-beta {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(25, 182, 209, .22);
    color: #9FE6F2;
}
.shell-spacer { flex: 1; }
.shell-icon-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
}
.shell-icon-btn:hover { background: rgba(255, 255, 255, .10); }
.shell-lang {
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .18);
    background: transparent;
    color: #fff;
    font: 500 13px var(--font);
    padding: 0 8px;
}
.shell-lang option { color: #000; }

.portal-content {
    padding: 32px clamp(16px, 3vw, 40px);
    max-width: 1320px;
}

.welcome h1 {
    font-size: clamp(30px, 3.4vw, 44px);
    letter-spacing: -.03em;
    font-weight: 800;
    margin: 0 0 8px;
}
.welcome p { color: var(--muted); max-width: 60ch; line-height: 1.55; margin: 0 0 24px; }

/* ── Errori Blazor ────────────────────────────────────────────────────────── */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 12px 16px;
    background: #fde7e9;
    color: #a80000;
    z-index: 1000;
}
#blazor-error-ui .reload, #blazor-error-ui .dismiss { margin-left: 12px; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
    .flow-a, .flow-b, .flow-c, .portal-loading img { animation: none; }
}

/* ── Selettore lingua sul modulo di accesso ───────────────────────────────── */
.auth-lang {
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font: 500 13px var(--font);
    padding: 0 8px;
}

/* ── Menu del profilo ─────────────────────────────────────────────────────── */
.profile { position: relative; }
.profile-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(25, 182, 209, .7);
    background: linear-gradient(135deg, var(--teal), var(--current));
    color: #fff;
    font: 700 13px var(--font);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
}
.profile-btn img { width: 100%; height: 100%; object-fit: cover; }
.profile-scrim { position: fixed; inset: 0; z-index: 40; }
.profile-card {
    position: absolute;
    right: 0;
    top: 44px;
    z-index: 50;
    min-width: 240px;
    padding: 8px;
    border-radius: var(--radius-m);
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px -12px rgba(6, 47, 61, .35);
    display: flex;
    flex-direction: column;
}
.profile-who { display: flex; flex-direction: column; padding: 8px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.profile-who span { color: var(--muted); font-size: 13px; }
.profile-card a, .profile-card button {
    text-align: left;
    padding: 9px 10px;
    border-radius: var(--radius-s);
    border: 0;
    background: transparent;
    color: inherit;
    font: 500 14px var(--font);
    text-decoration: none;
    cursor: pointer;
}
.profile-card a:hover, .profile-card button:hover { background: var(--surface-2); }

/* Il titolo riceve il focus a ogni navigazione (accessibilita'): niente riquadro visibile. */
h1:focus, h2:focus { outline: none; }

/* Campi Fluent intonati alla laguna nel tema scuro (e alla schiuma nel chiaro). */
[data-theme="dark"] {
    --colorNeutralBackground1: #0D2530;
    --colorNeutralBackground1Hover: #12303D;
    --colorNeutralBackground1Pressed: #0A1F28;
    --colorNeutralBackground2: #0A2029;
    --colorNeutralBackground3: #071C25;
    --colorNeutralBackground4: #06202A;
    --colorNeutralStroke1: rgba(227, 241, 245, .18);
    --colorNeutralStrokeAccessible: rgba(227, 241, 245, .45);
    --colorNeutralForeground1: #E3F1F5;
    --colorNeutralForeground2: #B9D3DA;
}
.auth-panel fluent-text-input, .auth-panel fluent-field { width: 100%; }

/* ── Dashboard: la marea in alto, i dettagli sotto ────────────────────────── */
.neg { color: var(--coral); }
.pos { color: var(--kelp); }

.tide {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    margin: -8px 0 28px;
    padding: 32px 36px 30px;
    border-radius: var(--radius-l);
    color: #fff;
    background:
        radial-gradient(80% 120% at 100% 0%, rgba(25, 182, 209, .35), transparent 60%),
        linear-gradient(160deg, var(--lagoon-2), var(--lagoon));
}
.tide-flow { position: absolute; inset: auto 0 0 0; height: 70%; z-index: -1; opacity: .55; }
.tide-flow svg { width: 100%; height: 100%; }
.tide-ribbon { fill: none; stroke-linecap: round; }
.tide-ribbon-a { stroke: var(--current); stroke-width: 2; opacity: .8; }
.tide-ribbon-b { stroke: #fff; stroke-width: 1; opacity: .35; }

.tide-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.tide-top h1 { margin: 0; font-size: clamp(26px, 2.6vw, 34px); font-weight: 800; letter-spacing: -.025em; }
.tide-top p { margin: 4px 0 0; color: rgba(255, 255, 255, .7); }
.tide-select {
    height: 38px;
    min-width: 200px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .22);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font: 500 14px var(--font);
    padding: 0 10px;
}
.tide-select option { color: #000; }

.tide-figures { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 32px; margin-top: 28px; align-items: end; }
.tide-label { display: block; color: rgba(255, 255, 255, .72); font-size: 14px; }
.tide-balance strong {
    display: block;
    font-size: clamp(40px, 4.4vw, 60px);
    font-weight: 800;
    letter-spacing: -.035em;
    font-stretch: 108%;
    line-height: 1.05;
    margin: 6px 0;
}
.tide-balance strong.neg { color: #FFB3B5; }
.tide-sub { color: rgba(255, 255, 255, .6); font-size: 13px; }

.tide-streams { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.stream { padding: 4px 20px; border-left: 1px solid rgba(255, 255, 255, .16); display: flex; flex-direction: column; gap: 4px; }
.stream span { color: rgba(255, 255, 255, .7); font-size: 13px; }
.stream strong { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.stream em { font-style: normal; font-size: 12px; color: rgba(255, 255, 255, .62); line-height: 1.4; }
.stream-in strong { color: #8BE0A2; }
.stream-out strong { color: #9FE6F2; }
.stream-spend strong.neg { color: #FFB3B5; }

.dash-loading { display: grid; place-items: center; padding: 60px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.dash-main, .dash-side { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

/* Pannelli: superficie piatta e una linea sottile, nessuna ombra uguale ovunque. */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.panel h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.panel-note { color: var(--muted); font-size: 13px; }
.panel-link { color: var(--teal); font-size: 13px; font-weight: 600; text-decoration: none; }
[data-theme="dark"] .panel-link { color: var(--current); }
.empty { color: var(--muted); margin: 6px 0; }

.panel-net h2 { margin-bottom: 8px; }
.panel-net strong { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.panel-net span { color: var(--muted); font-size: 13px; }

.flowchart svg { width: 100%; height: 220px; display: block; }
.fc-grid { stroke: var(--line); stroke-width: 1; }
.fc-line { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.fc-line-in { stroke: var(--kelp); }
.fc-line-out { stroke: var(--current); }
.fc-cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.fc-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.fc-in { color: var(--kelp); font-weight: 600; }
.fc-out { color: var(--current); font-weight: 600; }
.fc-legend { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 8px; }
.dot-in { background: var(--kelp); }
.dot-out { background: var(--current); }

.tx-list { list-style: none; margin: 0; padding: 0; }
.tx-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.tx-list li:first-child { border-top: 0; }
.tx-text { display: flex; flex-direction: column; min-width: 0; }
.tx-text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-text span { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amount { font-weight: 700; white-space: nowrap; }
.tx-list.compact li { padding: 8px 0; }

.cat-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    border-radius: 50%;
    color: var(--c);
    background: color-mix(in srgb, var(--c) 16%, transparent);
    vertical-align: middle;
}

.meter-row { padding: 8px 0; }
.meter-label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 6px; }
.meter-label span:first-child { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.meter-label span:last-child { color: var(--muted); white-space: nowrap; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter.thin { height: 5px; }
.meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--teal), var(--current)); }
.meter i.warn { background: #E8A33D; }
.meter i.over { background: var(--coral); }
.meter i.pos { background: var(--kelp); }

.goal { display: flex; align-items: center; gap: 16px; }
.goal div:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.goal span { color: var(--muted); font-size: 13px; }
.ring {
    --p: 0;
    width: 64px; height: 64px; flex: none;
    border-radius: 50%;
    display: grid; place-items: center;
    background: conic-gradient(var(--current) calc(var(--p) * 1%), var(--surface-2) 0);
    position: relative;
}
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; font-size: 13px; font-weight: 700; color: var(--ink) !important; }

@media (max-width: 1100px) {
    .dash-grid { grid-template-columns: minmax(0, 1fr); }
    .tide-figures { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 640px) {
    .tide { padding: 24px 20px; }
    .tide-streams { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .stream { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .16); padding: 10px 0 0; }
}

/* ── Pagine: intestazione, filtri, registro, pannello laterale ────────────── */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: clamp(28px, 2.6vw, 36px); font-weight: 800; letter-spacing: -.03em; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.field-search { position: relative; flex: 1 1 240px; display: flex; align-items: center; }
.field-search i { position: absolute; left: 12px; color: var(--muted); }
.field-search input { padding-left: 36px; width: 100%; }
.filters input, .filters select, .field input, .field select, .field textarea {
    height: 38px;
    box-sizing: border-box;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font: 500 14px var(--font);
    padding: 0 10px;
}
.field textarea { height: auto; padding: 8px 10px; resize: vertical; }
.filters input:focus, .filters select:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--current); outline-offset: 0; border-color: transparent; }
.field-select { min-width: 160px; }
.field-date { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
[data-theme="dark"] input[type="date"] { color-scheme: dark; }

.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.seg-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    font: 600 14px var(--font);
    padding: 8px 14px;
    border-radius: 9px;
    cursor: pointer;
}
.seg-btn.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(6, 47, 61, .12); }
.seg-btn:disabled { opacity: .45; cursor: default; }
.seg-expense.on { color: var(--coral); }
.seg-income.on { color: var(--kelp); }
.seg-transfer.on { color: var(--teal); }
.seg-small .seg-btn { padding: 6px 12px; font-size: 13px; }

.totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.totals div { padding: 14px 18px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.totals div:first-child { border-left: 0; }
.totals span { color: var(--muted); font-size: 13px; }
.totals strong { font-size: 19px; font-weight: 750; }

.ledger { display: flex; flex-direction: column; gap: 18px; }
.ledger-day header {
    display: flex;
    justify-content: space-between;
    padding: 0 4px 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid var(--line);
}
.ledger-day .tx-list { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-m) var(--radius-m); padding: 0 16px; }
.tx-row { cursor: pointer; }
.tx-row:hover .tx-text strong, .tx-row:focus-visible .tx-text strong { color: var(--teal); }
[data-theme="dark"] .tx-row:hover .tx-text strong { color: var(--current); }

.empty-state { text-align: center; padding: 56px 20px; }
.empty-state i { font-size: 44px; color: var(--current); }
.empty-state h2 { margin: 10px 0 6px; font-size: 20px; }
.empty-state p { color: var(--muted); margin: 0 0 18px; }

.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 22px 0 8px; color: var(--muted); }

.drawer-scrim { position: fixed; inset: 0; background: rgba(6, 47, 61, .45); z-index: 80; animation: fade .15s ease-out; }
.drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(460px, 100vw);
    z-index: 90;
    background: var(--surface);
    color: var(--ink);
    display: flex;
    flex-direction: column;
    box-shadow: -24px 0 48px -24px rgba(6, 47, 61, .5);
    animation: slide-in .2s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 20px; font-weight: 750; }
.drawer-x { border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; border-radius: 8px; width: 36px; height: 36px; }
.drawer-x:hover { background: var(--surface-2); }
.drawer-body { flex: 1; overflow: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.drawer-foot { display: flex; gap: 8px; align-items: center; padding-top: 12px; margin-top: auto; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-amount input { height: 54px; font-size: 26px; font-weight: 750; letter-spacing: -.01em; }
.btn-danger-text { color: var(--coral) !important; }
.btn-danger { color: var(--coral) !important; border-color: var(--coral) !important; }

@media (max-width: 760px) {
    .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .totals div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
    .totals div:nth-child(4) { border-top: 1px solid var(--line); }
    .field-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-scrim { animation: none; } }

/* ── Portafogli: carte vere, col loro colore ──────────────────────────────── */
.worth { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.worth span { color: var(--muted); font-size: 14px; }
.worth strong { display: block; font-size: clamp(30px, 3vw, 40px); font-weight: 800; letter-spacing: -.03em; }

.wallet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.wcard {
    --wc: #0077A3;
    position: relative;
    aspect-ratio: 1.586; /* proporzioni di una carta di pagamento */
    border-radius: 18px;
    color: #fff;
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .22), transparent 55%),
        linear-gradient(145deg, color-mix(in srgb, var(--wc) 88%, #fff 12%), color-mix(in srgb, var(--wc) 70%, #000 30%));
    box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--wc) 80%, #000 20%);
    overflow: hidden;
}
.wcard::after { /* la corrente del marchio, discreta, su ogni carta */
    content: "";
    position: absolute;
    inset: auto -10% -35% -10%;
    height: 70%;
    border-radius: 50%;
    border-top: 2px solid rgba(255, 255, 255, .22);
    pointer-events: none;
}
.wcard.archived { filter: grayscale(.85); opacity: .75; }
.wcard-main {
    all: unset;
    box-sizing: border-box;
    cursor: pointer;
    position: absolute;
    inset: 0;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
}
.wcard-main:focus-visible { outline: 3px solid #fff; outline-offset: -6px; border-radius: 18px; }
.wcard-top { display: flex; align-items: center; gap: 12px; }
.wcard-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .18); font-size: 20px; }
.wcard-name { display: flex; flex-direction: column; min-width: 0; }
.wcard-name strong { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard-name em { font-style: normal; font-size: 13px; opacity: .8; }
.wcard-group { margin-left: auto; opacity: .85; }
.wcard-balance { margin-top: auto; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.wcard-meta { font-size: 12px; opacity: .75; margin-top: 2px; }
.wcard-edit {
    position: absolute;
    right: 12px; bottom: 12px;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .2);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
}
.wcard-edit:hover { background: rgba(255, 255, 255, .32); }
.wcard.preview { aspect-ratio: auto; height: 170px; flex: none; }
.wcard.preview .wcard-main { cursor: default; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: var(--sw); cursor: pointer; }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, 38px); gap: 6px; }
.emoji { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: var(--surface-2); font-size: 18px; cursor: pointer; }
.emoji.on { border-color: var(--current); background: color-mix(in srgb, var(--current) 18%, transparent); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--teal); }

/* ── Movimenti: azioni, selezione multipla, import, allegati ──────────────── */
.head-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.page-notice { margin-bottom: 14px; }
.field-sort { min-width: 130px; }
.batch-bar {
    position: sticky;
    top: 8px;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
    border-radius: var(--radius-m);
    background: var(--lagoon);
    color: #fff;
}
.batch-bar select { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .25); }
.batch-bar option { color: #000; }
.tx-check { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; }
.tx-check.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.tx-row.picked { background: color-mix(in srgb, var(--current) 8%, transparent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.dropzone {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    border: 1.5px dashed color-mix(in srgb, var(--current) 55%, transparent);
    border-radius: var(--radius-m);
    color: var(--muted);
    cursor: pointer;
}
.dropzone.small { padding: 12px 14px; }
.dropzone i { font-size: 22px; color: var(--current); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone:hover { background: var(--surface-2); }
.import-errors { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; max-height: 260px; overflow: auto; }
.attachments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attachments li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.att-thumb { width: 52px; height: 52px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); overflow: hidden; display: grid; place-items: center; cursor: pointer; padding: 0; color: var(--muted); font-size: 22px; }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* ── Barra in alto: ricerca globale e "+" ─────────────────────────────────── */
.gsearch { position: relative; display: flex; align-items: center; width: min(420px, 40vw); margin-left: 12px; }
.gsearch > i { position: absolute; left: 12px; color: rgba(255, 255, 255, .6); pointer-events: none; }
.gsearch input {
    width: 100%;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font: 500 14px var(--font);
    padding: 0 64px 0 36px;
}
.gsearch input::placeholder { color: rgba(255, 255, 255, .55); }
.gsearch input:focus { outline: 2px solid var(--current); outline-offset: 0; background: rgba(255, 255, 255, .12); }
.gsearch kbd { position: absolute; right: 10px; font: 600 11px var(--font); color: rgba(255, 255, 255, .55); border: 1px solid rgba(255, 255, 255, .2); border-radius: 6px; padding: 1px 6px; }
.gsearch-pop {
    position: absolute;
    top: 44px; left: 0; right: 0;
    z-index: 60;
    max-height: 70vh;
    overflow: auto;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    box-shadow: 0 20px 44px -16px rgba(6, 47, 61, .45);
    padding: 6px;
}
.gsearch-group { font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 10px 4px; }
.gsearch-hit { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.gsearch-hit:hover, .gsearch-hit:focus-visible { background: var(--surface-2); }
.gsearch-text { display: flex; flex-direction: column; min-width: 0; }
.gsearch-text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gsearch-text span { font-size: 12px; color: var(--muted); }
.gsearch-empty { padding: 18px; text-align: center; color: var(--muted); }
.shell-add {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(135deg, var(--teal), var(--current));
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 6px 16px -6px rgba(25, 182, 209, .8);
}
.shell-add:hover { filter: brightness(1.08); }
@media (max-width: 760px) { .gsearch kbd { display: none; } .gsearch { width: auto; flex: 1; margin-left: 4px; } .gsearch input { padding-right: 10px; } }


/* ── Benvenuto ────────────────────────────────────────────────────────────── */
.onb-scrim { position: fixed; inset: 0; z-index: 100; background: rgba(6, 47, 61, .55); backdrop-filter: blur(2px); }
.onb {
    position: fixed;
    z-index: 101;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    box-sizing: border-box;
    padding: 28px;
    border-radius: var(--radius-l);
    background: var(--surface);
    color: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 30px 60px -20px rgba(6, 47, 61, .55);
}
.onb h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.onb p { margin: 0; color: var(--muted); line-height: 1.5; }
.onb footer { display: flex; justify-content: flex-end; margin-top: 6px; }
.onb-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.onb-steps i { height: 4px; border-radius: 4px; background: var(--surface-2); }
.onb-steps i.on { background: linear-gradient(90deg, var(--teal), var(--current)); }


/* ── Campanella ───────────────────────────────────────────────────────────── */
.bell { position: relative; }
.bell .shell-icon-btn { position: relative; }
.bell-badge {
    position: absolute;
    top: 2px; right: 0;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 9px;
    background: var(--coral);
    color: #fff;
    font: 700 11px/18px var(--font);
    text-align: center;
}
.bell-pop {
    position: absolute;
    right: 0; top: 44px;
    z-index: 50;
    width: min(360px, calc(100vw - 24px));
    padding: 8px;
    border-radius: var(--radius-m);
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px -12px rgba(6, 47, 61, .35);
    display: flex;
    flex-direction: column;
}
.bell-pop header { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 10px; border-bottom: 1px solid var(--line); }
.as-btn { border: 0; background: transparent; cursor: pointer; font-family: var(--font); }
.bell-empty { padding: 16px 8px; margin: 0; }
.bell-item { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 8px; cursor: pointer; }
.bell-item:hover { background: var(--surface-2); }
.bell-item strong { font-weight: 600; font-size: 14px; }
.bell-item span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bell-item em { font-style: normal; font-size: 12px; color: var(--muted); }
.bell-item.unread strong::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--current); margin-right: 6px; vertical-align: middle; }
.bell-all { text-align: center; padding: 10px; color: var(--teal); font-weight: 600; font-size: 13px; text-decoration: none; border-top: 1px solid var(--line); margin-top: 4px; }
[data-theme="dark"] .bell-all { color: var(--current); }


/* Importi grandi: si rimpiccioliscono con il riquadro invece di andare a capo o tagliarsi. */
.stream, .totals div { container-type: inline-size; }
.stream strong { font-size: clamp(15px, 13cqi, 22px); white-space: nowrap; }
.totals strong { font-size: clamp(14px, 12cqi, 19px); white-space: nowrap; }

/* Intestazioni di pagina: le azioni vanno sotto il titolo quando non ci stanno. */
.page-head { flex-wrap: wrap; }
.head-actions { justify-content: flex-end; }
@media (max-width: 1100px) { .head-actions { width: 100%; justify-content: flex-start; } }


/* ══ Passaggio "wow" ══════════════════════════════════════════════════════ */

/* Menu laterale: superficie pulita (chiaro) / laguna (scuro) invece del grigio di serie. */
:root { --nav-bg: #FFFFFF; --nav-hover: #EEF7F9; }
[data-theme="dark"] { --nav-bg: #071C25; --nav-hover: #0D2530; }

/* Ricerca: il tasto "Ctrl K" leggibile anche nel tema chiaro (la barra resta laguna). */
.gsearch kbd { background: transparent; }

/* Marea viva: i nastri scorrono lenti, come nella schermata d'accesso. */
.tide-flow { overflow: hidden; }
.tide-wave { position: absolute; left: 0; bottom: 0; width: 200%; height: 100%; }
.tide-wave-a { animation: flow 30s linear infinite; }
.tide-wave-b { animation: flow 46s linear infinite reverse; }

/* Dissolvenza di pagina. */
.page-enter { animation: page-in .22s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Sagome di caricamento al posto della rotellina, in tutte le pagine. */
.dash-loading { display: grid; gap: 14px; padding: 8px 0 24px; place-items: stretch; }
.dash-loading fluent-spinner { display: none; }
.dash-loading::before, .dash-loading::after {
    content: "";
    display: block;
    border-radius: var(--radius-m);
    background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
    background-size: 300% 100%;
    border: 1px solid var(--line);
    animation: shimmer 1.3s ease-in-out infinite;
}
.dash-loading::before { height: 140px; }
.dash-loading::after { height: 320px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Conferme in basso. */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 18px;
    border-radius: 999px;
    background: var(--lagoon);
    color: #fff;
    font: 600 14px var(--font);
    box-shadow: 0 14px 34px -12px rgba(6, 47, 61, .6);
    animation: toast-in .25s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.ok i { color: #8BE0A2; font-size: 18px; }
.toast.err { background: #8E1F24; }
.toast.err i { color: #FFB3B5; font-size: 18px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    .tide-wave-a, .tide-wave-b, .page-enter, .toast, .dash-loading::before, .dash-loading::after { animation: none; }
}


/* ── Finestra Pro ─────────────────────────────────────────────────────────── */
.paywall { text-align: center; align-items: center; }
.paywall-crown {
    width: 64px; height: 64px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 30px; color: #fff;
    background: linear-gradient(135deg, var(--teal), var(--current));
    box-shadow: 0 12px 28px -10px rgba(25, 182, 209, .7);
}
.paywall-feats { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.paywall-feats li { display: flex; align-items: center; gap: 10px; }
.paywall-feats i { color: var(--current); font-size: 18px; }
.paywall footer { justify-content: center; gap: 8px; width: 100%; }


/* ══ Strisce di stato, versione, errore di pagina, tema nel menu ══════════ */
.shell-banner {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 16px; padding: 10px 14px;
    border-radius: var(--radius-m);
    font-size: 14px;
    animation: page-in .22s ease-out;
}
.shell-banner > i { font-size: 18px; flex: none; }
.shell-banner > span { flex: 1; min-width: 0; }
.shell-banner.offline { background: #3A1518; color: #FFD7D8; border: 1px solid #8E1F24; }
.shell-banner.email { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
[data-theme="dark"] .shell-banner.email { background: #3B2A0A; color: #FCD98A; border-color: #6B4E12; }
.shell-banner-link { background: none; border: 0; padding: 0 0 0 6px; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.shell-banner-x { background: none; border: 0; color: inherit; cursor: pointer; padding: 4px; border-radius: 6px; font-size: 16px; }
.shell-banner-x:hover { background: rgba(0,0,0,.08); }

.nav-version { padding: 12px 20px 18px; font-size: 12px; color: var(--muted); }

.page-error { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 64px 16px; }
.page-error i { font-size: 48px; color: var(--coral); }
.page-error h2 { margin: 0; }
.page-error p { margin: 0 0 8px; color: var(--muted); max-width: 46ch; }

.profile-theme { display: flex; gap: 4px; padding: 6px 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 4px 0; }
.profile-theme button { flex: 1; display: grid; place-items: center; height: 34px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; font-size: 18px; }
.profile-theme button:hover { background: var(--surface-2); color: var(--ink); }
.profile-theme button.on { border-color: var(--current); color: var(--teal); background: var(--surface-2); }

/* Colonna del menu: stessa superficie del menu fino in fondo (niente fascia grigia sotto). */


/* La barra in alto non deve tagliare i suoi menu a tendina (profilo, campanella,
   risultati della ricerca): Fluent le mette overflow:hidden. */


/* Tasti del pannello sempre visibili in fondo, anche quando il modulo e' lungo
   (portafogli con tutte le icone: "Salva" finiva sotto il bordo). */
.drawer-foot {
    position: sticky; bottom: -20px; z-index: 2;
    margin: auto -24px -20px; padding: 12px 24px 20px;
    background: var(--surface);
    border-top: 1px solid var(--line);
}
.att-name-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.att-name-btn:hover { color: var(--teal); text-decoration: underline; }


/* ══════════════════════════════════════════════════════════════════════════
   STILE A+C (26-nov-2026): menu laterale laguna, niente barra in alto,
   barra in basso sul telefono. Le regole qui sotto vincono su quelle vecchie.
   ══════════════════════════════════════════════════════════════════════════ */

h1, h2, h3, .page-head h1 { font-family: var(--display); }
body { font-family: var(--font); }

.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; background: var(--surface-2); }
.shell-main { min-width: 0; display: flex; flex-direction: column; }
.portal-content { width: 100%; max-width: 1280px; padding: 30px clamp(16px, 3vw, 44px) 56px; }

/* ── Menu laterale ─────────────────────────────────────────────────────── */
.side {
    position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain;
    background: var(--lagoon); color: #CFE6EC;
    padding: 20px 14px 14px; display: flex; flex-direction: column; gap: 14px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 4px; color: #fff; text-decoration: none; font: 800 24px/1 var(--display); letter-spacing: -.035em; }
.side-brand img { flex: none; }
.side-brand .shell-beta { margin-left: auto; }

.side .gsearch { width: 100%; margin: 0; }
.side .gsearch input { height: 40px; border-radius: 12px; background: rgba(255,255,255,.07); border-color: transparent; }
.side .gsearch-pop { position: fixed; top: 16px; left: 276px; right: auto; width: min(460px, calc(100vw - 300px)); max-height: calc(100vh - 32px); z-index: 70; }

.side-add {
    width: 100%; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--current); color: #03222C; font: 700 15px var(--font); box-shadow: 0 10px 24px -14px rgba(25, 182, 209, .9);
}
.side-add i { font-size: 18px; }
.side-add:hover { filter: brightness(1.06); }

.side-nav { display: grid; gap: 2px; }
.side-nav a {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px;
    color: #B3D2DA; text-decoration: none; font-weight: 500; font-size: 15px; transition: background .15s, color .15s;
}
.side-nav a i { font-size: 20px; color: #7FA9B5; transition: color .15s; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a:hover i { color: #CFE6EC; }
.side-nav a.on { background: rgba(255,255,255,.10); color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 var(--current); }
.side-nav a.on i { color: var(--current); }
.side-group { margin: 12px 12px 4px; font-size: 12px; color: #6F98A4; }

.side-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.side-tools { display: flex; align-items: center; gap: 4px; }
.side-tools .shell-lang { margin-left: auto; max-width: 128px; }
.side-version { font-size: 11px; color: #5E8794; padding: 0 10px; }

/* Il menu scorre (overflow), quindi le sue tendine si aprono FUORI, accanto al menu:
   altrimenti verrebbero tagliate come succedeva con la vecchia barra in alto. */
.side .bell-pop { position: fixed; top: auto; bottom: 16px; left: 276px; right: auto; z-index: 70; }
.side .profile-card { position: fixed; top: auto; bottom: 16px; left: 276px; right: auto; width: 260px; z-index: 70; }

.profile-trigger { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; cursor: pointer; border-radius: 12px; }
.profile-trigger:focus-visible { outline: 2px solid var(--current); outline-offset: 2px; }
.profile-trigger.wide { width: 100%; padding: 8px 10px; background: rgba(255,255,255,.06); }
.profile-trigger.wide:hover { background: rgba(255,255,255,.1); }
.profile-btn { display: grid; place-items: center; flex: none; }
.profile-name { display: grid; min-width: 0; line-height: 1.25; color: #fff; }
.profile-name strong { font-weight: 600; font-size: 14px; }
.profile-name span { color: #8FB7C2; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-trigger .ti-selector { margin-left: auto; color: #7FA9B5; }
.profile-wide { width: 100%; }

/* ── Telefono: barra in alto leggera + barra in basso ─────────────────── */
.mobile-top, .tabbar { display: none; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

@media (max-width: 900px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .side { display: none; }
    .mobile-top {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        position: sticky; top: 0; z-index: 30;
        padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
        background: color-mix(in srgb, var(--surface-2) 88%, transparent);
        backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    }
    .mobile-brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font: 800 21px var(--display); letter-spacing: -.03em; }
    .mobile-tools { display: flex; align-items: center; gap: 6px; }
    .mobile-tools .shell-icon-btn { color: var(--ink); }
    .mobile-tools .shell-icon-btn:hover { background: var(--surface); }
    .mobile-tools .bell-pop, .mobile-tools .profile-card { right: 0; left: auto; top: 46px; }
    .portal-content { padding: 6px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }

    .tabbar {
        display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
        background: var(--surface); border-top: 1px solid var(--line);
        box-shadow: 0 -10px 30px -24px rgba(6, 47, 61, .5);
    }
    .tabbar > a, .tabbar > button:not(.tab-add) {
        all: unset; box-sizing: border-box; cursor: pointer;
        display: grid; justify-items: center; gap: 2px; padding: 6px 2px;
        color: var(--muted); font: 500 11px var(--font); text-align: center; min-width: 0;
    }
    .tabbar > a span, .tabbar > button:not(.tab-add) span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
    .tabbar i { font-size: 22px; }
    .tabbar > a.on, .tabbar > button.on { color: var(--teal); font-weight: 700; }
    [data-theme="dark"] .tabbar > a.on, [data-theme="dark"] .tabbar > button.on { color: var(--current); }
    .tab-add {
        justify-self: center; width: 56px; height: 56px; margin-top: -26px; border-radius: 50%; border: 0; cursor: pointer;
        display: grid; place-items: center; background: var(--teal); color: #fff;
        box-shadow: 0 12px 26px -10px rgba(0, 119, 163, .8), 0 0 0 5px var(--surface);
    }
    .tab-add i { font-size: 26px; }

    .sheet-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(4, 25, 32, .45); animation: fade .2s ease-out; }
    .sheet {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 81; max-height: 82vh; overflow-y: auto;
        background: var(--surface); color: var(--ink); border-radius: 28px 28px 0 0;
        padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
        display: grid; gap: 16px; animation: sheet-up .25s cubic-bezier(.2, .9, .3, 1);
    }
    .sheet-grip { justify-self: center; width: 40px; height: 5px; border-radius: 5px; background: var(--line-strong); }
    .sheet .gsearch { width: 100%; margin: 0; }
    .sheet .gsearch > i { color: var(--muted); }
    .sheet .gsearch input { height: 44px; color: var(--ink); background: var(--surface-2); border-color: var(--line); border-radius: 14px; }
    .sheet .gsearch input::placeholder { color: var(--muted); }
    .sheet .gsearch-pop { top: 50px; }
    .sheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .sheet-grid a {
        display: grid; justify-items: center; gap: 6px; padding: 14px 6px; border-radius: 18px; text-align: center;
        background: var(--surface-2); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600;
    }
    .sheet-grid a i { font-size: 24px; color: var(--teal); }
    [data-theme="dark"] .sheet-grid a i { color: var(--current); }
    .sheet-grid a.on { background: var(--aqua); color: var(--aqua-ink); }
    .sheet-grid a.on i { color: var(--aqua-ink); }
    .sheet-foot { display: flex; gap: 10px; align-items: center; }
    .sheet-theme { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: 600 14px var(--font); cursor: pointer; }
    .sheet-foot .auth-lang { height: 44px; border-radius: 14px; flex: 1; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Avviso "c'e' l'app" (solo telefono/tablet) ───────────────────────── */
.store-banner {
    display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
    margin: calc(env(safe-area-inset-top, 0px) + 10px) 16px 0; padding: 10px 8px 10px 12px;
    border-radius: 20px; background: var(--lagoon); color: #fff;
    box-shadow: 0 14px 30px -20px rgba(6, 47, 61, .8);
    animation: page-in .3s ease-out;
}
.store-logo { width: 42px; height: 42px; border-radius: 12px; background: #fff; display: grid; place-items: center; }
.store-text { display: grid; min-width: 0; line-height: 1.3; }
.store-text strong { font-size: 14px; }
.store-text span { font-size: 12px; color: #9CC6D1; }
.store-get { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; background: var(--current); color: #03222C; font-weight: 700; font-size: 13px; text-decoration: none; white-space: nowrap; }
.store-x { border: 0; background: transparent; color: #8FB7C2; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 18px; }
.store-x:hover { background: rgba(255,255,255,.08); color: #fff; }
@media (max-width: 380px) { .store-text span { display: none; } }
@media (min-width: 901px) { .store-banner { margin: 16px clamp(16px, 3vw, 44px) 0; max-width: 1192px; } }

/* ── Pezzi comuni: piu' morbidi e con piu' carattere ──────────────────── */
.page-head h1 { font-weight: 700; letter-spacing: -.025em; }
.panel {
    border-radius: var(--radius-l) !important;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}
.panel-head h2, .panel h2 { font-family: var(--display); font-weight: 700; letter-spacing: -.01em; }
.panel-link { font-weight: 600; }
.seg { border-radius: 999px; }
.seg-btn { border-radius: 999px; }
.drawer { border-radius: 28px 0 0 28px; }
.drawer-head h2 { font-family: var(--display); }
@media (max-width: 600px) {
    .drawer { border-radius: 28px 28px 0 0; top: auto; left: 0; right: 0; height: 92vh; height: 92dvh; width: auto; animation: sheet-up .25s cubic-bezier(.2, .9, .3, 1); }
}
.toast { font-family: var(--font); }
.toasts { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 900px) { .toasts { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); } }
.shell-banner { border-radius: var(--radius-m); }
.tx-amount.pos, .pos { color: var(--kelp); }
[data-theme="dark"] .tx-amount.pos, [data-theme="dark"] .pos { color: #6BD48A; }


/* ── Ritocchi dopo la prima occhiata (26-nov) ─────────────────────────── */
/* Il menu e' una colonna flessibile piu' alta dello schermo: senza questo il browser
   schiaccia i suoi pezzi (il tasto "Nuovo movimento" finiva alto 20 px). */
.side > * { flex-shrink: 0; }
.side { gap: 12px; }
.side-nav a { padding: 8px 12px; }
.side-group { margin-top: 8px; }

/* Contenuto centrato: niente vuoto enorme a destra sugli schermi larghi. */
.portal-content { margin-inline: auto; }

/* Selettori a tendina con lo stesso stile dei campi (prima erano quelli grezzi del browser). */
select.field-select, .field-select {
    appearance: none; -webkit-appearance: none;
    height: 42px; padding: 0 38px 0 14px; border-radius: 12px;
    border: 1px solid var(--line-strong); background-color: var(--surface); color: var(--ink);
    font: 500 14px var(--font); cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23587580' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
select.field-select:hover { border-color: var(--teal); }

/* Il "+" della barra in basso e' un bottone tondo: la regola generica della barra non lo tocca piu'. */
[data-theme="dark"] .dash-hero, [data-theme="dark"] .side { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }


/* ══ Scorrimento, larghezza, menu riducibile (26-nov, dopo la prova dell'utente) ══ */
/* Fluent UI blocca il body (height: 100dvh; overflow: hidden) perche' si aspetta di
   scorrere dentro il suo FluentLayout, che non usiamo piu': la pagina non scendeva. */
body { height: auto !important; min-height: 100dvh; overflow: visible !important; }
html { overflow-y: auto; }

/* Larghezza: il contenuto segue lo schermo (prima era fermo a 1280 px). */
.portal-content { max-width: 1680px; padding-inline: clamp(16px, 2.6vw, 48px); }
@media (min-width: 1500px) { .portal-content { padding-inline: clamp(32px, 3.2vw, 64px); } }

.side-top { display: flex; align-items: center; gap: 6px; }
.side-top .side-brand { flex: 1; min-width: 0; }
.side-toggle { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: #7FA9B5; cursor: pointer; font-size: 20px; display: grid; place-items: center; }
.side-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }

/* Menu ridotto: solo icone, i nomi compaiono al passaggio del mouse (title). */
.shell { --side-w: 264px; grid-template-columns: var(--side-w) minmax(0, 1fr); transition: grid-template-columns .2s ease; }
.shell.collapsed { --side-w: 84px; }
.side .bell-pop, .side .profile-card, .side .gsearch-pop { left: calc(var(--side-w) + 12px); }
.collapsed .side { padding-inline: 12px; align-items: stretch; }
.collapsed .side-top { flex-direction: column; gap: 10px; }
.collapsed .side-brand { justify-content: center; padding: 2px 0; }
.collapsed .side-brand span, .collapsed .side-nav a span, .collapsed .side-group, .collapsed .side-version,
.collapsed .side-add span, .collapsed .profile-name, .collapsed .profile-trigger .ti-selector, .collapsed .side-tools .shell-lang,
.collapsed .gsearch kbd { display: none; }
.collapsed .side-nav a { justify-content: center; padding: 10px 0; }
.collapsed .side-nav a.on { box-shadow: none; }
.collapsed .side-add { height: 44px; padding: 0; }
.collapsed .side-group { display: block; height: 1px; margin: 8px 10px; background: rgba(255,255,255,.08); font-size: 0; }
.collapsed .side-tools { flex-direction: column; }
.collapsed .profile-trigger.wide { justify-content: center; padding: 6px 0; background: transparent; }
/* ricerca ridotta: un'icona; quando prende il fuoco il campo si apre accanto al menu */
.collapsed .side .gsearch input { padding: 0; width: 100%; color: transparent; cursor: pointer; }
.collapsed .side .gsearch input::placeholder { color: transparent; }
.collapsed .side .gsearch > i { left: 50%; transform: translateX(-50%); }
.collapsed .side .gsearch:focus-within input {
    position: fixed; left: calc(var(--side-w) + 12px); top: 16px; width: 360px; height: 44px; z-index: 75;
    padding: 0 14px; color: #fff; background: var(--lagoon); border: 1px solid rgba(25,182,209,.5); cursor: text;
    box-shadow: 0 18px 40px -16px rgba(0,0,0,.5);
}
.collapsed .side .gsearch:focus-within input::placeholder { color: rgba(255,255,255,.55); }
.collapsed .side .gsearch-pop { top: 68px; }

/* Panoramica senza budget/obiettivi/ricorrenti: niente colonna destra vuota, i pannelli
   principali si dispongono su due colonne quando lo schermo e' largo. */
.dash-grid:not(:has(.dash-side .panel)) { grid-template-columns: minmax(0, 1fr); }
.dash-grid:not(:has(.dash-side .panel)) .dash-side { display: none; }
@media (min-width: 1280px) {
    .dash-grid:not(:has(.dash-side .panel)) .dash-main { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

/* Telefono: una sola colonna. Va DOPO la regola del menu riducibile (var(--side-w)),
   che altrimenti teneva anche qui 264 px per il menu nascosto e comprimeva la pagina. */
@media (max-width: 900px) {
    .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
}

/* Ricerca nelle pagine: la lente DENTRO il campo (la regola generica .field, a colonna,
   la spostava sopra la scritta "Cerca..."). */
.field.field-search { flex-direction: row; align-items: center; position: relative; }
.field.field-search > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); }
.field.field-search input { padding-left: 38px; width: 100%; }

/* Telefono: filtri compatti, due per riga; titoli un po' piu' piccoli. */
@media (max-width: 600px) {
    .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .filters > .field-search, .filters > .seg, .filters > .field-range { grid-column: 1 / -1; }
    .filters > .seg { justify-self: start; max-width: 100%; overflow-x: auto; }
    .filters select, .filters .field-select { width: 100%; min-width: 0; }
    .field-range { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; }
    .field-range .field-date { display: contents; }
    .field-range input { min-width: 0; width: 100%; }
    .page-head { flex-wrap: wrap; }
    .page-head h1 { font-size: clamp(26px, 8vw, 34px); }
}

/* Il menu e' sticky, quindi crea un suo livello: senza z-index il pannello "Nuovo movimento"
   (che nasce dentro il menu) restava sotto il contenuto e una carta sollevata ci passava sopra. */
.side { z-index: 50; }

/* Telefono: la barra dei tipi scorre di lato senza mostrare la barra di scorrimento. */
@media (max-width: 600px) { .filters > .seg { scrollbar-width: none; } .filters > .seg::-webkit-scrollbar { display: none; } }

/* Gruppi vuoto: niente nastri decorativi, come gli altri stati vuoti (Budget, Obiettivi). */
.g-empty-art { display: none !important; }
