/* ============================================================
   AETERNUM — Design System
   Custodire la volontà. Nel tempo.
   Direzione: chiaro, sobrio, premium — struttura SaaS moderna
   (card arrotondate, ombre morbide, pannelli tinti, pill),
   gravitas editoriale (serif, oro, avorio).
   ============================================================ */

:root {
    /* Superfici chiare */
    --paper:   #FAF7F0;
    --paper-2: #F1EBDE;
    --surface: #FFFFFF;

    /* Blocchi scuri di contrasto (CTA, footer) */
    --night:   #0B1424;
    --night-2: #101C33;

    /* Inchiostro */
    --text:      #1B2334;
    --text-soft: #4E576C;
    --text-dim:  #8B91A3;

    /* Oro brand */
    --gold:      #A9853F;
    --gold-soft: #C9A961;
    --gold-dim:  #8F7A45;
    --gold-tint: rgba(169, 133, 63, .08);

    /* Bordi */
    --line:      #DCD3BE;
    --line-soft: #ECE6D8;

    /* Stati (toni scuri, leggibili su chiaro) */
    --ok:     #2F7A4D;
    --warn:   #9A6F1D;
    --danger: #B14D3C;

    --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --sans:  'Inter', -apple-system, 'Segoe UI', sans-serif;

    --wrap: 1140px;
    --r: 20px;
    --r-sm: 12px;
    --r-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
    --shadow-md: 0 14px 30px -10px rgba(16, 24, 40, .12);
    --shadow-lg: 0 34px 70px -18px rgba(16, 24, 40, .2);
    --ease: cubic-bezier(.22, .61, .36, 1);

    /* Testi su blocchi scuri */
    --ivory:      #F3EEE1;
    --ivory-soft: #ABB2C2;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background: var(--paper);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15.5px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-wrap: break-word;
}

::selection { background: rgba(201, 169, 97, .35); color: var(--night); }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; opacity: .58; }

.skip-link {
    position: fixed; top: 12px; left: 12px; z-index: 1000;
    padding: 10px 16px; border-radius: var(--r-sm);
    background: var(--night); color: var(--ivory);
    font-size: 13px; font-weight: 700;
    transform: translateY(-160%); transition: transform .2s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

.sr-only {
    position: absolute !important; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }
#main-content:focus { outline: none; }
[hidden] { display: none !important; }

/* ---------- Tipografia ---------- */

h1, h2, h3, .serif {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--text);
}

.eyebrow {
    display: block;
    font-family: var(--sans);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--gold);
}

.micro { font-size: 12px; color: var(--text-dim); letter-spacing: .04em; }

.lead { font-size: 18px; color: var(--text-soft); font-weight: 400; }

.divider-star {
    display: flex; align-items: center; justify-content: center; gap: 18px;
    color: var(--gold); margin: 26px 0;
}
.divider-star::before, .divider-star::after {
    content: ''; height: 1px; width: 64px;
    background: linear-gradient(90deg, transparent, var(--gold-dim));
}
.divider-star::after { background: linear-gradient(90deg, var(--gold-dim), transparent); }

/* ---------- Bottoni ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px 30px;
    font-size: 12.5px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
    border-radius: var(--r-pill);
    border: 1px solid transparent;
    transition: all .3s var(--ease);
    white-space: nowrap;
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold-soft), #B08F49);
    color: #17110A;
    box-shadow: 0 10px 22px -8px rgba(169, 133, 63, .45);
}
.btn-gold:hover { filter: brightness(1.07); transform: translateY(-2px); box-shadow: 0 16px 30px -10px rgba(169, 133, 63, .5); }

.btn-ghost {
    border-color: var(--line);
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { border-color: var(--gold-dim); color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.btn-line {
    border-color: var(--line);
    color: var(--text-soft);
}
.btn-line:hover { border-color: var(--text-dim); color: var(--text); }

.btn-danger { border-color: rgba(177, 77, 60, .4); color: var(--danger); }
.btn-danger:hover { background: rgba(177, 77, 60, .08); }

.btn-sm { padding: 9px 18px; font-size: 11px; }
.btn-block { width: 100%; }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn.oc-loading, .btn[aria-busy="true"] { pointer-events: none; }

/* ---------- Nav pubblica ---------- */

.site-nav {
    position: sticky; top: 0; z-index: 50;
    background: rgba(250, 247, 240, .85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line-soft);
}

.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 76px; gap: 24px; }

.brand { display: inline-flex; align-items: center; gap: 13px; color: var(--gold); }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-word {
    font-family: var(--serif); font-size: 19px; font-weight: 600;
    letter-spacing: .34em; color: var(--text);
}

.nav-links { display: flex; gap: 36px; }
.nav-links a {
    font-size: 13.5px; font-weight: 500; letter-spacing: .04em; color: var(--text-soft);
    transition: color .25s;
}
.nav-links a:hover { color: var(--text); }

