/* ============================================================
   Anenso Consultores · sistema visual
   Identidad de marca: vino/burdeos #660032 + malva, sobre fondo cálido.
   Tipografías propias: "Carbon Block" (logotipo) y "Square721 BdEx BT".
   (Se conservan los nombres de variable --navy/--teal por compatibilidad;
    sus VALORES son ahora los de la gama vino de Anenso.)
   ============================================================ */
@font-face {
  font-family: "Carbon Block";
  src: url("../fonts/CarbonBlock.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Square721 BdEx BT";
  src: url("../fonts/Square721BdEx.ttf") format("truetype");
  font-weight: 700; font-style: normal; font-display: swap;
}
:root {
  /* Base clara/neutra (el blanco manda; el vino es solo un acento) */
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --text: #232B33;
  --muted: #6B7682;
  --hair: #E5E9EE;

  /* Marca: vino/burdeos como ACENTO */
  --vino: #660032; --vino-strong: #4D0026; --vino-soft: #F7E9EF;

  /* Titulares en gris pizarra neutro (NO vino) */
  --navy: #283441;

  /* Nombres heredados -> ahora vino, para acciones/enlaces/foco */
  --teal: #660032; --teal-strong: #4D0026; --teal-soft: #F7E9EF;
  --malva: #9C5A7C;

  /* Colores de estado / acentos (variedad, no solo rosa) */
  --amber: #B5722A; --amber-soft: #FBF1E3;
  --verde: #1F8A5B; --verde-soft: #E7F4EE;
  --azul:  #2E6FB0; --azul-soft:  #E9F1FA;
  --violeta: #6B4FA8; --violeta-soft: #EEEAF8;
  --rojo: #B42318; --rojo-soft: #FCEBEA;

  /* Lateral/appbar ahora claros (vars heredadas por compatibilidad) */
  --ink: #FFFFFF; --ink-2: #F2F4F7;

  --ring: rgba(102,0,50,.30);
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --sh-1: 0 1px 2px rgba(20,30,45,.06), 0 1px 3px rgba(20,30,45,.05);
  --sh-2: 0 6px 16px rgba(20,30,45,.08), 0 12px 30px rgba(20,30,45,.07);
  --sidebar-w: 244px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text); background: var(--bg);
  line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 4px; }

.ico {
  width: 1.25em; height: 1.25em; display: inline-block; vertical-align: middle; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface); color: var(--text); display: flex; flex-direction: column;
  padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; padding: 4px 6px 18px; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 100%; max-width: 168px; height: auto; display: block; }
.brand-logo-sm { height: 28px; width: auto; display: block; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group {
  margin: 16px 10px 5px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); font-weight: 700;
}
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-sm);
  color: #51606E; font-size: 14px; transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: var(--ink-2); color: var(--text); text-decoration: none; }
.nav-link .ico { width: 19px; height: 19px; opacity: .8; }
.nav-link.is-active {
  background: var(--vino-soft); color: var(--vino-strong); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--vino);
}
.nav-link.is-active .ico { opacity: 1; color: var(--vino); }

