:root {
    --blue-950: #082d58;
    --blue-900: #0d3a69;
    --blue-800: #155c96;
    --blue-700: #1e73b4;
    --blue-100: #edf5fc;
    --green: #2dbc1d;
    --green-dark: #218c16;
    --green-soft: #eef8ec;
    --heading: #0b315d;
    --text: #344f69;
    --muted: #74869a;
    --border: #d3e0ea;
    --border-soft: #e7eef4;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: Inter, Arial, sans-serif;
    color: var(--text);
    background: #fff;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-700); }

/* Split screen */
.app-shell {
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    min-height: 100vh;
    background: #fff;
}

/* Sidebar istituzionale */
.app-sidebar {
    min-height: 100vh;
    color: #fff;
    background:
        radial-gradient(circle at 15% 4%, rgba(255,255,255,.08), transparent 28%),
        linear-gradient(160deg, #0a3768 0%, #154b80 52%, #0a315c 100%);
}
.app-sidebar-inner {
    min-height: 100vh;
    padding: 34px 30px 28px;
    display: flex;
    flex-direction: column;
    gap: 23px;
}
.sidebar-logo {
    display: block;
    width: 178px;
    max-width: 100%;
    height: auto;
}
.sidebar-kicker {
    display: block;
    margin-bottom: 7px;
    color: #87c5f2;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .09em;
}
.sidebar-intro h1 {
    margin: 0 0 10px;
    color: #fff;
    font-size: 31px;
    line-height: 1.05;
    letter-spacing: -.035em;
}
.sidebar-intro p {
    margin: 0;
    max-width: 270px;
    color: rgba(255,255,255,.8);
    font-size: 14px;
    line-height: 1.48;
}
.sidebar-stack {
    display: grid;
    gap: 12px;
}
.sidebar-box {
    padding: 17px 18px 18px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 16px;
    background: rgba(255,255,255,.055);
}
.sidebar-box h2 {
    margin: 0 0 10px;
    color: #fff;
    font-size: 15px;
    line-height: 1.2;
}
.sidebar-box ul {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
}
.sidebar-box li {
    color: rgba(255,255,255,.87);
    font-size: 13px;
    line-height: 1.36;
}
.sidebar-footer {
    margin-top: auto;
    padding: 15px 16px;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    border: 1px solid rgba(75,224,55,.3);
    border-radius: 15px;
    background: rgba(45,188,29,.12);
}
.sidebar-footer-icon {
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    color: #a9f29d;
    font-size: 13px;
    font-weight: 800;
}
.sidebar-footer strong {
    display: block;
    margin-bottom: 4px;
    color: #fff;
    font-size: 13px;
}
.sidebar-footer div > span {
    display: block;
    color: rgba(255,255,255,.8);
    font-size: 12px;
    line-height: 1.4;
}

/* Area destra */
.app-main {
    min-width: 0;
    background:
        radial-gradient(circle at 84% 8%, rgba(45,188,29,.035), transparent 24%),
        linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}
.main-content {
    min-height: 100vh;
    padding: 42px 58px;
    display: flex;
    align-items: center;
}
.main-inner {
    width: 100%;
    max-width: 1210px;
    margin: 0 auto;
}
.page-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 17px;
}
.page-heading {
    min-width: 0;
    max-width: 820px;
}
.page-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--blue-700);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .09em;
}
.page-heading h2,
.thankyou-content h2 {
    margin: 0;
    color: var(--heading);
    font-size: 36px;
    line-height: 1.05;
    letter-spacing: -.035em;
}
.page-heading p {
    margin: 8px 0 0;
    color: #60758a;
    font-size: 15px;
    line-height: 1.48;
}
.page-status {
    margin-top: 2px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    background: #edf5fd;
    color: var(--blue-800);
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}
.page-status > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--blue-700);
}
.page-status.success {
    background: var(--green-soft);
    color: var(--green-dark);
}
.page-status.success > span { background: var(--green); }

