/* ==========================================================================
   SolarEdge Cloud Platform (mock) — stesso sistema visivo del Solar Edge
   Simulator: tela blu notte, vetro, accenti solare (ambra) ed energia (teal),
   un unico font (Inter) e animazioni sobrie che rispettano reduced-motion.
   ========================================================================== */

:root {
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --bg-0: #060a14;
    --bg-1: #0a1120;
    --surface: rgba(17, 25, 42, 0.72);
    --surface-2: rgba(24, 34, 56, 0.78);
    --border: rgba(150, 174, 214, 0.15);
    --border-strong: rgba(150, 174, 214, 0.28);
    --border-subtle: rgba(150, 174, 214, 0.14);

    --ink-primary: #eaf0fc;
    --ink-secondary: #9db0d0;
    --ink-muted: #647796;

    --solar: #ffb020;
    --energy: #2de2b0;
    --battery: #5aa9ff;

    /* Token letti da chart-theme.js e dal JS (nomi invariati) */
    --chart-surface: #111a2c;
    --chart-grid: rgba(150, 174, 214, 0.12);
    --series-energy: #25c9a0;
    --series-energy-light: #7ae8cb;
    --series-energy-fill-top: rgba(37, 201, 160, 0.34);
    --series-energy-fill-bottom: rgba(37, 201, 160, 0);
    --series-consumption: #ff8a4c;
    --series-consumption-light: #ffc09a;
    --series-consumption-fill-top: rgba(255, 138, 76, 0.30);
    --series-consumption-fill-bottom: rgba(255, 138, 76, 0);
    --series-cat-1: #25c9a0;
    --series-cat-2: #5aa9ff;
    --series-cat-3: #ff8a4c;
    --series-cat-4: #b48cff;

    --status-good: #1fcf7a;
    --status-warning: #ffb020;
    --status-serious: #ff8a4c;
    --status-critical: #ff5d6c;
    --status-idle: #7fa4e8;
    --status-offline: #7d8aa3;

    --radius: 16px;
    --shadow: 0 14px 40px rgba(0, 0, 0, 0.38), 0 2px 8px rgba(0, 0, 0, 0.3);
    --ease: cubic-bezier(0.22, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }
html { font-family: var(--font-sans); }
body {
    font-family: var(--font-sans);
    color: var(--ink-primary);
    background:
        radial-gradient(1100px 620px at 8% -8%, rgba(255, 176, 32, 0.10), transparent 60%),
        radial-gradient(1000px 640px at 100% 0%, rgba(45, 226, 176, 0.08), transparent 58%),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
.muted { color: var(--ink-secondary); }
.text-secondary { color: var(--ink-secondary) !important; }
code { color: #ffcf7a; background: rgba(255, 176, 32, 0.08); padding: 0.05rem 0.35rem; border-radius: 5px; font-size: 0.82em; }

/* ---------------------------------------------------------------- Topbar */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(8, 13, 24, 0.72); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1480px; margin: 0 auto; padding: 0.7rem 1.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink-primary); text-decoration: none; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand b { font-weight: 800; color: var(--solar); }
.brand-cloud { width: 34px; height: 34px; }
.brand-cloud .cloud-body { fill: url(#brandCloudGrad); }
.brand-cloud .cloud-bolt { fill: #1a1204; animation: led 2.4s ease-in-out infinite; }
.mock-badge { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.12em; padding: 0.18rem 0.5rem; border-radius: 999px; background: rgba(255, 176, 32, 0.14); color: var(--solar); border: 1px solid rgba(255, 176, 32, 0.35); }
.topbar-actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.topbar-actions .btn { white-space: nowrap; }
.key-label { font-size: 0.74rem; font-weight: 600; color: var(--ink-muted); }
.api-key-input { width: 230px; font-family: "JetBrains Mono", "DejaVu Sans Mono", monospace; font-size: 0.75rem; }
.btn-ghost { color: var(--ink-primary); border: 1px solid var(--border-strong); background: rgba(255, 255, 255, 0.03); border-radius: 999px; padding: 0.3rem 0.9rem; transition: background 0.2s, border-color 0.2s, transform 0.2s; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.4); color: #fff; transform: translateY(-1px); }

.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--status-offline); flex: none; }
.status-dot.active-plant { background: var(--status-good); animation: pulse-ring 2.2s ease-out infinite; }
.status-dot.fault { background: var(--status-critical); animation: pulse-ring-crit 1.2s ease-out infinite; }

/* ----------------------------------------------------------------- Pagina */
.page { max-width: 1480px; margin: 0 auto; padding: 1.2rem 1.4rem 3rem; }
.reveal { animation: rise 0.7s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------- HERO */
.hero { --day: 0; position: relative; overflow: hidden; border-radius: 22px; border: 1px solid var(--border-strong); box-shadow: var(--shadow); margin-bottom: 1rem; isolation: isolate; background: #060b18; }
.hero-sky { position: absolute; inset: 0; z-index: -1; transition: opacity 0.4s linear; }
.hero-sky-night { background: radial-gradient(900px 380px at 14% 20%, rgba(116, 150, 255, 0.16), transparent 60%), linear-gradient(180deg, #060b18 0%, #0b1730 62%, #0a1426 100%); }
.hero-sky-day { opacity: var(--day); background: radial-gradient(700px 360px at 12% 22%, rgba(255, 207, 110, 0.55), transparent 62%), linear-gradient(180deg, #0f3a73 0%, #2a6cb3 48%, #7fb2dd 80%, #bcd8ea 100%); }
.hero-head { position: absolute; left: 1.1rem; right: 1.1rem; top: 0.9rem; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; pointer-events: none; }
.hero-title { pointer-events: auto; display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.4rem 1rem 0.4rem 0.8rem; border-radius: 999px; background: rgba(8, 14, 28, 0.58); border: 1px solid var(--border-strong); backdrop-filter: blur(10px); font-weight: 700; font-size: 0.92rem; }
.hero-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tag { pointer-events: auto; font-size: 0.76rem; font-weight: 500; color: #dbe6ff; padding: 0.32rem 0.75rem; border-radius: 999px; background: rgba(8, 14, 28, 0.5); border: 1px solid var(--border); backdrop-filter: blur(8px); }
.flow-svg { display: block; width: 100%; height: auto; max-height: 520px; }

.flow-svg text { font-family: var(--font-sans); }
.flow-svg .lbl-sm { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; fill: #b9c9e8; }
.flow-svg .lbl-val { font-size: 22px; font-weight: 800; fill: #fff; font-variant-numeric: tabular-nums; }
.flow-svg .lbl-val-sm { font-size: 16px; font-weight: 700; fill: #fff; font-variant-numeric: tabular-nums; }
.flow-svg .lbl-sub { font-size: 12.5px; font-weight: 500; fill: #a9bbdc; font-variant-numeric: tabular-nums; }
.horizon { stroke: rgba(150, 190, 255, 0.18); stroke-width: 1.2; }
.star { animation: twinkle 3.4s ease-in-out infinite; }
.sun-rays { animation: spin 70s linear infinite; transform-origin: 0 0; }
.sunbeams line { stroke: rgba(255, 207, 110, 0.7); stroke-width: 2; stroke-dasharray: 3 12; stroke-linecap: round; animation: dash-flow 1.6s linear infinite; }
#sun, #moon, #stars, #sunbeams { transition: opacity 0.3s linear; }
.pv-legs line { stroke: #31405f; stroke-width: 5; stroke-linecap: round; }
.panel-glass { fill: url(#panelGlass); stroke: #6f9fe0; stroke-opacity: 0.65; stroke-width: 1; }
.panel-cell { stroke: rgba(180, 210, 255, 0.28); stroke-width: 0.8; }
.panels { filter: drop-shadow(0 0 calc(var(--prod, 0) * 10px) rgba(255, 190, 70, 0.55)); }
.pv-shine { animation: sweep 5.2s ease-in-out infinite; opacity: calc(var(--prod, 0) * 1.1); }

.pill { fill: rgba(6, 12, 26, 0.7); stroke: var(--border-strong); stroke-width: 1; }
.wire { fill: none; stroke-width: 4.5; stroke-linecap: round; transition: opacity 0.3s, stroke 0.3s; }
.wire-pv { stroke: rgba(255, 176, 32, 0.22); }
.wire-load { stroke: rgba(255, 138, 76, 0.24); }
.wire-grid { stroke: rgba(155, 183, 255, 0.26); }
.wire-bat { stroke: rgba(90, 169, 255, 0.26); }
.wire-off { opacity: 0; }

.hub-body { fill: url(#hubBody); stroke: #3e4f74; stroke-width: 2; }
.hub-glow { fill: rgba(45, 226, 176, 0.0); }
.hub.active .hub-glow { fill: rgba(45, 226, 176, 0.22); animation: breathe 2s ease-in-out infinite; }
.hub-bolt { fill: var(--energy); }
.hub-led { fill: var(--status-idle); }
.hub.active .hub-led { fill: var(--status-good); animation: led 1.6s ease-in-out infinite; }

.house-body { fill: rgba(255, 138, 76, 0.16); stroke: #ff9d6a; stroke-width: 2; stroke-linejoin: round; }
.house-roof { fill: rgba(255, 138, 76, 0.28); stroke: #ff9d6a; stroke-width: 2; stroke-linejoin: round; }
.house-door { fill: #ff9d6a; opacity: 0.55; }
.house-window { fill: #ffe3a6; opacity: 0.35; transition: opacity 0.6s; }
.house.lit .house-window { opacity: 0.95; filter: drop-shadow(0 0 5px rgba(255, 220, 140, 0.9)); }
.pylon path, .pylon line { stroke: #8da6d2; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.insul { fill: #c8d6f2; }
.grid-export .pylon path, .grid-export .pylon line { stroke: var(--energy); }
.bat-shell { fill: rgba(8, 14, 28, 0.6); stroke: #6f93d6; stroke-width: 2; }
.bat-cap { fill: #6f93d6; }
.bat-fill { transition: fill 0.4s; }
.bat-fill.ok { fill: rgba(45, 226, 176, 0.85); }
.bat-fill.mid { fill: rgba(255, 176, 32, 0.9); }
.bat-fill.low { fill: rgba(255, 93, 108, 0.9); }
.bat-soc { font-size: 15px; font-weight: 800; fill: #fff; paint-order: stroke; stroke: rgba(6, 10, 20, 0.7); stroke-width: 3px; }
[data-bat="Charging"] .bat-shell { animation: glow-blue 1.8s ease-in-out infinite; }
.is-batcritical .bat-shell { stroke: var(--status-critical); animation: blink 1s ease-in-out infinite; }

/* ---------------------------------------------------------- Card / pannelli */
.card { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22); color: var(--ink-primary); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; padding: 0.8rem 1.1rem; background: transparent; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 0.92rem; letter-spacing: -0.005em; color: var(--ink-primary); }
.card-body { padding: 1rem 1.1rem; }
.card-footer { background: transparent; border-top: 1px solid var(--border); }
.card.metric-card { background: rgba(255, 255, 255, 0.035); border: 1px solid var(--border); box-shadow: none; backdrop-filter: none; transition: transform 0.25s var(--ease), border-color 0.25s, background 0.25s; position: relative; overflow: hidden; }
.card.metric-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--solar), var(--energy)); opacity: 0.5; }
.card.metric-card:hover { transform: translateY(-3px); border-color: var(--border-strong); background: rgba(255, 255, 255, 0.06); }
.card.metric-card .card-body { padding: 0.8rem 0.95rem; }
.metric-label { color: var(--ink-secondary); font-size: 0.76rem; font-weight: 600; letter-spacing: 0.02em; margin-bottom: 0.3rem; }
.metric-label i { color: var(--solar); margin-right: 0.25rem; }
.metric-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; transition: color 0.2s ease; }
.metric-unit { font-size: 0.82rem; font-weight: 600; color: var(--ink-secondary); letter-spacing: 0; }
.value-flash { animation: valueFlash 0.9s ease; }
@keyframes valueFlash { 0% { color: var(--energy); transform: scale(1.04); } 100% { color: inherit; transform: none; } }

.table { --bs-table-bg: transparent; --bs-table-color: var(--ink-primary); --bs-table-hover-bg: rgba(45, 226, 176, 0.07); --bs-table-hover-color: var(--ink-primary); color: var(--ink-primary); border-color: var(--border); }
.table > :not(caption) > * > * { border-bottom-color: var(--border-subtle); box-shadow: none; }
.table thead th { color: var(--ink-secondary); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; background: rgba(255, 255, 255, 0.025); }

/* ---------------------------------------------------- Tabella impianti */
.site-row { cursor: pointer; transition: background-color 0.18s ease; }
.site-row:hover { background: rgba(45, 226, 176, 0.06); }
.site-row.active { background: rgba(255, 176, 32, 0.1); box-shadow: inset 3px 0 0 var(--solar); }

/* ------------------------------------------------- KPI produzione/consumo */
.kpi-block .kpi-label { color: var(--ink-secondary); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; margin-bottom: 0.25rem; }
.kpi-block .kpi-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-bottom: 0.55rem; }
.kpi-block .kpi-value .metric-unit { font-size: 0.9rem; }
.kpi-legend { display: flex; gap: 1rem; font-size: 0.78rem; color: var(--ink-secondary); margin-bottom: 0.5rem; flex-wrap: wrap; }
.kpi-legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 0.35rem; }
.kpi-split-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--border-subtle); }
.kpi-split-bar span { height: 100%; transition: width 0.6s var(--ease); }
.kpi-note { font-size: 0.75rem; color: var(--ink-secondary); margin-top: 0.4rem; }

.env-tile { text-align: center; padding: 0.6rem 0.25rem; }
.env-tile i { font-size: 1.5rem; color: var(--energy); margin-bottom: 0.3rem; display: block; filter: drop-shadow(0 0 6px rgba(45, 226, 176, 0.45)); }
.env-value { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.env-label { font-size: 0.72rem; color: var(--ink-secondary); }

.alerts-summary-ok { display: flex; align-items: center; gap: 0.5rem; color: var(--status-good); font-weight: 600; }
.alerts-summary-item { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.82rem; }
.alerts-summary-item:last-child { border-bottom: none; }

.power-gauge-wrap { position: relative; width: 150px; height: 150px; margin: 0 auto; filter: drop-shadow(0 0 12px rgba(45, 226, 176, 0.18)); }
.power-gauge-value { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.power-gauge-value .value { font-size: 1.5rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.power-gauge-value .unit { font-size: 0.72rem; color: var(--ink-secondary); }
.site-info-row { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.84rem; }
.site-info-row:last-child { border-bottom: none; }
.site-info-row .label { color: var(--ink-secondary); }
.site-info-row .value { text-align: right; font-variant-numeric: tabular-nums; }
.device-list-item { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.88rem; }
.device-list-item:last-child { border-bottom: none; }
.device-list-item .device-name { display: flex; align-items: center; gap: 0.5rem; }
.device-list-item .device-name i { color: var(--solar); width: 1.1rem; text-align: center; }

.date-nav { display: flex; align-items: center; gap: 0.35rem; }
.date-nav-label { min-width: 108px; text-align: center; font-weight: 700; font-size: 0.9rem; }

/* --------------------------------------------------------- Badge e alert */
.badge { font-weight: 700; letter-spacing: 0.02em; border-radius: 999px; padding: 0.35em 0.7em; }
.badge-severity-low { background: rgba(127, 164, 232, 0.2); color: #a9c4ff; border: 1px solid rgba(127, 164, 232, 0.4); }
.badge-severity-medium { background: rgba(255, 176, 32, 0.18); color: #ffd37a; border: 1px solid rgba(255, 176, 32, 0.42); }
.badge-severity-high { background: rgba(255, 93, 108, 0.18); color: #ff9aa4; border: 1px solid rgba(255, 93, 108, 0.45); }
.badge-status-opened { background: rgba(255, 93, 108, 0.18); color: #ff9aa4; border: 1px solid rgba(255, 93, 108, 0.45); }
.badge-status-muted { background: rgba(125, 138, 163, 0.2); color: #b7c2d8; border: 1px solid rgba(125, 138, 163, 0.4); }
.badge-status-closed, .badge-status-closedmuted { background: rgba(31, 207, 122, 0.16); color: #6df0ae; border: 1px solid rgba(31, 207, 122, 0.4); }
.impact-bar { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: var(--border-subtle); position: relative; vertical-align: middle; overflow: hidden; }
.impact-bar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, var(--solar), var(--status-critical)); }

.log-console { height: 170px; overflow-y: auto; padding: 0.7rem 0.9rem; border-radius: 12px; background: rgba(4, 8, 16, 0.7); border: 1px solid var(--border); font-family: "JetBrains Mono", "DejaVu Sans Mono", "SFMono-Regular", Consolas, monospace; font-size: 0.76rem; line-height: 1.5; color: #93a8cf; }
.log-console::-webkit-scrollbar { width: 8px; }
.log-console::-webkit-scrollbar-thumb { background: rgba(150, 174, 214, 0.25); border-radius: 8px; }
.key-value { font-family: "JetBrains Mono", "DejaVu Sans Mono", monospace; font-size: 0.8rem; color: var(--ink-primary); word-break: break-all; }

/* --------------------------------------------------- Form e pulsanti */
.form-control, .form-select { background-color: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-strong); color: var(--ink-primary); border-radius: 10px; }
.form-control:focus, .form-select:focus { background-color: rgba(255, 255, 255, 0.07); border-color: var(--solar); box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.18); color: #fff; }
.form-control::placeholder { color: var(--ink-muted); }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--ink-secondary); }
.form-check-input:checked { background-color: var(--energy); border-color: var(--energy); }
.btn { border-radius: 10px; font-weight: 600; transition: transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(180deg, #ffbf47, #ffa514); border: none; color: #231600; }
.btn-primary:hover { background: linear-gradient(180deg, #ffc95f, #ffb02e); color: #231600; box-shadow: 0 6px 20px rgba(255, 176, 32, 0.35); }
.btn-success { background: linear-gradient(180deg, #34e6b6, #1fcf9a); border: none; color: #04231a; }
.btn-success:hover { background: linear-gradient(180deg, #4af0c4, #2ddbaa); color: #04231a; box-shadow: 0 6px 20px rgba(45, 226, 176, 0.32); }
.btn-outline-light { border-color: var(--border-strong); }
.btn-outline-primary { color: var(--ink-secondary); border-color: var(--border-strong); }
.btn-outline-primary:hover, .btn-outline-primary:active { background: rgba(255, 176, 32, 0.14); border-color: var(--solar); color: #ffd37a; }
.btn-group .btn-outline-primary.active, .btn-check:checked + .btn-outline-primary { background: rgba(255, 176, 32, 0.2); border-color: var(--solar); color: #ffd37a; }
.alert { border-radius: 12px; border: 1px solid var(--border-strong); }
.navbar { background: rgba(8, 13, 24, 0.72); backdrop-filter: blur(18px); border-bottom: 1px solid var(--border) !important; }

/* ------------------------------------------------------------ Animazioni */
@keyframes fade-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes led { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes sweep { 0% { transform: translateX(0); } 60%, 100% { transform: translateX(400px); } }
@keyframes dash-flow { to { stroke-dashoffset: -30; } }
@keyframes glow-blue { 0%, 100% { filter: drop-shadow(0 0 0 rgba(90, 169, 255, 0)); } 50% { filter: drop-shadow(0 0 8px rgba(90, 169, 255, 0.9)); } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(31, 207, 122, 0.55); } 70%, 100% { box-shadow: 0 0 0 9px rgba(31, 207, 122, 0); } }
@keyframes pulse-ring-crit { 0% { box-shadow: 0 0 0 0 rgba(255, 93, 108, 0.6); } 70%, 100% { box-shadow: 0 0 0 10px rgba(255, 93, 108, 0); } }

@media (max-width: 760px) {
    .hero { overflow-x: auto; overflow-y: hidden; }
    .hero-head { position: sticky; left: 0; }
    .flow-svg { min-width: 840px; }
    .page { padding: 0.8rem 0.8rem 2rem; }
    .api-key-input { width: 150px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
    .sunbeams line { stroke-dasharray: none; }
}

/* ------------------------------------------------------------------ Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; }
.login-wrap { width: 100%; max-width: 400px; animation: rise 0.7s var(--ease) both; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 0.7rem; font-size: 1.2rem; margin-bottom: 1.4rem; }
.login-brand b { color: var(--solar); }
.login-brand .brand-cloud { width: 42px; height: 42px; }
.login-card .card-body { padding: 1.6rem; }
.login-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.2rem; }

/* ------------------------------------------------------- Utente / account */
.user-chip { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.8rem 0.25rem 0.35rem; border-radius: 999px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-strong); color: var(--ink-primary); font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.user-chip:hover { background: rgba(255, 255, 255, 0.09); }
.user-avatar { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--solar), var(--energy)); color: #0b1220; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.78rem; text-transform: uppercase; }
.role-badge { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.15rem 0.45rem; border-radius: 999px; }
.role-admin { background: rgba(255, 176, 32, 0.16); color: #ffd37a; border: 1px solid rgba(255, 176, 32, 0.4); }
.role-user { background: rgba(127, 164, 232, 0.16); color: #a9c4ff; border: 1px solid rgba(127, 164, 232, 0.4); }
.modal-content { background: #0f1830; border: 1px solid var(--border-strong); border-radius: var(--radius); color: var(--ink-primary); }
.modal-header, .modal-footer { border-color: var(--border); }
.site-chip { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 0.1rem 0.5rem; margin: 0.1rem 0.2rem 0.1rem 0; border-radius: 999px; background: rgba(45, 226, 176, 0.12); color: #7ae8cb; border: 1px solid rgba(45, 226, 176, 0.3); }
.check-list { max-height: 190px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 0.4rem 0.7rem; background: rgba(255, 255, 255, 0.025); }
.check-list .form-check { margin: 0.25rem 0; }
#save-alert { position: sticky; top: 72px; z-index: 40; box-shadow: var(--shadow); }
