* {
    box-sizing: border-box;
}


body {
    margin: 0;
    background-color: #174ea6;
    background-image: url("tooth-on-blue-background-with_small.jpg");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-attachment: fixed;
    color: #202938;
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.5;
}


.contenitore {
    width: min(100% - 32px, 760px);
    margin: 48px auto;
    padding: 28px;
    background: #fff;
    border: 1px solid #e0e5ec;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgb(20 35 60 / 6%);
}

h1 {
    margin-top: 0;
    font-size: 1.7rem;
}

label {
    display: block;
    margin: 18px 0 6px;
    font-weight: 600;
}

input,
textarea,
select {
    display: block;
    width: 100%;
    padding: 12px;
    border: 1px solid #bbc5d2;
    border-radius: 8px;
    background: #fff;
    color: inherit;
    font: inherit;
}

button {
    margin-top: 20px;
    padding: 12px 18px;
    border: 0;
    border-radius: 8px;
    background: #174ea6;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    background: #123d83;
}

a {
    color: #174ea6;
}

.errore {
    padding: 12px;
    border-radius: 8px;
    background: #fff0f0;
    color: #9b1c1c;
}


.login {
    max-width: 440px;
    margin: 8vh auto;
}

.login h1 {
    text-align: center;
    color: #174ea6;
}

.login > p {
    text-align: center;
    color: #596579;
}

.login button {
    width: 100%;
}

.login .errore {
    text-align: left;
}

.login .nota {
    margin-top: 24px;
    font-size: 0.85rem;
}

@media (max-width: 540px) {
    .contenitore {
        margin: 16px auto;
        padding: 20px;
    }

    .login {
        margin: 8vh auto;
    }
}

/* ========================================
   DASHBOARD - GESTIONE AVVISI
   ======================================== */

.dashboard {
    width: min(100% - 32px, 1100px);
    max-width: 1100px;
    margin: 32px auto;
    padding: 28px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding-bottom: 22px;
    border-bottom: 1px solid #e0e5ec;
}

.dashboard-header h1 {
    margin-bottom: 4px;
    color: #174ea6;
}

.dashboard-sottotitolo {
    margin: 0;
    color: #596579;
}

