/* ============================================================
   LOGIN (core — condiviso da tutti i plugin)
   ============================================================ */
.login-shell {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-3);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.login-card h2 {
    font-size: 20px;
    margin-top: 6px;
}

.login-subtitle {
    color: var(--ink-soft);
    font-size: 13px;
    margin: 2px 0 18px;
}

.field-label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink-soft);
    margin: 10px 0 6px;
    display: block;
}

.login-card input[type="text"],
.login-card input[type="password"] {
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-sunk);
    padding: 0 12px;
    font-size: 14px;
    color: var(--ink);
    width: 100%;
}

    .login-card input:focus {
        background: #fff;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-100);
    }

/* Campo password con occhio mostra/nascondi — stesso pattern del
   clear-btn di .search-field (bottone assoluto dentro un wrapper
   relative). Selettore con lo stesso peso di quello base sopra
   (classe+classe+attributo+tag) per garantire che l'override di
   padding-right non venga silenziosamente perso per specificità. */
.password-field {
    position: relative;
}

.login-card .password-field input[type="password"],
.login-card .password-field input[type="text"] {
    padding-right: 44px;
}

.password-toggle-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--ink-faint);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s var(--ease);
}

    .password-toggle-btn:hover {
        color: var(--primary-700);
        background: var(--primary-050);
    }

    .password-toggle-btn .material-symbols-outlined {
        font-size: 20px;
    }

.remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ink-soft);
    margin: 14px 0 6px;
    cursor: pointer;
}

    /* Prima checkbox nativa del progetto: accent-color basta (supporto ampio
       nei browser moderni) per allinearla al primary arancio del design
       system, senza dover ricostruire un checkbox custom da zero. */
    .remember-row input[type="checkbox"] {
        accent-color: var(--primary);
        width: 16px;
        height: 16px;
        cursor: pointer;
    }

.login-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    margin: 10px 0 4px;
}

.btn-primary {
    height: 38px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-top: 14px;
    transition: background .15s var(--ease);
}

    .btn-primary:hover {
        background: var(--primary-600);
    }

    .btn-primary:disabled {
        background: var(--ink-faint);
        cursor: default;
    }

/* ============================================================
   LAYOUT FISSO: header e footer fissi, scroll solo nel contenuto
   ============================================================ */
:root {
    --header-h: 68px; /* altezza dichiarata del TopBar (#topbar-slot) */
    --footer-h: 52px; /* altezza dichiarata del Footer (#footer-slot) */
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden; /* niente scroll di pagina: scrolla solo il contenuto */
}

/* Header fisso in alto — SEMPRE visibile (anche da anonimo, non più nascosto
   in quello stato: navbar unica, contenuto condizionale in base al login —
   vedi admin/js/app.js/renderTopbar()). */
#topbar-slot {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    z-index: 200;
    display: flex;
    align-items: center;
    background: var(--bg);
    box-shadow: var(--shadow-1);
    padding: 0 16px;
    box-sizing: border-box;
}

/* Navbar disattivata da CONFIG._hnb/?_hnb= (vedi
   config/config.js#resolveHnb e app.js): --header-h passa a 0, cosi'
   #app-root/#plugin-slot (che vi si agganciano sotto con margin-top/height,
   vedi sotto) riguadagnano lo spazio invece di lasciare un vuoto dov'era la
   barra. La classe va sul <body> (impostata da app.js) invece che solo su
   #topbar-slot: nascondere il solo elemento con display:none non
   basterebbe a far ricalcolare --header-h a chi lo consuma altrove. */
body.navbar-hidden #topbar-slot {
    display: none;
}
body.navbar-hidden {
    --header-h: 0px;
}

#topbar-slot .topbar {
    width: 100%;
    max-width: 1420px;
    margin: 0 auto;
}

