/* ============================================================
   Nivelex — Consulta de Personal
   Front basado en el diseño "RRHH Nivelex" (Claude Design)
   Mobile-first · fuente Archivo · acento #C8102E
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --red: #C8102E;
  --red-ink: #a50d26;
  --ink: #111111;
  --muted: #9a9a96;
  --muted2: #a0a09c;
  --faint: #bdbdb8;
  --line: #ececea;
  --line2: #f1f0ed;
  --line3: #e2e1dd;
  --avatar: #f3f2ef;
  --canvas: #cbc9c3;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--canvas); color: var(--ink); line-height: 1.4; }
input, button, select, textarea { font-family: inherit; }
.nx-num { font-variant-numeric: tabular-nums; }
@keyframes nx-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- Shell tipo dispositivo ---------------- */
.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  background: #fff;
  overflow: hidden;
}
.app-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--safe-top);
}
.app-scroll::-webkit-scrollbar { width: 0; height: 0; }

/* Sin marco de teléfono: la app ocupa toda la pantalla en cualquier tamaño. */

.screen { animation: nx-fade .28s ease; }
.hidden { display: none !important; }

/* ---------------- Cabecera del home ---------------- */
.home-head { padding: 20px 22px 0; display: flex; justify-content: space-between; align-items: flex-start; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted2); }
.h1 { font-size: 30px; font-weight: 800; letter-spacing: -1.2px; color: var(--ink); margin-top: 4px; line-height: 1; }
.nx-badge {
  width: 34px; height: 34px; background: var(--red); color: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; letter-spacing: -.5px;
}
.nx-badge.lg { width: 46px; height: 46px; font-size: 17px; }

/* ---------------- KPIs ---------------- */
.kpis { display: flex; gap: 8px; padding: 22px 22px 20px; }
.kpi {
  flex: 1; background: none; border: none; padding: 0; text-align: left; cursor: pointer; min-width: 0;
}
.kpi-value { font-size: 33px; font-weight: 800; letter-spacing: -1.8px; line-height: 1; }
.kpi-value.ink { color: var(--ink); }
.kpi-value.red { color: var(--red); }
.kpi-label { font-size: 9.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted2); margin-top: 7px; line-height: 1.2; }
.kpi-line { height: 2px; width: 18px; background: var(--red); opacity: 0; margin-top: 8px; transition: opacity .15s; }
.kpi[aria-pressed="true"] .kpi-line { opacity: 1; }

/* ---------------- Tira de stats ---------------- */
.strip {
  padding: 14px 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 10px;
}
.strip .s { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.strip .s-v { font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -.4px; line-height: 1; }
.strip .s-l { font-size: 9px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted2); white-space: nowrap; }

/* ---------------- Búsqueda + tabs estado ---------------- */
.search-wrap { padding: 18px 22px 0; position: sticky; top: 0; background: #fff; z-index: 6; }
.line-input {
  width: 100%; height: 46px; border: none; border-bottom: 1.5px solid #ddd;
  font-size: 16px; color: var(--ink); outline: none; background: none;
}
.line-input:focus { border-bottom-color: var(--red); }
.estado-tabs { display: flex; margin-top: 4px; }
.estado-tab {
  padding: 9px 0; margin-right: 18px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted2); font-size: 13px; font-weight: 700; cursor: pointer; letter-spacing: .2px;
}
.estado-tab.active { border-bottom-color: var(--red); color: var(--ink); }

.kpi-filterbar { padding: 10px 22px 0; display: none; align-items: center; justify-content: space-between; }
.kpi-filterbar.show { display: flex; }
.kpi-filterbar .lbl { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--red); }
.kpi-filterbar .clear { background: none; border: none; color: var(--muted2); font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; cursor: pointer; }

