/* Tema condiviso ispirato a acportal.studioacenergia.it/ACPortal/simulatori/ */

*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --cgs-teal: #1D7F84;
    --cgs-dark: #1B545E;
    --cgs-light: #f0f7f8;
    --cgs-error: #dc3545;
    --cgs-warning: #ffc107;
    --cgs-success: #1D7F84;
    --cgs-gray: #6c757d;
}

* {
    font-family: 'Montserrat', system-ui, sans-serif;
}

html {
    overflow-x: hidden;
}

body.cgs-body {
    font-family: 'Montserrat', system-ui, sans-serif;
    background: linear-gradient(135deg, #f0f7f8 0%, #e8f4f6 100%);
    min-height: 100vh;
    margin: 0;
    padding: 1.5rem 0;
}

.cgs-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

.glass-card {
    background: white;
    border-radius: 1.5rem;
    border: 1px solid rgba(29, 127, 132, 0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
    padding: 1.5rem;
}

.nav-header {
    background: linear-gradient(135deg, rgba(27, 84, 94, 0.95) 0%, rgba(29, 127, 132, 0.95) 100%);
    padding: 1rem 2rem;
    border-radius: 1.5rem;
    box-shadow: 0 8px 32px rgba(27, 84, 94, 0.15);
    margin-bottom: 2rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-cgs-fixed {
    height: 40px;
    filter: brightness(0) invert(1);
}

.nav-header.nav-header-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
}

.nav-header-grid .nav-header-left {
    justify-self: start;
}

.nav-header-grid .nav-header-center {
    justify-self: center;
}

.nav-header-grid .nav-header-right {
    justify-self: end;
}

.logo-affiliation {
    height: 84px;
    background: white;
    border-radius: 1rem;
    padding: 0.75rem 1.75rem;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

/* i loghi CGS e Studio AC di affiliazione sono bianchi: su fondo bianco sparivano */
.logo-affiliation[src*="header_cgs1"],
.logo-affiliation[src*="header_studio1"] {
    background: linear-gradient(135deg, #1b545e 0%, #1d7f84 100%);
    box-shadow: 0 6px 18px rgba(27, 84, 94, 0.18);
}

.hero-title {
    background: linear-gradient(135deg, #1B545E 0%, #1D7F84 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.btn-portal {
    background: linear-gradient(135deg, #1D7F84 0%, #1B545E 100%);
    color: white;
    font-family: 'Montserrat', system-ui, sans-serif;
    font-weight: 600;
    padding: 1rem 2.5rem;
    border-radius: 3rem;
    border: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(29, 127, 132, 0.3);
    cursor: pointer;
}

.btn-portal:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(29, 127, 132, 0.4);
    color: white;
}

/* Card icona+titolo per griglie di navigazione (Selector2.aspx) */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin: 1.5rem 0;
}

@media (max-width: 1200px) {
    .menu-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .menu-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
    .menu-grid { grid-template-columns: 1fr; }
}

.menu-card {
    background: white;
    border-radius: 1.5rem;
    border: 2px solid rgba(29, 127, 132, 0.15);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.75rem 1.25rem;
    text-decoration: none;
    color: inherit;
}

.menu-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px rgba(29, 127, 132, 0.2);
    border-color: var(--cgs-teal);
    color: inherit;
    text-decoration: none;
}

.menu-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--cgs-teal) 0%, var(--cgs-dark) 100%);
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.menu-icon i {
    font-size: 2rem;
    color: white;
}

.menu-title {
    font-weight: 700;
    color: var(--cgs-dark);
    font-size: 1rem;
}

/* Barra intestazione di sezione (sostituisce .titolo-tabella) */
.section-header-bar {
    background: linear-gradient(135deg, var(--cgs-teal) 0%, var(--cgs-dark) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.section-header-bar.with-close {
    display: flex;
    width: 100%;
    justify-content: space-between;
}

.modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Bottoni toolbar con icona (Main.aspx) */
.command-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
}

.command-btn {
    background: white;
    border: 2px solid rgba(29, 127, 132, 0.15);
    color: var(--cgs-dark);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.6rem 1.1rem;
    border-radius: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: all 0.25s;
    cursor: pointer;
}

.command-btn i {
    color: var(--cgs-teal);
    font-size: 1rem;
}

.command-btn:hover {
    background: linear-gradient(135deg, var(--cgs-teal) 0%, var(--cgs-dark) 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(29, 127, 132, 0.25);
    text-decoration: none;
}

.command-btn:hover i {
    color: white;
}

.command-btn.filtro-attivo {
    position: relative;
    border-color: var(--cgs-teal);
    background: rgba(29, 127, 132, 0.1);
}

.command-btn.filtro-attivo::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--cgs-error);
    border: 2px solid white;
}

/* Header GridView a gradiente */
.grid-header-gradient {
    background: linear-gradient(135deg, var(--cgs-teal) 0%, var(--cgs-dark) 100%) !important;
    color: white !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.cgs-body input[type="text"],
.cgs-body input[type="password"],
.cgs-body input[type="date"],
.cgs-body input[type="number"],
.cgs-body select,
.cgs-body textarea {
    border: 1px solid rgba(29, 127, 132, 0.25);
    border-radius: 0.75rem;
    padding: 0.5rem 0.85rem;
    font-family: 'Montserrat', system-ui, sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cgs-body input[type="text"]:focus,
.cgs-body input[type="password"]:focus,
.cgs-body input[type="date"]:focus,
.cgs-body input[type="number"]:focus,
.cgs-body select:focus,
.cgs-body textarea:focus {
    outline: none;
    border-color: var(--cgs-teal);
    box-shadow: 0 0 0 3px rgba(29, 127, 132, 0.15);
}

.cgs-body input[disabled] {
    background-color: #f4f7f8;
    color: var(--cgs-gray);
}

.page-section {
    margin-bottom: 2rem;
}

.command-group {
    margin-bottom: 1.25rem;
}

.command-group:last-child {
    margin-bottom: 0;
}

.command-group-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cgs-teal);
    margin-bottom: 0.5rem;
}

.grid-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

/* Barra comandi a dropdown (sostituisce .command-group impilati) */
.command-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
    background: white;
    padding: 0.6rem 0 0.85rem;
    border-bottom: 1px solid rgba(29, 127, 132, 0.08);
    box-shadow: 0 6px 12px -8px rgba(27, 84, 94, 0.15);
}