/* Footer fisso in basso, sempre presente (Login + shell applicativa). */
#footer-slot {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-h);
    z-index: 200;
    display: flex;
    align-items: center;
    background: var(--bg);
    box-shadow: 0 -1px 2px rgba(43, 33, 26, .06);
    box-sizing: border-box;
}

#footer-slot .app-footer {
    width: 100%;
    padding-top: 0;
    padding-bottom: 0;
}

/* Area di scroll del catalogo pubblico (utente non autenticato): sotto la
   topbar fissa, sopra il footer fisso — stesso schema di #plugin-slot qui
   sotto, usato invece da autenticato. */
#app-root {
    margin-top: var(--header-h); /* la topbar ora è SEMPRE visibile (anche da anonimo) */
    height: calc(100vh - var(--header-h) - var(--footer-h));
    overflow-y: auto;
    box-sizing: border-box;
}

/* Area di scroll della shell applicativa: spinta sotto l'header fisso
   (margin-top) e alta esattamente lo spazio residuo fra header e footer. */
#plugin-slot.shell-page {
    margin-top: var(--header-h);
    height: calc(100vh - var(--header-h) - var(--footer-h));
    overflow-y: auto;
    box-sizing: border-box;
}

/* ============================================================
   APP SHELL / TOPBAR (core)
   ============================================================ */
#app-shell[hidden],
#app-root[hidden] {
    display: none;
}

.shell-page {
    max-width: 1420px;
    margin: 0 auto;
    padding: 5px 5px 5px;
}

@media (max-width: 700px) {
    .shell-page {
        max-width: 1420px;
        margin: 0 auto;
        padding: 4px 4px 4px;
    }
}

.plugin-name-tag {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
    margin-left: 2px;
}

.env-badge {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 3px 8px;
    border-radius: 100px;
    margin-left: 8px;
}

    .env-badge.env-debug {
        background: var(--warn-bg);
        color: var(--warn);
    }

    .env-badge.env-release {
        background: var(--ok-bg);
        color: var(--ok);
    }

/* ============================================================
   FOOTER (core — unico, sempre visibile)
   ============================================================ */
.app-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 1420px;
    margin: 0 auto;
    padding: 14px 16px 22px;
    font-size: 12px;
    color: var(--ink-faint);
}

