/* ============================================================
   CySecAlert — tema "SOC" (Security Operations Center)
   Dark, vetro, glow teal, dati tecnici in monospace.
   ============================================================ */

:root {
  --bg:        #0a0e13;
  --bg-2:      #0c1219;
  --panel:     rgba(255, 255, 255, 0.035);
  --panel-2:   #111a23;
  --line:      rgba(255, 255, 255, 0.08);
  --line-2:    rgba(255, 255, 255, 0.14);

  --text:      #e8eef4;
  --muted:     #8a97a6;
  --faint:     #5c6873;

  --accent:    #2dd4bf;   /* teal: azioni / preciso */
  --accent-2:  #a3e635;   /* lime: attivo / safe */
  --danger:    #fb5b6b;   /* KEV / critico */
  --warn:      #f6b73c;
  --info:      #5cc8ff;

  --glow-teal: rgba(45, 212, 191, 0.35);

  --r-lg: 16px;
  --r-md: 11px;
  --r-sm: 8px;

  --shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.9);

  --font-display: "Chakra Petch", system-ui, sans-serif;
  --font-body:    "IBM Plex Sans", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.55;
  position: relative;
  overflow-x: hidden;
}

/* Atmosfera: glow radiale + griglia tecnica appena percettibile */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(45, 212, 191, 0.10), transparent 60%),
    radial-gradient(800px 600px at 100% 0%, rgba(92, 200, 255, 0.06), transparent 55%),
    var(--bg);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 75%);
  opacity: 0.35;
}

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 26px;
  background: rgba(10, 14, 19, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: 0.5px;
  color: var(--text);
  text-decoration: none;
}
.brand .logo {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), #0e7c70);
  box-shadow: 0 0 0 1px rgba(45,212,191,.4), 0 6px 18px -6px var(--glow-teal);
}
.brand .logo svg { width: 19px; height: 19px; }
.brand b { color: var(--accent); }

.nav {
  display: flex;
  gap: 4px;
  margin-right: auto;
  flex-wrap: wrap;
}
.nav a {
  position: relative;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color .18s, background .18s;
}
.nav a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav a.active { color: var(--accent); background: rgba(45,212,191,.10); }
.nav a.active::after {
  content: "";
  position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.user-chip {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 0.88rem;
}
.user-chip .who {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
}
.user-chip .who .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2);
}

/* ---------------- Layout ---------------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 34px 24px 60px; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-head h1 {
  font-family: var(--font-display);
  font-size: 1.6rem; font-weight: 600; letter-spacing: .3px; margin: 0;
}
.page-head .sub { color: var(--muted); font-size: .92rem; margin-top: 3px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- KPI cards ---------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
@media (max-width: 820px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi {
  position: relative;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  backdrop-filter: blur(6px);
  overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.kpi.k-lime::before   { background: var(--accent-2); }
.kpi.k-danger::before { background: var(--danger); }
.kpi.k-info::before   { background: var(--info); }
.kpi .k-label {
  font-size: .74rem; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--faint); font-weight: 600;
}
.kpi .k-value {
  font-family: var(--font-display);
  font-size: 2.1rem; font-weight: 700; line-height: 1.1; margin-top: 6px;
}
.kpi .k-foot { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.kpi .k-foot.ok  { color: var(--accent-2); }
.kpi .k-foot.bad { color: var(--danger); }

/* ---------------- Panels ---------------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel-2);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-pad { padding: 22px; }
.panel-title {
  font-family: var(--font-display);
  font-weight: 600; font-size: 1.05rem; margin: 0 0 4px;
}

/* ---------------- Tabella ---------------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  text-align: left;
  font-size: .72rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--faint); font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.015);
}
.tbl tbody td { padding: 15px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: rgba(45,212,191,.04); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .sw-name { font-weight: 600; }
.tbl .sw-vendor { color: var(--muted); font-size: .82rem; }
.dimmed { opacity: .5; }

.mono { font-family: var(--font-mono); font-size: .88em; }

/* ---------------- Pills / badge ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; letter-spacing: .2px;
  border: 1px solid transparent; white-space: nowrap;
}
.pill-ok      { color: #0a0e13; background: var(--accent-2); }
.pill-muted   { color: var(--muted); background: rgba(255,255,255,.05); border-color: var(--line); }
.pill-precise { color: var(--accent); background: rgba(45,212,191,.12); border-color: rgba(45,212,191,.35); }
.pill-keyword { color: var(--muted); background: rgba(255,255,255,.05); border-color: var(--line); }
.pill-kev     { color: #fff; background: rgba(251,91,107,.18); border-color: rgba(251,91,107,.5); }
.pill-kev .dot{ width:6px;height:6px;border-radius:50%;background:var(--danger);box-shadow:0 0 7px var(--danger); }
.pill-chip    { color: var(--text); background: rgba(255,255,255,.04); border-color: var(--line); }
.pill-paused  { color: var(--warn); background: rgba(246,183,60,.12); border-color: rgba(246,183,60,.35); }

/* ---------------- Bottoni ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r-sm);
  font-family: var(--font-body); font-size: .9rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  color: #06201d; background: var(--accent);
  box-shadow: 0 8px 22px -10px var(--glow-teal);
}
.btn-primary:hover { background: #41e3cf; box-shadow: 0 10px 26px -8px var(--glow-teal); }
.btn-ghost { color: var(--text); background: rgba(255,255,255,.05); border-color: var(--line); }
.btn-ghost:hover { background: rgba(255,255,255,.09); border-color: var(--line-2); }
.btn-outline { color: var(--accent); border-color: rgba(45,212,191,.4); background: transparent; }
.btn-outline:hover { background: rgba(45,212,191,.1); }
.btn-danger { color: var(--danger); border-color: rgba(251,91,107,.4); background: transparent; }
.btn-danger:hover { background: rgba(251,91,107,.12); }
.btn-warn { color: var(--warn); border-color: rgba(246,183,60,.4); background: transparent; }
.btn-warn:hover { background: rgba(246,183,60,.12); }
.btn-sm { padding: 6px 11px; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }
.inline { display: inline; }

/* ---------------- Form ---------------- */
.field { margin-bottom: 16px; }
.field label, .form-label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--muted); margin-bottom: 6px;
}
.input, .form-control, .form-select {
  width: 100%; padding: 10px 13px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text); font-family: var(--font-body); font-size: .92rem;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .form-control:focus, .form-select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,212,191,.15);
  background: rgba(255,255,255,.06);
}
.form-select option { background: var(--panel-2); }
.hint { color: var(--muted); font-size: .85rem; }

