/* ============================================================
   COCORA - Sistema visual del panel
   Paleta y tipografia heredadas de la plantilla T0001,
   reorganizadas para una interfaz de gestion (densa, tabular).
   ============================================================ */

:root {
  --bg: #04070e;
  --bg2: #070c17;
  --panel: rgba(15, 23, 42, .55);
  --panel2: rgba(10, 16, 28, .7);
  --panel-solido: #0b1220;
  --border: rgba(125, 211, 252, .14);
  --border2: rgba(34, 197, 94, .25);
  --text: #eaf2fb;
  --muted: #8aa0b8;
  --dim: #5b6c81;

  --green: #22c55e;
  --green2: #16a34a;
  --cyan: #06b6d4;
  --cyan2: #22d3ee;
  --sky: #7dd3fc;
  --violet: #a78bfa;
  --magenta: #e879f9;
  --blue: #2563eb;
  --rojo: #f87171;
  --ambar: #fbbf24;

  --brand: linear-gradient(120deg, #16a34a, #06b6d4 60%, #22d3ee);
  --glow-c: rgba(34, 211, 238, .5);
  --glow-g: rgba(34, 197, 94, .45);

  --sidebar-w: 250px;
  --topbar-h: 62px;
  --radio: 14px;
  --radio-sm: 9px;

  --fuente: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fuente-display: 'Space Grotesk', var(--fuente);
  --fuente-mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--fuente);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Halo de fondo: evoca la plantilla sin distraer de los datos. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 82% -8%, rgba(6, 182, 212, .10), transparent 60%),
    radial-gradient(700px 400px at 8% 102%, rgba(34, 197, 94, .08), transparent 60%),
    var(--bg);
}

a { color: var(--cyan2); text-decoration: none; }
a:hover { color: var(--sky); }

.gradient {
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ===================== ESTRUCTURA ===================== */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--panel2);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transition: transform .22s ease;
}

.marca {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}

.marca .logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand);
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 0 18px var(--glow-c);
}

.marca .logo::after {
  content: '';
  position: absolute;
  inset: 9px;
  border: 2.5px solid var(--bg);
  border-radius: 50%;
}

.marca b {
  font-family: var(--fuente-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .5px;
  display: block;
  line-height: 1.15;
}

.marca small {
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.nav-menu { padding: 14px 11px; flex: 1; overflow-y: auto; }

.nav-grupo {
  color: var(--dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  padding: 14px 10px 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radio-sm);
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .16s, color .16s;
}

.nav-item:hover { background: rgba(125, 211, 252, .07); color: var(--text); }

.nav-item.activo {
  background: linear-gradient(90deg, rgba(34, 197, 94, .16), rgba(6, 182, 212, .08));
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--green);
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .9; }

.nav-pie {
  padding: 13px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--dim);
}

.contenido {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: rgba(4, 7, 14, .8);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar h1 {
  font-family: var(--fuente-display);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.topbar .sub { color: var(--dim); font-size: 12px; }

.usuario-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}

.usuario-chip .avatar {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--brand);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--bg);
  flex-shrink: 0;
}

.usuario-chip .datos { line-height: 1.2; }
.usuario-chip .datos b { font-size: 12.5px; font-weight: 600; }
.usuario-chip .datos span { font-size: 10.5px; color: var(--dim); display: block; }

.pagina { padding: 22px; flex: 1; }

.menu-movil { display: none; background: none; border: 0; color: var(--text); font-size: 21px; cursor: pointer; }

/* ===================== TARJETAS ===================== */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radio);
  backdrop-filter: blur(9px);
}

.panel-cab {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-cab h2 {
  font-family: var(--fuente-display);
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.panel-cab .desc { color: var(--dim); font-size: 12px; margin-top: 2px; }
.panel-cuerpo { padding: 18px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); }

/* Tarjeta de metrica */
.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radio);
  padding: 16px 17px;
  position: relative;
  overflow: hidden;
}

.kpi::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--acento, var(--brand));
  opacity: .85;
}

.kpi .etiqueta {
  color: var(--dim);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}

.kpi .valor {
  font-family: var(--fuente-display);
  font-size: 27px;
  font-weight: 800;
  margin: 7px 0 2px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi .pie { color: var(--muted); font-size: 11.5px; }

/* ===================== TABLAS ===================== */

.tabla-wrap { overflow-x: auto; }

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

table.tabla th {
  text-align: left;
  padding: 10px 13px;
  color: var(--dim);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: rgba(7, 12, 23, .5);
}

table.tabla td {
  padding: 11px 13px;
  border-bottom: 1px solid rgba(125, 211, 252, .07);
  vertical-align: middle;
}

table.tabla tbody tr:hover { background: rgba(125, 211, 252, .04); }
table.tabla tbody tr:last-child td { border-bottom: 0; }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--fuente-mono); font-size: 12px; }

.vacio { padding: 44px 18px; text-align: center; color: var(--dim); }
.vacio h3 { font-family: var(--fuente-display); color: var(--muted); margin: 0 0 5px; font-size: 15px; }