.command-toolbar-spacer {
    flex: 1 1 auto;
}

.command-dropdown {
    position: relative;
}

.command-dropdown-toggle {
    background: linear-gradient(135deg, var(--cgs-teal) 0%, var(--cgs-dark) 100%);
    border: none;
    color: white;
    font-family: 'Montserrat', system-ui, sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.6rem 1.15rem;
    border-radius: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
}

.command-dropdown-toggle:hover {
    box-shadow: 0 8px 16px rgba(29, 127, 132, 0.25);
    transform: translateY(-1px);
}

.command-dropdown-toggle .bi-chevron-down {
    font-size: 0.65rem;
    transition: transform 0.2s;
}

.command-dropdown.open .command-dropdown-toggle .bi-chevron-down {
    transform: rotate(180deg);
}

.command-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.6rem);
    left: 0;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 16px 36px rgba(27, 84, 94, 0.2);
    border: 1px solid rgba(29, 127, 132, 0.1);
    padding: 0.5rem;
    min-width: 230px;
    display: none;
    flex-direction: column;
    gap: 0.1rem;
    z-index: 30;
}

.command-dropdown.open .command-dropdown-menu {
    display: flex;
}

.command-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.65rem;
    color: var(--cgs-dark);
    font-family: 'Montserrat', system-ui, sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.command-dropdown-item i {
    color: var(--cgs-teal);
    font-size: 1rem;
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

.command-dropdown-item:hover {
    background: rgba(29, 127, 132, 0.08);
    color: var(--cgs-dark);
    text-decoration: none;
}

.grid-scroll {
    width: 100%;
    overflow-x: auto;
    margin-top: 1rem;
}

.cell-hidden {
    display: none;
}

.grid-clickable-rows {
    border-collapse: collapse;
}

.grid-clickable-rows tr {
    background: transparent;
}

.grid-row-card {
    display: block;
    background: white;
    border: 1px solid rgba(29, 127, 132, 0.1);
    border-left: 4px solid var(--cgs-teal);
    border-radius: 1rem;
    box-shadow: 0 4px 14px rgba(27, 84, 94, 0.06);
    padding: 1.1rem 1.35rem;
    margin: 0 0 0.9rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

.grid-clickable-rows tr:last-child .grid-row-card {
    margin-bottom: 0;
}

.grid-clickable-rows tr:hover .grid-row-card {
    box-shadow: 0 12px 28px rgba(27, 84, 94, 0.16);
    transform: translateY(-2px);
}

.grid-row-card.status-accent-success { border-left-color: #1a7f37; }
.grid-row-card.status-accent-info { border-left-color: var(--cgs-teal); }
.grid-row-card.status-accent-warning { border-left-color: #a15c00; }
.grid-row-card.status-accent-danger { border-left-color: #c22; }
.grid-row-card.status-accent-neutral { border-left-color: #8a98a3; }

.grid-row-selected .grid-row-card {
    background: rgba(29, 127, 132, 0.05);
    box-shadow: 0 12px 28px rgba(27, 84, 94, 0.2);
}

.grid-row-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.grid-row-card-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.grid-row-avatar {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cgs-teal) 0%, var(--cgs-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.grid-row-card-main {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.grid-row-card-title {
    font-weight: 700;
    color: var(--cgs-dark);
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-row-card-subtitle {
    color: var(--cgs-gray);
    font-size: 0.8rem;
}

.grid-row-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.9rem 1.5rem;
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(29, 127, 132, 0.09);
}

.grid-row-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.grid-row-meta-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cgs-teal);
}

.grid-row-meta-value {
    font-size: 0.82rem;
    color: var(--cgs-dark);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.9rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-badge-sm {
    padding: 0.18rem 0.65rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    width: fit-content;
}

.status-badge-success {
    background: rgba(46, 160, 67, 0.12);
    color: #1a7f37;
}

.status-badge-info {
    background: rgba(29, 127, 132, 0.12);
    color: var(--cgs-dark);
}

.status-badge-warning {
    background: rgba(230, 159, 0, 0.14);
    color: #a15c00;
}

.status-badge-danger {
    background: rgba(217, 48, 48, 0.12);
    color: #c22;
}

.status-badge-neutral {
    background: rgba(100, 116, 130, 0.12);
    color: #4b5a63;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem 1.1rem;
    border-radius: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    text-decoration: none;
}

.user-menu {
    position: relative;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 2rem;
    padding: 0.35rem 1rem 0.35rem 0.35rem;
    cursor: pointer;
    color: white;
    transition: background 0.2s;
}

.user-pill:hover {
    background: rgba(255, 255, 255, 0.22);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cgs-teal) 0%, var(--cgs-dark) 100%);
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-pill-text {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.25;
}

.user-pill-text strong {
    font-size: 0.85rem;
}

.user-pill-text small {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.75);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 16px 40px rgba(0,0,0,0.18);
    width: 260px;
    z-index: 100;
    text-align: left;
    overflow: hidden;
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

.user-dropdown-header .user-avatar {
    width: 42px;
    height: 42px;
    font-size: 1rem;
}

.user-dropdown-header strong {
    display: block;
    color: var(--cgs-dark);
    font-size: 0.95rem;
}

.user-dropdown-header small {
    color: var(--cgs-teal);
    font-weight: 600;
    font-size: 0.8rem;
}

.user-dropdown-sub {
    padding: 0 1rem 0.85rem;
    font-size: 0.7rem;
    color: var(--cgs-gray);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid rgba(29,127,132,0.1);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    color: var(--cgs-dark);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: 'Montserrat', system-ui, sans-serif;
}

.user-dropdown-item i {
    color: var(--cgs-teal);
    font-size: 1rem;
}

.user-dropdown-item:hover {
    background: rgba(29, 127, 132, 0.08);
    text-decoration: none;
    color: var(--cgs-dark);
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(27, 84, 94, 0.45);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-panel {
    max-width: 420px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    animation: modal-pop 0.2s ease-out;
}

/* Legenda stati delle pratiche (js/legenda-stati.js) */
button.command-btn {
    font-family: inherit;
}

.legenda-panel {
    max-width: 640px;
}

#legendaTitolo i {
    margin-right: 0.5rem;
}

.legenda-gruppo + .legenda-gruppo {
    margin-top: 1.25rem;
}

.legenda-titolo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.35rem;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--cgs-dark);
}

.legenda-titolo i {
    color: var(--cgs-teal);
}

.legenda-nota {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    color: var(--cgs-gray);
}

.legenda-riga {
    display: grid;
    grid-template-columns: 150px 1fr;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-top: 1px solid rgba(29, 127, 132, 0.1);
}

.legenda-desc {
    font-size: 0.85rem;
    color: var(--cgs-dark);
    line-height: 1.4;
}

@media (max-width: 520px) {
    .legenda-riga {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
}

@keyframes modal-pop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    max-width: 420px;
    width: 100%;
}

/* Rimandi tra le pagine di login (Login / LoginPartners / LoginTech) */
.login-switch {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 0.6rem;
    z-index: 10;
}

.login-switch a {
    background: white;
    border: 2px solid rgba(29, 127, 132, 0.25);
    color: var(--cgs-dark);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.5rem 1.1rem;
    border-radius: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    transition: all 0.25s;
}

.login-switch a:hover {
    background: rgba(29, 127, 132, 0.08);
    border-color: rgba(29, 127, 132, 0.45);
    color: var(--cgs-dark);
    text-decoration: none;
}

/* Riepilogo attività operatori (Selector2.aspx) */
.notifiche-card {
    margin-bottom: 2rem;
}

.notifiche-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.notifiche-count {
    background: white;
    color: var(--cgs-dark);
    border-radius: 1rem;
    padding: 0.05rem 0.55rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.notifiche-empty {
    color: #5a6e7a;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.25rem;
}

.notifiche-empty i {
    color: var(--cgs-teal);
    font-size: 1.1rem;
}

.notifiche-list {
    max-height: 380px;
    overflow-y: auto;
}

.notifica-item {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 0.75rem 0.25rem;
    border-bottom: 1px solid rgba(29, 127, 132, 0.07);
}

.notifica-item:last-child {
    border-bottom: none;
}

.notifica-link {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    margin: -0.4rem 0;
    padding: 0.4rem 0.5rem;
    border-radius: 0.75rem;
    color: inherit;
    text-decoration: none;
    transition: background 0.2s;
}

.notifica-link:hover {
    background: rgba(29, 127, 132, 0.06);
    color: inherit;
    text-decoration: none;
}

.notifica-link:hover .notifica-title strong {
    text-decoration: underline;
}

.notifica-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 0.75rem;
    background: var(--cgs-light);
    color: var(--cgs-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.notifica-body {
    flex: 1 1 auto;
    min-width: 0;
}

.notifica-title {
    color: var(--cgs-dark);
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.notifica-tipo {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--cgs-teal);
    border: 1px solid rgba(29, 127, 132, 0.3);
    border-radius: 1rem;
    padding: 0.05rem 0.5rem;
}

.notifica-testo {
    color: #34474f;
    font-size: 0.88rem;
    margin-top: 0.2rem;
    overflow-wrap: anywhere;
}

.notifica-meta {
    color: var(--cgs-gray);
    font-size: 0.75rem;
    margin-top: 0.2rem;
}

.notifica-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cgs-gray);
    font-size: 1.2rem;
    line-height: 1;
    text-decoration: none;
    transition: all 0.2s;
}

.notifica-close:hover {
    background: rgba(29, 127, 132, 0.1);
    color: var(--cgs-dark);
    text-decoration: none;
}

@media (max-width: 600px) {
    .login-switch {
        position: static;
        justify-content: center;
        flex-wrap: wrap;
        padding: 0 1rem 1rem;
    }
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--cgs-dark);
    margin-bottom: 0.35rem;
}

.footer-cgs {
    margin-top: 2rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(27, 84, 94, 0.95) 0%, rgba(29, 127, 132, 0.95) 100%);
    color: white;
    border-radius: 1.5rem;
    font-size: 0.75rem;
    text-align: center;
    line-height: 1.6;
}

.filter-card {
    max-width: 760px;
    margin: 0 auto;
}

.filter-grid {
    display: flex;
    flex-direction: column;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.6rem 0.25rem;
    border-bottom: 1px solid rgba(29, 127, 132, 0.07);
}

.filter-row:last-child {
    border-bottom: none;
}

.filter-row-check {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: var(--cgs-teal);
}

.filter-row-label {
    flex: 0 0 240px;
    font-weight: 600;
    color: var(--cgs-dark);
    font-size: 0.85rem;
}

.filter-row-input {
    flex: 1 1 auto;
    min-width: 0;
}

.filter-row-input .cgs-body input,
.filter-row-input input,
.filter-row-input select {
    width: 100%;
}

@media (max-width: 600px) {
    .filter-row {
        flex-wrap: wrap;
    }

    .filter-row-label {
        flex: 1 1 auto;
    }

    .filter-row-input {
        flex: 1 1 100%;
    }
}

.filter-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-outline {
    background: white;
    border: 2px solid rgba(29, 127, 132, 0.25);
    color: var(--cgs-dark);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.7rem 1.5rem;
    border-radius: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s;
}

.btn-outline:hover {
    background: rgba(29, 127, 132, 0.08);
    color: var(--cgs-dark);
    text-decoration: none;
}

.modal-ajax-backdrop {
    background: rgba(27, 84, 94, 0.55);
}

.alert-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 300;
    max-width: min(90vw, 560px);
    padding: 1.1rem 1.75rem;
    border-radius: 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 20px 48px rgba(27, 84, 94, 0.3);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    animation: alert-toast-in 0.25s ease-out;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.alert-toast.alert-toast-hide {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.95);
}

.alert-toast:empty {
    display: none;
}

.alert-toast::before {
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
}

.alert-toast-error {
    background: #fdecec;
    color: #b42318 !important;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.alert-toast-error::before {
    content: '\26A0';
}

.alert-toast-success {
    background: #e9f7ee;
    color: #1a7f37 !important;
    border: 1px solid rgba(26, 127, 55, 0.3);
}

.alert-toast-success::before {
    content: '\2713';
}

@keyframes alert-toast-in {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Pagine a colonna stretta (FotoCT, Documentazione*) */
.page-narrow {
    max-width: 1000px;
    margin: 0 auto;
}

/* Riferimenti della pratica in cima alle pagine di lavorazione (RiepilogoPratica.vb) */
.riepilogo-pratica .grid-row-meta {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.riepilogo-pratica .grid-row-meta-value {
    font-size: 0.9rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.card-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Righe documento: etichetta / selettore file / azioni + stato */
.upload-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    padding: 0.85rem 0.25rem;
    border-bottom: 1px solid rgba(29, 127, 132, 0.07);
}

.upload-row:last-of-type {
    border-bottom: none;
}

.upload-row-label {
    flex: 0 0 300px;
    font-weight: 600;
    color: var(--cgs-dark);
    font-size: 0.9rem;
}

.upload-row-label small {
    display: block;
    font-weight: 500;
    color: var(--cgs-gray);
    font-size: 0.72rem;
}

.upload-row-input {
    flex: 1 1 220px;
    min-width: 0;
}

.upload-row-input input[type="file"] {
    max-width: 100%;
    font-size: 0.8rem;
    color: var(--cgs-gray);
}

.upload-row-input input[type="file"]::file-selector-button {
    font-family: 'Montserrat', system-ui, sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--cgs-dark);
    background: white;
    border: 2px solid rgba(29, 127, 132, 0.25);
    border-radius: 2rem;
    padding: 0.4rem 1rem;
    margin-right: 0.75rem;
    cursor: pointer;
}

.upload-row-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

/* Badge mostrato solo se la riga non ha pulsanti visibili (es. documento non ancora disponibile) */
.upload-row-actions:has(a) .when-missing {
    display: none;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid rgba(29, 127, 132, 0.2);
    color: var(--cgs-teal);
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.2s;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: linear-gradient(135deg, var(--cgs-teal) 0%, var(--cgs-dark) 100%);
    border-color: transparent;
    color: white;
    text-decoration: none;
}

.icon-btn-danger {
    color: #c22;
    border-color: rgba(217, 48, 48, 0.25);
}

.icon-btn-danger:hover {
    background: #c22;
    color: white;
}

@media (max-width: 700px) {
    .upload-row-label {
        flex: 1 1 100%;
    }

    .upload-row-actions {
        margin-left: 0;
    }
}

/* Griglia documenti a riquadri (Documentazione*) */
.doc-group {
    margin-bottom: 1.5rem;
}

.doc-group-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cgs-teal);
    margin-bottom: 0.6rem;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.85rem;
}

