/* Dashboard home — desktop distinta + mobile blu con sfumature */
:root {
    --dash-bg: #121212;
    --dash-card: #1e1e1e;
    --dash-border: #333;
    --dash-text: #e0e0e0;
    --dash-muted: #9e9e9e;
    --dash-mobile-bg: #0a1628;
    --dash-mobile-bg2: #0f2138;
    --dash-mobile-accent: #4d9fff;
    --dash-touch: 54px;
}

/* Splash avvio */
.dashboard-splash {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: radial-gradient(ellipse at 50% 30%, #1a3a5c 0%, #0a1628 55%, #060d18 100%);
    transition: opacity 0.45s ease, visibility 0.45s ease;
}
.dashboard-splash.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.dashboard-splash-logo {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    object-fit: cover;
}
.dashboard-splash-title {
    font-size: 1.65rem;
    font-weight: 900;
    letter-spacing: 0.28em;
    padding-left: 0.28em;
    color: #fff;
    text-transform: uppercase;
}
.dashboard-splash-bar {
    width: min(220px, 70vw);
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    margin-top: 0.25rem;
}
.dashboard-splash-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4d9fff, #f59e0b);
    transition: width 0.35s ease;
}

body.dashboard-home {
    background: var(--dash-bg);
    color: var(--dash-text);
    min-height: 100vh;
}
body.dashboard-home.splash-active {
    overflow: hidden;
}
body.dashboard-home .text-muted {
    color: var(--dash-muted) !important;
}

.dashboard-home-wrap {
    width: 100%;
    max-width: min(95%, 1800px);
    margin-left: auto;
    margin-right: auto;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 2rem;
    overflow: visible;
}

/* Hero hub */
.card-hub-hero {
    grid-column: 1 / -1;
    display: block;
    text-decoration: none;
    color: inherit;
    background-color: var(--dash-card);
    border: 2px solid #f59e0b;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.15);
    border-radius: 16px;
    padding: 22px;
    transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
    order: -1;
}
.card-hub-hero:hover {
    color: inherit;
    border-color: #fbbf24;
    box-shadow: 0 0 22px rgba(245, 158, 11, 0.28);
    transform: translateY(-2px);
}
.card-hub-hero-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}
.card-hub-hero-icon {
    font-size: 2.5rem;
    color: #f59e0b;
    line-height: 1;
    flex-shrink: 0;
}
.card-hub-hero-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #f59e0b;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin: 0 0 0.35rem;
    line-height: 1.2;
}
.card-hub-hero-sub {
    color: var(--dash-muted);
    font-size: 0.98rem;
    margin: 0;
    line-height: 1.4;
}
.card-hub-hero-modules {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem 1rem;
}
.card-hub-hero-modules li {
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.35;
    padding-left: 0.85rem;
    position: relative;
}
.card-hub-hero-modules li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #f59e0b;
}