/* ===================== INSIGNIAS ===================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge.ok { background: rgba(34, 197, 94, .14); color: #86efac; border-color: rgba(34, 197, 94, .3); }
.badge.no { background: rgba(248, 113, 113, .13); color: #fca5a5; border-color: rgba(248, 113, 113, .28); }
.badge.warn { background: rgba(251, 191, 36, .13); color: #fcd34d; border-color: rgba(251, 191, 36, .28); }
.badge.info { background: rgba(6, 182, 212, .13); color: var(--sky); border-color: rgba(6, 182, 212, .28); }
.badge.neutro { background: rgba(125, 211, 252, .08); color: var(--muted); border-color: var(--border); }
.badge.violeta { background: rgba(167, 139, 250, .14); color: #c4b5fd; border-color: rgba(167, 139, 250, .3); }

.punto { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok .punto { box-shadow: 0 0 7px var(--green); }

/* ===================== BOTONES ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: var(--radio-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: var(--fuente);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s, box-shadow .16s, background .16s;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); color: var(--text); }

.btn.primario {
  background: var(--brand);
  border-color: transparent;
  color: #04121a;
  font-weight: 700;
}

.btn.primario:hover { box-shadow: 0 8px 24px -6px var(--glow-c); }

.btn.peligro { border-color: rgba(248, 113, 113, .35); color: #fca5a5; background: rgba(248, 113, 113, .08); }
.btn.peligro:hover { background: rgba(248, 113, 113, .16); }
.btn.sm { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.acciones { display: flex; gap: 7px; flex-wrap: wrap; }

/* ===================== FORMULARIOS ===================== */

.campo { margin-bottom: 15px; }

.campo label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.campo .ayuda { font-size: 11.5px; color: var(--dim); margin-top: 5px; }

.control {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radio-sm);
  border: 1px solid var(--border);
  background: rgba(4, 7, 14, .6);
  color: var(--text);
  font-family: var(--fuente);
  font-size: 13.5px;
  transition: border-color .16s, box-shadow .16s;
}

.control:focus {
  outline: 0;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, .16);
}

.control::placeholder { color: var(--dim); }
select.control { cursor: pointer; }
textarea.control { resize: vertical; min-height: 72px; }

.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 15px; height: 15px; accent-color: var(--green); cursor: pointer; }
.check label { margin: 0; cursor: pointer; }

.error-campo { color: #fca5a5; font-size: 11.5px; margin-top: 5px; display: block; }
.input-invalido { border-color: rgba(248, 113, 113, .5) !important; }

/* ===================== AVISOS ===================== */

.aviso {
  padding: 11px 15px;
  border-radius: var(--radio-sm);
  border: 1px solid;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.aviso.ok { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .3); color: #86efac; }
.aviso.error { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .3); color: #fca5a5; }
.aviso.info { background: rgba(6, 182, 212, .1); border-color: rgba(6, 182, 212, .3); color: var(--sky); }
.aviso.warn { background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .3); color: #fcd34d; }

/* ===================== INGRESO ===================== */

.ingreso-pantalla {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.ingreso-caja {
  width: 100%;
  max-width: 390px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px;
  backdrop-filter: blur(14px);
  box-shadow: 0 26px 70px -18px rgba(0, 0, 0, .8);
}

.ingreso-caja .marca { border: 0; padding: 0 0 22px; justify-content: center; }

.ingreso-caja h1 {
  font-family: var(--fuente-display);
  font-size: 20px;
  text-align: center;
  margin: 0 0 5px;
}

.ingreso-caja .lead {
  color: var(--dim);
  text-align: center;
  font-size: 12.5px;
  margin: 0 0 24px;
}

/* Orbe decorativo del ingreso: guiño a la plantilla original. */
.orbe {
  position: fixed;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #7dd3fc, #06b6d4 30%, #1e3a8a 65%, #04101c 100%);
  filter: blur(58px);
  opacity: .22;
  top: -110px;
  right: -110px;
  z-index: -1;
  pointer-events: none;
}

/* ===================== GRAFICOS ===================== */

.grafico { width: 100%; height: 190px; display: block; }
.grafico .rejilla { stroke: rgba(125, 211, 252, .1); stroke-width: 1; }
.grafico .eje { fill: var(--dim); font-size: 10px; font-family: var(--fuente); }

.barra-mini {
  height: 5px;
  border-radius: 999px;
  background: rgba(125, 211, 252, .1);
  overflow: hidden;
}

.barra-mini > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }

/* ===================== SECRETO / TOKEN ===================== */

.secreto {
  font-family: var(--fuente-mono);
  font-size: 13px;
  background: rgba(4, 7, 14, .8);
  border: 1px dashed var(--border2);
  border-radius: var(--radio-sm);
  padding: 13px;
  word-break: break-all;
  color: #86efac;
  user-select: all;
}

/* ===================== PAGINACION ===================== */

.paginacion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
}

.paginacion .paginas { display: flex; gap: 5px; }

.paginacion a, .paginacion span.actual {
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.paginacion span.actual { background: var(--brand); color: #04121a; border-color: transparent; font-weight: 700; }
.paginacion a:hover { background: rgba(125, 211, 252, .08); color: var(--text); }

/* ===================== UTILIDADES ===================== */

.filtros { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filtros .campo { margin: 0; }
.flex { display: flex; }
.entre { justify-content: space-between; }
.centro { align-items: center; }
.gap { gap: 10px; }
.mt0 { margin-top: 0; } .mt1 { margin-top: 8px; } .mt2 { margin-top: 16px; } .mt3 { margin-top: 24px; }
.mb0 { margin-bottom: 0; } .mb2 { margin-bottom: 16px; }
.dim { color: var(--dim); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.w100 { width: 100%; }

/* ===================== RESPONSIVE ===================== */

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.abierto { transform: translateX(0); }
  .contenido { margin-left: 0; }
  .menu-movil { display: block; }
  .pagina { padding: 15px; }
  .topbar { padding: 0 15px; }
  .usuario-chip .datos { display: none; }
}

/* El foco debe verse siempre: se navega el panel con teclado. */
:focus-visible { outline: 2px solid var(--cyan2); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