.sidebar-foot {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--hair);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; padding-left: 6px; }
.who-name { font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-rol { font-size: 11px; color: var(--vino); font-weight: 600; }
.logout {
  flex: none; background: var(--ink-2); color: var(--muted); border: 1px solid var(--hair);
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.logout:hover { background: var(--vino-soft); color: var(--vino); }
.logout .ico { width: 18px; height: 18px; }

/* ---------- Barra superior (solo móvil) ---------- */
.appbar { display: none; }
.scrim { display: none; }

/* ---------- Contenido ---------- */
.main { min-width: 0; }
.content { max-width: 1080px; margin: 0 auto; padding: 34px 30px 64px; }
/* Columna para páginas de formulario+listado: alinea el form y la tabla al mismo ancho */
.col { max-width: 880px; }
.col .form-subida { max-width: none; }

.page-head { margin-bottom: 22px; }
.page-head h1 {
  color: var(--navy); font-size: 26px; line-height: 1.2; margin: 0 0 5px;
  font-weight: 650; letter-spacing: -.012em;
}
.lead { color: var(--muted); margin: 0; max-width: 72ch; }
.group-title {
  color: var(--teal-strong); font-size: 12px; text-transform: uppercase; letter-spacing: .1em;
  font-weight: 700; margin: 28px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--hair);
}
.back {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; color: var(--muted);
  margin-bottom: 4px;
}
.back:hover { color: var(--teal-strong); }
.back .ico { width: 16px; height: 16px; }

/* ---------- Tarjetas ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 16px; }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh-1);
  color: inherit; transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.card:hover {
  transform: translateY(-3px); text-decoration: none; border-color: rgba(102,0,50,.28); box-shadow: var(--sh-2);
}
.card-ico {
  --chip: var(--vino); --chip-soft: var(--vino-soft);
  width: 46px; height: 46px; border-radius: 12px; background: var(--chip-soft); color: var(--chip);
  display: grid; place-items: center; margin-bottom: 13px; transition: background .14s ease, color .14s ease;
}
.card-ico .ico { width: 24px; height: 24px; }
.card:hover .card-ico { background: var(--chip); color: #fff; }
.card h3 { margin: 0 0 4px; color: var(--navy); font-size: 16px; font-weight: 600; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; }
/* Cada herramienta con su color (variedad, manteniendo la base blanca) */
.card-ico[data-k="alta_dia"]    { --chip: var(--vino);    --chip-soft: var(--vino-soft); }
.card-ico[data-k="afi"]         { --chip: var(--azul);    --chip-soft: var(--azul-soft); }
.card-ico[data-k="contrata"]    { --chip: var(--verde);   --chip-soft: var(--verde-soft); }
.card-ico[data-k="certificado"] { --chip: var(--amber);   --chip-soft: var(--amber-soft); }
.card-ico[data-k="nominas"]     { --chip: var(--violeta); --chip-soft: var(--violeta-soft); }
.card-ico[data-k="empresas"]    { --chip: var(--azul);    --chip-soft: var(--azul-soft); }
.card-ico[data-k="empleados"]   { --chip: var(--verde);   --chip-soft: var(--verde-soft); }

.badge {
  position: absolute; top: 16px; right: 16px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px; text-transform: uppercase;
}
.badge--ok   { background: var(--verde-soft); color: var(--verde); }
.badge--warn { background: var(--amber-soft); color: var(--amber); }
.badge--info { background: var(--azul-soft);  color: var(--azul); }

/* ---------- Paneles / notas ---------- */
.panel { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); padding: 20px; box-shadow: var(--sh-1); }
.panel.placeholder p { margin: 0; color: var(--muted); }
.nota-aviso {
  background: var(--amber-soft); border: 1px solid #E6D3B4; border-left: 3px solid var(--amber);
  color: #7A4A12; padding: 12px 15px; border-radius: var(--r-sm); margin-bottom: 18px; font-size: 13.5px;
}
.error-box { border-left: 3px solid var(--rojo); background: var(--rojo-soft); color: #7a1c12; margin-top: 16px; }

/* ---------- Formularios ---------- */
.form-subida { display: flex; align-items: flex-end; gap: 14px 18px; flex-wrap: wrap; max-width: 760px; }
.form-subida .field { margin: 0; flex: 1 1 240px; }
.form-subida .field:has(.filedrop) { flex-basis: 100%; }   /* el archivo siempre a ancho completo */
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12.5px; color: var(--navy); font-weight: 600; margin-bottom: 6px; }
.field input, input[type="text"], input[type="password"], input[type="file"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--hair); border-radius: 10px;
  font: inherit; font-size: 14.5px; background: #fff; color: var(--text); transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--ring); }
input[type="file"] { padding: 9px 10px; }

/* Formulario vertical estrecho (cambio de contraseña y similares): campos apilados,
   sin estirarse en pantallas grandes. */
.form-vert { display: block; max-width: 460px; }
.form-vert .field { margin-bottom: 14px; }
/* Checkboxes/radios no deben estirarse al 100% como los inputs de texto. */
.field input[type="checkbox"], .field input[type="radio"] { width: auto; }
.check-inline { flex-direction: row; align-items: center; gap: .5rem; }
.form-subida .check-inline { flex-basis: 100%; }
.field small ul { margin: 6px 0 0; padding-left: 18px; }
.field small li { margin: 2px 0; }