/* Processo: nessun box, solo una linea informativa */
.process-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 6px;
    color: var(--heading);
    white-space: nowrap;
}
.process-step {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.process-step > span {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 11px;
    font-weight: 800;
}
.process-step strong {
    font-size: 13px;
    line-height: 1.2;
}
.process-arrow {
    color: #a0afbd;
    font-size: 16px;
}
.payment-note {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.alert {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid #f0cdcd;
    border-radius: 10px;
    background: #fff4f4;
    color: #8d2727;
    font-size: 13px;
    line-height: 1.4;
}

/* Form */
.form-section + .form-section {
    margin-top: 16px;
}
.form-section-heading {
    margin-bottom: 8px;
}
.form-section-heading strong {
    color: var(--heading);
    font-size: 14px;
    line-height: 1.2;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 11px 18px;
}
.span-2 { grid-column: span 2; }
.field { min-width: 0; }
.field label {
    display: block;
    margin: 0 0 5px;
    color: var(--heading);
    font-size: 13px;
    font-weight: 700;
}
.field input,
.field select {
    width: 100%;
    height: 50px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 15px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input:hover,
.field select:hover { border-color: #bfcfdd; }
.field input:focus,
.field select:focus {
    border-color: #6da3d0;
    box-shadow: 0 0 0 3px rgba(30,115,180,.09);
}
.field input::placeholder { color: #98a8b8; }
#codicefiscale { text-transform: uppercase; }
.field-help {
    display: block;
    margin-top: 4px;
    color: #7f90a1;
    font-size: 11px;
    line-height: 1.25;
}
.privacy-row {
    margin-top: 16px;
    padding: 10px 12px;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    color: #596e82;
    font-size: 11.5px;
    line-height: 1.4;
}
.privacy-row input {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--green);
}
.form-actions {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.btn-primary,
.btn-secondary-link {
    min-height: 49px;
    padding: 0 27px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}
.btn-primary {
    min-width: 190px;
    border: 0;
    color: #fff;
    background: linear-gradient(180deg,#35ca21 0%,#22a812 100%);
    box-shadow: 0 8px 18px rgba(40,174,24,.2);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(40,174,24,.24);
}
.btn-primary:disabled {
    opacity: .65;
    cursor: wait;
    transform: none;
}
.btn-secondary-link {
    color: var(--blue-800);
    background: #edf5fd;
    border: 1px solid #dbeaf8;
}
.centered-actions { justify-content: center; }

/* Select2 */
.select2-container {
    max-width: 100%;
    font-family: inherit;
}
.field > .select2-container {
    width: 100% !important;
    min-width: 0;
}
.select2-container--open { z-index: 10000; }
.select2-container .select2-selection--single {
    height: 50px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}
.select2-container .select2-selection--single .select2-selection__rendered {
    height: 48px;
    line-height: 48px;
    padding-left: 14px;
    padding-right: 36px;
    color: var(--text);
    font-size: 15px;
}
.select2-container .select2-selection--single .select2-selection__arrow {
    height: 48px;
    right: 8px;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #6da3d0;
    box-shadow: 0 0 0 3px rgba(30,115,180,.09);
}
.select2-container--default.select2-container--disabled .select2-selection--single {
    background: #f4f7f9;
    color: #8a98a6;
}
.select2-dropdown {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(20,45,70,.12);
}
.select2-search--dropdown { padding: 8px; }
.select2-search--dropdown .select2-search__field {
    height: 38px;
    padding: 0 10px;
    border: 1px solid #cfdbe5 !important;
    border-radius: 8px;
    outline: none;
    font-size: 13px;
}
.select2-results__option {
    padding: 8px 11px;
    font-size: 13px;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--blue-700);
}

/* Thank-you */
.thankyou-main { justify-content: center; }
.thankyou-content {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}
.thankyou-content .page-status {
    margin: 0 auto 22px;
}
.success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border: 1px solid #cfeac9;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 32px;
    font-weight: 800;
}
.thankyou-content .page-kicker { margin-bottom: 8px; }
.thankyou-lead {
    margin: 10px 0 0;
    color: #60758a;
    font-size: 17px;
    line-height: 1.45;
}
.thankyou-copy {
    margin: 8px auto 0;
    max-width: 700px;
    color: #60758a;
    font-size: 14px;
    line-height: 1.5;
}
.thankyou-steps {
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 16px;
}
.thankyou-steps > div {
    min-width: 0;
    padding: 20px 18px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: rgba(248,251,253,.8);
    text-align: left;
}
.thankyou-steps span {
    width: 28px;
    height: 28px;
    margin-bottom: 11px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--blue-100);
    color: var(--blue-800);
    font-size: 11px;
    font-weight: 800;
}
.thankyou-steps strong {
    display: block;
    margin-bottom: 4px;
    color: var(--heading);
    font-size: 13px;
}
.thankyou-steps small {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
}
.thankyou-note {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 12px;
}

/* Desktop: una sola viewport, nessuno scroll */
@media (min-width: 901px) {
    html, body {
        height: 100%;
        overflow: hidden;
    }
    body {
        height: 100vh;
        height: 100dvh;
    }
    .app-shell {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
    }
    .app-sidebar {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }
    .app-sidebar-inner {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }
    .app-main {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }
    .main-content {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }
    .main-inner { max-height: 100%; }
}

/* Desktop standard/basso: compattiamo gli spazi, non la leggibilita */
@media (min-width: 901px) and (max-height: 840px) {
    .app-shell { grid-template-columns: 315px minmax(0,1fr); }
    .app-sidebar-inner { padding: 20px 21px 17px; gap: 13px; }
    .sidebar-logo { width: 150px; }
    .sidebar-kicker { margin-bottom: 4px; font-size: 10px; }
    .sidebar-intro h1 { margin-bottom: 6px; font-size: 25px; }
    .sidebar-intro p { font-size: 12px; line-height: 1.38; }
    .sidebar-stack { gap: 8px; }
    .sidebar-box { padding: 11px 12px 12px; border-radius: 12px; }
    .sidebar-box h2 { margin-bottom: 6px; font-size: 12.5px; }
    .sidebar-box ul { padding-left: 15px; gap: 3px; }
    .sidebar-box li { font-size: 10.8px; line-height: 1.3; }
    .sidebar-footer { padding: 10px 11px; gap: 8px; border-radius: 12px; }
    .sidebar-footer-icon { width: 23px; height: 23px; flex-basis: 23px; font-size: 11px; }
    .sidebar-footer strong { margin-bottom: 2px; font-size: 11.5px; }
    .sidebar-footer div > span { font-size: 10.5px; line-height: 1.32; }

    .main-content { padding: 20px 34px; }
    .main-inner { max-width: 1120px; }
    .page-heading-row { margin-bottom: 10px; }
    .page-kicker { margin-bottom: 4px; font-size: 10px; }
    .page-heading h2,
    .thankyou-content h2 { font-size: 30px; }
    .page-heading p { margin-top: 5px; font-size: 13px; line-height: 1.38; }
    .page-status { padding: 6px 10px; font-size: 10.5px; }
    .process-line { gap: 9px; margin-bottom: 3px; }
    .process-step { gap: 5px; }
    .process-step > span { width: 21px; height: 21px; flex-basis: 21px; font-size: 9.5px; }
    .process-step strong { font-size: 11.5px; }
    .process-arrow { font-size: 14px; }
    .payment-note { margin-bottom: 10px; font-size: 11px; }

    .form-section + .form-section { margin-top: 10px; }
    .form-section-heading { margin-bottom: 5px; }
    .form-section-heading strong { font-size: 12.5px; }
    .form-grid { gap: 7px 14px; }
    .field label { margin-bottom: 3px; font-size: 11.5px; }
    .field input,
    .field select { height: 43px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
    .field-help { margin-top: 2px; font-size: 10px; }
    .privacy-row { margin-top: 10px; padding: 8px 9px; font-size: 10.4px; line-height: 1.3; }
    .privacy-row input { width: 14px; height: 14px; }
    .form-actions { margin-top: 9px; }
    .btn-primary,
    .btn-secondary-link { min-height: 42px; padding: 0 21px; font-size: 12px; }
    .btn-primary { min-width: 165px; }

    .select2-container .select2-selection--single { height: 43px; border-radius: 9px; }
    .select2-container .select2-selection--single .select2-selection__rendered {
        height: 41px;
        line-height: 41px;
        padding-left: 12px;
        font-size: 13px;
    }
    .select2-container .select2-selection--single .select2-selection__arrow { height: 41px; }

    .thankyou-content .page-status { margin-bottom: 14px; }
    .success-icon { width: 60px; height: 60px; margin-bottom: 12px; font-size: 27px; }
    .thankyou-lead { margin-top: 6px; font-size: 15px; }
    .thankyou-copy { margin-top: 5px; font-size: 13px; }
    .thankyou-steps { margin-top: 18px; gap: 11px; }
    .thankyou-steps > div { padding: 14px; }
    .thankyou-note { margin-top: 11px; }
}

/* Larghezze desktop piu compatte */
@media (min-width: 901px) and (max-width: 1500px) {
    .app-shell { grid-template-columns: 320px minmax(0,1fr); }
    .main-content { padding-left: 40px; padding-right: 40px; }
}

/* Tablet/mobile: scroll naturale */
@media (max-width: 900px) {
    html, body { height: auto; overflow: auto; }
    .app-shell { display: block; min-height: 100vh; }
    .app-sidebar { min-height: auto; }
    .app-sidebar-inner { min-height: auto; padding: 22px 20px; gap: 16px; }
    .sidebar-logo { width: 150px; }
    .sidebar-intro h1 { font-size: 27px; }
    .sidebar-intro p { font-size: 13px; }
    .sidebar-stack { grid-template-columns: 1fr 1fr; }
    .sidebar-footer { margin-top: 0; }
    .app-main { height: auto; overflow: visible; }
    .main-content { min-height: auto; padding: 28px 20px 34px; display: block; overflow: visible; }
    .page-heading-row { display: block; }
    .page-status { margin-top: 14px; }
    .process-line { flex-wrap: wrap; white-space: normal; }
    .process-arrow { display: none; }
}

@media (max-width: 640px) {
    .sidebar-stack { grid-template-columns: 1fr; }
    .sidebar-box:nth-child(2),
    .sidebar-footer { display: none; }
    .main-content { padding: 24px 16px 30px; }
    .page-heading h2,
    .thankyou-content h2 { font-size: 29px; }
    .page-heading p { font-size: 14px; }
    .page-status { display: none; }
    .process-line { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 8px; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .privacy-row { font-size: 11px; }
    .btn-primary { width: 100%; }
    .thankyou-steps { grid-template-columns: 1fr; }
}

/* =========================================================
   LARGE / 4K DESKTOP
   Mantiene invariati desktop, tablet e mobile standard.
   Sui monitor molto ampi aumenta la densita visiva,
   avvicina il contenuto alla sidebar e riduce l'effetto
   di grande superficie bianca inutilizzata.
   ========================================================= */
@media (min-width: 2200px) and (min-height: 1100px) {
    .app-shell {
        grid-template-columns: 430px minmax(0, 1fr);
    }

    .app-sidebar-inner {
        padding: 48px 40px 36px;
        gap: 28px;
    }
    .sidebar-logo {
        width: 210px;
    }
    .sidebar-kicker {
        margin-bottom: 9px;
        font-size: 12px;
    }
    .sidebar-intro h1 {
        margin-bottom: 12px;
        font-size: 38px;
        line-height: 1.03;
    }
    .sidebar-intro p {
        max-width: 330px;
        font-size: 16px;
        line-height: 1.48;
    }
    .sidebar-stack {
        gap: 16px;
    }
    .sidebar-box {
        padding: 21px 22px 22px;
        border-radius: 18px;
    }
    .sidebar-box h2 {
        margin-bottom: 12px;
        font-size: 17px;
    }
    .sidebar-box ul {
        padding-left: 20px;
        gap: 7px;
    }
    .sidebar-box li {
        font-size: 14.5px;
        line-height: 1.4;
    }
    .sidebar-footer {
        padding: 18px 19px;
        gap: 13px;
        border-radius: 17px;
    }
    .sidebar-footer-icon {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
        font-size: 14px;
    }
    .sidebar-footer strong {
        font-size: 14.5px;
    }
    .sidebar-footer div > span {
        font-size: 13px;
    }

    .app-main {
        background:
            radial-gradient(circle at 82% 12%, rgba(45,188,29,.065), transparent 29%),
            radial-gradient(circle at 12% 88%, rgba(30,115,180,.055), transparent 31%),
            linear-gradient(135deg, #ffffff 0%, #f8fbfd 52%, #f1f6fa 100%);
    }
    .main-content {
        padding: 68px clamp(100px, 7vw, 280px);
    }
    .main-inner {
        max-width: 1540px;
        margin-left: 0;
        margin-right: auto;
    }

    .page-heading-row {
        gap: 30px;
        margin-bottom: 23px;
    }
    .page-heading {
        max-width: 1040px;
    }
    .page-kicker {
        margin-bottom: 9px;
        font-size: 12px;
    }
    .page-heading h2,
    .thankyou-content h2 {
        font-size: 44px;
    }
    .page-heading p {
        margin-top: 10px;
        font-size: 17px;
    }
    .page-status {
        padding: 10px 15px;
        font-size: 12.5px;
    }

    .process-line {
        gap: 15px;
        margin-bottom: 8px;
    }
    .process-step {
        gap: 9px;
    }
    .process-step > span {
        width: 29px;
        height: 29px;
        flex-basis: 29px;
        font-size: 12px;
    }
    .process-step strong {
        font-size: 14.5px;
    }
    .process-arrow {
        font-size: 18px;
    }
    .payment-note {
        margin-bottom: 24px;
        font-size: 13px;
    }

    .form-section + .form-section {
        margin-top: 21px;
    }
    .form-section-heading {
        margin-bottom: 10px;
    }
    .form-section-heading strong {
        font-size: 15.5px;
    }
    .form-grid {
        gap: 15px 24px;
    }
    .field label {
        margin-bottom: 7px;
        font-size: 14px;
    }
    .field input,
    .field select {
        height: 58px;
        padding: 0 18px;
        border-radius: 12px;
        font-size: 16.5px;
    }
    .field-help {
        margin-top: 5px;
        font-size: 12px;
    }

    .privacy-row {
        margin-top: 21px;
        padding: 13px 14px;
        gap: 11px;
        font-size: 13px;
    }
    .privacy-row input {
        width: 18px;
        height: 18px;
    }
    .form-actions {
        margin-top: 18px;
    }
    .btn-primary,
    .btn-secondary-link {
        min-height: 56px;
        padding: 0 32px;
        font-size: 14.5px;
    }
    .btn-primary {
        min-width: 220px;
    }

    .select2-container .select2-selection--single {
        height: 58px;
        border-radius: 12px;
    }
    .select2-container .select2-selection--single .select2-selection__rendered {
        height: 56px;
        line-height: 56px;
        padding-left: 18px;
        font-size: 16.5px;
    }
    .select2-container .select2-selection--single .select2-selection__arrow {
        height: 56px;
        right: 10px;
    }

    .thankyou-content {
        max-width: 1080px;
    }
    .thankyou-lead {
        font-size: 19px;
    }
    .thankyou-copy {
        max-width: 820px;
        font-size: 15.5px;
    }
    .thankyou-steps {
        margin-top: 32px;
        gap: 20px;
    }
    .thankyou-steps > div {
        padding: 24px 22px;
    }
    .thankyou-steps strong {
        font-size: 14px;
    }
    .thankyou-steps small {
        font-size: 12.5px;
    }
}