.nav-actions { display: flex; align-items: center; gap: 22px; }
.nav-login { font-size: 13.5px; font-weight: 500; letter-spacing: .04em; color: var(--text-soft); }
.nav-login:hover { color: var(--text); }

.nav-burger { display: none; flex-direction: column; gap: 6px; padding: 8px; }
.nav-burger span {
    width: 22px; height: 1.5px; background: var(--text); display: block;
    transform-origin: center; transition: transform .25s var(--ease), opacity .2s;
}
.site-nav.nav-open [data-toggle-nav] span:first-child,
.app.sidebar-open [data-toggle-sidebar] span:first-child { transform: translateY(3.75px) rotate(45deg); }
.site-nav.nav-open [data-toggle-nav] span:last-child,
.app.sidebar-open [data-toggle-sidebar] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

/* ---------- Hero ---------- */

.hero {
    position: relative;
    min-height: 86vh;
    display: flex; align-items: center; justify-content: center;
    text-align: center;
    overflow: hidden;
    background:
        radial-gradient(56% 44% at 50% 106%, rgba(201, 169, 97, .28), transparent 70%),
        radial-gradient(70% 55% at 50% -10%, #FFFFFF 0%, transparent 65%),
        var(--paper);
}

.hero-inner { position: relative; z-index: 2; padding: 110px 28px 140px; max-width: 880px; }

.hero-mark { width: 58px; height: 58px; margin: 0 auto 34px; color: var(--gold); }

.hero h1 {
    font-size: clamp(48px, 8vw, 100px);
    font-weight: 600;
    letter-spacing: .16em;
    line-height: 1.02;
    text-indent: .16em;
}

.hero-claim {
    margin-top: 26px;
    font-size: 13px; font-weight: 600;
    letter-spacing: .34em; text-transform: uppercase;
    color: var(--gold);
    text-indent: .34em;
}

.hero-sub {
    margin: 30px auto 0; max-width: 560px;
    color: var(--text-soft); font-size: 17.5px;
}

.hero-cta { margin-top: 46px; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.hero-horizon {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 30vh; min-height: 180px;
    background:
        radial-gradient(44% 70% at 50% 112%, rgba(201, 169, 97, .3), rgba(201, 169, 97, .08) 48%, transparent 74%);
    pointer-events: none;
}
.hero-horizon svg { position: absolute; bottom: -2px; width: 100%; height: 100%; }

/* ---------- Sezioni pubbliche ---------- */

.section { padding: 100px 0; position: relative; }

.section-alt {
    background: var(--paper-2);
    border: 1px solid var(--line-soft);
    border-radius: 36px;
    max-width: min(1280px, calc(100% - 40px));
    margin: 0 auto;
}

.section-head { text-align: center; max-width: 660px; margin: 0 auto 64px; }
.section-head h2 { font-size: clamp(32px, 4.4vw, 48px); margin-top: 16px; line-height: 1.12; }
.section-head p { margin-top: 18px; color: var(--text-soft); font-size: 16.5px; }

.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r);
    padding: 34px 30px;
    box-shadow: var(--shadow-sm);
    transition: border-color .35s var(--ease), transform .35s var(--ease), box-shadow .35s var(--ease);
}
.card:hover { border-color: var(--line); transform: translateY(-4px); box-shadow: var(--shadow-md); }

.card-num {
    display: inline-flex; align-items: center;
    font-family: var(--sans); font-size: 10.5px; font-weight: 700;
    letter-spacing: .18em; text-transform: uppercase;
    color: var(--gold);
    background: var(--gold-tint);
    border: 1px solid rgba(169, 133, 63, .2);
    border-radius: var(--r-pill);
    padding: 6px 14px;
    margin-bottom: 20px;
}
.card h3 { font-size: 24px; margin-bottom: 12px; }
.card p { color: var(--text-soft); font-size: 14.5px; }

.manifesto {
    max-width: 720px; margin: 0 auto; text-align: center;
}
.manifesto blockquote {
    font-family: var(--serif); font-size: clamp(24px, 3.4vw, 36px);
    font-weight: 500; font-style: italic; line-height: 1.5;
    color: var(--text);
}
.manifesto cite { display: block; margin-top: 28px; font-style: normal; }

.cta-final { text-align: center; padding: 40px 20px 110px; }
.cta-final .wrap {
    max-width: 1160px;
    background:
        radial-gradient(52% 60% at 50% 118%, rgba(201, 169, 97, .28), transparent 70%),
        linear-gradient(180deg, var(--night-2), var(--night));
    border-radius: 40px;
    padding: 100px 48px;
    color: var(--ivory-soft);
}
.cta-final h2 { font-size: clamp(32px, 5vw, 54px); max-width: 720px; margin: 18px auto 0; color: var(--ivory); line-height: 1.12; }
.cta-final .hero-cta { margin-top: 40px; }

/* ---------- Footer ---------- */

.site-footer { background: var(--night); color: var(--ivory-soft); }

.footer-inner {
    display: flex; justify-content: space-between; gap: 60px;
    padding: 70px 28px 50px; flex-wrap: wrap;
}
.footer-claim { margin-top: 22px; font-family: var(--serif); font-size: 19px; font-style: italic; color: var(--ivory-soft); }

