/* ============================================================
   SISTEMA NÓMINA SEN — TEMA CLARO
   Paleta: Blanco / Gris azulado · Azul corporativo · Acentos color
   Tipografía: IBM Plex Mono + IBM Plex Sans
   ============================================================ */

:root {
  --bg-base:      #f0f2f5;
  --bg-surface:   #ffffff;
  --bg-card:      #ffffff;
  --bg-input:     #ffffff;
  --bg-row-alt:   #f7f8fa;

  --border:       #dde1e7;
  --border-focus: #1a6cdb;
  --border-light: #eaecef;

  --accent:       #1a6cdb;
  --accent-dim:   rgba(26,108,219,0.08);
  --accent-hover: #1458b8;

  --green:        #0f7b3e;
  --green-bg:     #e8f5ee;
  --green-dim:    rgba(15,123,62,0.10);
  --red:          #c0392b;
  --red-bg:       #fdf0ee;
  --red-dim:      rgba(192,57,43,0.10);
  --blue:         #1a6cdb;
  --blue-bg:      #eaf1fb;
  --blue-dim:     rgba(26,108,219,0.10);
  --purple:       #7c3aed;
  --purple-bg:    #f3eeff;
  --orange:       #b45309;
  --orange-bg:    #fef3e2;
  --orange-dim:   rgba(180,83,9,0.10);
  --muted:        #6b7280;
  --muted-light:  #9ca3af;

  --text-primary:   #111827;
  --text-secondary: #374151;
  --text-muted:     #6b7280;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);

  --font-mono: 'DM Mono', 'Fira Code', 'Courier New', monospace;
  --font-sans: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --nav-w: 224px;
}

/* ─── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── LAYOUT ─────────────────────────────────────────────── */
.app-shell    { display: flex; min-height: 100vh; }
.main-content { margin-left: var(--nav-w); flex: 1; padding: 32px 36px; min-width: 0; }

/* ─── NAVBAR ─────────────────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0;
  width: var(--nav-w); height: 100vh;
  background: #1e293b;
  display: flex; flex-direction: column;
  padding: 0; z-index: 100; overflow-y: auto;
  box-shadow: 2px 0 12px rgba(0,0,0,.15);
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 8px;
}
.nav-logo { font-size: 26px; color: #60a5fa; font-family: var(--font-mono); font-weight: 700; line-height: 1; }
.nav-title { font-family: var(--font-sans); font-weight: 800; font-size: 14px; color: #f1f5f9; letter-spacing: -.2px; }
.nav-ver { font-family: var(--font-mono); font-size: 9px; margin-left: auto; background: rgba(96,165,250,.15); color: #60a5fa; padding: 2px 6px; border-radius: 4px; }
.nav-links { list-style: none; flex: 1; padding: 4px 10px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: #94a3b8; font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  transition: all .15s; margin-bottom: 2px; letter-spacing: -.1px;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #f1f5f9; text-decoration: none; }
.nav-link.active { background: rgba(96,165,250,.15); color: #60a5fa; font-weight: 600; }
.nav-icon { font-size: 15px; width: 20px; text-align: center; }
.nav-user { padding: 14px 12px; border-top: 1px solid rgba(255,255,255,.08); margin-top: auto; }
.user-chip { display: flex; flex-direction: column; font-size: 12px; font-family: var(--font-mono); color: #f1f5f9; font-weight: 600; margin-bottom: 8px; }
.user-role { font-size: 10px; color: #60a5fa; letter-spacing: 1px; font-weight: 400; }
.btn-logout {
  display: block; text-align: center; padding: 7px 14px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-sm); color: #94a3b8; font-size: 12px; font-family: var(--font-mono); transition: all .15s;
}
.btn-logout:hover { background: rgba(192,57,43,.2); border-color: rgba(192,57,43,.5); color: #fca5a5; text-decoration: none; }

/* ─── PAGE HEADER ────────────────────────────────────────── */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; padding-bottom: 18px;
  border-bottom: 2px solid var(--border-light);
}
.page-title { font-family: var(--font-sans); font-weight: 800; font-size: 22px; color: var(--text-primary); display: flex; align-items: center; gap: 10px; letter-spacing: -.4px; }
.page-title .icon { font-size: 22px; }
.page-subtitle { color: var(--muted); font-size: 12px; margin-top: 3px; }