.doc-tile {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: white;
    border: 1px solid rgba(29, 127, 132, 0.15);
    border-radius: 1rem;
    padding: 0.9rem 1rem;
    transition: border-color 0.2s, background 0.2s;
}

.doc-tile:not(.doc-tile-download):has(.status-badge-success) {
    background: #f6fbf7;
    border-color: rgba(26, 127, 55, 0.3);
}

.doc-tile-head {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}

.doc-tile-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(29, 127, 132, 0.1);
    color: var(--cgs-teal);
    font-size: 1.05rem;
}

.doc-tile:not(.doc-tile-download):has(.status-badge-success) .doc-tile-icon,
.doc-tile-download:has(.doc-tile-actions a) .doc-tile-icon {
    background: rgba(26, 127, 55, 0.12);
    color: #1a7f37;
}

.doc-tile-title {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--cgs-dark);
    line-height: 1.3;
}

.doc-tile-title small {
    display: block;
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--cgs-gray);
    margin-top: 0.15rem;
}

.doc-tile-head .status-badge {
    padding: 0.2rem 0.65rem;
    font-size: 0.68rem;
}

.doc-tile-body {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
}

.doc-tile-body input[type="file"] {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.72rem;
    color: var(--cgs-gray);
}

.doc-tile-body input[type="file"]::file-selector-button {
    font-family: 'Montserrat', system-ui, sans-serif;
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--cgs-dark);
    background: white;
    border: 1.5px solid rgba(29, 127, 132, 0.25);
    border-radius: 2rem;
    padding: 0.3rem 0.8rem;
    margin-right: 0.5rem;
    cursor: pointer;
}