.dashboard-profilo {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.pulsante-link {
    display: inline-block;
    padding: 11px 16px;
    border: 0;
    border-radius: 8px;
    background: #174ea6;
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.pulsante-link:hover {
    background: #123d83;
    color: #fff;
}

.uscita {
    background: #f3f5f8;
    color: #202938;
    border: 1px solid #d7dee8;
}

.uscita:hover {
    background: #e4e9f0;
    color: #202938;
}

.dashboard-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 22px 0;
    padding-bottom: 18px;
    border-bottom: 1px solid #e0e5ec;
}

.dashboard-menu a {
    padding: 9px 13px;
    border-radius: 7px;
    color: #174ea6;
    font-weight: 600;
    text-decoration: none;
}

.dashboard-menu a:hover,
.dashboard-menu a[aria-current="page"] {
    background: #eaf1fc;
}

.dashboard-intro {
    margin: 26px 0;
}

.dashboard-intro h2,
.dashboard-azioni h2,
.dashboard-vuota h2 {
    margin-top: 0;
}

.dashboard-intro p {
    color: #596579;
}

.dashboard-statistiche {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 24px 0 32px;
}

.statistica {
    min-width: 0;
    padding: 22px;
    border: 1px solid #e0e5ec;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 16px rgb(20 35 60 / 4%);
}

.statistica-etichetta {
    display: block;
    color: #596579;
    font-size: 0.95rem;
    font-weight: 600;
}

.statistica-numero {
    margin: 10px 0 4px;
    color: #174ea6;
    font-size: 2.4rem;
    font-weight: 750;
    line-height: 1.2;
}

.statistica-pubblicati .statistica-numero {
    color: #16803d;
}

.statistica-bozze .statistica-numero {
    color: #a16207;
}

.statistica-descrizione {
    color: #596579;
    font-size: 0.875rem;
}

.dashboard-azioni {
    padding-top: 8px;
}

.dashboard-pulsanti {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.pulsante-secondario {
    background: #eaf1fc;
    color: #174ea6;
    border: 1px solid #d5e2f7;
}

.pulsante-secondario:hover {
    background: #dce8fa;
    color: #123d83;
}

.dashboard-vuota {
    margin-top: 28px;
    padding: 22px;
    border: 1px solid #d5e2f7;
    border-radius: 10px;
    background: #f5f8ff;
}

.dashboard-vuota h2 {
    color: #174ea6;
}

.dashboard-vuota a {
    display: inline-block;
    margin-top: 8px;
    font-weight: 600;
}

.dashboard-footer {
    margin-top: 36px;
    padding-top: 18px;
    border-top: 1px solid #e0e5ec;
    color: #596579;
    font-size: 0.875rem;
}

.dashboard-footer p {
    margin: 4px 0;
}

@media (max-width: 700px) {
    .dashboard {
        margin: 16px auto;
        padding: 20px;
    }

    .dashboard-statistiche {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-pulsanti {
        flex-direction: column;
    }

    .dashboard-pulsanti .pulsante-link {
        width: 100%;
    }
}

@media (max-width: 400px) {
    .dashboard {
        width: calc(100% - 20px);
        padding: 16px;
    }

    .dashboard-menu {
        flex-direction: column;
    }

    .dashboard-menu a {
        display: block;
    }
}

/* ========================================
   ELENCO AVVISI
   ======================================== */

.elenco-avvisi {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 20px;
}

.avviso-card {
    padding: 22px;
    border: 1px solid #e0e5ec;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 16px rgb(20 35 60 / 4%);
    overflow-wrap: anywhere;
}

.avviso-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}

.avviso-card h3 {
    margin: 0;
    color: #174ea6;
    font-size: 1.15rem;
}

.avviso-stato {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.avviso-stato-pubblicato {
    background: #e8f7ed;
    color: #16803d;
}

.avviso-stato-bozza {
    background: #fff4db;
    color: #925d00;
}

.avviso-data {
    margin: 14px 0 8px;
    color: #596579;
    font-size: 0.9rem;
}

.avviso-descrizione {
    margin-top: 14px;
    line-height: 1.7;
    white-space: normal;
}

.dashboard-azioni form {
    max-width: 100%;
}

.dashboard-azioni form button {
    margin-right: 8px;
}

.dashboard-azioni form .pulsante-link {
    margin-top: 20px;
}

@media (max-width: 540px) {
    .avviso-card {
        padding: 16px;
    }

    .avviso-card-header {
        flex-direction: column;
    }
}

.messaggio-successo {
    margin: 20px 0;
    padding: 14px 16px;
    border: 1px solid #b7e4c7;
    border-radius: 8px;
    background: #e8f7ed;
    color: #166534;
}


/* ========================================
   PAGINA PUBBLICA DEGLI AVVISI
   ======================================== */

.pagina-pubblica {
    width: min(100% - 32px, 900px);
    max-width: 900px;
}

.pagina-pubblica-header {
    padding-bottom: 22px;
    border-bottom: 1px solid #e0e5ec;
}

.pagina-pubblica-header h1 {
    margin-bottom: 8px;
    color: #174ea6;
}

.pagina-pubblica-header p {
    margin-bottom: 0;
    color: #596579;
}

.pagina-pubblica .avviso-card {
    line-height: 1.7;
}

.pagina-pubblica .avviso-card h3 {
    overflow-wrap: anywhere;
}

.pagina-pubblica .avviso-descrizione {
    overflow-wrap: anywhere;
}

@media (max-width: 540px) {
    .pagina-pubblica {
        width: calc(100% - 20px);
        margin: 16px auto;
        padding: 20px;
    }
}


.ritorna-iniziale {
    margin-top: 24px;
    text-align: center;
}

.ritorna-iniziale a {
    display: inline-block;
    font-weight: 600;
    text-decoration: none;
}

.ritorna-iniziale a:hover {
    text-decoration: underline;
}


/* ========================================
   GESTIONE UTENTI
   ======================================== */

.utenti-form {
    max-width: 620px;
    margin: 24px 0 36px;
    padding: 24px;
    border: 1px solid #e0e5ec;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 16px rgb(20 35 60 / 4%);
}

.utenti-form form {
    margin: 0;
}

.utenti-form button {
    width: 100%;
}

.nota-form {
    margin: 8px 0 0;
    color: #596579;
    font-size: 0.875rem;
}

.utenti-elenco {
    margin-top: 32px;
}

.tabella-utenti {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e0e5ec;
    border-radius: 10px;
}

.tabella-utenti table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    text-align: left;
}

.tabella-utenti th,
.tabella-utenti td {
    padding: 12px 14px;
    border-bottom: 1px solid #e0e5ec;
    overflow-wrap: anywhere;
}

.tabella-utenti th {
    background: #eaf1fc;
    color: #174ea6;
    font-weight: 700;
}

.tabella-utenti tbody tr:last-child td {
    border-bottom: 0;
}

@media (max-width: 540px) {
    .utenti-form {
        padding: 16px;
    }

    .tabella-utenti th,
    .tabella-utenti td {
        padding: 10px;
    }
}