:root {
    /* Nuovi colori della piattaforma (migrati dalla home page d'esempio) */
    --navy-900: #071A2E;
    --navy-800: #0E2A47;
    --navy-700: #143761;
    --navy-600: #1E4A7C;
    --navy-100: #E7EEF7;
    --navy-050: #F5F8FC;

    --yellow-600: #D99800;
    --yellow-500: #F5B700;
    --yellow-400: #FFC627;
    --yellow-300: #FFD557;

    --white: #FFFFFF;
    --grey-100: #F1F4F9;
    --grey-200: #E3E8F0;
    --grey-400: #9AA8BC;
    --grey-500: #6B7C93;
    --grey-700: #2C3E5A;

    /* Stati semantici (esiti questionario, validazioni) */
    --green: #1F9D57;
    --red: #D64545;

    --text: var(--navy-800);
    --text-soft: var(--grey-700);
    --text-muted: var(--grey-500);

    --border: var(--grey-200);

    --radius: 12px;
    --radius-lg: 20px;
    --container: 1240px;

    --shadow-sm: 0 1px 2px rgba(14,42,71,.04), 0 2px 4px rgba(14,42,71,.05);
    --shadow-md: 0 8px 24px rgba(14,42,71,.08);
    --shadow-lg: 0 24px 60px rgba(14,42,71,.14);

    --pantone-background-color: #021d2a; /*#022a38;*/
    --pantone-background-color-dark: #00212c;
    --pantone-background-alternate-color: #ffc000;
}

body{
  font-family:'Inter',-apple-system,sans-serif;font-size:16px;line-height:1.65;
  color:var(--text);background:var(--navy-050);-webkit-font-smoothing:antialiased;
  min-height:100vh;display:flex;flex-direction:column;
}
/* sticky footer: il wrapper del contenuto cresce e tiene il footer in fondo sulle pagine corte */
body > main,
body > .container{
  flex:1 0 auto;
}

h1,h2,h3,h4{
  font-family:'Outfit','Inter',sans-serif;
  font-weight:700;line-height:1.15;
  letter-spacing:-.02em;color:var(--navy-800);
}

html {
  font-size: 14px;
  /* guard mobile: evita lo scroll orizzontale causato da elementi che sforano di poco
     (il back-to-top fixed a right:24px ne diventa il sintomo visibile).
     clip, non hidden: non crea uno scroll-container e non rompe position:sticky */
  overflow-x: clip;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* ======== SITE HEADER / TOOLBAR ======== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    max-width: var(--container);
    margin: 0 auto;
    padding: .75rem 1.5rem;
}
.site-logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.site-logo img {
    height: 44px;
    width: auto;
}
.main-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.main-nav ul {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.main-nav a {
    position: relative;
    padding: .5rem 0;
    font-size: .92rem;
    font-weight: 500;
    color: var(--navy-800);
    text-decoration: none;
    transition: color .2s;
}
.main-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 2px;
    background: var(--yellow-500);
    transition: width .25s;
}
.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}
.main-nav a.active {
    font-weight: 600;
}
.nav-right {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-shrink: 0;
}
.user-area {
    display: flex;
    align-items: center;
    gap: .6rem;
}
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem .9rem .3rem .45rem;
    background: var(--navy-050);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .88rem;
    font-weight: 500;
    color: var(--navy-800);
    text-decoration: none;
    transition: all .2s;
    cursor: pointer;
}
.user-chip:hover {
    border-color: var(--yellow-500);
    background: var(--white);
}
.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy-700), var(--navy-800));
    color: var(--yellow-400);
    font-family: 'Outfit';
    font-weight: 700;
    font-size: .78rem;
}
.user-chip .chevron {
    font-size: .6rem;
    opacity: .5;
}
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 36px;
    padding: 0 8px;
    background: none;
    border: none;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--navy-800);
    border-radius: 2px;
}

@media (max-width: 1040px) {
    .site-logo img {
        height: 40px;
    }
}

@media (max-width: 860px) {
    .site-logo img {
        height: 38px;
    }
    .nav-toggle {
        display: flex;
    }
    /* "Home piattaforma" (.nav-always) resta inline; solo .nav-collapsible va nell'hamburger */
    .main-nav .nav-collapsible {
        display: none;
    }
    .main-nav.open .nav-collapsible {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        border-bottom: 1px solid var(--border);
        padding: 1rem 1.5rem;
        box-shadow: var(--shadow-md);
    }
    .main-nav.open .nav-collapsible li {
        border-bottom: 1px solid var(--border);
    }
    .main-nav.open .nav-collapsible li:last-child {
        border-bottom: none;
    }
    .main-nav.open .nav-collapsible a {
        display: block;
        padding: .9rem 0;
        font-size: .95rem;
    }
    .user-chip .user-name {
        display: none;
    }
}

