:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#667085;
  --line:#e4e7ec;
  --line-soft:#eef2f7;
  --primary:#1d4ed8;
  --primary-soft:#eff6ff;
  --danger:#dc2626;
  --danger-soft:#fff1f2;
  --ok:#16a34a;
  --ok-soft:#ecfdf3;
  --warn:#d97706;
  --warn-soft:#fffbeb;
  --shadow:0 10px 30px rgba(15, 23, 42, 0.06);
  --radius:18px;
}

*{
  box-sizing:border-box;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,'Helvetica Neue',Arial,sans-serif;
}

html, body{
  margin:0;
  padding:0;
}

a{
  text-decoration:none;
}

/* =========================
   AUTH
========================= */

.auth-body{
  background:linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.auth-container{
  width:420px;
  padding:20px;
  text-align:center;
}

.brand-logo{
  width:140px;
  margin-bottom:14px;
}

.auth-title{
  margin:6px 0 18px;
  color:var(--text);
  font-size:24px;
  font-weight:800;
  letter-spacing:-0.02em;
}

.auth-card{
  border:1px solid var(--line);
  background:var(--card);
  border-radius:var(--radius);
  padding:20px;
  text-align:left;
  box-shadow:var(--shadow);
}

.label{
  display:block;
  font-size:13px;
  color:var(--muted);
  margin:8px 0 6px;
  font-weight:600;
}

.input{
  width:100%;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:12px;
  outline:none;
  background:#fff;
  transition:all .2s ease;
}

.input:focus{
  border-color:#bfd3ff;
  box-shadow:0 0 0 4px rgba(29,78,216,.08);
}

.password-wrap{
  position:relative;
}

.eye{
  position:absolute;
  right:8px;
  top:8px;
  border:none;
  background:transparent;
  cursor:pointer;
  font-size:16px;
}

.btn{
  width:100%;
  margin-top:14px;
  padding:12px;
  border:none;
  border-radius:12px;
  cursor:pointer;
  background:#ffffff;
  border:1px solid var(--line);
  font-weight:700;
  transition:all .2s ease;
}

.btn:hover{
  background:#f9fafb;
  border-color:#d0d5dd;
}

.alert-error{
  background:#fff1f2;
  border:1px solid #fecdd3;
  color:#9f1239;
  padding:10px 12px;
  border-radius:12px;
  margin-bottom:12px;
}

.auth-footer{
  color:var(--muted);
  font-size:12px;
  margin-top:14px;
}

/* =========================
   DASHBOARD
========================= */

.dash-body{
  background:var(--bg);
  display:flex;
  min-height:100vh;
  overflow-x:hidden;
}

/* =========================
   SIDEBAR
========================= */

.sidebar{
  width:270px;
  background:#fff;
  border-right:1px solid var(--line);
  padding:18px;
  display:flex;
  flex-direction:column;
  box-shadow:2px 0 20px rgba(15, 23, 42, 0.03);
}

.sidebar-brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding-bottom:16px;
  border-bottom:1px solid var(--line-soft);
}

.sidebar-logo{
  width:46px;
  height:auto;
}

.sidebar-name{
  font-weight:800;
  font-size:20px;
  color:var(--text);
  letter-spacing:-0.02em;
}

.menu{
  padding-top:18px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.menu-item{
  text-align:left;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  cursor:pointer;
  color:var(--text);
  font-weight:600;
  transition:all .2s ease;
}

.menu-item:hover{
  background:#f8fafc;
  border-color:#d0d5dd;
}

.menu-item.active{
  border-color:#c7d7ff;
  background:#eef4ff;
  color:#123ea6;
  box-shadow:0 4px 12px rgba(29, 78, 216, 0.08);
}

.sidebar-footer{
  margin-top:auto;
  padding-top:14px;
  border-top:1px solid var(--line-soft);
}

.link{
  color:var(--primary);
  font-weight:700;
}

/* =========================
   CONTENT
========================= */

.content{
  flex:1;
  min-width:0;
  max-width:100%;
  padding:26px;
  overflow-x:hidden;
}

.topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:18px;
  flex-wrap:wrap;
}

.topbar h2{
  margin:0;
  font-size:30px;
  line-height:1.1;
  color:var(--text);
  letter-spacing:-0.03em;
}

.agent-select{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--muted);
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px 12px;
  box-shadow:var(--shadow);
  max-width:100%;
  flex-shrink:1;
}

.agent-select span{
  font-weight:600;
  color:var(--muted);
}

.agent-select select{
  border:1px solid var(--line);
  border-radius:10px;
  padding:8px 10px;
  background:#fff;
  color:var(--text);
  font-weight:600;
  outline:none;
  max-width:220px;
}