.site-footer .brand-word { color: var(--ivory); }
.site-footer .brand { color: var(--gold-soft); }

.footer-cols { display: flex; gap: 70px; flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: 12px; }
.footer-col .eyebrow { margin-bottom: 8px; color: var(--gold-soft); }
.footer-col a { font-size: 13.5px; color: var(--ivory-soft); transition: color .25s; }
.footer-col a:hover { color: var(--gold-soft); }
.footer-note { font-size: 13.5px; color: #7A8194; }

.site-footer .micro { color: #7A8194; }

.footer-base {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 26px; padding-bottom: 30px;
    border-top: 1px solid rgba(243, 238, 225, .1);
}

/* ---------- Auth ---------- */

.auth-wrap {
    min-height: calc(100vh - 76px);
    display: flex; align-items: center; justify-content: center;
    padding: 70px 24px;
    background:
        radial-gradient(50% 40% at 50% 110%, rgba(201, 169, 97, .2), transparent 70%),
        var(--paper);
}

.auth-card {
    width: 100%; max-width: 460px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: 26px;
    padding: 52px 48px;
    position: relative;
    box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 31px; text-align: center; margin: 14px 0 6px; }
.auth-card .auth-sub { text-align: center; color: var(--text-dim); font-size: 13.5px; margin-bottom: 34px; }
.auth-mark { width: 40px; height: 40px; margin: 0 auto; color: var(--gold); display: block; }

.auth-alt { text-align: center; margin-top: 26px; font-size: 13.5px; color: var(--text-dim); }
.auth-alt a { color: var(--gold); font-weight: 600; }

/* ---------- Form ---------- */

.field { margin-bottom: 20px; }
.field label {
    display: block; font-size: 11px; font-weight: 700;
    letter-spacing: .16em; text-transform: uppercase;
    color: var(--text-dim); margin-bottom: 9px;
}

.field input, .field select, .field textarea {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--text);
    padding: 13px 16px;
    font: inherit; font-size: 14.5px;
    transition: border-color .3s, box-shadow .3s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--gold-dim);
    box-shadow: 0 0 0 4px rgba(169, 133, 63, .12);
}
.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(177, 77, 60, .1);
}
.field textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.field select { appearance: none; }
.field-hint { font-size: 12px; color: var(--text-dim); margin-top: 7px; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 7px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.check { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--text-soft); }
.check input { width: auto; }

/* ---------- Flash ---------- */