.app-footer-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.app-footer-secondary {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.app-footer-spacer {
    flex: 1 1 auto;
}

.app-footer-link {
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 600;
}

    .app-footer-link:hover {
        color: var(--primary-700);
        text-decoration: underline;
    }

/* Selettore lingua: variante compatta rispetto a .select-field della
   topbar (qui l'altezza disponibile è quella del footer, 52px). */
.app-footer-locale.has-icon select {
    height: 26px;
    font-size: 11.5px;
    padding: 0 24px 0 26px;
    border-radius: 6px;
    background-size: 12px;
}

.app-footer-locale.has-icon .material-symbols-outlined {
    font-size: 14px;
    left: 7px;
}

/* Selettore lingua reale del catalogo (#langSwitch), spostato qui via
   relocateLangSwitch() — vedi admin/js/app.js. Versione compatta per stare
   nell'altezza ridotta del footer (--footer-h), stessa select moderna
   (.select-field.has-icon) usata nella testata del catalogo. */
.app-footer-lang-slot:empty {
    display: none; /* prima che relocateLangSwitch() lo popoli, non lascia un buco vuoto */
}
.app-footer-lang-slot .lang-switch.select-field select {
    height: 26px;
    min-width: 0;
    padding: 0 24px 0 26px;
    font-size: 11.5px;
    border-radius: 6px;
    background-size: 12px;
}
.app-footer-lang-slot .lang-switch.select-field .material-symbols-outlined {
    font-size: 14px;
    left: 7px;
}

/*
 * Mobile: il footer resta una riga flessibile con wrap (ereditato dalla
 * regola base .app-footer{flex-wrap:wrap}), non uno stack a colonna —
 * lo stack verticale a due righe è stato provato e scartato (si vede lo
 * scarto nel flex-direction:column commentato sotto, lasciato come
 * traccia deliberata, non refuso). .app-footer-meta e .app-footer-secondary
 * restano due gruppi logici (copyright/versione, lingua/supporto): quando
 * il contenuto non entra su una riga vanno a capo *dentro* il proprio
 * gruppo, senza mischiarsi tra loro. justify-content:space-between sui
 * due gruppi principali; centratura interna di ciascun gruppo.
 */
@media (max-width: 560px) {
    .app-footer {
        /* flex-direction: column; */
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 12px 16px 16px;
        text-align: center;
        font-size: 12.5px;
    }

    .app-footer-meta,
    .app-footer-secondary {
        justify-content: center;
    }

    .app-footer-spacer {
        display: none;
    }

    /* Il footer fisso deve poter ospitare due righe reali (il contenuto può
       andare a capo qui sotto) senza che il contenuto della pagina sopra ne
       resti coperto: --footer-h è quello che #app-root/#plugin-slot
       sottraggono per calcolare la propria altezza (vedi height:calc(...)
       più sopra in questo file) — se il footer renderizzato è più alto di
       quanto dichiarato qui, la parte finale della pagina finisce nascosta
       SOTTO il footer invece di restare scrollabile fino in fondo (bug
       segnalato: "l'ultima parte del contenuto va sotto il footer"). Valore
       alzato con margine generoso per coprire il caso a due righe, non solo
       quello a una riga già misurato. */
    :root {
        --footer-h: 64px;
    }

    .app-footer-locale.has-icon select {
        height: 38px;
        font-size: 13px;
        padding: 0 30px 0 32px;
        border-radius: 9px;
        background-size: 15px;
    }

    .app-footer-locale.has-icon .material-symbols-outlined {
        font-size: 17px;
        left: 10px;
    }
}

/* ============================================================
   PLUGIN LIST (core — fallback quando non c'è un plugin risolvibile)
   ============================================================ */
.plugin-list {
    max-width: 720px;
    margin: 40px auto;
    text-align: center;
}

    .plugin-list h2 {
        font-size: 22px;
        margin-bottom: 6px;
    }

    .plugin-list > p {
        color: var(--ink-soft);
        font-size: 13.5px;
        margin-bottom: 24px;
    }

.plugin-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.plugin-list-loading {
    grid-column: 1 / -1;
    color: var(--ink-faint);
}

.plugin-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 22px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-1);
    cursor: pointer;
    transition: all .15s var(--ease);
}

    .plugin-card:hover {
        border-color: var(--primary);
        box-shadow: var(--shadow-2);
        transform: translateY(-1px);
    }

    .plugin-card-icon {
        font-size: 30px;
        color: var(--primary);
    }

    .plugin-card-name {
        font-weight: 700;
        font-size: 14px;
    }

    .plugin-card-version {
        font-size: 11px;
        color: var(--ink-faint);
        font-family: var(--font-mono);
    }

/* ============================================================
   DEBUG CONSOLE (core)
   ============================================================ */
#debug-console-slot {
    position: fixed;
    right: 16px;
    bottom: calc(var(--footer-h) + 16px);
    z-index: 500;
    width: min(420px, calc(100vw - 32px));
}

.debug-console {
    background: var(--ink);
    color: #E8E3DC;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-3);
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 12px;
    width: 130px;
}

.debug-console-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255,255,255,.06);
    font-family: var(--font-body);
}

    .debug-console-header .material-symbols-outlined {
        font-size: 17px;
        color: var(--primary-100);
    }

    .debug-console-header strong {
        font-size: 12.5px;
    }

.debug-console-count {
    background: rgba(255,255,255,.12);
    border-radius: 100px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
}

.debug-console-spacer {
    flex: 1 1 auto;
}