.doc-tile-actions {
    display: flex;
    gap: 0.4rem;
    margin-left: auto;
}

.doc-tile-actions .icon-btn {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
}

/* Gruppo opzionale richiudibile */
details.doc-group-optional {
    border: 1px dashed rgba(29, 127, 132, 0.3);
    border-radius: 1rem;
    padding: 0.75rem 1rem;
}

details.doc-group-optional > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--cgs-dark);
}

details.doc-group-optional > summary::-webkit-details-marker {
    display: none;
}

details.doc-group-optional > summary::before {
    content: '\F285';
    font-family: 'bootstrap-icons';
    color: var(--cgs-teal);
    transition: transform 0.2s;
}

details.doc-group-optional[open] > summary::before {
    transform: rotate(90deg);
}

details.doc-group-optional > summary small {
    font-weight: 500;
    color: var(--cgs-gray);
    font-size: 0.75rem;
}

details.doc-group-optional[open] > .doc-grid {
    margin-top: 0.85rem;
}

/* Riquadri di sola consultazione: disponibili se il code-behind rende visibile il pulsante di download */
.doc-tile-download .when-available {
    display: none;
}

.doc-tile-download:has(.doc-tile-actions a) .when-available {
    display: inline-flex;
}

.doc-tile-download:has(.doc-tile-actions a) .when-missing {
    display: none;
}

