/* ============================================================
   Rete Irene Hub — design system responsive (desktop/tablet/mobile)
   ============================================================ */
:root {
    --primary: #8bc53f;
    --primary-dark: #6fa032;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --text-light: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --warning: #f59e0b;
    --ok: #16a34a;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1);
    --shadow-lg: 0 10px 20px -5px rgb(0 0 0 / .15);
    --radius: .5rem;
    --radius-lg: 1rem;
    --sidebar-w: 260px;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.material-icons-outlined { line-height: 1; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .7rem 1.3rem; border: none; border-radius: var(--radius);
    font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer;
    transition: background .2s, transform .1s, box-shadow .2s; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgb(139 197 63 / .3); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary-dark); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-text { background: transparent; color: var(--text-light); }
.btn-text:hover { color: var(--text); }
.btn-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: .4rem .8rem; font-size: .82rem; }
.btn-icon { padding: .5rem; border-radius: 50%; background: transparent; color: var(--text-light); }
.btn-icon:hover { background: var(--border); color: var(--text); }
.btn:disabled, .btn[disabled] { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* ---------- Boot / generic ---------- */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; color: var(--text-light); }
.boot .material-icons-outlined { font-size: 2.5rem; color: var(--primary); }

/* ---------- Auth ---------- */
.auth-view, .gate-view {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    /* Sfondo chiaro caldo: verde tenue → arancione tenue. */
    padding: 1.5rem; background: linear-gradient(135deg, #f0fdf4, #fdebd0);
}
.auth-card, .gate-card {
    width: 100%; max-width: 440px; background: var(--surface);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 2.5rem;
    text-align: center;
}
.brand-logo { height: 64px; object-fit: contain; margin-bottom: 1.5rem; }
.auth-title { font-size: 1.4rem; }
.auth-sub { color: var(--text-light); margin: .5rem 0 1.8rem; font-size: .95rem; }
.form-group { text-align: left; margin-bottom: 1.1rem; }
.form-group label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.form-group input {
    width: 100%; padding: .8rem 1rem; border: 1px solid var(--border);
    border-radius: var(--radius); font: inherit; font-size: 1rem; background: #fff;
}
.form-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgb(139 197 63 / .15); }
.form-error { color: var(--danger); background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius); padding: .6rem .8rem; font-size: .88rem; margin-bottom: 1rem; text-align: left; }
.auth-hint { margin-top: 1.4rem; font-size: .85rem; color: var(--text-light); }
.auth-hint a { color: var(--primary-dark); font-weight: 600; }

