/* ─── Reset y base ─────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: #1f2937;
  background: #f3f4f6;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }

/* ─── Layout principal ─────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: #1e1b4b;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
}
.contenido {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ─── Sidebar ──────────────────────────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo-icon {
  width: 38px; height: 38px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.logo-name { font-weight: 600; font-size: 14px; }
.logo-sub { font-size: 11px; color: rgba(255,255,255,.55); }

nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 2px;
  color: rgba(255,255,255,.75);
  font-size: 13px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: #7c3aed; color: #fff; }
.nav-item .ico { font-size: 16px; }

.user-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #7c3aed;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; }
.user-email { font-size: 11px; color: rgba(255,255,255,.55); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout {
  color: rgba(255,255,255,.55);
  padding: 6px;
  border-radius: 6px;
  font-size: 16px;
}
.logout:hover { color: #fff; background: rgba(255,255,255,.08); }

/* ─── Página ───────────────────────────────────────────────────────── */
.page-head {
  background: #fff;
  padding: 22px 28px;
  border-bottom: 1px solid #e5e7eb;
}
.page-head h1 { font-size: 22px; font-weight: 600; color: #1f2937; }

.page-body { padding: 24px 28px; }

/* ─── KPIs del dashboard ───────────────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 18px 20px;
}
.kpi-titulo { font-size: 12px; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.kpi-valor { font-size: 28px; font-weight: 600; color: #1f2937; }
.kpi-detalle { font-size: 12px; color: #6b7280; margin-top: 4px; }
.kpi.verde .kpi-valor { color: #059669; }
.kpi.rojo .kpi-valor { color: #dc2626; }
.kpi.naranja .kpi-valor { color: #d97706; }

/* ─── Tarjetas y secciones ─────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 20px;
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 16px 20px; }

/* ─── Tabla ────────────────────────────────────────────────────────── */
table.lista {
  width: 100%;
  border-collapse: collapse;
}
table.lista th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: #6b7280;
  letter-spacing: .5px;
  padding: 10px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
table.lista td {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}
table.lista tr:hover td { background: #fafbfc; }
table.lista td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.lista td.acc { text-align: right; white-space: nowrap; }

/* ─── Badges ───────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  background: #e5e7eb;
  color: #4b5563;
}
.badge.activa  { background: #d1fae5; color: #065f46; }
.badge.suspendida { background: #fef3c7; color: #92400e; }
.badge.caducada, .badge.revocada { background: #fee2e2; color: #991b1b; }
.badge.pagada  { background: #d1fae5; color: #065f46; }
.badge.pendiente { background: #fef3c7; color: #92400e; }
.badge.vencida { background: #fee2e2; color: #991b1b; }
.badge.mayor   { background: #dbeafe; color: #1e3a8a; }
.badge.menor   { background: #e0e7ff; color: #3730a3; }
.badge.parche  { background: #f3e8ff; color: #6b21a8; }
.badge.seguridad { background: #fecaca; color: #991b1b; }
.badge.critica { background: #ef4444; color: #fff; }

/* ─── Botones ──────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  background: #fff;
  color: #1f2937;
  transition: all .15s;
}
.btn:hover { background: #f9fafb; }
.btn-primario {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}
.btn-primario:hover { background: #6d28d9; }
.btn-peligro {
  background: #fff;
  color: #dc2626;
  border-color: #fecaca;
}
.btn-peligro:hover { background: #fee2e2; }
.btn-sec {
  border-color: #e5e7eb;
}
.btn-mini { padding: 4px 10px; font-size: 12px; }

/* ─── Formularios ──────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 20px;
}
.form-grid.full > * { grid-column: 1 / -1; }
.campo { display: flex; flex-direction: column; gap: 5px; }
.campo.full { grid-column: 1 / -1; }
.campo label {
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
}
.campo input, .campo select, .campo textarea {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px 11px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
  color: #1f2937;
}
.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}
.campo textarea { min-height: 76px; resize: vertical; }

.form-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ─── Mensajes flash ───────────────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 13px;
}
.flash.ok    { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.flash.err   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash.info  { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }

/* ─── Login ────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #7c3aed 100%);
}
.login-box {
  background: #fff;
  border-radius: 12px;
  padding: 38px 38px 30px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,.25);
}
.login-box .marca {
  text-align: center;
  margin-bottom: 26px;
}
.login-box .marca .logo-icon {
  width: 56px; height: 56px;
  background: #7c3aed;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  margin-bottom: 12px;
}
.login-box h1 { font-size: 20px; font-weight: 600; }
.login-box p { font-size: 13px; color: #6b7280; margin-top: 4px; }

/* ─── Misc ─────────────────────────────────────────────────────────── */
.barra-acciones {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
}
.barra-acciones .right { margin-left: auto; }
.empty {
  padding: 60px 20px;
  text-align: center;
  color: #6b7280;
}
.empty .ico { font-size: 40px; margin-bottom: 8px; opacity: .4; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
}

.upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  background: #fafbfc;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload-zone:hover, .upload-zone.over {
  border-color: #7c3aed;
  background: #faf5ff;
}
.upload-zone .ico { font-size: 36px; margin-bottom: 8px; opacity: .5; }