.debug-console-header button {
    background: transparent;
    border: none;
    color: #E8E3DC;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 6px;
}

    .debug-console-header button:hover {
        background: rgba(255,255,255,.12);
    }

.debug-console-toggle {
    font-size: 14px !important;
    line-height: 1;
}

.debug-console-body {
    max-height: 280px;
    overflow-y: auto;
    padding: 6px 10px 10px;
}

.debug-console[data-collapsed="true"] .debug-console-body {
    display: none;
}

.debug-console[data-collapsed="true"] .debug-console-toggle {
    transform: rotate(-90deg);
}

.debug-console-empty {
    color: #9C9488;
    padding: 8px 2px;
}

.debug-entry {
    padding: 5px 2px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: baseline;
}

.debug-entry-time {
    color: #9C9488;
    flex-shrink: 0;
}

.debug-entry-source {
    background: rgba(255,255,255,.1);
    border-radius: 6px;
    padding: 0 6px;
    flex-shrink: 0;
}

.debug-entry-message {
    flex: 1 1 auto;
}

.debug-entry-payload {
    width: 100%;
    margin: 4px 0 0;
    color: #9C9488;
    white-space: pre-wrap;
    word-break: break-all;
}

.debug-entry.level-error .debug-entry-message,
.debug-entry.level-error .debug-entry-source {
    color: #F19E93;
}

.debug-entry.level-warn .debug-entry-message,
.debug-entry.level-warn .debug-entry-source {
    color: #FFC978;
}

@media (max-width: 560px) {
    #debug-console-slot {
        right: 8px;
        bottom: calc(var(--footer-h) + 8px);
        left: 8px;
        width: auto;
    }
}

/* ============================================================
   USER MENU (topbar, angolo in alto a destra)
   Blocco additivo: nessuna regola precedente di questo file o di
   core.css è stata modificata. Riusa i token di core.css:
   --surface, --border, --primary-*, --danger, --radius-md,
   --shadow-2, --ease, --font-display.
   Il dropdown è absolute rispetto a .user-menu e "sporge" sotto
   il #topbar-slot fisso (h. --header-h): funziona perché nessun
   antenato nella topbar ha overflow:hidden.
   ============================================================ */

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
}

/* ---- trigger: avatar cliccabile -------------------------- */
.user-menu-trigger {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .16s var(--ease);
}

    .user-menu-trigger:hover {
        border-color: var(--border-strong);
        box-shadow: var(--shadow-1);
    }

    .user-menu.is-open .user-menu-trigger {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-100);
    }

.user-menu-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* iniziali: stesso linguaggio di .avatar-chip .dot (core.css) */
    background: linear-gradient(155deg, #FFB077, var(--primary-600));
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: .02em;
    user-select: none;
    overflow: hidden;
}

    .user-menu-avatar.has-photo {
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        color: transparent;
    }

/* ---- dropdown -------------------------------------------- */
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 230px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2);
    padding: 6px;
    z-index: 300; /* sopra il contenuto; sotto toast (999) e modali (9999) */
    animation: user-menu-in .18s var(--ease);
}