/* ---------- Login/registrazione full-page a due colonne ---------- */
.auth-view { padding: 0; align-items: stretch; }
.auth-split {
    width: 100%; min-height: 100vh; min-height: 100dvh;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch; background: var(--surface);
}
.auth-split > .auth-card {
    flex: 1 1 0; min-width: 0; box-shadow: none; border-radius: 0; max-width: none; width: auto;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 2.5rem;
}
/* annulla il max-width del wizard: nel layout full-page la card riempie la colonna */
.auth-split > .auth-card.reg-card { max-width: none; }
/* il contenuto del form resta leggibile e non si allarga su schermi grandi */
.auth-split > .auth-card > *:not(img) { width: 100%; max-width: 420px; }
.auth-info {
    flex: 1 1 0; min-width: 0;
    /* Sfumatura "logo sociale": verde in alto → arancione in basso (pannello alto). */
    background: linear-gradient(180deg, var(--primary) 0%, #eca441 100%);
    color: #fff; padding: clamp(2rem, 4vw, 3.4rem); text-align: left;
    display: flex; flex-direction: column; gap: 1.05rem; justify-content: center;
    text-shadow: 0 1px 3px rgb(0 0 0 / .28); /* leggibilità su arancione */
}
.auth-info-title { font-size: 1.5rem; line-height: 1.25; font-weight: 800; }
.auth-info-lead { font-size: .92rem; line-height: 1.55; color: rgb(255 255 255 / .9); }
.auth-info-sub { font-weight: 700; font-size: .92rem; margin-top: .1rem; }
.auth-info-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .65rem; }
.auth-info-list li { display: flex; align-items: flex-start; gap: .65rem; font-size: .88rem; line-height: 1.4; color: rgb(255 255 255 / .95); }
.auth-info-list .material-icons-outlined { font-size: 20px; flex: 0 0 auto; color: #eaffd0; margin-top: 1px; }
.auth-info-quote {
    margin-top: auto; font-style: italic; font-size: .95rem; font-weight: 500;
    border-top: 1px solid rgb(255 255 255 / .25); padding-top: 1.1rem;
}

@media (max-width: 860px) {
    /* impila: login in alto, testo informativo che riempie sotto */
    .auth-split { display: flex; flex-direction: column-reverse; }
    .auth-split > .auth-card { flex: 0 0 auto; padding: 2.2rem 1.5rem; }
    .auth-split > .auth-card > *:not(img) { max-width: 420px; margin-left: auto; margin-right: auto; }
    .auth-info { flex: 1 1 auto; padding: 2rem 1.6rem; }
    .auth-info-quote { margin-top: 1rem; }
}

/* Login e iscrizione: pagina + piè di pagina stanno insieme nello schermo
   d'arrivo. Il body diventa una colonna: l'app prende lo spazio che resta e
   il footer (appeso al body) resta visibile senza scorrere. */
body:has(.auth-view) { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body:has(.auth-view) #app { flex: 1 0 auto; display: flex; flex-direction: column; }
body:has(.auth-view) .auth-view { flex: 1 0 auto; min-height: 0; }
body:has(.auth-view) .auth-split { min-height: 0; }
body:has(.auth-view) .legal-footer {
    max-width: none; width: 100%; margin: 0; padding: .6rem 1.5rem .5rem;
    background: var(--surface); font-size: .7rem; line-height: 1.5;
}
body:has(.auth-view) .legal-footer p { margin: 0 0 .15rem; }
@media (min-width: 861px) {
    /* Contenuto più alto e compatto, così con il footer entra in un portatile. */
    body:has(.auth-view) .auth-info { gap: .8rem; padding-block: clamp(1.4rem, 3.2vh, 2.4rem); }
    body:has(.auth-view) .auth-split > .auth-card { padding-block: clamp(1.4rem, 3.2vh, 2.4rem); }
    body:has(.auth-view) .auth-info-quote { padding-top: .8rem; }
}
@media (max-width: 860px) {
    body:has(.auth-view) .legal-footer { padding-bottom: calc(.6rem + env(safe-area-inset-bottom)); }
}

/* ---------- "Come funziona l'abbonamento" ---------- */
/* Bottoni sotto l'elenco: lo spazio libero si divide sopra e sotto, a metà
   tra elenco e citazione. */
.howto-actions {
    display: flex; flex-direction: column; gap: .6rem;
    width: 100%; max-width: 420px; margin-block: auto;
}
.howto-actions + .auth-info-quote { margin-top: 0; }
.howto-open {
    display: flex; align-items: center; gap: .7rem; width: 100%; max-width: 420px;
    padding: .8rem 1rem; cursor: pointer; text-align: left;
    font: inherit; font-weight: 700; font-size: .95rem; color: #3f6212;
    background: #fff; border: none; border-radius: 12px; text-shadow: none;
    box-shadow: 0 6px 18px rgb(0 0 0 / .14);
    transition: transform .15s, box-shadow .15s;
}
.howto-open .material-icons-outlined { font-size: 22px; color: var(--primary-dark); }
.howto-open-arrow { margin-left: auto; transition: transform .15s; }
.howto-open:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgb(0 0 0 / .18); }
.howto-open:hover .howto-open-arrow { transform: translateX(3px); }
.howto-open:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

body.howto-lock { overflow: hidden; }
.howto-overlay {
    position: fixed; inset: 0; z-index: 130;
    background: rgb(15 23 42 / .45); backdrop-filter: blur(2px);
    display: flex; justify-content: flex-start;
    animation: fadeIn .2s ease;
}
.howto-panel {
    position: relative; width: min(620px, 100%); height: 100%;
    display: flex; flex-direction: column; background: var(--surface);
    box-shadow: 12px 0 40px rgb(0 0 0 / .25); outline: none;
    animation: howtoIn .28s cubic-bezier(.2, .8, .2, 1);
}
.howto-overlay.is-closing { animation: fadeOut .22s ease forwards; }
.howto-overlay.is-closing .howto-panel { animation: howtoOut .22s ease forwards; }
@keyframes howtoIn { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes howtoOut { to { transform: translateX(-100%); } }
@keyframes fadeOut { to { opacity: 0; } }

.howto-head {
    flex: 0 0 auto; color: #fff; padding: 1.3rem 1.5rem 0;
    background: linear-gradient(135deg, var(--primary) 0%, #eca441 100%);
    text-shadow: 0 1px 3px rgb(0 0 0 / .22);
}
.howto-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.howto-kicker { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .9; }
.howto-head h2 { font-size: 1.35rem; font-weight: 800; line-height: 1.25; margin-top: .15rem; }
.howto-close {
    flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
    display: grid; place-items: center; color: #fff; background: rgb(255 255 255 / .2);
    transition: background .15s;
}
.howto-close:hover { background: rgb(255 255 255 / .35); }
.howto-nav { display: flex; gap: .3rem; margin-top: 1rem; overflow-x: auto; scrollbar-width: none; }
.howto-nav::-webkit-scrollbar { display: none; }
.howto-nav-link {
    display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
    padding: .6rem .9rem .7rem; border-radius: 10px 10px 0 0;
    color: #fff; text-decoration: none; font-size: .86rem; font-weight: 600;
    background: rgb(255 255 255 / .14); transition: background .15s, color .15s;
}
.howto-nav-link:hover { background: rgb(255 255 255 / .26); }
.howto-nav-num {
    display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
    font-size: .72rem; font-weight: 800; background: rgb(255 255 255 / .28);
}
.howto-nav-link.is-active { background: var(--surface); color: var(--primary-dark); text-shadow: none; }
.howto-nav-link.is-active .howto-nav-num { background: var(--primary); color: #fff; }

.howto-body {
    position: relative; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
    padding: 1.4rem 1.5rem 1.6rem; scroll-behavior: smooth;
}
.howto-section + .howto-section { margin-top: 1.8rem; padding-top: 1.6rem; border-top: 1px solid var(--border); }
.howto-section-title { display: flex; align-items: center; gap: .6rem; font-size: 1.1rem; font-weight: 800; line-height: 1.3; }
.howto-section-title .material-icons-outlined { color: var(--primary-dark); font-size: 24px; }
.howto-lead { margin-top: .6rem; color: var(--text-light); font-size: .92rem; line-height: 1.55; }
.howto-items { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .7rem; }
.howto-items li {
    display: flex; gap: .85rem; align-items: flex-start;
    padding: .85rem 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
}
.howto-item-icon {
    flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px;
    display: grid; place-items: center; font-size: 22px; color: #fff;
    background: linear-gradient(135deg, var(--primary), #eca441);
}
.howto-items strong { display: block; font-size: .93rem; line-height: 1.3; }
.howto-items p { margin-top: .25rem; font-size: .86rem; line-height: 1.5; color: var(--text-light); }
.howto-cta {
    margin-top: 1.8rem; padding: 1.2rem; border-radius: 14px; text-align: center;
    background: rgb(139 197 63 / .1); border: 1px solid rgb(139 197 63 / .35);
}
.howto-cta p { font-size: .9rem; line-height: 1.5; margin-bottom: .9rem; }
@media (max-width: 560px) {
    .howto-head { padding: 1rem 1rem 0; }
    .howto-head h2 { font-size: 1.2rem; }
    .howto-nav { gap: .25rem; }
    .howto-nav-link { flex: 1 1 auto; justify-content: center; padding: .55rem .6rem .65rem; font-size: .8rem; }
    .howto-nav-num { display: none; }
    .howto-body { padding: 1.1rem 1rem calc(1.4rem + env(safe-area-inset-bottom)); }
    .howto-items li { padding: .75rem .8rem; }
}
@media (prefers-reduced-motion: reduce) {
    .howto-panel, .howto-overlay, .howto-overlay.is-closing .howto-panel { animation: none; }
    .howto-body { scroll-behavior: auto; }
}
/* ---------- Countdown pre-apertura ---------- */
.countdown { display: flex; justify-content: center; gap: .6rem; margin: 1.6rem 0 1.6rem; }
.countdown-item {
    display: flex; flex-direction: column; align-items: center; gap: .35rem;
    background: linear-gradient(180deg, var(--primary), #eca441);
    color: #fff; border-radius: var(--radius); padding: .85rem .4rem; min-width: 66px;
    box-shadow: var(--shadow-md);
}
.countdown-num { font-size: 1.75rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.countdown-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; opacity: .92; }
.prereg-text { font-size: .92rem; color: var(--text-light); line-height: 1.5; margin-bottom: 1rem; }
@media (max-width: 420px) {
    .countdown { gap: .4rem; }
    .countdown-item { min-width: 0; flex: 1; padding: .7rem .2rem; }
    .countdown-num { font-size: 1.4rem; }
}

/* ---------- Registrazione (wizard) ---------- */
.auth-card.reg-card { max-width: 520px; }
.reg-row { display: flex; gap: 1rem; }
.reg-row > .form-group { flex: 1; min-width: 0; }
.reg-steps {
    display: flex; gap: .6rem; list-style: none; margin: 0 0 1.6rem; padding: 0;
    justify-content: center; font-size: .82rem; font-weight: 600; color: var(--text-light);
}
.reg-steps li {
    padding: .35rem .9rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--border);
}
.reg-steps li.is-active { background: rgb(139 197 63 / .12); border-color: var(--primary); color: var(--primary-dark); }
.reg-steps li.is-done { background: #e3f6ea; border-color: #b7e4c7; color: #1d7a45; }
.reg-check { font-size: 3rem; color: var(--success, #1d7a45); margin-bottom: .4rem; }
.reg-plan {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; text-align: left;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 1.1rem 1.3rem; margin: 1.4rem 0;
}
.reg-plan-name { font-weight: 700; }
.reg-plan-sub { font-size: .85rem; color: var(--text-light); margin-top: .2rem; }
.reg-plan-price { font-size: 1.6rem; font-weight: 800; color: var(--primary-dark); white-space: nowrap; }
.reg-plan-price span { font-size: .8rem; font-weight: 600; color: var(--text-light); }

/* ---------- Gate ---------- */
.gate-icon { font-size: 3rem; color: var(--warning); margin-bottom: .5rem; }
.gate-card h1 { font-size: 1.5rem; margin-bottom: .8rem; }
.gate-card p { color: var(--text-light); margin-bottom: 1.6rem; }
.gate-card .btn-primary { margin-bottom: .6rem; }

/* ---------- Layout dashboard ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem; }
.sidebar-logo { height: 38px; object-fit: contain; }
.sidebar-close { display: none; }
.sidebar-nav { flex: 1; padding: 0 .8rem; display: flex; flex-direction: column; gap: .25rem; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: .9rem; padding: .75rem .9rem; border-radius: var(--radius);
    color: var(--text-light); text-decoration: none; font-weight: 500; border: none; background: none;
    cursor: pointer; font: inherit; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: rgb(139 197 63 / .12); color: var(--primary-dark); font-weight: 600; }
.nav-item.active .material-icons-outlined { color: var(--primary); }
.sidebar-foot { padding: 1rem; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.avatar { width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-badge { font-size: .7rem; color: var(--primary-dark); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 1.2rem 2rem; position: sticky; top: 0; background: rgb(248 250 252 / .85); backdrop-filter: blur(8px); z-index: 5; border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 1.25rem; }
.topbar-spacer { flex: 1; }
.menu-toggle { display: none; }
.content { padding: 2rem; flex: 1; }

/* ---------- Section header ---------- */
.section-head { margin-bottom: 1.5rem; }
.section-head h2 { font-size: 1.3rem; }
.section-head p { color: var(--text-light); margin-top: .25rem; }

/* ---------- Cards / grids ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s; }
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.card-link { text-decoration: none; color: inherit; cursor: pointer; }
.card-banner { height: 120px; padding: 1rem; display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap; position: relative; overflow: hidden; }
/* Banner segnaposto: gradienti brand (verde #8bc53f + arancione #eca441). */
.doc-bg-1 { background: linear-gradient(135deg, #8bc53f, #eca441); }
.doc-bg-2 { background: linear-gradient(135deg, #eca441, #8bc53f); }
.doc-bg-3 { background: linear-gradient(135deg, #8bc53f, #6fa032 45%, #eca441); }
/* Banner con immagine in evidenza (es. copertina articolo da WordPress) */
.card-banner-img > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.card-banner-img .tag { position: relative; z-index: 1; }
.tag { background: rgb(255 255 255 / .9); padding: .2rem .7rem; border-radius: 1rem; font-size: .72rem; font-weight: 700; box-shadow: var(--shadow-sm); }
.card-body { padding: 1.3rem; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.card-body p { color: var(--text-light); font-size: .9rem; margin-bottom: 1.2rem; }
.card-body .btn { margin-top: auto; }
.card-meta { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-light); margin-bottom: .4rem; }
.card-actions { margin-top: auto; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.card-actions .btn { margin-top: 0; }

/* ---------- Tabs tipo contenuto ---------- */
.type-tabs { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.type-tab { padding: .45rem 1rem; border: 1px solid var(--border); border-radius: 999px; background: #fff; font: inherit; font-size: .85rem; font-weight: 600; color: var(--text-light); cursor: pointer; }
.type-tab:hover { background: var(--bg); }
.type-tab.active { background: var(--primary); border-color: var(--primary); color: #10301a; }
/* Box logo UNIFORME (larghezza piena della card, altezza fissa): qualsiasi
   immagine — grande/piccola, larga/alta — viene contenuta dentro questo riquadro,
   con limiti massimi sia in larghezza sia in altezza, senza deformarsi. */
.partner-logo { height: 140px; display: flex; align-items: center; justify-content: center; background: #fff; border-bottom: 1px solid var(--border); padding: .8rem; }
.partner-logo .material-icons-outlined { font-size: 2.8rem; color: var(--primary); }
.partner-logo-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}
.partner-link { display: inline-block; margin-top: auto; font-size: .85rem; font-weight: 600; color: var(--primary); text-decoration: none; }
.partner-link:hover { text-decoration: underline; }
.partner-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; padding: 0 1.3rem 1.1rem; }
.section-head.with-action { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.section-head.with-action > h2 { flex: 1 1 100%; }
.section-head.with-action > p { flex: 1 1 auto; margin-top: 0; }
.section-head.with-action > .btn { margin-left: auto; }
.text-center { text-align: center; }

/* ---------- Form partner (drawer) ---------- */
.partner-form { display: flex; flex-direction: column; gap: 1rem; }
.form-field { display: flex; flex-direction: column; gap: .35rem; text-align: left; }
.form-label { font-weight: 600; font-size: .9rem; }
.form-control { width: 100%; padding: .55rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; font-size: .9rem; background: #fff; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgb(139 197 63 / .15); }
textarea.form-control { resize: vertical; }
.partner-logo-control { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.partner-logo-preview { width: 100%; max-width: 240px; height: 140px; border: 1px dashed var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; background: var(--bg); overflow: hidden; }
.partner-logo-preview .partner-logo-img { width: 100%; height: 100%; border: 0; padding: .4rem; background: transparent; }
.btn.danger, .btn-text.danger { color: var(--danger); }
.muted { color: var(--text-light); }
.small { font-size: .8rem; }

/* ---------- Article reader ---------- */
.article-body { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; line-height: 1.7; }
.article-body h2, .article-body h3, .article-body h4 { margin: 1.2rem 0 .6rem; }
.article-body p { margin-bottom: 1rem; }
.article-body ul, .article-body ol { margin: 0 0 1rem 1.4rem; }
.article-meta { color: var(--text-light); font-size: .85rem; margin: .3rem 0 1.2rem; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.filters input, .filters select { padding: .55rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; font-size: .9rem; background: #fff; }
.filters .search { flex: 1; min-width: 200px; }
.filters .filter-toggle { display: none; }

/* ---------- Users table (desktop) ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
table.users { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.users th, table.users td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.users th { background: var(--bg); font-weight: 600; color: var(--text-light); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
table.users tr:last-child td { border-bottom: none; }
table.users tr:hover td { background: #fafcff; }

.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 1rem; font-size: .75rem; font-weight: 600; }
.pill-active { background: #dcfce7; color: #166534; }
.pill-expired { background: #fef9c3; color: #854d0e; }
.pill-pending { background: #ffedd5; color: #9a3412; }
.pill-none { background: #f1f5f9; color: #475569; }
.pill-suspended { background: #fee2e2; color: #991b1b; }
.pill-role { background: rgb(139 197 63 / .15); color: var(--primary-dark); }

.row-actions { display: flex; gap: .4rem; }

/* User cards (mobile) — nascoste su desktop */
.user-cards { display: none; flex-direction: column; gap: .8rem; }
.user-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem; }
.user-card .uc-name { font-weight: 700; }
.user-card .uc-line { font-size: .85rem; color: var(--text-light); margin-top: .2rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.user-card .uc-actions { display: flex; gap: .5rem; margin-top: .8rem; }

/* ---------- Modal / drawer dettaglio ---------- */
.scrim { position: fixed; inset: 0; background: rgb(15 23 42 / .45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 420px; max-width: 92vw; background: var(--surface); box-shadow: var(--shadow-lg); z-index: 50; display: flex; flex-direction: column; animation: slideIn .25s ease; }
.drawer-wide { width: 560px; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border); }
.drawer-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.detail-row { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.detail-row .k { color: var(--text-light); }
.detail-row .v { font-weight: 600; text-align: right; }
.detail-section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-light); margin: 1.4rem 0 .5rem; }
.admin-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1.5rem; }
.admin-actions .btn { width: 100%; }
.admin-actions .full { grid-column: 1 / -1; }
.inline-form { display: flex; gap: .5rem; margin-top: .5rem; }
.inline-form select, .inline-form input { flex: 1; padding: .5rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: .5rem; }
.toast { background: var(--text); color: #fff; padding: .7rem 1.1rem; border-radius: var(--radius); font-size: .9rem; box-shadow: var(--shadow-lg); animation: slideUp .2s ease; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.empty { text-align: center; padding: 3rem 1rem; color: var(--text-light); }

/* ---------- Home / hero ---------- */
/* Fondo bianco: gli edifici animati dietro portano il colore, quindi una
   sfumatura piena qui coprirebbe l'effetto e affaticherebbe la lettura. */
/* Riquadro di saluto contenuto: è un'intestazione, non il contenuto della
   pagina — lo spazio serve alle categorie sotto. */
.home-hero {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.5rem; margin-bottom: 1.4rem;
    box-shadow: var(--shadow-sm);
}
.home-hero h2 { font-size: 1.15rem; margin-bottom: .15rem; color: var(--text); }
.home-hero p { color: var(--text-light); font-size: .88rem; }

/* ---------- Prendi un appuntamento ---------- */
.appointment-card {
    max-width: 640px; text-align: center; padding: 2.2rem 2rem;
    border: 1px solid rgb(139 197 63 / .35); background: rgb(139 197 63 / .06);
}
.appointment-icon {
    font-size: 2.6rem !important; color: var(--primary-dark);
    background: rgb(139 197 63 / .15); width: 72px; height: 72px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; margin-bottom: 1rem;
}
.appointment-card h3 { font-size: 1.25rem; color: var(--primary-dark); margin-bottom: .6rem; }
.appointment-lead { color: var(--text-light); margin-bottom: 1.4rem; }
.appointment-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Form prendi appuntamento ---------- */
.appointment-form { display: flex; flex-direction: column; gap: 1rem; max-width: 640px; padding: 1.6rem 1.7rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-field { flex: 1 1 200px; }

/* ---------- Profilo ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; max-width: 900px; margin-bottom: 1.2rem; align-items: start; }
.profile-grid .profile-card { margin-bottom: 0; max-width: none; }
.profile-card { padding: 1.5rem 1.7rem; margin-bottom: 1.2rem; max-width: 640px; }
.txn-table { width: 100%; border-collapse: collapse; margin-top: .6rem; font-size: .88rem; }
.txn-table th, .txn-table td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--border); }
.txn-table th { color: var(--text-light); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.txn-table td:nth-child(2) { font-weight: 600; }
.txn-badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--border); color: var(--text); }
.txn-badge.txn-paid { background: rgb(139 197 63 / .2); color: var(--primary-dark); }
.txn-badge.txn-pending { background: rgb(251 176 59 / .2); color: #9a6700; }
.txn-badge.txn-refunded, .txn-badge.txn-failed { background: rgb(220 38 38 / .12); color: #b91c1c; }
.profile-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.profile-avatar {
    width: 56px; height: 56px; border-radius: 50%; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary); color: #10301a; font-weight: 800; font-size: 1.2rem;
}
.profile-head h3 { font-size: 1.2rem; }
.profile-actions { margin-top: 1rem; max-width: 640px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet: sidebar comprimibile a icone-overlay, griglie più strette */
@media (max-width: 1024px) {
    .content { padding: 1.5rem; }
    .topbar { padding: 1rem 1.5rem; }
}

/* Bottom navigation stile app — nascosta su desktop */
.bottom-nav { display: none; }

/* Tablet / mobile: niente drawer, navigazione con barra in basso (stile app) */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .menu-toggle { display: none; }
    .content { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

    .bottom-nav {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        background: var(--surface); border-top: 1px solid var(--border);
        box-shadow: 0 -4px 18px rgb(31 36 51 / .08);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    }
    .bottom-nav-item {
        flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
        background: none; border: none; cursor: pointer; padding: 5px 2px; border-radius: 12px;
        color: var(--text-light); font: inherit; -webkit-tap-highlight-color: transparent;
    }
    .bottom-nav-item .material-icons-outlined { font-size: 24px; }
    .bottom-nav-item .bn-label {
        font-size: 10.5px; font-weight: 600; line-height: 1; max-width: 100%;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .bottom-nav-item.active { color: var(--primary-dark); }
    .bottom-nav-item.active .material-icons-outlined { color: var(--primary); }
    .bottom-nav-item:active { background: var(--bg); }
}

/* Mobile: tabella utenti -> card, filtri compatti */
@media (max-width: 720px) {
    .content { padding: 1.1rem; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
    .grid { grid-template-columns: 1fr; gap: 1rem; }
    .table-wrap { display: none; }       /* nasconde la tabella larga */
    .user-cards { display: flex; }        /* mostra le card verticali */
    .drawer { width: 100vw; max-width: 100vw; }
    .filters .filter-toggle { display: inline-flex; }
    .filters.collapsed .filter-field { display: none; }
    .filters .search { width: 100%; flex: 1 1 100%; }
    .admin-actions { grid-template-columns: 1fr; }
    .reg-row { flex-direction: column; gap: 0; }
}

/* ---------- Installazione PWA: banner + guida ---------- */
.install-banner {
    position: fixed; left: 12px; right: 12px; z-index: 70;
    bottom: calc(68px + env(safe-area-inset-bottom) + 10px);
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: 0 8px 28px rgb(15 23 42 / .16);
    padding: 10px 12px;
}
.install-banner-icon { width: 38px; height: 38px; border-radius: 9px; flex: 0 0 auto; }
.install-banner-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1 1 auto; }
.install-banner-text strong { font-size: .92rem; }
.install-banner-text span { font-size: .78rem; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.install-banner .btn-sm { flex: 0 0 auto; }
.install-banner-x {
    flex: 0 0 auto; border: none; background: transparent; cursor: pointer;
    color: var(--text-light); display: inline-flex; padding: 4px; border-radius: 8px;
}
.install-banner-x .material-icons-outlined { font-size: 20px; }
/* Su desktop il banner non serve (display:standalone non disponibile in genere). */
@media (min-width: 901px) { .install-banner { display: none; } }

.install-overlay {
    position: fixed; inset: 0; z-index: 120;
    background: rgb(15 23 42 / .5);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0; animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.install-sheet {
    position: relative; width: 100%; max-width: 460px;
    background: var(--surface);
    border-radius: 18px 18px 0 0;
    padding: 26px 22px calc(26px + env(safe-area-inset-bottom));
    text-align: center; box-shadow: 0 -10px 40px rgb(15 23 42 / .25);
    animation: sheetUp .2s ease;
}
@keyframes sheetUp { from { transform: translateY(30px); } to { transform: translateY(0); } }
.install-close {
    position: absolute; top: 12px; right: 12px; border: none; background: transparent;
    cursor: pointer; color: var(--text-light); padding: 6px; border-radius: 8px; display: inline-flex;
}
.install-icon { width: 64px; height: 64px; border-radius: 14px; box-shadow: var(--shadow-md); }
.install-sheet h3 { margin: 12px 0 4px; font-size: 1.2rem; }
.install-lead { color: var(--text-light); font-size: .9rem; margin-bottom: 16px; }
.install-steps { list-style: none; margin: 0 0 8px; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 12px; }
.install-steps li { display: flex; align-items: flex-start; gap: 12px; font-size: .92rem; }
.install-steps li .material-icons-outlined {
    flex: 0 0 auto; font-size: 22px; color: var(--primary-dark);
    background: rgb(139 197 63 / .14); border-radius: 9px; padding: 7px;
}
.install-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.install-note { font-size: .8rem; color: var(--text-light); }

@media (min-width: 560px) {
    .install-overlay { align-items: center; }
    .install-sheet { border-radius: 18px; }
}

/* --- Fatturazione elettronica / log acquisti ------------------------------ */
/* I blocchi nascosti via attributo hidden: serve !important perché .form-field
   e simili impostano display:flex. */
[hidden] { display: none !important; }

.pill-ok   { background: #dcfce7; color: #166534; }
.pill-warn { background: #fef3c7; color: #92400e; }

/* Righe secondarie nelle celle della tabella acquisti (dati fiscali, note). */
table.users td small.muted { display: block; font-size: .75rem; line-height: 1.35; }

/* --- Home per categorie --------------------------------------------------- */
/* Le card categoria sono <button>: azzeriamo lo stile nativo e allineiamo il
   contenuto a sinistra come nelle card <a>. */
.cat-card { font: inherit; text-align: left; border: 1px solid var(--border); padding: 0; width: 100%; }
.cat-card .card-body h3 { margin: 0 0 .25rem; }
.cat-card .card-body p { margin: 0; color: var(--text-light); font-size: .85rem; }
.cat-card:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Redattore dell'articolo (autore del post WordPress): chip con iniziali in
   fondo alla riga dei bottoni della card. È un <button>: cliccandolo si filtrano
   i soli contenuti di quel redattore. */
.card-byline {
    display: inline-flex; align-items: center; gap: .45rem;
    margin-left: auto; min-width: 0; max-width: 100%;
    border: 1px solid transparent; border-radius: 999px;
    background: none; padding: .25rem .6rem .25rem .25rem; cursor: pointer;
    font: inherit; text-align: left; transition: background .15s, border-color .15s;
}
.byline-avatar {
    width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgb(139 197 63 / .18); color: var(--primary-dark);
    font-size: .66rem; font-weight: 800; letter-spacing: .02em;
}
.byline-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.byline-label {
    font-size: .6rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: #94a3b8;
}
.byline-name {
    font-size: .78rem; font-weight: 600; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-byline:hover { background: var(--bg); border-color: var(--border); }
.card-byline.is-active { background: rgb(139 197 63 / .12); border-color: var(--primary); }
.card-byline.is-active .byline-avatar { background: var(--primary); color: #16330a; }
.card-byline.is-active .byline-name { color: var(--primary-dark); }
.card-byline:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Su card strette la riga bottoni va a capo: il chip parte da sinistra. */
@media (max-width: 720px) { .card-byline { margin-left: 0; } }

/* Messaggio di conferma nei form pubblici (es. link di reset inviato). */
.form-ok {
    color: #166534; background: #dcfce7; border: 1px solid #bbf7d0;
    border-radius: var(--radius); padding: .6rem .8rem; font-size: .88rem;
    margin-bottom: 1rem; text-align: left;
}

/* Uso del piano di fatturazione (Log acquisti). */
.usage-bar {
    background: #f1f5f9; border: 1px solid var(--border); border-radius: var(--radius);
    padding: .6rem .9rem; font-size: .82rem; color: var(--text-light); margin-bottom: 1rem;
}
.usage-bar.is-warn { background: #fef3c7; border-color: #fde68a; color: #92400e; font-weight: 600; }
.usage-bar.is-over { background: #fee2e2; border-color: #fecaca; color: #991b1b; font-weight: 600; }

/* Piè di pagina con i dati societari e le informative (obbligatorio). */
.legal-footer {
    max-width: 1120px; margin: 2rem auto 1.2rem; padding: 1.1rem 1.5rem 0;
    border-top: 1px solid var(--border); text-align: center;
    font-size: .74rem; line-height: 1.6; color: var(--text);
}
.legal-footer p { margin: 0 0 .35rem; }
.legal-footer .legal-links a { color: var(--primary-dark); font-weight: 600; text-decoration: none; }
.legal-footer .legal-links a:hover { text-decoration: underline; }
.legal-footer .legal-lines { color: var(--text); font-weight: 500; }
/* Su mobile la bottom-nav copre il fondo pagina: si lascia spazio. */
@media (max-width: 900px) { .legal-footer { margin-bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ---------- Card categoria della home ------------------------------------
   Più grandi di quelle degli elenchi: qui sono il punto d'ingresso, non un
   risultato di ricerca. */
.grid-cats { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.6rem; }
.grid-cats .card-banner { height: 160px; }
.grid-cats .card-body { padding: 1.5rem 1.6rem; }
.grid-cats .card-body h3 { font-size: 1.25rem; }
@media (max-width: 720px) {
    .grid-cats { grid-template-columns: 1fr; gap: 1.1rem; }
    .grid-cats .card-banner { height: 130px; }
}

/* ============================================================
   SFONDO DELL'APPLICAZIONE — disegno tecnico animato
   ------------------------------------------------------------
   Carta millimetrata, prospetti a filo di linea, gru di cantiere e linea di
   quota: il linguaggio di chi progetta, non una città generica.

   Compare SOLO nella home (classe .bg-blueprint sul body, vedi app.js): lì la
   pagina è corta e il disegno la riempie; nelle altre schermate — elenchi,
   tabelle, form — sarebbe rumore sotto ai contenuti.

   Un solo elemento con tre immagini SVG sovrapposte: animando l'intera
   proprietà background-position ogni livello percorre una distanza diversa
   nello stesso tempo, ottenendo la parallasse senza tre elementi separati.
   Le immagini sono SVG in linea: nessun file, nessuna richiesta di rete.
   ============================================================ */
body { background: #fbfcfa; }

body.bg-blueprint::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-repeat: repeat-x, repeat-x, repeat;
    /* Sollevate dal bordo inferiore: il cantiere non deve sembrare appoggiato
       al margine della finestra. */
    background-position: 0 calc(100% - 44px), 0 calc(100% - 96px), 0 0;
    /* 1) cantiere in primo piano  2) prospetti sullo sfondo  3) millimetrata */
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='760' height='190' viewBox='0 0 760 190'%3E%3Cg fill='none' stroke='%238bc53f' stroke-width='1.5' stroke-linecap='square'%3E%3Cpath d='M0 189h760'/%3E%3Cpath d='M36 189V96h74v93M36 116h74M36 136h74M36 156h74M54 96v93M72 96v93M92 96v93'/%3E%3Cpath d='M150 189v-54h44v54M150 135l22-15 22 15'/%3E%3Cpath d='M560 189v-78h58v78M560 130h58M560 150h58M560 170h58M579 111v78M599 111v78'/%3E%3Cpath d='M660 189v-46h40v46M660 160h40'/%3E%3C/g%3E%3Cg fill='none' stroke='%23eca441' stroke-width='1.5' stroke-linecap='square'%3E%3Cpath d='M300 189V44M292 189l8-16 8 16M296 150h8M296 110h8M296 70h8'/%3E%3Cpath d='M242 46h198'/%3E%3Cpath d='M300 26 405 46M300 26 250 46M300 26v18'/%3E%3Cpath d='M406 46v30M400 76h12l-6 10z'/%3E%3Cpath d='M242 40h14v12h-14z'/%3E%3C/g%3E%3Cg fill='none' stroke='%2394a3b8' stroke-width='1' stroke-dasharray='5 4'%3E%3Cpath d='M36 76h74'/%3E%3C/g%3E%3Cg fill='none' stroke='%2394a3b8' stroke-width='1'%3E%3Cpath d='M36 70v12M110 70v12'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='150' viewBox='0 0 560 150'%3E%3Cg fill='none' stroke='%238bc53f' stroke-width='1' stroke-linecap='square'%3E%3Cpath d='M0 149h560'/%3E%3Cpath d='M24 149V82h48v67M24 82l24-16 24 16'/%3E%3Cpath d='M96 149v-42h34v42'/%3E%3Cpath d='M156 149V64h52v85M156 84h52M156 104h52M156 124h52'/%3E%3Cpath d='M232 149v-30h28v30'/%3E%3Cpath d='M286 149V72h46v77M286 92h46M286 112h46M286 132h46'/%3E%3Cpath d='M356 149v-52h38v52M356 97l19-13 19 13'/%3E%3Cpath d='M416 149v-26h24v26'/%3E%3Cpath d='M462 149V76h42v73M462 96h42M462 118h42'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg stroke='%238bc53f' stroke-opacity='.32' stroke-width='.5' fill='none'%3E%3Cpath d='M0 .5h80M0 16.5h80M0 32.5h80M0 48.5h80M0 64.5h80M.5 0v80M16.5 0v80M32.5 0v80M48.5 0v80M64.5 0v80'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 1060px 265px, 780px 210px, 80px 80px;
    /* Il disegno resta un fondo: leggibilità dei contenuti prima di tutto. */
    opacity: .62;
    /* Sfuma verso l'alto: in cima resta carta pulita. */
    -webkit-mask-image: linear-gradient(to top, #000 0%, #000 55%, rgb(0 0 0 / .45) 80%, rgb(0 0 0 / .25) 100%);
            mask-image: linear-gradient(to top, #000 0%, #000 55%, rgb(0 0 0 / .45) 80%, rgb(0 0 0 / .25) 100%);
    animation: bp-pan 120s linear infinite;
}

/* Distanze diverse nello stesso tempo = piani a velocità diverse.
   Ogni distanza è un multiplo esatto della larghezza della piastrella,
   così il ciclo si chiude senza scatti. */
@keyframes bp-pan {
    from { background-position:     0px calc(100% - 44px),     0px calc(100% - 96px),    0px    0px; }
    to   { background-position: -2120px calc(100% - 44px), -1560px calc(100% - 96px), -160px -160px; }
}

/* Su mobile il fondo è più discreto: schermo piccolo, meno rumore. */
@media (max-width: 720px) {
    body.bg-blueprint::before { opacity: .34; background-size: 720px 180px, 520px 140px, 64px 64px; }
}

/* Chi ha chiesto di ridurre le animazioni vede il disegno fermo. */
@media (prefers-reduced-motion: reduce) {
    body.bg-blueprint::before { animation: none; }
}

/* Le superfici di lettura restano opache, così il fondo non disturba. */
.topbar { background: rgb(251 252 250 / .88); }

/* ---------- Video di presentazione (login) ---------- */
.video-overlay {
    position: fixed; inset: 0; z-index: 140; padding: 1.5rem;
    display: grid; place-items: center;
    background: rgb(15 23 42 / .82); backdrop-filter: blur(3px);
    animation: fadeIn .2s ease;
}
.video-frame { position: relative; width: min(960px, 100%); }
.video-ratio {
    position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden;
    background: #000; box-shadow: 0 20px 60px rgb(0 0 0 / .5);
}
.video-ratio iframe, .video-ratio video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-close {
    position: absolute; top: -48px; right: 0; width: 40px; height: 40px; border-radius: 50%;
    border: none; cursor: pointer; display: grid; place-items: center;
    color: #fff; background: rgb(255 255 255 / .18); transition: background .15s;
}
.video-close:hover { background: rgb(255 255 255 / .32); }
.video-close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (max-width: 560px) { .video-overlay { padding: 1rem; } }

/* ---------- Carica documenti (staff) ---------- */
.doc-form { display: flex; flex-direction: column; gap: 1rem; }
.drop-zone {
    display: flex; align-items: center; gap: 1rem; padding: 1.3rem 1.2rem; cursor: pointer;
    border: 2px dashed #cbd5e1; border-radius: 14px; background: var(--bg);
    transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.is-over {
    outline: none; border-color: var(--primary); background: rgb(139 197 63 / .08);
}
.drop-zone.has-file { border-style: solid; border-color: rgb(139 197 63 / .6); background: rgb(139 197 63 / .06); }
.drop-icon {
    flex: 0 0 auto; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
    font-size: 26px; color: #fff; background: linear-gradient(135deg, var(--primary), #eca441);
}
.drop-text { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.drop-text strong { font-size: .95rem; overflow-wrap: anywhere; }
.drop-text span { font-size: .8rem; color: var(--text-light); line-height: 1.4; }
.upload-progress { display: flex; align-items: center; gap: .7rem; }
.upload-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), #eca441); transition: width .15s; }
.upload-pct { font-size: .8rem; font-weight: 600; color: var(--text-light); min-width: 5.5rem; text-align: right; }
.docs-table .doc-cell { display: flex; align-items: center; gap: .75rem; white-space: normal; min-width: 260px; }
.docs-table .doc-cell strong { display: block; line-height: 1.3; }
.doc-icon { flex: 0 0 auto; font-size: 28px; color: #dc2626; }
.doc-file { display: block; font-size: .78rem; color: var(--text-light); margin-top: .15rem; overflow-wrap: anywhere; }
.docs-empty {
    display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 3rem 1rem;
    border: 2px dashed var(--border); border-radius: 14px; color: var(--text-light); text-align: center;
}
.docs-empty .material-icons-outlined { font-size: 44px; color: var(--primary); }
.field-hint { font-size: .78rem; color: var(--text-light); line-height: 1.35; }
.doc-form .form-row { align-items: flex-start; }