/* ---------------- Lista ---------------- */
.list-wrap { padding: 14px 22px 16px; }
.list-count { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
.row {
  width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 15px 0; cursor: pointer; display: flex; gap: 14px; align-items: center;
}
.row.dim { opacity: .5; }
.avatar {
  width: 42px; height: 42px; background: var(--avatar); color: var(--ink); flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; letter-spacing: -.3px;
}
.avatar.lg { width: 56px; height: 56px; font-size: 19px; letter-spacing: -.5px; }
.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.row-name { font-size: 15.5px; font-weight: 700; color: var(--ink); letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-id { font-size: 11px; font-weight: 600; color: var(--faint); flex: none; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-tags { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
.tag .d { width: 5px; height: 5px; border-radius: 50%; }
.row-chev { color: #d5d5d0; font-size: 16px; flex: none; }

.empty { text-align: center; padding: 50px 20px; color: var(--faint); font-size: 13px; }

/* ---------------- Detalle ---------------- */
.detail-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px 10px; position: sticky; top: 0; background: #fff; z-index: 5;
}
.tbtn { background: none; border: none; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; cursor: pointer; padding: 0; }
.tbtn.ink { color: var(--ink); }
.tbtn.red { color: var(--red); }
.detail-body { padding: 8px 22px 20px; }
.detail-id { display: flex; gap: 15px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.detail-name { font-size: 22px; font-weight: 800; color: var(--ink); letter-spacing: -.6px; line-height: 1.05; }
.detail-cargo { font-size: 13px; color: var(--muted); margin-top: 3px; }

.alerts { margin-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.alert {
  background: var(--red); color: #fff; padding: 15px 18px;
}
.alert-title { font-size: 14px; font-weight: 800; letter-spacing: -.2px; text-transform: uppercase; }
.alert-sub { font-size: 12px; color: rgba(255,255,255,.86); margin-top: 4px; line-height: 1.35; }

.section { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.section:first-of-type, .section.tight { margin-top: 22px; padding-top: 0; border-top: none; }
.section-label { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); }
.section-label.red { color: var(--red); }

.kv { display: flex; justify-content: space-between; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line2); gap: 14px; }
.kv .k { font-size: 12px; color: var(--muted2); font-weight: 600; flex: none; }
.kv .v { font-size: 13.5px; color: var(--ink); font-weight: 600; text-align: right; }

.salary-row { display: flex; gap: 30px; margin-top: 12px; }
.salary-big { font-size: 30px; font-weight: 800; letter-spacing: -1.2px; line-height: 1; }
.salary-big.ink { color: var(--ink); }
.salary-big.faint { color: var(--faint); }
.salary-cap { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted2); margin-top: 7px; }
.salary-note { font-size: 11.5px; color: var(--muted2); margin-top: 12px; }

.obra-line { font-size: 14px; font-weight: 600; color: var(--ink); padding: 9px 0; border-bottom: 1px solid var(--line2); }

.rec { margin-top: 12px; padding-left: 14px; border-left: 2px solid var(--red); }
.rec-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; color: var(--ink); gap: 10px; }
.rec-top .n { color: var(--red); }
.rec-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.rec-sub b { color: var(--red); }
.sanc { margin-top: 11px; padding-bottom: 11px; border-bottom: 1px solid var(--line2); }
.sanc-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; color: var(--ink); gap: 10px; }
.sanc-top .n { color: var(--muted2); font-weight: 600; }
.sanc-motivo { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------------- Laudos ---------------- */
.pad-head { padding: 20px 22px 8px; }
.pad-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.laudos-body { padding: 18px 22px 16px; }
.laudos-thead { display: flex; padding-bottom: 9px; border-bottom: 1px solid var(--ink); }
.laudos-thead > div { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted2); }
.laudos-row { display: flex; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line2); }
.lc-cat { flex: 1.4; min-width: 0; }
.lc-cat .name { font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -.2px; }
.lc-cat .bruto { font-size: 11px; color: var(--muted2); margin-top: 2px; }
.lc-hora { flex: 1; text-align: right; font-size: 13.5px; font-weight: 600; color: #6b6b67; }
.lc-liq { flex: 1.2; text-align: right; font-size: 15px; font-weight: 800; color: var(--ink); letter-spacing: -.3px; }
.laudos-foot { font-size: 11px; color: var(--faint); text-align: center; margin-top: 16px; line-height: 1.4; }

/* ---------------- Formulario (alta/edición) ---------------- */
.form-body { padding: 14px 22px 16px; }
.form-sec { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); margin: 24px 0 8px; }
.form-sec:first-child { margin-top: 6px; }
.fld {
  width: 100%; height: 50px; border: none; border-bottom: 1.5px solid var(--line3);
  font-size: 16px; color: var(--ink); outline: none; background: none;
}
.fld:focus { border-bottom-color: var(--red); }
.fld-row { display: flex; gap: 16px; }
.fld-row .fld { flex: 1; min-width: 0; }
.fld-row .fld.sm { width: 110px; flex: none; }
.fld-err { color: var(--red); font-size: 12px; margin-top: 4px; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-cat {
  border: 1px solid #ddd; background: #fff; color: #6b6b67;
  padding: 9px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; letter-spacing: .2px;
}
.chip-cat.active { border-color: var(--ink); background: var(--ink); color: #fff; }
.sueldo-est { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.sueldo-est .cap { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted2); }
.sueldo-est .cap2 { font-size: 11px; color: var(--faint); margin-top: 2px; }
.sueldo-est .big { font-size: 24px; font-weight: 800; color: var(--ink); letter-spacing: -.8px; line-height: 1; }
.sueldo-est .sm { font-size: 11px; color: var(--muted2); margin-top: 4px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle-row .t { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.toggle-row .s { font-size: 12px; color: var(--muted2); margin-top: 2px; }
.switch { width: 46px; height: 27px; border-radius: 999px; background: var(--line3); position: relative; flex: none; transition: background .15s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--red); }
.switch.on .knob { left: 22px; }
.btn-fill {
  width: 100%; height: 54px; border: none; background: var(--red); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; cursor: pointer; margin-top: 28px;
}
.btn-fill:active { background: var(--red-ink); }
.btn-text {
  width: 100%; height: 48px; border: none; background: none; color: var(--red);
  font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; margin-top: 6px;
}

/* ---------------- Nav inferior ---------------- */
.bottom-nav {
  flex: none; height: calc(66px + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: #fff; border-top: 1px solid var(--line); display: flex; z-index: 30;
}
.nav-btn {
  flex: 1; background: none; border: none; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; padding: 0; position: relative; text-decoration: none;
}
.nav-bar { height: 2px; width: 30px; background: var(--red); opacity: 0; position: absolute; top: 0; }
.nav-btn.active .nav-bar { opacity: 1; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted2); margin-top: 24px; }
.nav-btn.active .nav-label { color: var(--ink); }

/* ---------------- Login ---------------- */
.login-screen { position: absolute; inset: 0; background: #fff; display: flex; flex-direction: column; padding: 84px 32px calc(40px + var(--safe-bottom)); }
.login-top { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.login-title { font-size: 36px; font-weight: 800; letter-spacing: -1.4px; line-height: 1; color: var(--ink); margin-top: 12px; }
.login-desc { font-size: 14px; color: #8a8a86; margin-top: 16px; max-width: 250px; line-height: 1.45; }
.login-error { background: #fdecec; color: var(--red); padding: 11px 14px; font-size: 13px; margin-bottom: 16px; }
.login-field { width: 100%; height: 54px; border: none; border-bottom: 1.5px solid #ddd; font-size: 16px; color: var(--ink); outline: none; background: none; }
.login-field + .login-field { margin-top: 8px; }

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