/* Nuova grafica della dashboard principale */
body.sw-dash { background: radial-gradient(1200px 600px at 15% -10%, #1e3a8a26, transparent), #0b1220; }
#sw-dash { margin-bottom: 8px; }

/* Intestazione */
.swd-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; padding: 24px 28px;
  border-radius: 20px; border: 1px solid #24324a; margin-bottom: 18px;
  background: linear-gradient(135deg, #172036 0%, #111a2e 60%, #0f172a 100%); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
@media (max-width: 1150px) { .swd-hero { grid-template-columns: auto 1fr; } .swd-kpis { grid-column: 1 / -1; } }
.swd-health { position: relative; width: 108px; height: 108px; }
.swd-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.swd-ring circle { fill: none; stroke-width: 10; }
.swd-ring .bg { stroke: #1e293b; }
.swd-ring .fg { stroke: #22c55e; stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1s ease, stroke .3s; }
.swd-health-txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.swd-score { font-size: 30px; font-weight: 800; line-height: 1; }
.swd-score-l { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: .12em; margin-top: 4px; }
.swd-hero-main h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.swd-sub { color: #94a3b8; font-size: 13px; margin-top: 6px; }
.swd-sub strong { font-weight: 700; }
.swd-kpis { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 10px; }
@media (max-width: 700px) { .swd-kpis { grid-template-columns: repeat(2, 1fr); } }
.swd-kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: #0b1220b3;
  border: 1px solid #24324a; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.swd-kpi:hover { border-color: #3b82f6; transform: translateY(-2px); }
.swd-kpi .l { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: .06em; }
.swd-kpi .v { font-size: 28px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.swd-kpi .s { font-size: 12px; color: #64748b; }
.swd-kpi.alert { border-color: #7f1d1d; background: linear-gradient(135deg, #3b1d24b3, #0b1220b3); }
.swd-kpi.alert .v { color: #f87171; }
.swd-kpi.warn .v { color: #fbbf24; }
.swd-kpi.ok .v { color: #4ade80; }

/* Filtri */
.swd-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.swd-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.swd-chip { background: #111a2e; border: 1px solid #24324a; color: #cbd5e1; border-radius: 999px; padding: 6px 14px;
  font-size: 13px; cursor: pointer; transition: all .15s; }
.swd-chip:hover { border-color: #3b82f6; }
.swd-chip .n { margin-left: 6px; color: #64748b; font-variant-numeric: tabular-nums; }
.swd-chip.on { background: #1d4ed8; border-color: #3b82f6; color: #fff; }
.swd-chip.on .n { color: #bfdbfe; }
#swd-q { background: #111a2e; border: 1px solid #24324a; color: #e2e8f0; border-radius: 10px; padding: 8px 12px;
  min-width: 240px; font: inherit; font-size: 13px; }

/* Schede dei siti */
.swd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 8px; }
.swd-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 12px; padding: 16px 18px 14px 22px;
  border-radius: 16px; background: linear-gradient(180deg, #172036, #131c30); border: 1px solid #24324a;
  transition: transform .15s, box-shadow .15s, border-color .15s; }
.swd-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0, 0, 0, .35); border-color: #334155; }
.swd-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: #22c55e; }
.swd-card.st-crit::before { background: #ef4444; box-shadow: 0 0 18px #ef4444; }
.swd-card.st-down::before { background: #f97316; }
.swd-card.st-warn::before { background: #f59e0b; }
.swd-card.st-idle::before { background: #475569; }
.swd-card.st-idle { opacity: .65; }
.swd-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.swd-name { font-weight: 700; font-size: 16px; }
.swd-url { font-size: 12px; color: #64748b; word-break: break-all; margin-top: 2px; }
.swd-type { font-size: 11px; color: #cbd5e1; background: #0b1220; border: 1px solid #24324a; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.swd-status { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.swd-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.swd-dot.on { background: #22c55e; animation: swdpulse 2s infinite; }
.swd-dot.off { background: #f97316; }
.swd-dot.idle { background: #475569; }
@keyframes swdpulse { 0% { box-shadow: 0 0 0 0 #22c55e66; } 70% { box-shadow: 0 0 0 8px #22c55e00; } 100% { box-shadow: 0 0 0 0 #22c55e00; } }
.swd-muted { color: #64748b; font-size: 12px; }
.swd-spark { width: 100%; height: 34px; display: block; }
.swd-counts { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.swd-counts .c { color: #f87171; font-weight: 700; }
.swd-counts .w { color: #fbbf24; font-weight: 700; }
.swd-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; }
.swd-inc { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; text-decoration: none; }
.swd-inc.crit { color: #fca5a5; background: #7f1d1d55; border: 1px solid #7f1d1d; }
.swd-inc.warn { color: #fcd34d; background: #78350f55; border: 1px solid #78350f; }
.swd-inc.ok { color: #86efac; background: #14532d44; border: 1px solid #14532d; }
.swd-btn { font-size: 12px; font-weight: 600; color: #e2e8f0; background: #1e293b; border: 1px solid #334155;
  padding: 6px 12px; border-radius: 8px; text-decoration: none; transition: all .15s; }
.swd-btn:hover { background: #2563eb; border-color: #2563eb; }

/* Riquadri e tabelle esistenti nello stesso stile */
body.sw-dash .card { border-radius: 16px; border-color: #24324a; background: linear-gradient(180deg, #172036, #131c30); }
body.sw-dash .section-title { font-size: 12px; letter-spacing: .1em; color: #8ea0b8; margin: 26px 0 10px; }
body.sw-dash .table-wrap { border-radius: 14px; overflow: hidden; border: 1px solid #24324a; }
body.sw-dash .table-wrap th { background: #111a2e; font-size: 11px; letter-spacing: .06em; }
body.sw-dash .table-wrap tbody tr:hover td { background: #1c2a40; }

/* Grafici a ciambella */
.swd-charts { display: grid; grid-template-columns: repeat(3, minmax(300px, 1fr)); gap: 14px; margin: 18px 0 6px; align-items: stretch; }
@media (max-width: 1200px) { .swd-charts { grid-template-columns: 1fr; } }
.swd-charts > .card { margin: 0 !important; }
.swd-chart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.swd-chart-head h3 { margin: 0 !important; }
.swd-period { display: flex; gap: 4px; }
.swd-period button { background: #0b1220; border: 1px solid #24324a; color: #94a3b8; border-radius: 999px; padding: 3px 10px; font-size: 11px; cursor: pointer; }
.swd-period button.on { background: #1d4ed8; border-color: #3b82f6; color: #fff; }
.swd-donut-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.swd-donut { position: relative; width: 170px; height: 170px; flex: none; }
.swd-donut canvas { width: 170px !important; height: 170px !important; max-height: none !important; }
.swd-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.swd-donut-center .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.swd-donut-center .l { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: .06em; text-align: center; max-width: 110px; }
.swd-legend { flex: 1; min-width: 190px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.swd-leg { display: grid; grid-template-columns: 12px 1fr auto 38px; gap: 8px; align-items: center; cursor: default; }
.swd-leg .sw { width: 12px; height: 12px; border-radius: 3px; }
.swd-leg .n { font-weight: 700; font-variant-numeric: tabular-nums; }
.swd-leg .p { color: #64748b; font-size: 12px; text-align: right; }
.swd-leg.zero { opacity: .45; }
.swd-leg-sub { font-size: 11px; color: #f87171; margin: -4px 0 0 20px; }

/* Tre riquadri dei grafici uniformi */
.swd-charts > .card { padding: 18px 20px !important; display: flex; flex-direction: column; }
.swd-chart-head h3 { font-size: 12px !important; font-weight: 700 !important; text-transform: uppercase; letter-spacing: .08em; color: #8ea0b8 !important; }
.swd-donut-row { flex: 1; }
#platform-security-card canvas { max-height: none !important; }
.swd-legend { gap: 8px; }
.swd-leg .t { min-width: 0; }
.swd-leg .x { font-size: 11px; color: #f87171; margin-left: 6px; white-space: nowrap; }
