:root {
  --rojo: #C8102E;         /* rojo institucional UniCCo */
  --rojo-oscuro: #97101f;  /* hover / degradados */
  --rojo-claro: #E23744;   /* enlaces / foco */
  --acento: #334155;       /* slate para segundo tono de la marca */
  --gris: #64748b;
  --gris-claro: #94a3b8;
  --fondo: #f5f3f4;
  --tinta: #1a1416;
  --borde: #e7e2e3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fondo);
  color: var(--tinta);
  line-height: 1.5;
}

a { color: var(--rojo-claro); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Barra de navegación ---------- */
.nav {
  background: #fff;
  border-bottom: 1px solid var(--borde);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.nav-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 88px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.marca {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--rojo);
  letter-spacing: -0.02em;
}
.marca:hover { text-decoration: none; }
.marca span { color: var(--acento); }
.menu { display: flex; gap: 0.25rem; flex: 1; }
.menu a {
  color: var(--gris);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
}
.menu a:hover { background: var(--fondo); color: var(--rojo); text-decoration: none; }
.usuario-box { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; }
.usuario-box a { color: var(--tinta); font-weight: 600; }

.rol-chip {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.rol-sistemas { background: #ede9fe; color: #6d28d9; }
.rol-administrador { background: #dbeafe; color: #1d4ed8; }
.rol-operador { background: #d1fae5; color: #047857; }

/* ---------- Contenedor y tarjetas ---------- */
.contenedor { max-width: 1040px; margin: 0 auto; padding: 2rem 1rem; }
h1 { color: var(--rojo); margin-bottom: 0.25rem; letter-spacing: -0.02em; }
h2 { color: var(--rojo); }
.sub { color: var(--gris); margin-top: 0; }

.tarjeta {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.tarjeta h2 { margin-top: 0; }

/* ---------- Botones y formularios ---------- */
button, .btn {
  background: var(--rojo);
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
button:hover, .btn:hover { background: var(--rojo-oscuro); }
button:disabled { background: var(--gris-claro); cursor: not-allowed; }
.btn-sec {
  background: transparent;
  color: var(--gris);
  border: 1px solid var(--borde);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}
.btn-sec:hover { background: var(--fondo); color: var(--tinta); }

input, select, textarea {
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--rojo-claro); border-color: var(--rojo-claro); }
label { font-weight: 600; font-size: 0.9rem; }
.campo { margin: 0.75rem 0; }
.campo input, .campo select, .campo textarea { width: 100%; max-width: 460px; display: block; margin-top: 0.25rem; }

code {
  background: var(--borde);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.88em;
}

/* ---------- Mensajes ---------- */
.msg-error { color: #b91c1c; margin: 0; }
.aviso-box {
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  font-size: 0.92rem;
}
.aviso-ok { background: #dcfce7; color: #166534; }
.aviso-mal { background: #fee2e2; color: #991b1b; }
.aviso-warn { background: #fef9c3; color: #854d0e; }

/* ---------- Pills / resumen ---------- */
.resumen { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.pill { background: var(--borde); border-radius: 999px; padding: 0.25rem 0.75rem; font-size: 0.9rem; }
.pill-ok { background: #dcfce7; color: #166534; }
.pill-warn { background: #fef9c3; color: #854d0e; }
.pill-bad { background: #fee2e2; color: #991b1b; }

/* ---------- Tablas ---------- */
.tabla-scroll { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tabla th, .tabla td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
.tabla th { color: var(--gris); font-weight: 600; }
.est-error { background: #fef2f2; }
.est-advertencia { background: #fefce8; }

.badge { display: inline-block; border-radius: 6px; padding: 0.1rem 0.5rem; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef9c3; color: #854d0e; }
.badge-bad { background: #fee2e2; color: #991b1b; }

.avisos { margin: 0; padding-left: 1rem; }
.aviso-error { color: #b91c1c; }
.aviso-advertencia { color: #854d0e; }

/* ---------- Dashboard ---------- */
.acciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.accion {
  display: block;
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.accion:hover { border-color: var(--rojo-claro); text-decoration: none; box-shadow: 0 4px 12px rgba(200, 16, 46, 0.12); }
.accion h3 { margin: 0 0 0.25rem; color: var(--rojo); }
.accion p { margin: 0; color: var(--gris); font-size: 0.9rem; }

/* ---------- Login ---------- */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #C8102E 0%, #6b0b15 100%);
  padding: 1rem;
}
.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 2.25rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}
.login-card .marca { font-size: 1.6rem; display: block; margin-bottom: 0.25rem; }
.login-card .sub { margin-bottom: 1.5rem; }
.login-card .campo input { max-width: none; }
.login-card button { width: 100%; margin-top: 1rem; padding: 0.65rem; }

/* Logo de marca (imagen) */
.marca img { height: 74px; width: auto; display: block; }
.login-card .marca img { height: 120px; width: auto; max-width: 100%; margin: 0 auto 0.5rem; }

/* Barra de progreso (envío en segundo plano) */
.barra-progreso { background: var(--borde); border-radius: 999px; height: 16px; overflow: hidden; margin: 0.75rem 0 0.25rem; }
.barra-progreso > div { height: 100%; background: var(--rojo); border-radius: 999px; transition: width 0.4s ease; min-width: 2px; }
.progreso-num { color: var(--gris); margin: 0.25rem 0 0.85rem; }
.girando { display: inline-block; animation: girar 1.2s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