.flash {
    display: flex; justify-content: space-between; align-items: center; gap: 20px;
    padding: 14px 20px; margin-bottom: 26px;
    border-radius: var(--r-sm);
    border: 1px solid rgba(169, 133, 63, .3);
    background: var(--gold-tint);
    font-size: 14px;
    animation: flashIn .4s var(--ease);
}
.flash-success { border-color: rgba(47, 122, 77, .3); background: rgba(47, 122, 77, .07); color: #235C3A; }
.flash-error   { border-color: rgba(177, 77, 60, .3); background: rgba(177, 77, 60, .07); color: #8E3E30; }
.flash-close { color: inherit; font-size: 18px; opacity: .6; }
.flash-close:hover { opacity: 1; }

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

/* Winter AJAX flash flottante */
p.flash-message {
    font-family: var(--sans); border-radius: var(--r-sm);
    background: var(--surface); color: var(--text); border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
}
p.flash-message.success { background: #EDF6F0; border-color: rgba(47, 122, 77, .4); color: #235C3A; }
p.flash-message.error { background: #FAEEEB; border-color: rgba(177, 77, 60, .4); color: #8E3E30; }

/* ---------- App shell ---------- */

.app { background: var(--paper); }

.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.app-sidebar {
    width: 264px; flex: none;
    background: var(--surface);
    border-right: 1px solid var(--line-soft);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto;
}

.sidebar-overlay { display: none; }

.sidebar-brand { padding: 26px 24px 20px; border-bottom: 1px solid var(--line-soft); }
.sidebar-brand .brand-word { font-size: 15px; letter-spacing: .26em; }
.sidebar-brand .brand-mark { width: 28px; height: 28px; }

.sidebar-nav { padding: 20px 14px; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.side-label { padding: 18px 12px 8px; }

.side-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    font-size: 13.5px; font-weight: 500; color: var(--text-soft);
    border-radius: var(--r-sm);
    transition: all .25s;
}
.side-link:hover { color: var(--text); background: var(--paper); }
.side-link.is-active {
    color: var(--gold);
    background: var(--gold-tint);
    box-shadow: inset 2px 0 0 var(--gold);
}

.side-badge {
    margin-left: auto;
    background: var(--gold); color: #FFF;
    font-size: 10.5px; font-weight: 700;
    min-width: 19px; height: 19px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 6px;
}

.sidebar-foot { padding: 18px 24px; border-top: 1px solid var(--line-soft); }
.side-logout {
    font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
    color: var(--text-dim); transition: color .25s;
}
.side-logout:hover { color: var(--danger); }

.app-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.app-topbar {
    display: flex; align-items: center; gap: 22px;
    padding: 22px 38px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(250, 247, 240, .82);
    backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 20;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-h { font-size: 26px; margin-top: 2px; }
.topbar-user { display: flex; align-items: center; gap: 16px; }

.avatar {
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid var(--line);
    overflow: hidden; flex: none;
    display: flex; align-items: center; justify-content: center;
    background: var(--paper-2);
    font-family: var(--serif); font-size: 16px; color: var(--gold);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 34px; height: 34px; font-size: 13px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }

.pill {
    font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    padding: 7px 14px; border-radius: var(--r-pill); border: 1px solid;
}
.pill-ok     { color: var(--ok);     border-color: rgba(47, 122, 77, .3);  background: rgba(47, 122, 77, .07); }
.pill-warn   { color: var(--warn);   border-color: rgba(154, 111, 29, .3); background: rgba(154, 111, 29, .07); }
.pill-danger { color: var(--danger); border-color: rgba(177, 77, 60, .3);  background: rgba(177, 77, 60, .07); }
.pill-dim    { color: var(--text-dim); border-color: var(--line-soft); background: var(--surface); }
.pill-gold   { color: var(--gold); border-color: rgba(169, 133, 63, .3); background: var(--gold-tint); }

.app-main { padding: 38px; flex: 1; max-width: 1240px; width: 100%; margin: 0 auto; }

.app-footer {
    display: flex; justify-content: space-between; gap: 20px;
    padding: 20px 38px; border-top: 1px solid var(--line-soft);
}

/* ---------- Dashboard ---------- */

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 34px; }

.stat {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r);
    padding: 24px 24px 20px;
    box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
}
.stat::before {
    content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
    background: linear-gradient(180deg, var(--gold-soft), transparent);
    opacity: .72;
}
.stat-value { font-family: var(--serif); font-size: 40px; line-height: 1; color: var(--text); }
.stat-label { margin-top: 10px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-dim); }
.stat-value small { font-size: 18px; color: var(--text-dim); }

.panel {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r);
    padding: 30px;
    box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: 22px; }
.panel-head {
    display: flex; justify-content: space-between; align-items: baseline; gap: 20px;
    margin-bottom: 22px;
}
.panel-head h2 { font-size: 21px; }
.panel-link { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.panel-link:hover { color: var(--gold-dim); }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: start; }

/* Anello check-in */
.ring-box { display: flex; align-items: center; gap: 26px; }
.ring {
    --p: 0;
    width: 108px; height: 108px; border-radius: 50%; flex: none;
    background:
        radial-gradient(closest-side, var(--surface) 82%, transparent 83% 100%),
        conic-gradient(var(--gold-soft) calc(var(--p) * 1%), rgba(27, 35, 52, .08) 0);
    display: flex; align-items: center; justify-content: center;
    text-align: center;
}
.ring b { font-family: var(--serif); font-size: 26px; font-weight: 600; display: block; line-height: 1; }
.ring span { font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-dim); }

.meter { height: 5px; background: rgba(27, 35, 52, .08); border-radius: 3px; overflow: hidden; margin-top: 14px; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold-soft)); border-radius: 3px; }

/* ---------- Liste / timeline ---------- */

.tl { list-style: none; }
.tl li {
    display: flex; gap: 18px; padding: 15px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 14px;
}
.tl li:last-child { border-bottom: 0; }