/* header: su schermi molto stretti il logo si riduce, così l'header non sfora a destra
   (hamburger e chip utente restano interi) — fix alla radice dello scroll orizzontale mobile */
@media (max-width: 560px) {
    .site-logo {
        flex-shrink: 1;
        min-width: 0;
    }
    .site-logo img {
        max-width: 100%;
        height: auto;
    }
}

/* ======== SITE FOOTER ======== */
.site-footer {
    background: var(--navy-900);
    color: rgba(255, 255, 255, .7);
    padding: 2rem 0;
    margin-top: 0rem;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: .88rem;
}
.footer-inner a {
    color: rgba(255, 255, 255, .7);
    text-decoration: none;
    transition: color .2s;
}
.footer-inner a:hover {
    color: var(--yellow-400);
}
.footer-links {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: rgba(255, 255, 255, .45);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.debug {
    display: none;
}

/* ======== BACK TO TOP (riusa .scroll-to-top, look ufficiale) ======== */
.scroll-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy-800);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    z-index: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}
.scroll-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}
.scroll-to-top:hover {
    background: var(--navy-600);
    transform: translateY(-2px);
}
.scroll-to-top svg {
    width: 18px;
    height: 18px;
}

/* ======== COOKIE BANNER ======== */
.cookie-banner {
    position: fixed;
    left: 1.5rem;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 9999;
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem 1.75rem;
    background: var(--navy-800);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--radius);
    box-shadow: 0 16px 48px rgba(7, 26, 46, .32);
    transform: translateY(120%);
    opacity: 0;
    transition: all .45s cubic-bezier(.16, 1, .3, 1);
}
.cookie-banner.show {
    transform: translateY(0);
    opacity: 1;
}
.cookie-banner h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    color: var(--yellow-400);
    margin-bottom: .5rem;
}
.cookie-banner p {
    font-size: .92rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, .85);
    margin-bottom: 1rem;
}
.cookie-banner p a {
    color: var(--yellow-400);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.cookie-banner p a:hover {
    color: var(--yellow-300);
}
.cookie-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}
.cookie-actions button {
    padding: .6rem 1.25rem;
    border: none;
    border-radius: 999px;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    transition: all .2s;
}
.cookie-btn-accept {
    background: var(--yellow-500);
    color: var(--navy-900);
}
.cookie-btn-accept:hover {
    background: var(--yellow-400);
}
.cookie-actions button.cookie-btn-reject {
/*    background: transparent;
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, .3);*/
    background: var(--white);
    color: var(--navy-900);
    border: 1px solid var(--white);
}
.cookie-actions button.cookie-btn-reject:hover {
    border-color: var(--yellow-400);
}
@media (max-width: 560px) {
    .cookie-actions {
        flex-direction: column;
    }
}

.fade-left {
    mask-image: linear-gradient(to left, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0) 100%);
    background-size: cover;
}
/*compensa i margini boostrap del container*/
.row .fade-left[style*="background-image"] {
    left: calc(-.5 * var(--bs-gutter-x));
    position: relative;
}

.custom-card {
    border: solid 1px lightgrey;
    border-left: solid 5px var(--pantone-background-color);
    border-radius: 3px;
    padding: 18px;
    margin: 23px 0 23px 0;
    background-color: #fafafa;
}
    .custom-card > h5 {
        margin-bottom: 15px;
        font-weight: bold;
        font-size: 1.1rem;
    }

:invalid {
    border-left-color: red;
    border-bottom-color: red;
}

.validation-summary {
    padding-bottom: 0px;
}
.validation-summary-valid {
    display: none;
}

/* ======== PILL (badge) — base comune riusabile; le varianti colore stanno nei css di pagina ======== */
.pill {
    display: inline-block;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: .72rem;
    letter-spacing: .04em;
    padding: .22rem .5rem;
    border-radius: 6px;
    line-height: 1.2;
    white-space: nowrap;
}

.error-message-container.bs-callout {
    margin: 0px;
    border-style: none none none solid;
    padding: 20px 20px 5px 20px;
    border-left-width: 7px;
}

/* ======== COLORE TESTO (utility, palette di progetto) ======== */
.txt-navy {
    color: var(--navy-800);
}
.txt-yellow {
    color: var(--yellow-600);
}
.txt-green {
    color: var(--green);
}
.txt-red {
    color: var(--red);
}
.txt-muted {
    color: var(--text-muted);
}