.agent-select select:focus{
  border-color:#bfd3ff;
  box-shadow:0 0 0 4px rgba(29,78,216,.08);
}

/* =========================
   TEXT HELPERS
========================= */

.muted{
  color:var(--muted);
  font-size:14px;
  line-height:1.5;
}

.hidden{
  display:none;
}

/* =========================
   SUMMARY CARDS
========================= */

.cards{
  display:grid;
  grid-template-columns:1fr 1fr 1fr;
  gap:14px;
  margin-bottom:14px;
}

.card{
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:16px 18px;
  font-weight:800;
  font-size:16px;
  box-shadow:var(--shadow);
  min-height:72px;
  display:flex;
  align-items:center;
}

.status-card{
  color:var(--danger);
  background:var(--danger-soft);
  border-color:#fecdd3;
}

.protected-card{
  color:var(--ok);
  background:var(--ok-soft);
  border-color:#abefc6;
}

.last-card{
  color:var(--primary);
  background:var(--primary-soft);
  border-color:#bfdbfe;
}

/* =========================
   METRICS
========================= */

.metrics{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:14px;
  margin-bottom:14px;
}

.metric{
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:16px 18px;
  box-shadow:var(--shadow);
  min-height:92px;
}

.metric-label{
  color:var(--muted);
  font-size:13px;
  font-weight:600;
}

.metric-value{
  color:var(--text);
  font-size:18px;
  font-weight:800;
  margin-top:8px;
  letter-spacing:-0.02em;
}

/* =========================
   PANELS
========================= */

.panel{
  background:#fff;
  border:1px solid var(--line);
  border-radius:22px;
  padding:18px;
  margin-bottom:14px;
  box-shadow:var(--shadow);
  overflow:hidden;
}

.panel-title{
  font-weight:800;
  font-size:22px;
  margin-bottom:4px;
  color:var(--text);
  letter-spacing:-0.02em;
}

.panel-subtitle{
  color:var(--muted);
  font-size:14px;
  margin-bottom:14px;
  line-height:1.5;
}

.chart-wrap{
  width:100%;
  min-height:320px;
  max-height:320px;
  position:relative;
}

.chart-wrap canvas{
  width:100% !important;
  height:320px !important;
  display:block;
}

/* =========================
   TABLE
========================= */

.table{
  width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  border:1px solid var(--line);
  border-radius:16px;
  background:#fff;
}

.table table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}

.table thead{
  background:#f8fafc;
}

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

.table th{
  color:#111827;
  font-weight:800;
  font-size:12px;
  letter-spacing:0.01em;
}

.table td{
  color:#334155;
}

.table tbody tr:hover{
  background:#fafcff;
}

/* =========================
   BADGE BASE
========================= */

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
}

.badge-ok{
  background:var(--ok-soft);
  color:var(--ok);
}

.badge-warn{
  background:var(--warn-soft);
  color:var(--warn);
}

.badge-danger{
  background:var(--danger-soft);
  color:var(--danger);
}

.badge-info{
  background:var(--primary-soft);
  color:var(--primary);
}

/* =========================
   AJUSTES PARA ABAS AVANÇADAS
========================= */

#view-vuln .panel,
#view-intel .panel{
  width:100%;
}

#view-vuln .metric-value,
#view-intel .metric-value{
  word-break:break-word;
}

#view-vuln .table table,
#view-intel .table table{
  min-width:900px;
}

/* =========================
   RESPONSIVO
========================= */

@media (max-width: 1200px){
  .metrics{
    grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  }

  .cards{
    grid-template-columns:1fr;
  }
}

@media (max-width: 960px){
  .dash-body{
    flex-direction:column;
  }

  .sidebar{
    width:100%;
    border-right:none;
    border-bottom:1px solid var(--line);
  }

  .content{
    padding:18px;
  }

  .topbar{
    flex-direction:column;
    align-items:flex-start;
  }

  .agent-select{
    width:100%;
    justify-content:space-between;
  }
}

@media (max-width: 680px){
  .metrics{
    grid-template-columns:1fr;
  }

  .panel-title{
    font-size:18px;
  }

  .topbar h2{
    font-size:24px;
  }

  .chart-wrap{
    min-height:260px;
    max-height:260px;
  }

  .chart-wrap canvas{
    height:260px !important;
  }
}

body,
html{
  overflow-x:hidden;
}

#view-vuln,
#view-intel,
#view-monitor{
  min-width:0;
}

#view-vuln .table,
#view-intel .table,
#view-monitor .table{
  max-width:100%;
}