@keyframes user-menu-in {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---- header nome + email --------------------------------- */
.user-menu-header {
    padding: 10px 12px 11px;
}

.user-menu-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 13.5px;
    color: var(--ink);
    letter-spacing: -.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-email {
    font-size: 12px;
    color: var(--ink-faint);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- separatore ------------------------------------------ */
.user-menu-separator {
    height: 1px;
    background: var(--border);
    margin: 5px 6px;
}

/* ---- voci ------------------------------------------------- */
.user-menu-item {
    width: 100%;
    border: none;
    background: transparent;
    border-radius: 9px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    text-align: left;
    transition: all .14s var(--ease);
}

    .user-menu-item .material-symbols-outlined {
        font-size: 19px;
        color: var(--ink-faint);
        transition: color .14s var(--ease);
    }

    .user-menu-item:hover {
        background: var(--primary-050);
        color: var(--primary-700);
    }

        .user-menu-item:hover .material-symbols-outlined {
            color: var(--primary-700);
        }

    /* logout: sempre in rosso, hover coerente con .action-btn.danger */
    .user-menu-item.danger {
        color: var(--danger);
    }

        .user-menu-item.danger .material-symbols-outlined {
            color: var(--danger);
        }

        .user-menu-item.danger:hover {
            background: var(--danger-bg);
            color: var(--danger);
        }

/* ---- mobile ----------------------------------------------- */
@media (max-width: 560px) {
    .user-menu-dropdown {
        min-width: 210px;
        /* resta ancorata a destra del trigger, che sta già
           nell'angolo destro della topbar: non esce dal viewport */
    }
}

/* ============================================================
   LOGIN MODALE (login-modal.js) — riusa .login-card SOLO per lo stile dei
   campi (le regole sotto sono la stessa identica dichiarazione di
   .login-card input[...]/.password-field sopra, duplicata per un contesto
   diverso: stesso principio già usato per .profile-card input[...] più
   sotto in questo file). .login-card stesso non si può riusare come
   contenitore qui perché porta con sé anche padding/bordo/ombra pensati
   per una card a schermo intero, ridondanti dentro un modale che li ha
   già propri (.custom-modal-content).
   ============================================================ */
.login-modal-body input[type="text"],
.login-modal-body input[type="password"] {
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-sunk);
    padding: 0 12px;
    font-size: 14px;
    color: var(--ink);
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    transition: all .15s var(--ease);
}

    .login-modal-body input:focus {
        background: #fff;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-100);
        outline: none;
    }

.login-modal-body .password-field input[type="password"],
.login-modal-body .password-field input[type="text"] {
    padding-right: 44px;
}

/* ============================================================
   PROFILE PAGE (vista core in #plugin-slot)
   Blocco additivo. Riusa: .field-label, .password-field,
   .password-toggle-btn, .login-error, .btn-primary (shell.css)
   e i token di core.css.
   ============================================================ */

.profile-page {
    max-width: 860px;
    margin: 0 auto;
}

.profile-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 40px;
    padding: 0 16px 0 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--primary-700);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    box-shadow: var(--shadow-1);
    cursor: pointer;
    transition: all .15s var(--ease);
}

    .profile-back:hover {
        border-color: var(--primary);
        color: #fff;
        background: var(--primary);
        box-shadow: var(--shadow-2);
    }

    .profile-back .material-symbols-outlined {
        font-size: 19px;
    }

.profile-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 14px;
    align-items: start;
}

.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    padding: 24px;
}

    .profile-card h2 {
        font-size: 17px;
        margin: 0 0 4px;
    }

.profile-card-subtitle {
    color: var(--ink-soft);
    font-size: 13px;
    margin: 0 0 14px;
}

/* ---- card identità --------------------------------------- */
.profile-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.profile-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* stesso linguaggio di .user-menu-avatar / .avatar-chip .dot */
    background: linear-gradient(155deg, #FFB077, var(--primary-600));
    color: #fff;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 26px;
    letter-spacing: .02em;
    user-select: none;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: var(--shadow-2);
}

    .profile-avatar.has-photo {
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        color: transparent;
    }

/* Più specifico di ".profile-card h2" (classe > tag): niente !important,
   coerente con la disciplina di specificità del resto del file. */
.profile-card .profile-name {
    font-size: 18px;
    margin: 0 0 12px;
}

.profile-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    text-align: left;
}

.profile-detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    min-width: 0;
}

    .profile-detail-row .material-symbols-outlined {
        font-size: 17px;
        color: var(--ink-faint);
        flex-shrink: 0;
    }

.profile-detail-label {
    color: var(--ink-faint);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    flex-shrink: 0;
}