/* Toggle (riusa input checkbox) */
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: none; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: rgba(255,255,255,.12); transition: background .2s;
}
.switch .track::before {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .2s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(18px); }

/* Lista candidati CPE */
.cpe-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.cpe-opt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: rgba(255,255,255,.02); cursor: pointer; transition: border-color .15s, background .15s;
}
.cpe-opt:hover { border-color: var(--line-2); background: rgba(255,255,255,.04); }
.cpe-opt input { margin-top: 3px; accent-color: var(--accent); }
.cpe-opt .t { font-weight: 600; }
.cpe-opt .c { color: var(--muted); font-size: .8rem; font-family: var(--font-mono); }

/* ---------------- Flash ---------------- */
.flash {
  padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 14px;
  border: 1px solid var(--line); font-size: .92rem;
  display: flex; align-items: center; gap: 9px;
}
.flash::before { font-size: 1.05rem; }
.flash-success { background: rgba(163,230,53,.08); border-color: rgba(163,230,53,.3); color: #cdee8f; }
.flash-success::before { content: "✓"; }
.flash-danger  { background: rgba(251,91,107,.08); border-color: rgba(251,91,107,.3); color: #ffb3bb; }
.flash-danger::before  { content: "✕"; }
.flash-warning { background: rgba(246,183,60,.08); border-color: rgba(246,183,60,.3); color: #f3d08a; }
.flash-warning::before { content: "!"; }
.flash-info    { background: rgba(92,200,255,.08); border-color: rgba(92,200,255,.3); color: #aee2ff; }
.flash-info::before    { content: "i"; }

/* ---------------- Accordion (avvisi) ---------------- */
.acc-item { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); margin-bottom: 12px; overflow: hidden; }
.acc-head {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 16px 18px; background: none; border: none; color: var(--text);
  cursor: pointer; font-family: var(--font-body); text-align: left;
}
.acc-head:hover { background: rgba(255,255,255,.02); }
.acc-head .nm { font-weight: 600; font-family: var(--font-display); }
.acc-head .ver { color: var(--muted); font-family: var(--font-mono); font-size: .85rem; }
.acc-head .chev { margin-left: auto; color: var(--faint); transition: transform .2s; }
.acc-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.acc-body { border-top: 1px solid var(--line); }

/* severità dot */
.sev { display:inline-flex; align-items:center; gap:6px; }
.sev .d { width:8px;height:8px;border-radius:50%; }
.sev-crit .d { background: var(--danger); box-shadow:0 0 7px var(--danger); }
.sev-high .d { background: #ff8a4c; }
.sev-med  .d { background: var(--warn); }
.sev-low  .d { background: var(--info); }
.sev-na   .d { background: var(--faint); }

a.cve { color: var(--accent); text-decoration: none; font-family: var(--font-mono); font-size:.88rem; }
a.cve:hover { text-decoration: underline; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 2.2rem; margin-bottom: 8px; }

/* ---------------- Login ---------------- */
.auth-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--panel-2); box-shadow: var(--shadow);
  padding: 34px 30px;
}
.auth-logo {
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 16px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #0e7c70);
  box-shadow: 0 0 0 1px rgba(45,212,191,.4), 0 10px 30px -8px var(--glow-teal);
}
.auth-logo svg { width: 30px; height: 30px; }
.auth-card h1 { font-family: var(--font-display); text-align: center; font-size: 1.4rem; margin: 0 0 4px; }
.auth-card .tag { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: 22px; }
.auth-foot { text-align: center; color: var(--faint); font-size: .78rem; margin-top: 16px; }

/* ---------------- Animazioni ---------------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
.rise-1 { animation-delay: .04s; }
.rise-2 { animation-delay: .10s; }
.rise-3 { animation-delay: .16s; }
.rise-4 { animation-delay: .22s; }
.rise-5 { animation-delay: .28s; }

/* ---------------- Helper layout ---------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.settings-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 760px) { .grid-2, .grid-3, .settings-grid { grid-template-columns: 1fr; } }
.col-span-2 { grid-column: 1 / -1; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 14px; }
.text-end { text-align: right; }
.tbl-scroll { overflow-x: auto; }

footer.foot { text-align: center; color: var(--faint); font-size: .8rem; padding: 26px 0 40px; }
footer.foot .mono { color: var(--muted); }

/* scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