/* Card moduli omogenee */
.card-op {
    background-color: var(--dash-card);
    border: 1px solid var(--dash-border);
    border-radius: 14px;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    color: #e8e8e8;
    min-height: 128px;
    aspect-ratio: 1 / 1;
    max-height: 160px;
    position: relative;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.card-op:hover {
    color: #fff;
    transform: translateY(-3px);
    border-color: #555;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.card-op-icon {
    font-size: 2.1rem;
    line-height: 1;
    margin-bottom: 0.65rem;
    flex-shrink: 0;
}
.card-op-titolo {
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.25;
    color: #f5f5f5;
    max-width: 100%;
    word-break: break-word;
}
.card-op-desc {
    display: none;
}
.icon-blu { color: #3b82f6; }
.icon-arancio { color: #f59e0b; }
.icon-verde { color: #4caf50; }
.icon-viola { color: #a855f7; }
.icon-rosso { color: #f87171; }
.icon-cyan { color: #00bcd4; }
.icon-teal { color: #14b8a6; }

.dashboard-sezione-label {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b7280;
    margin: 0.35rem 0 0;
    padding-bottom: 0.15rem;
}

#accordionManutenzione .accordion-item {
    background: var(--dash-card);
    border-color: #444;
    color: var(--dash-text);
}
#accordionManutenzione .accordion-button {
    background: var(--dash-card);
    color: #f87171;
}
#accordionManutenzione .accordion-button:not(.collapsed) {
    background: #252525;
    color: #f87171;
}
#accordionManutenzione .accordion-body {
    background: #1a1a1a;
}
body.dashboard-home .alert-success {
    background: #14532d;
    border-color: #22c55e;
    color: #dcfce7;
}
.manutenzione-gruppo {
    border: 1px solid var(--dash-border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.85rem;
    background: #222;
}
.manutenzione-gruppo-titolo {
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}
.manutenzione-gruppo-desc {
    font-size: 0.95rem;
    color: var(--dash-muted);
    margin-bottom: 0.65rem;
}

/* Barra accesso rapido mobile (in basso) */
.dashboard-mobile-quick {
    display: none;
}

@media (min-width: 769px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    .card-hub-hero-modules {
        grid-template-columns: repeat(3, 1fr);
    }
    .card-op {
        min-height: 140px;
        max-height: 170px;
        padding: 20px 16px;
        aspect-ratio: auto;
    }
    .card-op-icon {
        font-size: 2.35rem;
        margin-bottom: 0.75rem;
    }
    .card-op-titolo {
        font-size: 1rem;
    }
    .card-hub-hero {
        padding: 25px;
    }
    .card-hub-hero-icon {
        font-size: 2.75rem;
    }
    .card-hub-hero-title {
        font-size: 1.5rem;
    }
}

@media (min-width: 1200px) {
    .dashboard-grid {
        gap: 18px;
    }
    .card-op {
        min-height: 148px;
        max-height: none;
    }
    .card-op-icon {
        font-size: 2.45rem;
    }
    .card-op-titolo {
        font-size: 1.05rem;
    }
}

/* Mobile — tema blu con sfumature */
@media (max-width: 768px) {
    body.dashboard-home {
        background: var(--dash-mobile-bg) !important;
        background-image:
            radial-gradient(ellipse at 50% -15%, #1a3a5c 0%, transparent 55%),
            radial-gradient(ellipse at 100% 100%, rgba(77, 159, 255, 0.08) 0%, transparent 45%),
            linear-gradient(180deg, var(--dash-mobile-bg2) 0%, var(--dash-mobile-bg) 40%, #081220 100%) !important;
        padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }
    body.dashboard-home .text-muted {
        color: #9eb4d0 !important;
    }
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .card-op {
        background: rgba(19, 42, 71, 0.92);
        border-color: #2a4a6e;
        border-bottom: 3px solid rgba(77, 159, 255, 0.35);
        min-height: 118px;
        max-height: none;
        aspect-ratio: 1 / 1;
        border-radius: 16px;
    }
    .card-op:hover {
        border-color: var(--dash-mobile-accent);
    }
    .card-hub-hero {
        background: rgba(19, 42, 71, 0.95);
        border-color: #f59e0b;
    }
    .dashboard-sezione-label {
        color: #9eb4d0;
    }
    #accordionManutenzione .accordion-item,
    #accordionManutenzione .accordion-button {
        background: rgba(19, 42, 71, 0.9);
        border-color: #2a4a6e;
    }
    #accordionManutenzione .accordion-body {
        background: rgba(15, 33, 56, 0.95);
    }
    .manutenzione-gruppo {
        background: rgba(26, 53, 88, 0.6);
        border-color: #2a4a6e;
    }

    .dashboard-mobile-quick {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1030;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
        gap: 8px;
        background: linear-gradient(180deg, rgba(10, 22, 40, 0.2) 0%, rgba(10, 22, 40, 0.97) 35%);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid rgba(42, 74, 110, 0.85);
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
    }
    .dash-quick-btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: var(--dash-touch);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 6px 4px;
        border-radius: 14px;
        text-decoration: none;
        color: #f0f4fa;
        background: rgba(19, 42, 71, 0.88);
        border: 1px solid #2a4a6e;
        font-size: 0.68rem;
        font-weight: 700;
        line-height: 1.15;
        text-align: center;
        transition: background 0.15s, border-color 0.15s;
    }
    .dash-quick-btn i {
        font-size: 1.25rem;
        color: var(--dash-mobile-accent);
    }
    .dash-quick-btn:active,
    .dash-quick-btn:hover {
        background: rgba(26, 53, 88, 0.95);
        border-color: var(--dash-mobile-accent);
        color: #fff;
    }
}