.profile-detail-value {
    color: var(--ink);
    font-weight: 600;
    margin-left: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- form cambio password ---------------------------------
   Input: stessa resa dei campi della login-card. */
.profile-card input[type="password"],
.profile-card input[type="text"] {
    width: 100%;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-sunk);
    padding: 0 12px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--ink);
    box-sizing: border-box;
    transition: all .15s var(--ease);
}

    .profile-card input:focus {
        background: #fff;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-100);
        outline: none;
    }

/* Override spazio per il toggle: STESSO pareggiamento di specificità
   della regola congelata di .login-card (2 classi + attributo + tag,
   vedi core-shell-freeze.md, sezione LOGIN). Se questo selettore perde
   peso, il padding-right viene battuto silenziosamente dalla regola
   base qui sopra. */
.profile-card .password-field input[type="password"],
.profile-card .password-field input[type="text"] {
    padding-right: 44px;
}

.profile-password-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .profile-password-form .btn-primary {
        margin-top: 14px;
        align-self: flex-start;
        min-width: 200px;
    }

.profile-form-error {
    margin-top: 10px;
}

.profile-form-success {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--ok-bg);
    color: var(--ok);
    font-size: 13px;
    font-weight: 600;
}

    .profile-form-success .material-symbols-outlined {
        font-size: 18px;
        flex-shrink: 0;
    }

/* ---- responsive ------------------------------------------- */
@media (max-width: 720px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .profile-password-form .btn-primary {
        align-self: stretch;
        min-width: 0;
    }
}

/* ============================================================
   PROFILE PAGE v2 — header, tab, form grid, indirizzi
   Blocco additivo (estende la sezione PROFILE PAGE precedente:
   .profile-grid/.profile-identity restano definite ma il markup
   v2 non le usa più).
   ============================================================ */

/* ---- header identità (orizzontale) ------------------------ */
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    padding: 18px 24px;
}

    .profile-header .profile-avatar {
        margin-bottom: 0;
        width: 64px;
        height: 64px;
        font-size: 22px;
        flex-shrink: 0;
    }

.profile-header-text {
    min-width: 0;
}

.profile-card .profile-header-sub,
.profile-header-sub {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--ink-faint);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- tab bar ---------------------------------------------- */
.profile-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.profile-tab {
    height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-sunk);
    color: var(--ink-soft);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all .15s var(--ease);
}

    .profile-tab .material-symbols-outlined {
        font-size: 18px;
    }

    .profile-tab:hover {
        border-color: var(--border-strong);
    }

    /* stato attivo: stesso linguaggio di .chip.active */
    .profile-tab.active {
        background: var(--primary);
        border-color: var(--primary);
        color: #fff;
        box-shadow: 0 4px 10px -3px rgba(232,90,12,.5);
    }

/* ---- form a griglia (anagrafica e indirizzo) -------------- */
.profile-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 16px;
    margin-bottom: 6px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---- banner "dati dalla cache" ---------------------------- */
.profile-cache-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--warn-bg);
    color: var(--warn);
    border: 1px solid #F0CB86;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 12px;
}

    .profile-cache-banner .material-symbols-outlined {
        font-size: 17px;
        flex-shrink: 0;
    }

/* ---- testata pannello indirizzi --------------------------- */
.profile-pane-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

    .profile-pane-head .btn-primary {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }

        .profile-pane-head .btn-primary .material-symbols-outlined {
            font-size: 18px;
        }

/* ---- lista indirizzi -------------------------------------- */
.address-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 4px;
}

.address-empty {
    color: var(--ink-faint);
    font-size: 13px;
    padding: 18px 0;
    text-align: center;
}

.address-card {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    background: var(--surface);
    transition: all .15s var(--ease);
}

    .address-card:hover {
        border-color: var(--border-strong);
        background: var(--primary-050);
    }