/* Subida de archivo (zona con estilo + arrastrar y soltar) */
.filedrop {
  position: relative; display: flex; align-items: center; gap: 12px;
  border: 1.5px dashed #C7D3DE; border-radius: 11px; padding: 13px 15px; background: #fff;
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.filedrop:hover, .filedrop.drag { border-color: var(--teal); background: var(--teal-soft); }
.filedrop input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; margin: 0;
  border: 0; opacity: 0; cursor: pointer;
}
.filedrop-ico {
  width: 38px; height: 38px; flex: none; border-radius: 10px; padding: 8px;
  background: var(--teal-soft); color: var(--teal-strong);
}
.filedrop:hover .filedrop-ico, .filedrop.drag .filedrop-ico { background: #fff; }
.filedrop-main { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1 1 auto; }
.filedrop-cta { font-weight: 600; color: var(--teal-strong); font-size: 14px; }
.filedrop-hint { font-size: 11.5px; color: var(--muted); }
.filedrop-name {
  margin-left: auto; padding-left: 14px; font-size: 13px; color: var(--muted); font-weight: 500;
  flex: 0 1 auto; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right;
}
.filedrop.has-file { border-style: solid; border-color: #BFE0DA; background: var(--teal-soft); }
.filedrop.has-file .filedrop-cta, .filedrop.has-file .filedrop-name { color: var(--navy); font-weight: 600; }

.btn, .btn-inline {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center; background: var(--teal);
  color: #fff; border: 0; border-radius: 10px; padding: 11px 18px; font: inherit; font-size: 14.5px;
  font-weight: 600; cursor: pointer; box-shadow: 0 2px 6px rgba(102,0,50,.30); transition: background .15s ease, transform .1s ease;
}
.btn { width: 100%; }
.btn:hover, .btn-inline:hover { background: var(--teal-strong); text-decoration: none; }
.btn:active, .btn-inline:active { transform: translateY(1px); }
.btn-inline .ico { width: 17px; height: 17px; }

/* Botón secundario (acción "Validar") y fila de acciones */
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center; background: #fff;
  color: var(--teal-strong); border: 1px solid #BFE0DA; border-radius: 10px; padding: 10px 18px;
  font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; transition: background .15s ease, border-color .15s ease;
}
.btn-ghost:hover { background: var(--teal-soft); border-color: var(--teal); text-decoration: none; }
.btn-ghost .ico { width: 17px; height: 17px; }
.form-acciones { display: flex; gap: 10px; flex-wrap: wrap; }
.form-hint { font-size: 13px; margin: 10px 0 0; }
@media (max-width: 560px) { .form-acciones .btn-ghost, .form-acciones .btn-inline { width: 100%; } }

/* ---------- Resultado / hallazgos ---------- */
.resultado { margin-top: 24px; }
.res-title { color: var(--navy); font-size: 19px; margin: 0 0 12px; }
.ok-line { color: var(--teal-strong); font-weight: 600; }
.warn { color: var(--amber); font-weight: 600; }
.muted { color: var(--muted); }
.hallazgos h3 { color: var(--navy); font-size: 15px; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.cuenta { display: inline-block; min-width: 22px; text-align: center; border-radius: 999px; font-size: 12px; padding: 1px 8px; color: #fff; }
.cuenta.err { background: var(--rojo); }
.cuenta.avi { background: var(--amber); }
.lista-err, .lista-avi { list-style: none; padding: 0; margin: 0; }
.lista-err li, .lista-avi li { padding: 9px 12px; border-radius: 8px; margin-bottom: 6px; font-size: 14px; border-left: 3px solid transparent; }
.lista-err li { background: var(--rojo-soft); border-left-color: var(--rojo); }
.lista-avi li { background: var(--amber-soft); border-left-color: var(--amber); }
.loc { display: inline-block; font-weight: 600; color: var(--navy); margin-right: 6px; }

/* ---------- Tablas ---------- */
.tabla-wrap { overflow-x: auto; margin-top: 10px; border-radius: var(--r); }
.tabla { width: 100%; min-width: 560px; border-collapse: collapse; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r); overflow: hidden; font-size: 14px; box-shadow: var(--sh-1); }
.tabla-wrap .tabla { margin-top: 0; }
.tabla th { background: #F0F4F8; color: var(--navy); text-align: left; padding: 11px 14px; font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--hair); }
.tabla td { padding: 11px 14px; border-top: 1px solid var(--hair); }
.tabla tbody tr:hover { background: #F8FAFC; }
.tabla td .btn-sm { margin: -3px 0; }

/* ---------- Botón pequeño (acciones de tabla) ---------- */
.btn-sm {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid #BFE0DA; background: #fff; color: var(--teal-strong); font-size: 13px;
  font-weight: 600; cursor: pointer; transition: background .14s ease, border-color .14s ease;
}
.btn-sm:hover { background: var(--teal-soft); border-color: var(--teal); text-decoration: none; }
.btn-sm .ico { width: 15px; height: 15px; }

/* ---------- Estado vacío ---------- */
.vacio {
  text-align: center; padding: 44px 24px; color: var(--muted);
  border: 1px dashed var(--hair); border-radius: var(--r); background: var(--surface);
}
.vacio .ico { width: 40px; height: 40px; color: #B7C4D2; margin-bottom: 10px; stroke-width: 1.5; }
.vacio p { margin: 0; font-size: 14px; }

/* ---------- Spinner en botones al enviar ---------- */
.btn.is-loading, .btn-inline.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.is-loading::after, .btn-inline.is-loading::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Animación de entrada ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.content > * { animation: fadeUp .34s ease both; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.cards .card { animation: fadeUp .4s ease both; }
.cards .card:nth-child(2) { animation-delay: .05s; }
.cards .card:nth-child(3) { animation-delay: .10s; }
.cards .card:nth-child(4) { animation-delay: .15s; }
.cards .card:nth-child(5) { animation-delay: .20s; }
.cards .card:nth-child(6) { animation-delay: .25s; }
.cards .card:nth-child(7) { animation-delay: .30s; }

/* ---------- Detalle: selección y scrollbar ---------- */
::selection { background: rgba(102,0,50,.18); }
* { scrollbar-width: thin; scrollbar-color: #C3D0DD transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #C3D0DD; border-radius: 6px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #A7B7C6; }

/* ---------- Mensajes flash ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 20px; }
.msg { padding: 11px 15px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; border: 1px solid transparent; }
.msg.success { background: var(--teal-soft); color: var(--teal-strong); border-color: #BFE0DA; }
.msg.error { background: var(--rojo-soft); color: var(--rojo); border-color: #F0C9C6; }

/* ---------- Login (independiente) ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(760px 460px at 85% -8%, var(--vino-soft) 0%, transparent 60%), linear-gradient(160deg, #FAFBFC 0%, #ECEFF3 100%); }
.auth-card { width: 100%; max-width: 396px; background: var(--surface); border-radius: 18px; padding: 36px 34px; box-shadow: 0 18px 50px rgba(20,30,45,.16); border: 1px solid var(--hair); }
.auth-brand { display: flex; justify-content: center; margin-bottom: 24px; }
.auth-logo { width: 100%; max-width: 234px; height: auto; display: block; }
.auth-card h1 { margin: 0 0 3px; color: var(--navy); font-size: 22px; }
.auth-sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.auth-error { background: var(--rojo-soft); color: var(--rojo); padding: 10px 13px; border-radius: 9px; font-size: 13.5px; margin-bottom: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .shell { display: block; }
  .appbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30;
    background: var(--surface); color: var(--text); padding: 10px 16px; border-bottom: 1px solid var(--hair);
  }
  .appbar-brand { display: flex; align-items: center; gap: 9px; }
  .burger { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 9px; cursor: pointer; color: var(--text); background: var(--ink-2); }
  .burger .ico { width: 22px; height: 22px; }
  .sidebar {
    position: fixed; top: 0; left: 0; width: 270px; height: 100vh; z-index: 50;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(0,0,0,.4);
  }
  .nav-toggle:checked ~ .shell .sidebar { transform: translateX(0); }
  .nav-toggle:checked ~ .shell .scrim { display: block; position: fixed; inset: 0; background: rgba(10,18,30,.5); z-index: 40; }
  .content { padding: 22px 18px 56px; }
  .page-head h1 { font-size: 22px; }
  .form-subida { gap: 12px; }
  .form-subida .field { flex-basis: 100%; }
  .btn-inline { width: 100%; }
}

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