/* ═══════════════════════════════════════════════════════════════════════════
   ARIA Console — Design System
   Dark professional UI · Inter + JetBrains Mono · acento ámbar
   ═══════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  color-scheme: dark; /* los dropdowns/scrollbars nativos del navegador van en oscuro */
  /* Superficies — jerarquía de profundidad */
  --bg-0: #080a10;            /* fondo raíz */
  --bg-1: #0d1017;            /* fondo app */
  --bg-2: rgba(255,255,255,.028);  /* panel glass */
  --bg-3: rgba(255,255,255,.05);   /* panel elevado / hover */
  --border: rgba(255,255,255,.07);
  --border-strong: rgba(255,255,255,.14);

  /* Texto */
  --text: #e6e9f0;
  --text-dim: #8b93a7;
  --text-faint: #565e72;

  /* Marca y acentos */
  --accent: #f59e0b;
  --accent-soft: rgba(245,158,11,.12);
  --accent-glow: rgba(245,158,11,.35);
  --cyan: #22d3ee;
  --cyan-soft: rgba(34,211,238,.1);

  /* Semáforo de severidades */
  --critical: #f43f5e;
  --critical-soft: rgba(244,63,94,.12);
  --high: #fb923c;
  --high-soft: rgba(251,146,60,.12);
  --medium: #facc15;
  --medium-soft: rgba(250,204,21,.12);
  --info: #34d399;
  --info-soft: rgba(52,211,153,.12);

  --font-ui: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-panel: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --sidebar-w: 236px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
/* Fondo con gradientes radiales sutiles (profundidad sin ruido) */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(245,158,11,.05), transparent 60%),
    radial-gradient(800px 500px at 90% 10%, rgba(34,211,238,.04), transparent 60%),
    var(--bg-0);
}

.hidden { display: none !important; }
.dim { color: var(--text-dim); }

::selection { background: var(--accent-glow); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.09); border-radius: 5px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.16); }

/* ═══ Login ═══ */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 400px; padding: 40px 38px;
  background: var(--bg-2);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  animation: riseIn .45s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes riseIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.login-brand svg { color: var(--accent); filter: drop-shadow(0 0 12px var(--accent-glow)); }