.address-card-icon {
    color: var(--primary-700);
    background: var(--primary-050);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.address-card-body {
    min-width: 0;
    flex: 1;
}

.address-card-title {
    font-weight: 700;
    font-size: 13.5px;
}

.address-card-sub {
    font-size: 12.5px;
    color: var(--ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.address-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ---- form indirizzo --------------------------------------- */
.address-form {
    border-top: 1px dashed var(--border);
    margin-top: 12px;
    padding-top: 14px;
}

.address-form-title {
    font-size: 15px;
    margin: 0 0 8px;
}

.address-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

/* bottone secondario (annulla): introdotto qui, riusabile */
.btn-secondary {
    height: 36px;
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--ink-soft);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s var(--ease);
}

    .btn-secondary:hover {
        background: var(--bg-sunk);
        color: var(--ink);
    }

/* ---- responsive ------------------------------------------- */
@media (max-width: 720px) {
    .profile-form-grid {
        grid-template-columns: 1fr;
    }

    .profile-pane-head {
        flex-direction: column;
        align-items: stretch;
    }

    .address-card-sub {
        white-space: normal;
    }
}

/* ============================================================
   PROFILE PAGE v3 — salvataggio in testata + SecurityView
   Blocco additivo.
   ============================================================ */

/* La testata del pannello ora vive dentro il form dell'anagrafica e
   contiene il submit in alto a destra; su SecurityView idem. Il bordo
   inferiore separa testata e campi. */
.profile-pane-head {
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 14px;
    align-items: center;
}

/* Testata del form indirizzo: titolo a sinistra, azioni a destra */
.address-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

    .address-form-head .address-form-title {
        margin: 0;
    }

    .address-form-head .address-form-actions {
        margin-top: 0;
    }

/* SecurityView: card a colonna singola, larghezza contenuta */
.security-page .profile-card {
    max-width: 560px;
}

@media (max-width: 720px) {
    /* su mobile la testata torna in colonna e il salva si allarga */
    .profile-pane-head {
        flex-direction: column;
        align-items: stretch;
    }

    .address-form-head {
        flex-direction: column;
        align-items: stretch;
    }

        .address-form-head .address-form-actions {
            justify-content: stretch;
        }

            .address-form-head .address-form-actions button {
                flex: 1;
            }
}

/* ============================================================
   PROFILE PAGE v4 — allineamento al design system dell'app
   Blocco additivo. Tocca (policy account-freeze):
   - profile page (anagrafica/indirizzi): sola resa CSS
   - security view: sola resa CSS
   Nessun contratto JS/markup modificato.
   ============================================================ */

/* ---- bottoni: testo sempre centrato ------------------------
   Vale per tutti i bottoni testuali dell'area (btn-primary,
   btn-secondary, back, tab). justify-content copre anche i casi
   in cui una regola più specifica imposta già display:flex
   (es. .profile-pane-head .btn-primary). */
.btn-primary,
.btn-secondary,
.profile-back,
.profile-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.profile-pane-head .btn-primary,
.address-form-actions .btn-primary,
.address-form-actions .btn-secondary {
    justify-content: center;
}

/* ---- card: stesso linguaggio dei pannelli dell'app ---------
   I pannelli dati dell'app usano radius-md + shadow-1 e padding
   più compatto: la card profilo si allinea (era radius-lg/24px). */
.profile-page .profile-card {
    border-radius: var(--radius-md);
    padding: 18px 20px;
}

.profile-page .profile-header {
    padding: 16px 20px;
}

/* Primario coerente con lo stato attivo dei chip dell'app
   (stessa ombra arancio di .chip.active / .profile-tab.active). */
.profile-page .btn-primary:not(:disabled) {
    box-shadow: 0 4px 10px -3px rgba(232,90,12,.5);
}

    .profile-page .btn-primary:not(:disabled):hover {
        background: var(--primary-600);
    }

/* ---- SecurityView: card cambio password centrata ----------- */
.security-page .profile-card {
    margin: 0 auto;
}

@media (max-width: 720px) {
    .profile-page .profile-card {
        padding: 16px;
    }
}