.doc-tile-download:has(.doc-tile-actions a) {
    background: #f6fbf7;
    border-color: rgba(26, 127, 55, 0.3);
}

.doc-tile-download:not(:has(.doc-tile-actions a)) .doc-tile-title {
    color: var(--cgs-gray);
}

.doc-grid-single {
    grid-template-columns: 1fr;
}

/* Variante distruttiva del pulsante principale (conferme di cancellazione) */
.btn-portal.btn-portal-danger {
    background: linear-gradient(135deg, #dc3545 0%, #a71d2a 100%);
    box-shadow: 0 8px 20px rgba(220, 53, 69, 0.3);
}

.btn-portal.btn-portal-danger:hover {
    box-shadow: 0 15px 30px rgba(220, 53, 69, 0.4);
}

/* LinkButton disabilitati (Enabled=False rende <a disabled> senza href) */
a.btn-portal[disabled],
a.btn-outline[disabled],
a.command-btn[disabled] {
    opacity: 0.5;
    pointer-events: none;
    box-shadow: none;
}

/* Sottotitolo con data (es. "Inviato il <data>"): nascosto finché la data è vuota */
.doc-tile-title small:has(> span:empty) {
    display: none;
}

/* Titoletti di gruppo nelle pagine Filtro*.aspx */
.filter-group-label {
    margin: 1.25rem 0 0.25rem;
}

.filter-group-label:first-of-type {
    margin-top: 0;
}