.login-brand h1 { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.login-sub { color: var(--text-dim); font-size: 12.5px; margin-bottom: 28px; line-height: 1.6; }
#login-form { display: flex; flex-direction: column; gap: 13px; }
#login-form input {
  padding: 13px 16px; border-radius: 10px;
  background: rgba(255,255,255,.04); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-family: var(--font-ui); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#login-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-error { color: var(--critical); font-size: 13px; text-align: center; }

/* ═══ Layout: sidebar + main ═══ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
}
.sb-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--border);
}
.sb-brand svg { color: var(--accent); filter: drop-shadow(0 0 10px var(--accent-glow)); }
.sb-brand h1 { font-size: 16px; font-weight: 800; letter-spacing: -.3px; }
.sb-brand h1 .dim { font-weight: 500; font-size: 13px; }

.sb-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sb-section {
  font-size: 10px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-faint); padding: 14px 10px 6px;
}
.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-dim);
  font-size: 13.5px; font-weight: 500; font-family: var(--font-ui);
  cursor: pointer; text-align: left; width: 100%;
  transition: all .15s;
  position: relative;
}
.sb-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .75; }
.sb-item:hover { color: var(--text); background: var(--bg-3); }
.sb-item.active {
  color: var(--accent); background: var(--accent-soft);
}
.sb-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 2px; background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
.sb-item.active svg { opacity: 1; }

.sb-footer {
  padding: 14px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sb-user-dot {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #b45309);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #1a1207;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-env { font-size: 10px; color: var(--text-faint); font-family: var(--font-mono); }
.sb-logout {
  background: none; border: none; color: var(--text-faint); cursor: pointer;
  padding: 6px; border-radius: 6px; transition: all .15s;
}
.sb-logout:hover { color: var(--critical); background: var(--critical-soft); }

/* ═══ Main ═══ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 26px; height: 54px;
  background: rgba(13,16,23,.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.topbar-title { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.topbar-title .dim { font-weight: 400; font-size: 12.5px; margin-left: 8px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.env-badge {
  font-size: 10px; font-weight: 800; letter-spacing: 1.2px;
  padding: 4px 10px; border-radius: 6px;
  background: var(--medium-soft); color: var(--medium);
  font-family: var(--font-mono);
  border: 1px solid rgba(250,204,21,.25);
}
.env-QA { background: rgba(59,130,246,.12); color: #60a5fa; border-color: rgba(59,130,246,.3); }
.env-PROD, .env-LIVE { background: var(--critical-soft); color: var(--critical); border-color: rgba(244,63,94,.3); }

.live-pill {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--info); font-family: var(--font-mono);
  padding: 5px 11px; border-radius: 20px;
  background: var(--info-soft); border: 1px solid rgba(52,211,153,.25);
}
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--info); animation: pulse 2s infinite; }
.live-pill.off { color: var(--critical); background: var(--critical-soft); border-color: rgba(244,63,94,.25); }
.live-pill.off .live-dot { background: var(--critical); animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52,211,153,.4); } 50% { opacity: .5; box-shadow: 0 0 0 4px transparent; } }

.content { padding: 24px 26px; max-width: 1460px; width: 100%; margin: 0 auto; }
.view { animation: viewIn .25s cubic-bezier(.2,.8,.3,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }

/* ═══ KPIs ═══ */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 15px; margin-bottom: 20px;
}
.kpi {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, transform .2s;
  animation: riseIn .4s cubic-bezier(.2,.9,.3,1.1) backwards;
}
.kpi:nth-child(2) { animation-delay: .05s; }
.kpi:nth-child(3) { animation-delay: .1s; }
.kpi:nth-child(4) { animation-delay: .15s; }
.kpi:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.kpi::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--kpi-color, var(--accent));
  opacity: .6;
}
.kpi-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; margin-bottom: 8px; }
.kpi-value { font-size: 30px; font-weight: 800; font-family: var(--font-mono); letter-spacing: -1px; color: var(--kpi-color, var(--text)); }
.kpi-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; }
.kpi.c-critical { --kpi-color: var(--critical); }
.kpi.c-info { --kpi-color: var(--info); }
.kpi.c-accent { --kpi-color: var(--accent); }
.kpi.c-cyan { --kpi-color: var(--cyan); }

/* ═══ Paneles ═══ */
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 15px; }
@media (max-width: 1000px) { .panel-grid { grid-template-columns: 1fr; } }
.panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 19px 21px;
  margin-bottom: 15px;
  box-shadow: var(--shadow-panel);
}
.panel-grid .panel { margin-bottom: 0; }
.panel h2 {
  font-size: 13.5px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: baseline; gap: 10px; letter-spacing: -.1px;
}
.panel-hint { font-size: 11px; color: var(--text-faint); font-weight: 500; }

/* ═══ Charts ═══ */
.chart-box { position: relative; height: 190px; }
.chart-box-sm { position: relative; height: 150px; }

/* ═══ Feed / alertas ═══ */
.feed { display: flex; flex-direction: column; gap: 7px; }
.feed-item, .alert-item {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.02); border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.alert-item { cursor: pointer; }
.alert-item:hover { background: var(--bg-3); border-color: var(--border); }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.sev-dot.s-critical { background: var(--critical); box-shadow: 0 0 9px var(--critical); }
.sev-dot.s-high { background: var(--high); box-shadow: 0 0 7px rgba(251,146,60,.5); }
.sev-dot.s-medium { background: var(--medium); }
.sev-dot.s-info { background: var(--info); }
.feed-body { flex: 1; min-width: 0; }
.feed-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.feed-meta { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }
.feed-detail {
  margin-top: 11px; padding: 14px; border-radius: var(--radius-sm);
  background: var(--bg-0); border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 11px;
  white-space: pre-wrap; word-break: break-word; line-height: 1.65;
  max-height: 320px; overflow-y: auto;
}
.sev-tag {
  font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 6px;
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .5px;
  flex-shrink: 0; margin-top: 3px;
}
.sev-tag.s-critical { background: var(--critical-soft); color: var(--critical); border: 1px solid rgba(244,63,94,.3); }
.sev-tag.s-high { background: var(--high-soft); color: var(--high); border: 1px solid rgba(251,146,60,.3); }
.sev-tag.s-medium { background: var(--medium-soft); color: var(--medium); border: 1px solid rgba(250,204,21,.3); }
.sev-tag.s-info { background: var(--info-soft); color: var(--info); border: 1px solid rgba(52,211,153,.3); }

