.profilo-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    --page-gutter: 1.5rem;
    --section-space: 3rem;
    background:
        linear-gradient(180deg, rgba(16, 12, 10, 0.88) 0%, rgba(16, 12, 10, 0.94) 100%),
        url("/images/Legno2.jpg") center/cover no-repeat fixed;
}

.profilo-page main {
    flex: 1;
    padding: var(--section-space) var(--page-gutter) 4rem;
}

.profilo-shell {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--section-space);
}

.profilo-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.profilo-intro-copy {
    flex: 1 1 18rem;
    max-width: 38rem;
}

.profilo-page.is-authed .profilo-shell {
    gap: 1.5rem;
}

.profilo-page.is-authed .profilo-content {
    gap: 0;
}

.profilo-kicker {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wood);
    margin: 0 0 0.65rem;
    font-weight: 600;
}

.profilo-title {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    font-weight: 500;
    line-height: 1.12;
    margin: 0 0 0.85rem;
    color: var(--paper);
}

.profilo-lede {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--paper-2);
    max-width: 32rem;
}

.profilo-guest-cta {
    flex-shrink: 0;
    margin-top: 0.35rem;
}

.profilo-page.is-guest .profilo-guest-cta {
    display: block;
}

.profilo-loading,
.profilo-guest-lede {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.45;
}

.profilo-guest-lede {
    max-width: 28rem;
}

.profilo-page.is-loading .profilo-loading {
    display: block;
}

.profilo-page.is-loading .profilo-content,
.profilo-page.is-loading .profilo-guest {
    display: none;
}

.profilo-page.is-guest .profilo-loading,
.profilo-page.is-guest .profilo-content {
    display: none;
}

.profilo-page.is-guest .profilo-guest {
    display: block;
}

.profilo-page.is-authed .profilo-loading,
.profilo-page.is-authed .profilo-guest,
.profilo-page.is-authed .profilo-guest-cta {
    display: none;
}

.profilo-page.is-authed .profilo-content {
    display: flex;
}

.profilo-content {
    flex-direction: column;
    gap: var(--section-space);
    --profilo-line-section: rgba(196, 165, 116, 0.32);
    --profilo-line-row: rgba(243, 235, 224, 0.07);
}

.profilo-band {
    padding-top: 0;
    border-top: 0;
}

.profilo-band + .profilo-band {
    margin-top: 1.65rem;
    padding-top: 1.65rem;
    border-top: 1px solid var(--profilo-line-section);
}

.profilo-band-head {
    margin-bottom: 0.85rem;
}

.profilo-band-title {
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--paper);
}

.profilo-band-lede {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--muted);
    max-width: 30rem;
}

/* Form nome */
.profilo-name-form {
    margin: 0;
}

.profilo-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.profilo-name-row {
    display: flex;
    gap: 0.65rem;
    align-items: stretch;
}

.profilo-name-row input {
    flex: 1 1 auto;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.55rem 0.65rem;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--paper);
    background: rgba(16, 12, 10, 0.55);
    border: 1px solid rgba(243, 235, 224, 0.12);
    border-radius: 0;
    transition: border-color 0.2s ease;
}

.profilo-name-row input:focus {
    outline: none;
    border-color: rgba(196, 165, 116, 0.55);
}

.profilo-name-row input.is-error {
    border-color: rgba(232, 180, 180, 0.65);
}

.profilo-name-row .btn {
    flex-shrink: 0;
}

.profilo-save-btn {
    display: none !important;
}

.profilo-save-btn.is-visible {
    display: inline-flex !important;
}

[hidden] {
    display: none !important;
}

/* Righe accesso */
.profilo-rows {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.profilo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    padding: 0;
    border: 0;
}

.profilo-row + .profilo-row {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--profilo-line-row);
}

.profilo-row-label {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.profilo-row-value {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--paper);
    text-align: right;
    word-break: break-word;
}

.profilo-row-link {
    color: var(--wood);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 500;
}

.profilo-row-link:hover {
    color: var(--paper);
}

