﻿:root {
  --bg: #F5F7FB;
  --sidebar: #0A2540;
  --text: #0A2540;
  --muted: #5f6b7a;
  --accent: #0a66c2;
  --card: #ffffff;
  --shadow: 0 8px 24px rgba(10, 37, 64, 0.08);
  --border: #e2e8f0;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
}

body.dark {
  --bg: #0b1220;
  --text: #e5e7eb;
  --card: #111827;
  --border: #1f2937;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 37, 64, 0.08);
  z-index: 999;
}

.loader::after {
  content: "";
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid #e5e7eb;
  border-top-color: #0a66c2;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: 240px;
  background: var(--sidebar);
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sidebar .brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar nav a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  display: block;
  font-weight: 500;
}

.sidebar nav a:hover,
.sidebar nav a:focus {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .page-title {
  font-size: 18px;
  font-weight: 700;
}

.topbar .topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-security-score {
  font-weight: 600;
  margin-left: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--card);
}

.topbar .user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}

.topbar .user-chip img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.topbar-security-score {
  font-weight: 600;
  margin-left: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--card);
}

#userSecurityBadge {
  font-size: 0.85rem;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 4px;
}

#clienteSecurityStatus {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 5px;
}

.cliente-security-summary {
  margin-bottom: 20px;
  padding: 16px;
  border-left: 4px solid #0A2540;
}
#clienteSummaryStatus {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}
#clienteSummaryScore {
  opacity: 0.8;
  margin-bottom: 10px;
}

.sal-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-left: 4px solid #0A2540;
  padding: 10px 14px;
  margin-bottom: 20px;
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.sal-banner .sal-icon {
  font-size: 1.3rem;
}

@media (max-width: 768px) {
  .sal-banner {
    font-size: 0.9rem;
    padding: 8px 10px;
  }
}

.security-overview-card {
  margin-top: 20px;
  padding: 16px;
  border-left: 4px solid #0A2540;
}
#securityOverviewStatus {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}
#securityOverviewScore {
  font-size: 1rem;
  opacity: 0.8;
  margin-bottom: 10px;
}

.content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.card h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
}

.card .value {
  font-size: 28px;
  font-weight: 700;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: #f8fafc;
  font-weight: 700;
  font-size: 14px;
}

.table tr:last-child td {
  border-bottom: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0a66c2;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}

.btn.ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.btn:focus,
.btn:hover {
  filter: brightness(0.95);
}

.back-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text);
}

.link-cliente {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.link-cliente:hover {
  text-decoration: underline;
}

.kpi-card {
  cursor: pointer;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge.success { background: rgba(22, 163, 74, 0.1); color: #15803d; }
.badge.warning { background: rgba(245, 158, 11, 0.12); color: #b45309; }
.badge.danger { background: rgba(220, 38, 38, 0.12); color: #991b1b; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.input-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.input-group input,
.input-group select,
.form input,
.form select,
.form button {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
}

.form label {
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.list li {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}

.grid-columns-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.fase-item {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  font-weight: 700;
  text-align: center;
}

.fase-completata {
  background: rgba(22, 163, 74, 0.08);
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.3);
}

.fase-attuale {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.4);
}

.fase-pending {
  opacity: 0.7;
}

.login-wrapper {
  max-width: 420px;
  margin: 80px auto;
  padding: 32px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  text-align: center;
}

.login-wrapper img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 16px;
}

.login-wrapper .form {
  display: grid;
  gap: 12px;
  text-align: left;
}

.breadcrumb {
  font-size: 0.85rem;
  color: #6B7280;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(6px);
}
.breadcrumb a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.breadcrumb a:hover {
  text-decoration: underline;
}
.breadcrumb-icon {
  font-size: 0.85rem;
  opacity: 0.8;
}
.breadcrumb-separator {
  opacity: 0.5;
  font-size: 0.8rem;
}
.breadcrumb-current {
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 4px;
}
.breadcrumb.animate {
  animation: breadcrumbFade 0.35s ease-out forwards;
}
.breadcrumb-mobile {
  display: none;
  font-size: 0.9rem;
  margin-bottom: 12px;
  opacity: 0;
  transform: translateY(6px);
}
.breadcrumb-mobile a {
  text-decoration: none;
  color: #0A2540;
  font-weight: 600;
}
.breadcrumb-mobile.animate {
  animation: breadcrumbFade 0.35s ease-out forwards;
}
.nav-history {
  margin-top: 30px;
  font-size: 0.75rem;
  color: #6B7280;
  opacity: 0.85;
}
.nav-history a {
  color: inherit;
  text-decoration: none;
}
.nav-history a:hover {
  text-decoration: underline;
}
.nav-history .nav-history-separator {
  margin: 0 4px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: min(420px, 90vw);
  box-shadow: var(--shadow);
}

.modal h3 {
  margin-top: 0;
}

.modal .actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.nav-history {
  margin-top: 30px;
  font-size: 0.75rem;
  color: #6B7280;
  opacity: 0.85;
}
.nav-history a {
  color: inherit;
  text-decoration: none;
}
.nav-history a:hover {
  text-decoration: underline;
}
.nav-history .nav-history-separator {
  margin: 0 4px;
}
.radar-card { margin-top: 20px; padding: 20px; }
.radar-card h2 { margin-bottom: 10px; }
.radar-card ul { list-style: none; padding: 0; margin: 0; }
.radar-card li { margin: 4px 0; }
@keyframes breadcrumbFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sidebar nav ul {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .topbar {
    position: static;
  }
}

@media (max-width: 768px) {
  .breadcrumb {
    display: none;
  }
  .breadcrumb-mobile {
    display: block;
  }
  .back-btn {
    display: inline-block;
  }
}

@media print {
  .sidebar,
  .topbar,
  nav,
  #repExportPDF {
    display: none !important;
  }
  body {
    background: white !important;
  }
  .content {
    margin: 0;
    padding: 0;
  }
  .card {
    box-shadow: none !important;
    border: none !important;
  }
}



.security-overview-card {
  margin-top: 20px;
  padding: 16px;
  border-left: 4px solid #0A2540;
}
#securityOverviewStatus {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}
#securityOverviewScore {
  font-size: 1rem;
  opacity: 0.8;
  margin-bottom: 10px;
}