/* ═══ Controles ═══ */
.toolbar { display: flex; gap: 11px; margin-bottom: 18px; align-items: center; flex-wrap: wrap; }
.input {
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-family: var(--font-ui); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { cursor: pointer; appearance: none; padding-right: 34px;
  background-color: var(--bg-2); color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b93a7' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select.input option, select.input optgroup {
  background-color: var(--bg-1, #14181f); color: #e6e9ef; padding: 8px;
}
select.input option:checked, select.input option:hover {
  background-color: var(--accent-soft, rgba(122,162,255,.25)); color: #fff;
}

.btn-primary {
  padding: 10px 20px; border: none; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #d97706);
  color: #1a1207; font-size: 13px; font-weight: 700; font-family: var(--font-ui);
  cursor: pointer; transition: all .18s;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-ghost {
  padding: 9px 15px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); font-size: 12.5px; font-family: var(--font-ui); cursor: pointer;
  transition: all .15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-3); }

.alerts-list { display: flex; flex-direction: column; gap: 7px; }

/* ═══ Rankings (intel) ═══ */
.rank-row {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.04);
}
.rank-row:last-child { border-bottom: none; }
.rank-click { cursor: pointer; user-select: none; }
.rank-click:hover .rank-name { color: var(--accent, #7aa2ff); }
.rank-caret { display: inline-block; width: 12px; opacity: .5; }
.ip-detail {
  display: none; margin: 2px 0 8px 24px; padding: 6px 10px;
  border-left: 2px solid rgba(122,162,255,.25);
  background: rgba(255,255,255,.02); border-radius: 0 6px 6px 0;
}
.ip-detail.open { display: block; }
.ip-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 3px 0; font-family: var(--font-mono); font-size: 11px;
}
.ip-addr { color: var(--accent, #7aa2ff); }
.ip-val { color: rgba(255,255,255,.55); }
.rank-name {
  font-family: var(--font-mono); font-size: 12px;
  width: 340px; flex-shrink: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rank-bar-wrap {
  flex: 1; height: 7px; background: rgba(255,255,255,.05);
  border-radius: 4px; overflow: hidden;
}
.rank-bar {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--cyan), #0e7490);
  animation: barGrow .6s cubic-bezier(.2,.8,.3,1) backwards;
}
.rank-bar.hot { background: linear-gradient(90deg, var(--critical), #9f1239); }
.rank-bar.sevbar-critical { background: linear-gradient(90deg, var(--critical), #9f1239); }
.rank-bar.sevbar-high { background: linear-gradient(90deg, var(--high), #b45309); }
.rank-bar.sevbar-medium { background: linear-gradient(90deg, var(--medium), #a16207); }
.rank-bar.sevbar-info { background: linear-gradient(90deg, var(--info), #065f46); }
.decay-tag {
  margin-left: 8px; font-size: 10px; padding: 1px 6px; border-radius: 8px;
  background: var(--info-soft); color: var(--info); border: 1px solid rgba(52,211,153,.3);
}
@keyframes barGrow { from { width: 0 !important; } }
.rank-val { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); width: 70px; text-align: right; font-weight: 700; }

/* ═══ Skeleton loading ═══ */
.skel {
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,.03) 25%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ═══ Toasts ═══ */
#toast-zone { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 13px 18px; border-radius: var(--radius-sm);
  background: var(--bg-1); border: 1px solid var(--border-strong);
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  font-size: 13px; display: flex; align-items: center; gap: 10px;
  animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2);
  max-width: 380px;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }
.toast.ok { border-left: 3px solid var(--info); }
.toast.err { border-left: 3px solid var(--critical); }
.toast.info { border-left: 3px solid var(--cyan); }

/* ═══ Configs WAF viewer ═══ */
.cfg-layout { display: grid; grid-template-columns: 380px 1fr; gap: 15px; }
@media (max-width: 900px) { .cfg-layout { grid-template-columns: 1fr; } }
.cfg-list { max-height: 580px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-right: 4px; }
.cfg-dir { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700; padding: 12px 8px 5px; }
.cfg-item {
  padding: 8px 11px; border-radius: 7px; font-family: var(--font-mono); font-size: 11px;
  cursor: pointer; white-space: normal; word-break: break-all; line-height: 1.45;
  color: var(--text-dim); transition: all .13s;
}
.cfg-item:hover { background: var(--bg-3); color: var(--text); }
.cfg-item.active { background: var(--accent-soft); color: var(--accent); }
.cfg-item.cfg-suspended { opacity: .55; font-style: italic; }
.cfg-actions {
  display: flex; gap: 8px; align-items: center; margin-bottom: 10px;
  padding: 7px 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 7px;
  font-size: 11px;
}
.cfg-suspend { border-color: #d29922; color: #d29922; }
.cfg-resume { border-color: var(--info); color: var(--info); }
.cfg-delete { border-color: var(--critical); color: var(--critical); }
.cfg-viewer {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6;
  max-height: 580px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  tab-size: 4;
}

/* ═══ Chat LLM ═══ */
.chat-log {
  display: flex; flex-direction: column; gap: 11px; margin-bottom: 16px;
  max-height: 400px; overflow-y: auto; min-height: 60px;
}
.chat-msg {
  padding: 11px 16px; border-radius: 13px; font-size: 13px; line-height: 1.65;
  max-width: 85%; animation: msgIn .25s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.chat-msg.user { align-self: flex-end; background: var(--cyan-soft); border: 1px solid rgba(34,211,238,.25); border-bottom-right-radius: 4px; }
.chat-msg.bot { align-self: flex-start; background: var(--bg-3); border: 1px solid var(--border); border-bottom-left-radius: 4px; white-space: pre-wrap; }
.chat-msg.error { align-self: flex-start; background: var(--critical-soft); border: 1px solid rgba(244,63,94,.3); color: var(--critical); }
.chat-typing { color: var(--text-dim); font-style: italic; }

/* ═══ Componentes infra ═══ */
.comp-row {
  display: flex; align-items: center; gap: 13px; padding: 12px 14px;
  border-radius: var(--radius-sm); background: rgba(255,255,255,.02); margin-bottom: 7px;
  border: 1px solid transparent; transition: border-color .15s;
}
.comp-row:hover { border-color: var(--border); }
.comp-name { flex: 1; font-size: 13px; font-weight: 600; }
.comp-detail { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }

/* ═══ kv / status ═══ */
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--text-dim); }
.kv dd { font-family: var(--font-mono); font-size: 12px; }
.status-ok { color: var(--info); }
.status-bad { color: var(--critical); }

/* ═══ Ratio ring (efectividad WAF) ═══ */
.ratio-wrap { display: flex; align-items: center; gap: 30px; }
.ratio-ring {
  width: 130px; height: 130px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; font-family: var(--font-mono);
  flex-shrink: 0; position: relative;
}
.ratio-ring::before {
  content: ''; position: absolute; inset: 9px; border-radius: 50%;
  background: var(--bg-1);
}
.ratio-ring span { position: relative; }
.ratio-legend { font-size: 13px; line-height: 2.1; }

/* ═══ NGINX audit ═══ */
.sev-chips { display: flex; gap: 9px; flex: 1; flex-wrap: wrap; }
.chip {
  padding: 7px 15px; border-radius: 20px; font-size: 12px;
  font-family: var(--font-mono); border: 1px solid var(--border);
}
.chip.c-high { border-color: rgba(244,63,94,.4); color: var(--critical); background: var(--critical-soft); }
.chip.c-medium { border-color: rgba(250,204,21,.35); color: var(--medium); background: var(--medium-soft); }
.chip.c-low { border-color: rgba(52,211,153,.3); color: var(--info); background: var(--info-soft); }
.chip.c-clean { border-color: var(--border); color: var(--text-dim); }

.nginx-file {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 9px; overflow: hidden;
  transition: border-color .18s;
}
.nginx-file:hover { border-color: var(--border-strong); }
.nginx-file-head {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 17px; cursor: pointer; user-select: none;
}
.nginx-file-head:hover { background: var(--bg-3); }
.nginx-file-name { font-family: var(--font-mono); font-size: 12px; flex: 1; word-break: break-all; }
.nginx-file-body { padding: 0 17px 16px; display: none; }
.nginx-file.open .nginx-file-body { display: block; }
.finding {
  padding: 12px 14px; margin-top: 9px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.02); border-left: 3px solid var(--medium);
  font-size: 12px;
}
.finding.f-high, .finding.f-critical { border-left-color: var(--critical); }
.finding.f-low { border-left-color: var(--info); }
.finding-title { font-weight: 700; margin-bottom: 5px; }
.finding-desc { color: var(--text-dim); line-height: 1.6; }
.finding-plugin { font-family: var(--font-mono); font-size: 10px; color: var(--cyan); margin-top: 7px; }

/* ═══ Pentest ═══ */
.allowed-list { display: flex; flex-wrap: wrap; gap: 9px; }
.allowed-tag {
  padding: 7px 13px; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 12px;
  background: rgba(255,255,255,.03); border: 1px solid var(--border); cursor: pointer;
  transition: all .15s;
}
.allowed-tag:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.allowed-tag.cidr { border-style: dashed; cursor: default; }
.allowed-tag.cidr:hover { border-color: var(--border); color: inherit; background: rgba(255,255,255,.03); }
.allowed-del { color: var(--sev-critical, #ef4444); cursor: pointer; margin-left: 4px; font-size: 14px; }
.allowed-del:hover { text-shadow: 0 0 6px currentColor; }

/* ─── Modal de confirmación (pruebas intrusivas) ─── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(4, 6, 10, .92);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-panel {
  max-width: 580px; width: 92%; max-height: 88vh; overflow-y: auto;
  background: var(--bg-1, #0d1117);
  border: 1px solid rgba(248, 113, 113, .55);
  box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 18px 60px rgba(0,0,0,.7), 0 0 40px rgba(248,113,113,.08);
  padding: 22px 24px;
}
.modal-text { line-height: 1.75; font-size: 13px; margin: 8px 0; }
.modal-list { line-height: 2; font-size: 12.5px; padding-left: 22px; margin: 6px 0; }
.modal-list li::marker { content: ''; }

/* ─── Informe formateado ─── */
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-pdf { white-space: nowrap; }
.report-body {
  margin-top: 11px; padding: 18px 20px; border-radius: var(--radius-sm);
  background: var(--bg-0); border: 1px solid var(--border);
  font-size: 12.5px; line-height: 1.8; max-height: 620px; overflow-y: auto;
  word-break: break-word;
}
.rep-h { color: var(--accent); margin: 20px 0 10px; font-size: 13.5px; letter-spacing: .2px; }
.rep-h2 { font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.rep-h:first-child { margin-top: 0; }
h4.rep-h { font-size: 12.5px; color: var(--text); }
.rep-p { margin: 5px 0; }
.rep-gap { height: 8px; }
.rep-li { padding-left: 16px; margin: 3px 0; position: relative; }
.rep-num { color: var(--text-dim); padding-left: 8px; }
.rep-note {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 10px 13px; margin: 12px 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.7;
}
.rep-table {
  width: 100%; border-collapse: collapse; margin: 14px 0;
  font-size: 11.5px; line-height: 1.6;
}
.rep-table th {
  text-align: left; padding: 8px 10px; background: rgba(255,255,255,.05);
  border-bottom: 2px solid var(--accent); color: var(--accent);
  font-weight: 600; white-space: nowrap;
}
.rep-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  vertical-align: top; word-break: break-word;
}
.rep-table tr:hover td { background: rgba(255,255,255,.02); }
.rep-table td.sev-critical, .sev-critical { color: #f87171; font-weight: 700; }
.rep-table td.sev-high, .sev-high { color: #fb923c; font-weight: 600; }
.rep-table td.sev-medium, .sev-medium { color: #fbbf24; }
.rep-table td.sev-low, .sev-low { color: #34d399; }
.rep-code {
  background: var(--bg-2, rgba(255,255,255,.04)); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; margin: 10px 0;
  font-family: var(--font-mono); font-size: 11px; overflow-x: auto; white-space: pre;
  line-height: 1.6;
}
.rep-inline {
  background: rgba(255,255,255,.06); border-radius: 3px; padding: 1px 5px;
  font-family: var(--font-mono); font-size: 11px;
}

.scan-form { display: flex; gap: 11px; flex-wrap: wrap; }
.scan-form .input { flex: 1; min-width: 230px; }
.scan-status {
  margin-top: 15px; padding: 13px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.02); border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12px;
}
.report-row {
  display: flex; align-items: center; gap: 13px; padding: 11px 8px;
  border-bottom: 1px solid rgba(255,255,255,.04); cursor: pointer;
  border-radius: 6px; transition: background .13s;
}
.report-row:hover { background: var(--bg-3); }
.report-row:last-child { border-bottom: none; }

/* ═══ Terminal de pentest en vivo ═══ */
#scan-terminal { margin-top: 16px; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: #05070b; }
.st-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 11px 16px; background: rgba(255,255,255,.03); border-bottom: 1px solid var(--border);
}
.st-title { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--cyan); }
.st-phases { display: flex; gap: 6px; flex-wrap: wrap; }
.st-phase {
  font-size: 10px; font-family: var(--font-mono); font-weight: 700; letter-spacing: .5px;
  padding: 4px 10px; border-radius: 12px; text-transform: uppercase;
  background: rgba(255,255,255,.04); color: var(--text-faint);
  border: 1px solid transparent; transition: all .25s;
}
.st-phase.active { background: var(--accent-soft); color: var(--accent); border-color: rgba(245,158,11,.4); animation: phasePulse 1.4s infinite; }
.st-phase.done { background: var(--info-soft); color: var(--info); }
.st-phase.failed { background: var(--critical-soft); color: var(--critical); }
@keyframes phasePulse { 0%,100% { box-shadow: 0 0 0 0 var(--accent-glow); } 50% { box-shadow: 0 0 12px 2px var(--accent-glow); } }
.st-progress-wrap {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.st-progress-wrap .st-progress-bar { flex: 1; }
.st-progress-bar {
  height: 10px; border-radius: 5px; overflow: hidden;
  background: rgba(255,255,255,.05);
  position: relative;
}
.st-progress-bar::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--accent), #fbbf24);
  border-radius: 5px;
  transform-origin: left;
  transform: scaleX(calc(var(--p, 0) / 100));
  transition: transform .8s cubic-bezier(.2,.8,.3,1);
}
.st-progress-bar.shimmer::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
  animation: barShimmer 1.6s infinite;
}
@keyframes barShimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.st-progress-pct { font-family: var(--font-mono); font-size: 15px; font-weight: 800; color: var(--accent); width: 52px; text-align: right; }
.st-log {
  padding: 13px 16px; max-height: 300px; overflow-y: auto;
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.75;
}
.st-log-line { display: flex; gap: 10px; animation: logIn .2s ease; }
@keyframes logIn { from { opacity: 0; transform: translateX(-6px); } }
.st-log-line .lg-ps { color: var(--info); flex-shrink: 0; user-select: none; }
.st-log-line .lg-txt { color: #c3cbdd; word-break: break-word; }
.st-log-line.lg-cmd .lg-txt { color: var(--cyan); }
.st-log-line.lg-warn .lg-txt { color: var(--high); }
.st-log-line.lg-err .lg-txt { color: var(--critical); }
.st-log-caret { display: inline-block; width: 8px; height: 14px; background: var(--accent); animation: caretBlink 1s steps(1) infinite; vertical-align: -2px; }
@keyframes caretBlink { 50% { opacity: 0; } }
.st-report {
  border-top: 1px solid var(--border); padding: 16px;
  font-size: 12.5px; line-height: 1.65;
  word-break: break-word; max-height: 420px; overflow-y: auto;
  background: rgba(52,211,153,.03);
}

/* ═══ Gestión de usuarios ═══ */
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-faint); font-weight: 700; padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.users-table td { padding: 11px 10px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
.users-table tr:last-child td { border-bottom: none; }
.user-cell { display: flex; align-items: center; gap: 11px; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #475569, #1e293b);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #cbd5e1;
}
.user-avatar.is-admin { background: linear-gradient(135deg, var(--accent), #b45309); color: #1a1207; }
.user-name { font-weight: 600; }
.user-meta { font-size: 10.5px; color: var(--text-faint); font-family: var(--font-mono); }
.role-tag {
  font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 6px;
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .5px;
}
.role-tag.admin { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(245,158,11,.3); }
.role-tag.operador { background: var(--cyan-soft); color: var(--cyan); border: 1px solid rgba(34,211,238,.3); }
.status-pill {
  font-size: 10.5px; font-family: var(--font-mono); padding: 3px 10px; border-radius: 12px;
}
.status-pill.on { background: var(--info-soft); color: var(--info); border: 1px solid rgba(52,211,153,.25); }
.status-pill.off { background: var(--critical-soft); color: var(--critical); border: 1px solid rgba(244,63,94,.25); }
.user-actions { display: flex; gap: 7px; justify-content: flex-end; }
.btn-mini {
  padding: 6px 11px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  cursor: pointer; font-family: var(--font-ui); transition: all .14s;
}
.btn-mini:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-3); }
.btn-mini.danger:hover { color: var(--critical); border-color: rgba(244,63,94,.4); background: var(--critical-soft); }

/* ─── Mitigación (aplicar en WAF + corregido) ─── */
.mit-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.btn-apply { color: #fbbf24; border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.08); }
.btn-apply:hover { color: #fbbf24; border-color: #fbbf24; background: rgba(251,191,36,.16); }
.btn-ok { color: var(--info); border-color: rgba(52,211,153,.4); background: var(--info-soft); }
.btn-ok:hover { color: var(--info); border-color: var(--info); }
.btn-ghost { opacity: .6; }
.btn-ghost:hover { opacity: 1; }
.mit-done { font-size: 11px; color: var(--info); font-family: var(--font-mono); }
.alert-item.is-mitigated { opacity: .55; }
.alert-item.is-mitigated .feed-title { text-decoration: line-through; text-decoration-color: rgba(52,211,153,.5); }
.modal-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 10px 0; font-size: 12px; }
.modal-meta dt { color: var(--dim); }
.modal-meta dd { margin: 0; }
.mono { font-family: var(--font-mono); font-size: 11px; word-break: break-all; }
.mit-preview {
  background: var(--bg-1); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.55;
  max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  color: #a5d6a7;
}
.mit-check { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-size: 12.5px; cursor: pointer; }
.mit-check input { margin-top: 2px; accent-color: #fbbf24; }

/* ─── Versionados (backups) ─── */
.bkp-group { margin-bottom: 14px; }
.bkp-target { font-size: 12px; color: var(--text); margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,.06); }
.bkp-row { display: flex; align-items: center; gap: 12px; padding: 4px 0 4px 12px; font-size: 12px; }
.bkp-name { flex: 1; color: var(--accent, #7aa2ff); word-break: break-all; }
.bkp-latest { font-size: 10px; color: var(--info); background: var(--info-soft); padding: 1px 6px; border-radius: 8px; margin-left: 6px; }
.bkp-meta { color: var(--dim); font-size: 11px; white-space: nowrap; }
.bkp-restore:disabled { opacity: .5; cursor: default; }

/* ─── Post-mortem LLM (falla de aplicación) ─── */
.pm-box { position: relative; margin-top: 10px; background: var(--bg-1); border: 1px solid var(--critical); border-radius: var(--radius-sm); max-width: 520px; box-shadow: var(--shadow-panel); }
.pm-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; color: var(--critical); font-weight: 700; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.pm-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 14px; }
.pm-close:hover { color: var(--text); }
.pm-body { padding: 12px 14px; font-size: 12.5px; line-height: 1.6; color: var(--text); white-space: pre-wrap; }

/* ─── IPs bloqueadas globalmente ─── */
.ipb-form { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; }
.btn-block-add { background: rgba(244,63,94,.12); border-color: var(--critical); color: var(--critical); }
.btn-block-add:hover:not(:disabled) { background: rgba(244,63,94,.22); }
.ipb-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.ipb-row:last-child { border-bottom: none; }
.ipb-ip { font-weight: 700; color: var(--critical); cursor: pointer; flex-shrink: 0; }
.ipb-ip:hover { text-decoration: underline; }
.ipb-whois { flex: 1; font-size: 12px; color: var(--text-dim); min-width: 0; }
.ipb-whois.hidden { display: none; }
.ipb-risk { color: var(--high); }
.ipb-ok { color: var(--info); }
.ipb-del { background: none; border: 1px solid var(--border); color: var(--text-dim); padding: 4px 8px; font-size: 11px; }
.ipb-del:hover { border-color: var(--critical); color: var(--critical); }

/* ─── Botón aplicar global (mitigación a todos los vhosts) ─── */
.btn-global { padding: 10px 20px; border: 1px solid var(--cyan); border-radius: var(--radius-sm); background: rgba(34,211,238,.08); color: var(--cyan); font-size: 13px; font-weight: 700; font-family: var(--font-ui); cursor: pointer; transition: background .2s, box-shadow .2s; }
.btn-global:hover:not(:disabled) { background: rgba(34,211,238,.18); box-shadow: 0 0 18px var(--cyan-soft); }
.btn-global:disabled { opacity: .5; cursor: default; }

/* ─── ADD VHOST ─── */
.vhost-form { display: flex; flex-direction: column; gap: 4px; }
.vh-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.vh-row label { font-size: 12px; color: var(--dim); }
.vh-row .input { font-size: 12.5px; padding: 8px 10px; }

/* ═══ Responsive ═══ */
@media (max-width: 860px) {
  .sidebar { width: 64px; }
  .sb-item span:not(.sb-ico), .sb-brand h1, .sb-section, .sb-user-info { display: none; }
  .sb-item { justify-content: center; padding: 11px; }
  .rank-name { width: 160px; }
  .content { padding: 16px; }
}

/* ═══ NGINX QA — sección separada con marca de agua ═══ */
:root { --qa: #f0a500; --qa-soft: rgba(240,165,0,.25); --qa-dim: rgba(240,165,0,.12); }

/* Separador de sección en el sidebar */
.sb-section.qa-section { color: var(--qa); border-top: 1px dashed var(--qa-soft); margin-top: 10px; padding-top: 10px; font-weight: 700; letter-spacing: .04em; }
.sb-item.sb-qa { border-left: 2px solid transparent; }
.sb-item.sb-qa:hover { border-left-color: var(--qa-soft); }
.sb-item.sb-qa.active { background: var(--qa-dim); color: var(--qa); border-left-color: var(--qa); }

/* Banner de ambiente + marca de agua diagonal en TODAS las vistas QA */
.qa-watermark { position: relative; }
.qa-watermark::before {
  content: 'NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA · NGINX QA';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  font-size: 42px; font-weight: 800; color: rgba(240,165,0,.045);
  transform: rotate(-18deg) scale(1.6); transform-origin: center;
  display: flex; align-items: center; justify-content: center;
  word-spacing: 60px; line-height: 3.2; white-space: pre-wrap; text-align: center;
}
.qa-watermark > * { position: relative; z-index: 1; }
.qa-banner {
  background: var(--qa-dim); border: 1px dashed var(--qa); color: var(--qa);
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
}
.qa-banner b { color: var(--qa); }

/* Accentos ámbar dentro de las vistas QA */
.qa-watermark .panel h2 { color: var(--text); }
.qa-watermark .panel h2::after { content: ''; display: block; width: 34px; height: 2px; background: var(--qa); margin-top: 5px; border-radius: 2px; opacity: .7; }
.qa-watermark .btn-primary { background: var(--qa-dim); border-color: var(--qa); color: var(--qa); }
.qa-watermark .btn-primary:hover:not(:disabled) { background: var(--qa-soft); box-shadow: 0 0 16px var(--qa-soft); }
.qa-watermark .cfg-item.active { background: var(--qa-dim); color: var(--qa); }
.qa-watermark .chip.c-clean { border-color: var(--qa-soft); }