/* ─── CARDS ──────────────────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 20px; overflow: hidden; box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border-light); background: #f8f9fb; }
.card-header h2 { font-family: var(--font-sans); font-size: 13px; font-weight: 700; color: var(--text-primary); margin: 0; letter-spacing: -.1px; }
.card-body { padding: 20px; }
.card-accent { border-top: 3px solid var(--accent); }
.card-green  { border-top: 3px solid var(--green); }
.card-red    { border-top: 3px solid var(--red); }

/* ─── STAT CARDS ─────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; transition: transform .15s, box-shadow .15s; box-shadow: var(--shadow-sm); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-label { font-family: var(--font-sans); font-size: 10px; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; font-weight: 600; letter-spacing: .6px; }
.stat-value { font-family: var(--font-mono); font-size: 20px; font-weight: 700; color: var(--text-primary); }
.stat-card.green  { border-left: 4px solid var(--green); }
.stat-card.green  .stat-value { color: var(--green); }
.stat-card.red    { border-left: 4px solid var(--red); }
.stat-card.red    .stat-value { color: var(--red); }
.stat-card.amber  { border-left: 4px solid var(--accent); }
.stat-card.amber  .stat-value { color: var(--accent); }
.stat-card.blue   { border-left: 4px solid var(--blue); }
.stat-card.blue   .stat-value { color: var(--blue); }

/* ─── TABLES ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12px; }
thead tr { border-bottom: 2px solid var(--border); background: #f4f6f9; }
thead th { padding: 10px 14px; text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border-light); }
tbody tr:nth-child(even) { background: var(--bg-row-alt); }
tbody tr:hover { background: var(--blue-dim); }
tbody td { padding: 9px 14px; vertical-align: middle; white-space: nowrap; color: var(--text-secondary); }
tfoot td { padding: 10px 14px; font-weight: 700; border-top: 2px solid var(--border); background: #f4f6f9; color: var(--text-primary); }
.col-money  { text-align: right; }
.col-center { text-align: center; }
.text-green  { color: var(--green)  !important; }
.text-red    { color: var(--red)    !important; }
.text-amber  { color: var(--accent) !important; }
.text-blue   { color: var(--blue)   !important; }
.text-purple { color: var(--purple) !important; }
.text-muted  { color: var(--muted)  !important; }
.fw-700 { font-weight: 700; }

/* ─── FORMS ──────────────────────────────────────────────── */
.form-grid  { display: grid; grid-template-columns: repeat(auto-fill,minmax(210px,1fr)); gap: 14px; }
.form-grid-2 { grid-template-columns: repeat(2,1fr); }
.form-grid-3 { grid-template-columns: repeat(3,1fr); }
.form-grid-4 { grid-template-columns: repeat(4,1fr); }
.col-span-2  { grid-column: span 2; }
.col-span-3  { grid-column: span 3; }
.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-label  { font-family: var(--font-sans); font-size: 10px; color: var(--muted); text-transform: uppercase; font-weight: 700; letter-spacing: .5px; }
.form-control {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); padding: 8px 12px;
  font-family: var(--font-mono); font-size: 13px; transition: border-color .15s, box-shadow .15s; width: 100%;
}
.form-control:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-dim); }

/* Horas extras dobles — azul */
.form-control.he-doble { border-color: rgba(26,108,219,.4); background: var(--blue-bg); color: var(--blue); font-weight: 600; }
.form-control.he-doble:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); }
/* Horas extras triples — morado */
.form-control.he-triple { border-color: rgba(124,58,237,.3); background: var(--purple-bg); color: var(--purple); font-weight: 600; }
.form-control.he-triple:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,58,237,.12); }

.form-hint { font-size: 10px; color: var(--muted-light); font-family: var(--font-sans); }

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all .15s; white-space: nowrap;
  text-decoration: none; letter-spacing: -.1px;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); text-decoration: none; }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success   { background: var(--green-bg); color: var(--green); border: 1px solid rgba(15,123,62,.25); }