.tl-dot {
    width: 34px; height: 34px; flex: none; border-radius: 50%;
    border: 1px solid rgba(169, 133, 63, .25);
    display: flex; align-items: center; justify-content: center;
    color: var(--gold); font-size: 13px;
    background: var(--gold-tint);
}
.tl-body { flex: 1; min-width: 0; }
.tl-desc { color: var(--text-soft); }
.tl-time { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

/* ---------- Vault ---------- */

.toolbar {
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
    margin-bottom: 26px;
}
.toolbar .field { margin: 0; flex: 1; min-width: 200px; }
.toolbar .field input, .toolbar .field select { padding: 11px 14px; }

.vault-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

.v-card {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r);
    padding: 24px;
    display: flex; flex-direction: column; gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: border-color .3s, transform .3s, box-shadow .3s;
    position: relative;
}
.v-card:hover { border-color: var(--line); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.v-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.v-type {
    font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
    color: var(--gold); border: 1px solid rgba(169, 133, 63, .25);
    background: var(--gold-tint);
    padding: 4px 11px; border-radius: var(--r-pill);
}
.v-card h3 { font-size: 19px; line-height: 1.3; }
.v-desc { font-size: 13.5px; color: var(--text-soft); flex: 1; }
.v-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.v-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.v-tag { font-size: 11px; color: var(--text-dim); border: 1px solid var(--line-soft); background: var(--paper); padding: 2px 10px; border-radius: var(--r-pill); }
.v-actions { display: flex; gap: 12px; }
.v-actions a, .v-actions button { font-size: 12px; color: var(--text-dim); letter-spacing: .06em; transition: color .25s; }
.v-actions a:hover { color: var(--gold); }
.v-actions button:hover { color: var(--danger); }

.results-meta {
    margin: -6px 0 14px; color: var(--text-dim);
    font-size: 12px; letter-spacing: .06em;
}

.empty {
    text-align: center; padding: 70px 30px;
    border: 1px dashed var(--line); border-radius: var(--r);
    color: var(--text-dim);
    background: rgba(255, 255, 255, .5);
}
.empty .serif { font-size: 22px; color: var(--text-soft); display: block; margin-bottom: 8px; }
.empty p { margin: 0 auto; }
.empty-action { margin-top: 22px; }

/* ---------- Note ---------- */

.note-layout { display: grid; grid-template-columns: 1fr 1.2fr; gap: 22px; align-items: start; }

.note-item {
    padding: 18px 20px; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
    margin-bottom: 12px; cursor: pointer;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: border-color .3s, transform .3s, box-shadow .3s;
}
.note-item:hover { border-color: var(--line); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.note-item:focus-visible, .note-item.is-active {
    outline: none; border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(169, 133, 63, .1), var(--shadow-sm);
}
.note-item h3 { font-size: 17px; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.note-item p { font-size: 13px; color: var(--text-dim); margin-top: 6px; }

.ai-box {
    border: 1px solid rgba(169, 133, 63, .25);
    background: var(--gold-tint);
    border-radius: var(--r-sm);
    padding: 18px;
    margin-bottom: 20px;
}
.ai-box .field { margin-bottom: 12px; }

/* ---------- Fiduciari ---------- */

.contact-row {
    display: flex; align-items: center; gap: 18px;
    padding: 18px 0; border-bottom: 1px solid var(--line-soft);
}
.contact-row:last-child { border-bottom: 0; }
.contact-info { flex: 1; min-width: 0; }
.contact-info b { font-size: 15.5px; font-weight: 600; }
.contact-info span { display: block; font-size: 13px; color: var(--text-dim); }
.contact-tools { display: flex; align-items: center; gap: 14px; }
.contact-tools select {
    background: var(--surface); color: var(--text); border: 1px solid var(--line);
    border-radius: var(--r-sm); padding: 7px 10px; font-size: 12.5px;
}
.contact-remove { color: var(--text-dim); font-size: 12px; }
.contact-remove:hover { color: var(--danger); }

/* ---------- Tabelle ---------- */

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    text-align: left; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
    color: var(--text-dim); font-weight: 700;
    padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.table td { padding: 14px; border-bottom: 1px solid var(--line-soft); color: var(--text-soft); }
.table tr:last-child td { border-bottom: 0; }

/* ---------- Piano ---------- */

.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; max-width: 860px; }
.plan {
    border: 1px solid var(--line-soft); border-radius: var(--r);
    padding: 40px 36px; position: relative;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.plan.is-featured {
    border-color: rgba(169, 133, 63, .4);
    background: linear-gradient(180deg, #FFFDF6, var(--surface));
    box-shadow: var(--shadow-md);
}
.plan h3 { font-size: 26px; margin: 10px 0 4px; }
.plan-price { font-family: var(--serif); font-size: 44px; margin: 18px 0 6px; }
.plan-price small { font-size: 15px; color: var(--text-dim); font-family: var(--sans); }
.plan ul { list-style: none; margin: 24px 0 30px; display: flex; flex-direction: column; gap: 11px; }
.plan li { font-size: 14px; color: var(--text-soft); padding-left: 22px; position: relative; }
.plan li::before { content: '✦'; position: absolute; left: 0; color: var(--gold); font-size: 10px; top: 4px; }

/* ---------- Fiduciario (pubblica) ---------- */

.trustee-wrap { max-width: 780px; margin: 0 auto; padding: 90px 28px 120px; }
.trustee-head { text-align: center; margin-bottom: 50px; }
.trustee-head h1 { font-size: clamp(30px, 5vw, 42px); margin-top: 18px; }

.release-item {
    border: 1px solid rgba(169, 133, 63, .25); border-radius: var(--r);
    padding: 28px; margin-bottom: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.release-item h3 { font-size: 20px; margin-bottom: 10px; }
.release-body {
    font-size: 14.5px; color: var(--text-soft); white-space: pre-line;
    border-top: 1px solid var(--line-soft); padding-top: 14px; margin-top: 14px;
}

/* ---------- Icone minime ---------- */

[data-ico] { font-style: normal; width: 17px; text-align: center; opacity: .9; }
[data-ico="home"]::before  { content: '⌂'; }
[data-ico="vault"]::before { content: '▣'; }
[data-ico="note"]::before  { content: '✎'; }
[data-ico="users"]::before { content: '☍'; }
[data-ico="pulse"]::before { content: '◉'; }
[data-ico="clock"]::before { content: '◷'; }
[data-ico="bell"]::before  { content: '◭'; }
[data-ico="gear"]::before  { content: '⚙'; }
[data-ico="gem"]::before   { content: '◆'; }

/* ---------- Modale ---------- */

.modal-backdrop {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(16, 20, 32, .45);
    backdrop-filter: blur(8px);
    display: none;
    align-items: flex-start; justify-content: center;
    overflow-y: auto;
    padding: 6vh 20px 60px;
    overscroll-behavior: contain;
}
.modal-backdrop.is-open { display: flex; animation: modalFade .3s var(--ease); }

.modal {
    width: 100%; max-width: 680px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: 26px;
    padding: 44px 46px 40px;
    position: relative;
    animation: modalUp .4s var(--ease);
    box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 27px; margin: 12px 0 6px; }
.modal-sub { color: var(--text-dim); font-size: 13.5px; margin-bottom: 28px; }
.modal-close {
    position: absolute; top: 16px; right: 20px;
    width: 44px; height: 44px; border-radius: 50%;
    font-size: 26px; color: var(--text-dim); line-height: 1;
    transition: color .25s; z-index: 2;
}
.modal-close:hover { color: var(--gold); background: var(--gold-tint); }

@keyframes modalFade { from { opacity: 0; } }
@keyframes modalUp { from { opacity: 0; transform: translateY(26px); } }

body.modal-open { overflow: hidden; }

/* ---------- Wizard ---------- */

.wiz-steps {
    display: flex; align-items: flex-start; justify-content: center;
    gap: 0; margin: 6px 0 30px;
}
.wiz-dot {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    min-width: 92px; position: relative;
    font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--text-dim);
}
.wiz-dot::before {
    content: attr(data-n);
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--serif); font-size: 15px; font-weight: 600;
    border: 1.5px solid var(--line);
    background: var(--surface); color: var(--text-dim);
    transition: all .35s var(--ease);
}
.wiz-dot:not(:first-child)::after {
    content: ''; position: absolute; top: 17px; right: calc(50% + 24px);
    width: calc(100% - 48px); height: 1.5px;
    background: var(--line); transition: background .35s;
}
.wiz-dot.is-current { color: var(--gold); }
.wiz-dot.is-current::before {
    border-color: var(--gold); color: var(--gold);
    background: var(--gold-tint);
    box-shadow: 0 0 0 5px rgba(169, 133, 63, .1);
}
.wiz-dot.is-done { color: var(--ok); }
.wiz-dot.is-done::before {
    content: '✓';
    border-color: var(--ok); color: #FFF; background: var(--ok);
    font-family: var(--sans); font-size: 13px;
}
.wiz-dot.is-done:not(:first-child)::after,
.wiz-dot.is-current:not(:first-child)::after { background: var(--gold-soft); }

.wiz-step { display: none; }
.wiz-step.is-active { display: block; animation: wizIn .45s var(--ease); }
@keyframes wizIn { from { opacity: 0; transform: translateX(26px); } }

.wiz-nav {
    display: flex; justify-content: space-between; align-items: center;
    gap: 14px; margin-top: 26px; padding-top: 22px;
    border-top: 1px solid var(--line-soft);
}

/* ---------- Tile di scelta (tipo, ruolo, trigger) ---------- */

.type-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.type-tiles.cols-2 { grid-template-columns: repeat(2, 1fr); }

.tile {
    border: 1.5px solid var(--line-soft);
    border-radius: var(--r-sm);
    background: var(--surface);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all .28s var(--ease);
    display: flex; flex-direction: column; align-items: center; gap: 9px;
    position: relative;
}
.tile:hover { border-color: var(--gold-dim); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.tile.is-disabled { opacity: .5; cursor: not-allowed; background: var(--paper); }
.tile.is-disabled:hover { border-color: var(--line-soft); transform: none; box-shadow: none; }
.tile.is-checked, .tile.is-selected {
    border-color: var(--gold);
    background: linear-gradient(180deg, #FFFDF6, var(--surface));
    box-shadow: 0 0 0 4px rgba(169, 133, 63, .12), var(--shadow-md);
}
.tile.is-checked::after, .tile.is-selected::after {
    content: '✓'; position: absolute; top: 9px; right: 11px;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--gold); color: #FFF;
    font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    animation: tickPop .3s var(--ease);
}
@keyframes tickPop { from { transform: scale(0); } }

.tile-ico {
    width: 46px; height: 46px; border-radius: 14px;
    background: var(--gold-tint); border: 1px solid rgba(169, 133, 63, .2);
    color: var(--gold); font-size: 20px;
    display: flex; align-items: center; justify-content: center;
}
.tile b { font-size: 14px; font-weight: 600; color: var(--text); }
.tile small { font-size: 11.5px; color: var(--text-dim); line-height: 1.45; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile:has(input:focus-visible), .choice-chip:has(input:focus-visible), .seg label:has(input:focus-visible) {
    outline: 2px solid var(--gold-dim); outline-offset: 3px;
}

/* ---------- Segmented control ---------- */

.seg {
    display: inline-flex; gap: 4px;
    background: var(--paper-2);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-pill);
    padding: 4px;
}
.seg label {
    position: relative; cursor: pointer;
    padding: 9px 20px; border-radius: var(--r-pill);
    font-size: 12.5px; font-weight: 600; color: var(--text-soft);
    transition: all .25s var(--ease);
}
.seg label:hover { color: var(--text); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) {
    background: var(--surface); color: var(--gold);
    box-shadow: var(--shadow-sm); border: 1px solid rgba(169, 133, 63, .3);
    padding: 8px 19px;
}
.seg label.is-checked {
    background: var(--surface); color: var(--gold);
    box-shadow: var(--shadow-sm); border: 1px solid rgba(169, 133, 63, .3);
    padding: 8px 19px;
}

/* ---------- Chip di selezione contenuti ---------- */

.choice-list { display: flex; flex-wrap: wrap; gap: 9px; }
.choice-chip {
    position: relative; cursor: pointer;
    border: 1.5px solid var(--line-soft); border-radius: var(--r-pill);
    background: var(--surface);
    padding: 9px 18px;
    font-size: 13px; color: var(--text-soft);
    transition: all .25s var(--ease);
    display: inline-flex; align-items: center; gap: 8px;
}
.choice-chip:hover { border-color: var(--gold-dim); }
.choice-chip input { position: absolute; opacity: 0; pointer-events: none; }
.choice-chip:has(input:checked) {
    border-color: var(--gold); color: var(--gold);
    background: var(--gold-tint); font-weight: 600;
}
.choice-chip:has(input:checked)::before { content: '✓ '; font-weight: 700; }
.choice-chip.is-checked {
    border-color: var(--gold); color: var(--gold);
    background: var(--gold-tint); font-weight: 600;
}
.choice-chip.is-checked::before { content: '✓ '; font-weight: 700; }

/* ---------- Percorso di attivazione (quest) ---------- */

.quest {
    background:
        radial-gradient(60% 90% at 100% 0%, rgba(201, 169, 97, .16), transparent 60%),
        linear-gradient(180deg, var(--night-2), var(--night));
    border-radius: var(--r);
    padding: 30px;
    color: var(--ivory-soft);
    margin-bottom: 34px;
    box-shadow: var(--shadow-md);
}
.quest h2 { color: var(--ivory); font-size: 22px; }
.quest .eyebrow { color: var(--gold-soft); }
.quest-head { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.quest-pct { font-family: var(--serif); font-size: 34px; color: var(--gold-soft); }
.quest .meter { background: rgba(243, 238, 225, .12); margin: 16px 0 22px; }

.quest-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.quest-step {
    border: 1px solid rgba(243, 238, 225, .12);
    border-radius: var(--r-sm);
    padding: 14px 14px 12px;
    font-size: 12.5px; line-height: 1.45;
    color: var(--ivory-soft);
    transition: all .3s var(--ease);
    display: block;
}
.quest-step:hover { border-color: rgba(201, 169, 97, .45); transform: translateY(-2px); }
.quest-step b { display: block; color: var(--ivory); font-size: 13px; margin-top: 8px; }
.quest-step .q-dot {
    width: 24px; height: 24px; border-radius: 50%;
    border: 1.5px solid rgba(243, 238, 225, .3);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; color: var(--ivory-soft);
}
.quest-step.is-done { opacity: .78; }
.quest-step.is-done .q-dot { background: var(--gold-soft); border-color: var(--gold-soft); color: #17110A; }
.quest-step.is-done b { text-decoration: line-through; text-decoration-color: rgba(201,169,97,.6); }

/* ---------- Effetti wow ---------- */

.btn-gold { position: relative; overflow: hidden; }
.btn-gold::after {
    content: ''; position: absolute; top: 0; bottom: 0; width: 46%;
    left: -70%; transform: skewX(-22deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
    transition: left .05s;
}
.btn-gold:hover::after { left: 130%; transition: left .7s var(--ease); }

.burst-star {
    position: fixed; z-index: 999; pointer-events: none;
    color: var(--gold); font-size: 15px; line-height: 1;
    animation: burst .9s var(--ease) forwards;
}
@keyframes burst {
    0%   { opacity: 1; transform: translate(0, 0) scale(.5) rotate(0deg); }
    100% { opacity: 0; transform: translate(var(--bx), var(--by)) scale(1.25) rotate(160deg); }
}

.grid .reveal:nth-child(2), .quest-steps .quest-step:nth-child(2) { transition-delay: .08s; animation-delay: .05s; }
.grid .reveal:nth-child(3), .quest-steps .quest-step:nth-child(3) { transition-delay: .16s; animation-delay: .1s; }
.grid .reveal:nth-child(4), .quest-steps .quest-step:nth-child(4) { transition-delay: .24s; animation-delay: .15s; }
.quest-steps .quest-step:nth-child(5) { animation-delay: .2s; }

@media (max-width: 900px) {
    .quest-steps { grid-template-columns: repeat(2, 1fr); }
    .type-tiles { grid-template-columns: repeat(2, 1fr); }
    .wiz-dot { min-width: 64px; }
}

/* ---------- Accessibilità ---------- */

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

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    html { scroll-behavior: auto; }
    html.js-reveal .reveal { opacity: 1; transform: none; }
}

/* ---------- Reveal ----------
   L'occultamento vale solo con JS attivo (html.js-reveal, aggiunto da aeternum.js):
   senza JS i contenuti restano visibili. */

html.js-reveal .reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
html.js-reveal .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Pagination ---------- */

.pagination { display: flex; gap: 8px; margin-top: 26px; justify-content: center; }
.pagination a, .pagination span {
    min-width: 34px; height: 34px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line-soft); border-radius: var(--r-sm);
    font-size: 13px; color: var(--text-soft);
    background: var(--surface);
}
.pagination .is-current { border-color: var(--gold-dim); color: var(--gold); background: var(--gold-tint); }

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
    .stat-row { grid-template-columns: repeat(2, 1fr); }
    .vault-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-grid, .note-layout { grid-template-columns: 1fr; }
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
    .nav-links { display: none; }
    .nav-burger { display: flex; }
    .site-nav.nav-open .nav-links {
        display: flex; flex-direction: column;
        position: absolute; top: 76px; left: 0; right: 0;
        background: var(--paper); border-bottom: 1px solid var(--line);
        padding: 24px 28px; gap: 20px;
        box-shadow: var(--shadow-md);
    }

    .app-sidebar {
        position: fixed; z-index: 60; left: -280px; transition: left .35s var(--ease);
        box-shadow: 30px 0 60px rgba(16, 24, 40, .18);
    }
    .app.sidebar-open .app-sidebar { left: 0; }
    .sidebar-overlay {
        display: block; position: fixed; inset: 0; z-index: 55;
        background: rgba(11, 20, 36, .42); backdrop-filter: blur(3px);
        opacity: 0; visibility: hidden; pointer-events: none;
        transition: opacity .3s var(--ease), visibility .3s;
    }
    .app.sidebar-open .sidebar-overlay { opacity: 1; visibility: visible; pointer-events: auto; }
    .app.sidebar-open { overflow: hidden; }
    .app-burger { display: flex; }
    .app-main, .app-topbar, .app-footer { padding-left: 22px; padding-right: 22px; }

    .contact-row { align-items: flex-start; flex-wrap: wrap; }
    .contact-tools { width: 100%; padding-left: 60px; flex-wrap: wrap; }
    .contact-tools select { flex: 1; min-width: 145px; }
}

@media (max-width: 620px) {
    .stat-row, .vault-grid, .grid-2, .grid-3, .grid-4, .plan-grid, .field-row { grid-template-columns: 1fr; }
    .modal-backdrop { padding: 0; align-items: stretch; }
    .modal { max-width: none; min-height: 100%; min-height: 100dvh; border-radius: 0; padding: 54px 22px 30px; }
    .seg { display: flex; }
    .seg label { flex: 1 1 0; min-width: 0; padding: 9px 6px; text-align: center; white-space: nowrap; font-size: 12px; }
    .seg label:has(input:checked) { padding: 8px 5px; }
    .seg label.is-checked { padding: 8px 5px; }
    .type-tiles, .type-tiles.cols-2 { grid-template-columns: 1fr 1fr; }
    .auth-card { padding: 40px 26px; }
    .hero h1 { letter-spacing: .1em; }
    .footer-inner { flex-direction: column; gap: 40px; }
    .section-alt { border-radius: 24px; max-width: calc(100% - 24px); }
    .cta-final .wrap { padding: 70px 28px; border-radius: 28px; }
    .app-topbar { padding-top: 14px; padding-bottom: 14px; }
    .topbar-h { font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .topbar-user .pill { display: none; }
    .app-main { padding-top: 24px; }
    .app-footer { flex-direction: column; gap: 4px; }
    .ring-box { align-items: flex-start; }
    .ring { width: 92px; height: 92px; }
    .wiz-steps { overflow-x: auto; justify-content: flex-start; padding: 4px 2px 10px; }
    .wiz-dot { flex: 1 0 82px; }
    .wiz-nav { flex-wrap: wrap; }
    .wiz-nav .btn { flex: 1; }
    .toolbar { align-items: stretch; }
    .toolbar .field, .toolbar .field[style] { width: 100% !important; max-width: none !important; }
    .toolbar > .btn { width: 100%; order: -1 !important; }
    .contact-tools { padding-left: 0; }
    .nav-inner { padding-left: 16px; padding-right: 16px; gap: 10px; }
    .nav-actions { gap: 8px; }
    .nav-actions .nav-login { display: none; }
    .nav-actions .btn { padding: 9px 14px; font-size: 10.5px; }
    .brand { gap: 8px; }
    .brand-word { font-size: 16px; letter-spacing: .24em; }
    .brand-mark { width: 30px; height: 30px; }
}