.profilo-band--session {
    padding-bottom: 0.25rem;
}

.profilo-band--session .profilo-band-head {
    margin-bottom: 1rem;
}

.profilo-session-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

.profilo-logout-btn {
    width: 100%;
    max-width: 12rem;
}

.profilo-delete-wrap {
    width: 100%;
    max-width: 12rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--profilo-line-row);
}

.profilo-delete-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--wood);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.profilo-delete-link:hover {
    color: var(--paper);
}

.btn-danger {
    background: #6b2e2e;
    color: #f5d0d0;
    border: 1px solid rgba(232, 180, 180, 0.35);
}

.btn-danger:hover {
    background: #7a3535;
    color: #fff;
}

/* Modale elimina account */
.profilo-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.profilo-modal.is-open {
    display: flex;
}

body.profilo-modal-open {
    overflow: hidden;
}

.profilo-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
}

.profilo-modal-content {
    position: relative;
    z-index: 1;
    width: min(420px, calc(100vw - 2rem));
    background:
        linear-gradient(180deg, rgba(196, 165, 116, 0.08) 0%, transparent 38%),
        var(--ink-2);
    border: 1px solid rgba(243, 235, 224, 0.18);
    color: var(--paper);
    padding: 1rem 1rem 0.85rem;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.profilo-modal-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wood);
}

.profilo-modal-title {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 4vw, 1.4rem);
    font-weight: 500;
    line-height: 1.2;
    margin: 0 2rem 0.55rem 0;
    color: var(--paper);
}

.profilo-modal-lede {
    margin: 0 0 1rem;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--muted);
}

.profilo-modal-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.profilo-modal-close:hover {
    color: var(--paper);
}

.profilo-delete-field {
    margin-bottom: 1rem;
}

.profilo-delete-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.profilo-delete-field input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.65rem;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--paper);
    background: rgba(16, 12, 10, 0.55);
    border: 1px solid rgba(243, 235, 224, 0.12);
    border-radius: 0;
}

.profilo-delete-field input:focus {
    outline: none;
    border-color: rgba(196, 165, 116, 0.55);
}

.profilo-delete-field input.is-error {
    border-color: rgba(232, 180, 180, 0.65);
}

.profilo-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
}

/* Toast */
.profilo-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    z-index: 100000;
    padding: 0.85rem 1.25rem;
    background: var(--paper);
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    max-width: calc(100vw - 2rem);
    text-align: center;
}

.profilo-toast.is-visible {
    transform: translateX(-50%) translateY(0);
}

.profilo-toast.is-error {
    background: #3d2222;
    color: #f5d0d0;
    border: 1px solid rgba(232, 180, 180, 0.35);
}

.profilo-toast.is-success {
    background: var(--paper);
    color: var(--ink);
}

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

@media (max-width: 640px) {
    .profilo-page {
        --section-space: 1.75rem;
    }

    .profilo-page main {
        padding-top: 2rem;
        padding-bottom: 2.5rem;
    }

    .profilo-shell {
        gap: 1rem;
    }

    .profilo-page.is-authed .profilo-shell {
        gap: 0.85rem;
    }

    .profilo-intro {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }

    .profilo-intro-copy {
        flex: none;
    }

    .profilo-title {
        margin-bottom: 0.65rem;
    }

    .profilo-band + .profilo-band {
        margin-top: 1.35rem;
        padding-top: 1.35rem;
    }

    .profilo-row + .profilo-row {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }

    .profilo-guest-cta {
        margin-top: 0;
    }

    .profilo-guest-cta .btn {
        width: 100%;
    }

    .profilo-name-row {
        flex-direction: column;
    }

    .profilo-save-btn.is-visible {
        display: flex !important;
        width: 100%;
    }

    .profilo-row-value {
        text-align: left;
        width: 100%;
    }

    .profilo-logout-btn {
        max-width: none;
    }

    .profilo-delete-wrap {
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .profilo-toast {
        transition: none;
    }
}