.btn-success:hover { background: rgba(15,123,62,.18); }
.btn-danger    { background: var(--red-bg); color: var(--red); border: 1px solid rgba(192,57,43,.25); }
.btn-danger:hover  { background: rgba(192,57,43,.18); }
.btn-secondary { background: #fff; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--muted); background: var(--bg-row-alt); }
.btn-blue      { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(26,108,219,.25); }
.btn-blue:hover { background: rgba(26,108,219,.18); }
.btn-sm { padding: 5px 12px; font-size: 11px; }
.btn-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ─── BADGES ─────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-family: var(--font-sans); font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.badge-active, .badge-green  { background: var(--green-bg); color: var(--green); border: 1px solid rgba(15,123,62,.2); }
.badge-inactive, .badge-red  { background: var(--red-bg); color: var(--red); border: 1px solid rgba(192,57,43,.2); }
.badge-amber  { background: var(--blue-bg); color: var(--accent); border: 1px solid rgba(26,108,219,.2); }
.badge-blue   { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(26,108,219,.2); }
.badge-purple { background: var(--purple-bg); color: var(--purple); border: 1px solid rgba(124,58,237,.2); }
.badge-closed { background: #f3f4f6; color: var(--muted); border: 1px solid var(--border); }

/* ─── ALERTS ─────────────────────────────────────────────── */
.alert { padding: 11px 16px; border-radius: var(--radius-sm); font-family: var(--font-sans); font-size: 13px; margin-bottom: 16px; }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(15,123,62,.25); }
.alert-error   { background: var(--red-bg);   color: var(--red);   border: 1px solid rgba(192,57,43,.25); }
.alert-info    { background: var(--blue-bg);  color: var(--blue);  border: 1px solid rgba(26,108,219,.25); }
.alert-warning { background: var(--orange-bg);color: var(--orange);border: 1px solid rgba(180,83,9,.25); }

/* ─── NÓMINA — BLOQUES POR EMPLEADO ─────────────────────── */
.emp-block { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.emp-block-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; background: #f8f9fb; border-bottom: 1px solid var(--border-light);
  cursor: pointer; user-select: none; transition: background .12s;
}
.emp-block-header:hover { background: var(--blue-dim); }
.emp-name { font-family: var(--font-sans); font-size: 13px; font-weight: 800; color: var(--text-primary); letter-spacing: -.1px; }
.emp-meta { font-size: 11px; color: var(--muted); font-family: var(--font-mono); margin-top: 2px; }
.emp-neto-preview { font-family: var(--font-mono); font-size: 17px; font-weight: 700; color: var(--accent); }
.emp-block-body { padding: 16px 18px; background: #fff; }
.emp-block-body.collapsed { display: none; }

.mini-result { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-light); }
.mini-item { background: #f4f6f9; border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 5px 10px; text-align: center; min-width: 90px; }
.mini-label { font-size: 9px; color: var(--muted); font-family: var(--font-sans); text-transform: uppercase; letter-spacing: .3px; }
.mini-val   { font-size: 12px; font-family: var(--font-mono); font-weight: 700; }

/* ─── RECIBOS ────────────────────────────────────────────── */
.recibo-card { background: #fff; color: #111827; border-radius: var(--radius-lg); padding: 28px 32px; margin-bottom: 28px; border: 1px solid #ddd; font-family: var(--font-mono); page-break-after: always; box-shadow: var(--shadow-sm); }
.recibo-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #1e293b; padding-bottom: 14px; margin-bottom: 14px; }
.recibo-empresa-name { font-size: 17px; font-weight: 700; color: #1e293b; }
.recibo-sub { font-size: 11px; color: #6b7280; }
.recibo-datos-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; padding: 10px 12px; background: #f4f6f9; border: 1px solid #e5e7eb; border-radius: 6px; margin-bottom: 14px; font-size: 11px; }
.recibo-dato-label { color: #6b7280; font-size: 10px; }
.recibo-dato-val   { font-weight: 700; color: #111827; }
.recibo-body { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.recibo-col-header { font-size: 12px; font-weight: 700; padding: 7px 10px; border-radius: 6px 6px 0 0; }
.recibo-col-header.percepciones { background: #1e293b; color: #60a5fa; }
.recibo-col-header.deducciones  { background: #1e293b; color: #fca5a5; }
.recibo-row { display: flex; justify-content: space-between; padding: 4px 8px; font-size: 11px; border-bottom: 1px solid #f3f4f6; }
.recibo-row.total     { background: #f0fdf4; font-weight: 700; padding: 7px 8px; }
.recibo-row.total-ded { background: #fef2f2; font-weight: 700; padding: 7px 8px; }
.recibo-neto { background: #1e293b; text-align: center; border-radius: 8px; padding: 12px; margin-top: 14px; }
.recibo-neto-label { font-size: 11px; margin-bottom: 4px; color: #94a3b8; }
.recibo-neto-value { font-size: 24px; font-weight: 700; color: #fff; }
.recibo-firmas { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 24px; padding-top: 16px; border-top: 1px dashed #d1d5db; font-size: 11px; color: #6b7280; text-align: center; }
.firma-line { border-top: 1px solid #374151; padding-top: 6px; margin-top: 30px; }

/* ─── LOGIN ──────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#e8f0fe 0%,#f0f2f5 60%,#e8f5ee 100%); }
.login-box { width: 400px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 44px 40px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon { font-size: 48px; color: var(--accent); }
.login-logo-text { font-family: var(--font-sans); font-size: 18px; font-weight: 700; color: var(--text-primary); margin-top: 8px; }

/* ─── UTILS ──────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-end     { display: flex; justify-content: flex-end; gap: 10px; }
.flex-gap     { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mt-0  { margin-top: 0; }
.mb-0  { margin-bottom: 0; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.w-100 { width: 100%; }

/* ─── PRINT ──────────────────────────────────────────────── */
@page {
  size: letter portrait;
  margin: 0;
}
@media print {
  .navbar, .page-header .btn-actions, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; padding: 0 !important; }
  body { background: #fff !important; color: #000; font-size: 8.5px; }
  /* Cada recibo ocupa una página completa */
  [style*="page-break-after:always"] { page-break-after: always; }
}

/* ─── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f0f2f5; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
