/* ==========================================================================
   NexChecador - Sistema de diseño (un solo archivo, sin recursos externos)
   1. Variables  2. Base  3. Layout  4. Componentes  5. Pantallas  6. Móvil público
   Las clases rh-* se conservan (las vistas las usan); nx-* son las nuevas del layout.
   ========================================================================== */

/* ---------- 1. Variables (tema claro principal) ---------- */
:root {
  --marca: #0F2A47;            /* azul marino: barra lateral y encabezados */
  --marca-2: #16385E;          /* hover sobre la barra lateral */
  --acento: #2563EB;           /* botones primarios, enlaces, foco */
  --acento-hover: #1D4ED8;
  --acento-suave: #EAF1FF;

  --texto: #1F2937;
  --texto-2: #64748B;
  --fondo: #F4F6F9;
  --superficie: #FFFFFF;
  --superficie-2: #F8FAFC;     /* encabezados de tabla, filas alternas */
  --borde: #E2E8F0;
  --borde-fuerte: #CBD5E1;
  --hover: #F1F5F9;

  /* Estados: color de acento + par tinte/texto con contraste AA */
  --ok: #15803D;      --ok-bg: #DCFCE7;      --ok-fg: #166534;
  --warn: #B45309;    --warn-bg: #FEF3C7;    --warn-fg: #92400E;
  --err: #B91C1C;     --err-bg: #FEE2E2;     --err-fg: #991B1B;
  --info: #0369A1;    --info-bg: #E0F2FE;    --info-fg: #075985;
  --neutro-bg: #E2E8F0; --neutro-fg: #334155;

  --radio: 6px;
  --radio-lg: 8px;
  --sombra: 0 1px 2px rgba(15, 42, 71, .06);
  --sombra-modal: 0 12px 32px rgba(15, 42, 71, .22);
  --ancho-lateral: 248px;
  --alto-top: 56px;
  --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

/* Tema oscuro: listo para activarse con el sistema; el claro es el principal. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --acento: #60A5FA; --acento-hover: #93C5FD; --acento-suave: #172554;
    --texto: #E5E7EB; --texto-2: #94A3B8;
    --fondo: #0B1220; --superficie: #111B2E; --superficie-2: #0F182B;
    --borde: #22304A; --borde-fuerte: #334155; --hover: #16233A;
    --ok: #4ADE80; --ok-bg: #052E16; --ok-fg: #86EFAC;
    --warn: #FBBF24; --warn-bg: #3A2506; --warn-fg: #FCD34D;
    --err: #F87171; --err-bg: #3B0D0D; --err-fg: #FCA5A5;
    --info: #38BDF8; --info-bg: #082F49; --info-fg: #7DD3FC;
    --neutro-bg: #22304A; --neutro-fg: #CBD5E1;
    --sombra: none; --sombra-modal: 0 12px 32px rgba(0, 0, 0, .6);
  }
}

/* ---------- 2. Reset y tipografía ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font-family: var(--fuente); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { color: var(--marca); font-weight: 650; line-height: 1.25; margin: 0 0 .75rem; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) h1, :root:not([data-theme="light"]) h2, :root:not([data-theme="light"]) h3 { color: var(--texto); } }
p { margin: 0 0 .75rem; }
a { color: var(--acento); text-underline-offset: 2px; }
a:hover { color: var(--acento-hover); }
code, .rh-folio, .rh-secreto, .rh-codigo-vinculacion, .rh-pin-grande { font-family: var(--mono); }
table, .rh-m-hora, .rh-stat-value, .rh-cell-hora, .rh-grid-celda, .rh-folio { font-variant-numeric: tabular-nums; }
.nx-i { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -.2em; }

/* Foco visible en todos los controles */
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; border-radius: 3px; }
.nx-sidebar :focus-visible { outline-color: #fff; }

.nx-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.nx-skip { position: absolute; left: 8px; top: -48px; background: var(--acento); color: #fff; padding: 8px 14px; border-radius: var(--radio); z-index: 2000; }
.nx-skip:focus { top: 8px; color: #fff; }

/* ---------- 3. Layout: barra lateral + barra superior + contenido ---------- */
.nx-shell { min-height: 100vh; }
.nx-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--ancho-lateral); background: var(--marca); color: #CBD8E8;
  display: flex; flex-direction: column; z-index: 300; overflow-y: auto;
}
.nx-brand { display: block; padding: 18px 20px 4px; color: #fff; font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; text-decoration: none; }
.nx-brand:hover { color: #fff; }
.nx-brand span { color: #7FB0FF; }
.nx-empresa { padding: 0 20px 16px; font-size: .82rem; color: #9FB4CC; border-bottom: 1px solid rgba(255,255,255,.1); overflow-wrap: anywhere; }
.nx-empresa strong { display: block; color: #E6EEF8; font-weight: 600; font-size: .9rem; }
.nx-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; flex: 1; }
.nx-nav-titulo { padding: 12px 10px 4px; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: #7F95AF; }
.nx-nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; min-height: 40px; border-radius: var(--radio);
  color: #CBD8E8; text-decoration: none; font-size: .92rem; font-weight: 500; background: none; border: 0; width: 100%; text-align: left; font-family: inherit; cursor: pointer;
}
.nx-nav-link:hover { background: var(--marca-2); color: #fff; }
.nx-nav-link.active { background: rgba(37, 99, 235, .28); color: #fff; box-shadow: inset 3px 0 0 #7FB0FF; }
.nx-nav-pie { padding: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.nx-nav-pie form { margin: 0; }

.nx-main { margin-left: var(--ancho-lateral); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.nx-topbar {
  height: var(--alto-top); background: var(--superficie); border-bottom: 1px solid var(--borde);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 28px; position: sticky; top: 0; z-index: 200;
}
.nx-topbar-izq { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nx-menu-btn { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; background: none; border: 1px solid var(--borde); border-radius: var(--radio); color: var(--texto); cursor: pointer; }
.nx-topbar-titulo { font-weight: 600; color: var(--texto); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx-user { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: .88rem; }
.nx-user-correo { color: var(--texto); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.nx-rol { display: inline-flex; padding: 2px 10px; border-radius: 999px; background: var(--acento-suave); color: var(--acento); font-size: .75rem; font-weight: 650; white-space: nowrap; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nx-rol { color: var(--texto); } }

.nx-banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 28px; font-size: .92rem; border-bottom: 1px solid; }
.nx-banner .nx-i { margin-top: 2px; }
.nx-banner-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: #F5D58A; }
.nx-banner-err { background: var(--err-bg); color: var(--err-fg); border-color: #F5B5B5; }
.nx-banner-info { background: var(--info-bg); color: var(--info-fg); border-color: #A5D8F2; }

.rh-main { padding: 28px; width: 100%; max-width: 1500px; margin: 0 auto; flex: 1; }
.nx-footer { padding: 14px 28px; font-size: .8rem; color: var(--texto-2); border-top: 1px solid var(--borde); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.nx-velo { display: none; }

.nx-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.nx-page-header h1 { margin: 0; }
.nx-page-sub { color: var(--texto-2); margin: 4px 0 0; font-size: .9rem; }
.nx-acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 960px) {
  .nx-sidebar { transform: translateX(-100%); transition: transform .2s ease; width: min(86vw, 300px); box-shadow: var(--sombra-modal); }
  .nx-main { margin-left: 0; }
  .nx-menu-btn { display: inline-flex; }
  .nx-topbar { padding: 0 14px; }
  .nx-user-correo { display: none; }
  .rh-main { padding: 18px 16px; }
  .nx-banner, .nx-footer { padding-left: 16px; padding-right: 16px; }
  body.nx-menu-abierto .nx-sidebar { transform: none; }
  body.nx-menu-abierto .nx-velo { display: block; position: fixed; inset: 0; background: rgba(15, 42, 71, .5); z-index: 250; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- 4. Componentes ---------- */
/* Botones */
.rh-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 16px;
  border-radius: var(--radio); border: 1px solid transparent; font: inherit; font-size: .9rem; font-weight: 600;
  line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .12s, border-color .12s;
}
.rh-btn-primary { background: var(--acento); color: #fff; }
.rh-btn-primary:hover { background: var(--acento-hover); color: #fff; }
.rh-btn-secondary { background: var(--superficie); color: var(--texto); border-color: var(--borde-fuerte); }
.rh-btn-secondary:hover { background: var(--hover); color: var(--texto); }
.rh-btn-danger { background: var(--err); color: #fff; }
.rh-btn-danger:hover { background: #991B1B; color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rh-btn-primary, :root:not([data-theme="light"]) .rh-btn-danger { color: #0B1220; } }
.rh-btn-sm { min-height: 32px; padding: 4px 10px; font-size: .84rem; }
.rh-btn[disabled], .rh-btn:disabled { opacity: .55; cursor: not-allowed; }

/* Tarjetas */
.rh-card { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio-lg); box-shadow: var(--sombra); padding: 20px; margin-bottom: 20px; }
.rh-card > h2:first-child, .rh-card > h3:first-child { margin-top: 0; }
.rh-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.rh-stat-card { background: var(--superficie); border: 1px solid var(--borde); border-top: 3px solid var(--acento); border-radius: var(--radio-lg); padding: 16px 18px; box-shadow: var(--sombra); }
.rh-stat-label { color: var(--texto-2); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.rh-stat-value { color: var(--marca); font-size: 1.9rem; font-weight: 700; line-height: 1.2; margin-top: 4px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rh-stat-value { color: var(--texto); } }
.rh-stat-card.is-ok { border-top: 3px solid var(--ok); }
.rh-stat-card.is-warn { border-top: 3px solid var(--warn); }
.rh-stat-card.is-neutro { border-top: 3px solid var(--borde-fuerte); }
.rh-links { display: flex; gap: 10px; flex-wrap: wrap; }

/* Formularios */
.rh-form-group { display: flex; flex-direction: column; margin-bottom: 16px; }
.rh-form-group-inline { display: flex; flex-direction: column; margin-bottom: 0; }
.rh-label { font-size: .86rem; font-weight: 600; color: var(--texto); margin-bottom: 5px; }
.rh-label-required::after { content: " *"; color: var(--err); }
.rh-label-optional::after { content: " (opcional)"; color: var(--texto-2); font-weight: 400; font-size: .8rem; }
.rh-ayuda { color: var(--texto-2); font-size: .8rem; margin-top: 4px; }
.rh-input, .rh-select, .rh-textarea {
  width: 100%; max-width: 420px; min-height: 38px; padding: 7px 11px; background: var(--superficie); color: var(--texto);
  border: 1px solid var(--borde-fuerte); border-radius: var(--radio); font: inherit; font-size: .92rem;
}
.rh-textarea { min-height: 90px; max-width: 640px; }
.rh-input:hover, .rh-select:hover, .rh-textarea:hover { border-color: var(--texto-2); }
.rh-input:focus, .rh-select:focus, .rh-textarea:focus { outline: 2px solid var(--acento); outline-offset: 0; border-color: var(--acento); }
.rh-input.input-validation-error, .rh-textarea.input-validation-error { border-color: var(--err); }
.rh-input-narrow { max-width: 160px; }
.rh-validation, .text-danger, .field-validation-error { color: var(--err); font-size: .82rem; margin-top: 4px; }
.rh-form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.rh-filter-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.rh-preset-group { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.nx-form-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nx-form-inline .rh-input { width: auto; flex: 1 1 200px; }
.nx-celda-acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.nx-celda-acciones form { margin: 0; }
.rh-inline-form { display: inline; }
.nx-form-estrecho { max-width: 460px; }
.nx-form-estrecho .rh-input, .nx-form-estrecho .rh-select { max-width: none; display: block; }
.nx-form-estrecho > .rh-label { display: block; margin-top: 14px; }
.nx-form-estrecho > .rh-label:first-child { margin-top: 0; }
.nx-form-estrecho > .rh-btn { margin-top: 20px; }
fieldset.rh-fieldset { border: 1px solid var(--borde); border-radius: var(--radio-lg); padding: 14px 18px; margin: 0 0 18px; }
fieldset.rh-fieldset legend { padding: 0 8px; font-weight: 600; color: var(--texto-2); font-size: .88rem; }

/* Avisos (discretos): borde lateral + icono (por CSS) + texto; el tipo nunca depende solo del color */
.rh-alert { position: relative; padding: 11px 14px 11px 42px; border-radius: var(--radio); margin-bottom: 16px; border: 1px solid; border-left-width: 4px; font-size: .92rem; }
.rh-alert::before { content: ""; position: absolute; left: 14px; top: 13px; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.rh-alert-success { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12.5l3 3 5-6'/%3E%3C/svg%3E"); background: var(--ok-bg); color: var(--ok-fg); border-color: #A7DDB7; border-left-color: var(--ok); }
.rh-alert-warning { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l10 18H2L12 3z'/%3E%3Cpath d='M12 10v5M12 18v.01'/%3E%3C/svg%3E"); background: var(--warn-bg); color: var(--warn-fg); border-color: #F2D48A; border-left-color: var(--warn); }
.rh-alert-danger { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6M12 16.5v.01'/%3E%3C/svg%3E"); background: var(--err-bg); color: var(--err-fg); border-color: #F2B4B4; border-left-color: var(--err); }
.rh-alert-info { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v6M12 7.5v.01'/%3E%3C/svg%3E"); background: var(--info-bg); color: var(--info-fg); border-color: #A9D8EE; border-left-color: var(--info); }

/* Caja de secreto: se muestra una sola vez */
.nx-secreto { background: var(--superficie); border: 1px solid var(--warn); border-left-width: 4px; border-radius: var(--radio-lg); padding: 16px 18px; margin-bottom: 20px; }
.nx-secreto-titulo { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--warn-fg); margin-bottom: 10px; }
.nx-secreto-fila { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.rh-secreto { flex: 1 1 280px; min-width: 0; font-size: 1.02rem; background: var(--superficie-2); border: 1px dashed var(--borde-fuerte); padding: 10px 14px; border-radius: var(--radio); word-break: break-all; user-select: all; color: var(--texto); }
.nx-secreto-nota { margin: 10px 0 0; color: var(--texto-2); font-size: .85rem; }

/* Tablas: densas, encabezado fijo, hover suave */
.rh-table-container { overflow: auto; max-height: 72vh; border: 1px solid var(--borde); border-radius: var(--radio-lg); background: var(--superficie); box-shadow: var(--sombra); }
.rh-card .rh-table-container { box-shadow: none; }
.rh-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.rh-table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--superficie-2); color: var(--texto-2); text-align: left;
  font-size: .74rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; white-space: normal; vertical-align: bottom; border-bottom: 1px solid var(--borde-fuerte);
}
.rh-table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--borde); vertical-align: middle; font-size: .9rem; }
.rh-table tbody tr:last-child td { border-bottom: 0; }
.rh-table tbody tr:hover { background: var(--hover); }
.rh-table .rh-num, .rh-table th.rh-num { text-align: right; font-variant-numeric: tabular-nums; }
.rh-table td:last-child .rh-btn { white-space: nowrap; }
.rh-table-empty { text-align: center !important; padding: 36px 16px !important; color: var(--texto-2); }
.rh-card > table.rh-table { border: 1px solid var(--borde); border-radius: var(--radio); }
.rh-fila-baja { opacity: .72; }
.rh-fila-baja td { background: var(--superficie-2); }

/* Etiquetas (badges) con texto: nunca solo color */
.rh-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 650; white-space: nowrap; }
.rh-badge-success { background: var(--ok-bg); color: var(--ok-fg); }
.rh-badge-danger { background: var(--err-bg); color: var(--err-fg); }
.rh-badge-warning { background: var(--warn-bg); color: var(--warn-fg); }
.rh-badge-info { background: var(--info-bg); color: var(--info-fg); }
.rh-badge-secondary { background: var(--neutro-bg); color: var(--neutro-fg); }

/* Chips de la cuadrícula */
.rh-chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 4px; font-size: .72rem; font-weight: 650; margin-top: 3px; white-space: nowrap; line-height: 1.5; }
.rh-chip .nx-i { width: 1em; height: 1em; }
.rh-chip-ent { background: var(--ok-bg); color: var(--ok-fg); }
.rh-chip-sal { background: var(--info-bg); color: var(--info-fg); }
.rh-chip-retardo { background: var(--warn-bg); color: var(--warn-fg); }
.rh-chip-falta { background: var(--err-bg); color: var(--err-fg); }
.rh-chip-descanso { background: var(--neutro-bg); color: var(--neutro-fg); }
.rh-chip-compartido { background: var(--err-bg); color: var(--err-fg); border: 1px solid #F2B4B4; }

/* Modal */
.rh-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15, 42, 71, .55); align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.rh-modal-overlay.show { display: flex; }
.rh-modal { background: var(--superficie); border-radius: var(--radio-lg); box-shadow: var(--sombra-modal); width: 100%; max-width: 480px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; border: 1px solid var(--borde); }
.rh-modal-ancho { max-width: 760px; }
.rh-modal-header { padding: 16px 20px; border-bottom: 1px solid var(--borde); }
.rh-modal-header h3 { margin: 0; color: var(--texto); }
.rh-modal-body { padding: 16px 20px; overflow: auto; color: var(--texto); }
.rh-modal-footer { padding: 12px 20px; border-top: 1px solid var(--borde); display: flex; justify-content: flex-end; gap: 10px; }

/* Utilidades */
.rh-mt-lg { margin-top: 20px; }
.rh-mb-lg { margin-bottom: 20px; }
.rh-text-muted { color: var(--texto-2); }
.nx-flex { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.nx-mb { margin-bottom: 16px; }
.nx-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

/* ---------- 5. Pantallas ---------- */
/* Navegación semanal */
.rh-week-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.rh-week-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rh-week-title { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.rh-week-badge { background: var(--neutro-bg); color: var(--neutro-fg); padding: 3px 12px; border-radius: 999px; font-weight: 650; font-size: .8rem; }
.rh-week-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rh-estatus-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

/* Cuadrícula de checadas: encabezado y primera columna fijos */
.rh-grid-wrap { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio-lg); box-shadow: var(--sombra); overflow: auto; max-height: calc(100vh - 150px); margin-bottom: 16px; }
.rh-grid { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 980px; }
.rh-grid th, .rh-grid td { border-bottom: 1px solid var(--borde); border-right: 1px solid var(--borde); padding: 7px 8px; vertical-align: top; text-align: left; }
.rh-grid th:last-child, .rh-grid td:last-child { border-right: 0; }
.rh-grid thead th { position: sticky; top: 0; z-index: 3; background: var(--superficie-2); text-align: center; font-size: .8rem; color: var(--texto); border-bottom: 1px solid var(--borde-fuerte); }
.rh-grid-emp-col { position: sticky; left: 0; z-index: 2; min-width: 200px; width: 200px; background: var(--superficie); box-shadow: 1px 0 0 var(--borde-fuerte); }
.rh-grid thead .rh-grid-emp-col { z-index: 4; text-align: left; background: var(--superficie-2); }
.rh-grid-dia-nombre { display: block; font-weight: 650; }
.rh-grid-dia-fecha { display: block; font-weight: 400; color: var(--texto-2); font-size: .78rem; }
.rh-grid thead th.rh-grid-hoy { background: var(--marca); color: #fff; }
.rh-grid thead th.rh-grid-hoy .rh-grid-dia-fecha { color: #C8D6E8; }
.rh-grid-celda-hoy { background: var(--acento-suave); }
.rh-grid-emp-nombre { font-weight: 600; }
.rh-grid-emp-puesto { color: var(--texto-2); font-size: .78rem; margin-top: 2px; }
.rh-grid-celda { min-width: 116px; font-size: .82rem; text-align: center; font-variant-numeric: tabular-nums; }
.rh-grid-click { cursor: pointer; }
.rh-grid-click:hover { background: var(--hover); }
.rh-grid-click:focus-visible { outline: 2px solid var(--acento); outline-offset: -2px; }
.rh-grid-linea { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.rh-grid-vacio { color: var(--texto-2); display: block; text-align: center; }
.rh-grid-horas { font-weight: 650; margin-top: 4px; }
.rh-grid-nota { font-size: .76rem; margin-top: 2px; }
.rh-grid-nota-turno { color: var(--info-fg); font-weight: 600; }
.rh-grid-nota-sinsalida { color: var(--warn-fg); font-weight: 650; }
.rh-grid-detalle-datos { display: none; }
.rh-grid-leyenda { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--texto-2); font-size: .82rem; margin-bottom: 20px; }
.rh-grid-leyenda .rh-chip { margin: 0 4px 0 0; }
.rh-checada-motivo { display: block; font-size: .78rem; color: var(--texto-2); margin-top: 2px; }

/* Reporte semanal de asistencia */
.rh-attendance-table th, .rh-attendance-table td { text-align: center; vertical-align: top; }
.rh-attendance-table th:first-child, .rh-attendance-table td:first-child { text-align: left; vertical-align: middle; }
.rh-attendance-day-header { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.rh-attendance-day-header .rh-attendance-day-name { font-size: .72rem; color: var(--texto-2); text-transform: uppercase; }
.rh-empleado-cell { display: flex; flex-direction: column; min-width: 190px; }
.rh-empleado-folio { font-size: .74rem; color: var(--texto-2); font-weight: 650; font-family: var(--mono); }
.rh-empleado-nombre { font-weight: 600; color: var(--texto); text-decoration: none; }
.rh-empleado-nombre:hover { color: var(--acento); text-decoration: underline; }
.rh-empleado-horario { font-size: .78rem; color: var(--texto-2); }
.rh-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 104px; padding: 4px; font-size: .82rem; }
.rh-cell-checada-row { display: flex; align-items: center; gap: 4px; }
.rh-cell-checada-tipo { font-weight: 650; color: var(--texto-2); font-size: .72rem; }
.rh-cell-hora { font-weight: 650; }
.rh-cell-check { color: var(--ok); font-weight: 700; }
.rh-badge-retardo { display: inline-flex; align-items: center; background: var(--warn-bg); color: var(--warn-fg); font-weight: 650; font-size: .72rem; padding: 1px 8px; border-radius: 999px; }
.rh-cell-sinregistro { color: var(--texto-2); font-size: .82rem; }
.rh-cell-descanso-text { color: var(--texto-2); font-size: .82rem; }
.rh-cell-sinhorario-text { color: var(--texto-2); font-size: .78rem; }
.rh-resumen-badge-danger { color: var(--err-fg); font-weight: 650; }
.rh-resumen-badge-warning { color: var(--warn-fg); font-weight: 650; }

/* Detalle de empleado y bitácora */
.rh-detail-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.rh-detail-header-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rh-detail-folio { color: var(--texto-2); font-weight: 650; font-family: var(--mono); }
.rh-folio { font-weight: 650; font-size: .9rem; white-space: nowrap; }
.rh-detail-title { margin: 0; }
.rh-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rh-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 24px; }
.rh-detail-label { font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--texto-2); margin-bottom: 2px; }
.rh-detail-value { color: var(--texto); }
.rh-detail-value-missing { color: var(--texto-2); font-size: .88rem; }
.rh-baja-form { margin-top: 16px; padding: 16px; border: 1px solid #F2B4B4; border-left: 4px solid var(--err); border-radius: var(--radio-lg); background: var(--err-bg); color: var(--err-fg); }
.rh-baja-form .rh-label { color: inherit; }
.rh-timeline { display: flex; flex-direction: column; gap: 12px; }
.rh-timeline-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--borde); border-left: 3px solid var(--acento); border-radius: var(--radio); background: var(--superficie); }
.rh-timeline-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rh-timeline-fecha { color: var(--texto-2); font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.rh-timeline-diff { color: var(--texto-2); font-size: .82rem; }
.rh-timeline-diff strong { color: var(--texto); }
.rh-codigo-vinculacion { font-size: 1.8rem; font-weight: 700; letter-spacing: .15em; color: var(--marca); }
.rh-qr-img { display: block; width: 220px; height: 220px; image-rendering: pixelated; background: #fff; padding: 8px; border: 1px solid var(--borde); border-radius: var(--radio); }
.rh-pin-grande { font-size: 2.6rem; font-weight: 700; letter-spacing: .3em; color: var(--marca); }

/* Plataforma */
.nx-vig { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Acceso (login, acceso denegado, error) */
.nx-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--fondo); }
.nx-auth-caja { width: 100%; max-width: 400px; }
.nx-auth-marca { text-align: center; margin-bottom: 22px; }
.nx-auth-marca strong { display: block; font-size: 1.6rem; color: var(--marca); letter-spacing: -.02em; }
.nx-auth-marca strong span { color: var(--acento); }
.nx-auth-marca small { color: var(--texto-2); }
.nx-auth-caja .rh-card { padding: 26px 24px; }
.nx-auth-caja .rh-input { max-width: none; }
.nx-auth-caja .rh-btn { width: 100%; min-height: 42px; }
.nx-auth-pie { text-align: center; margin-top: 16px; font-size: .8rem; color: var(--texto-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nx-auth-marca strong { color: var(--texto); } }

/* ---------- 6. Página pública del celular (/m/checar): una columna, campos grandes ---------- */
.rh-m-body { margin: 0; min-height: 100vh; background: var(--fondo); font-size: 1.05rem; }
.rh-m-header { background: var(--marca); color: #fff; text-align: center; padding: 14px 16px; font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }
.rh-m-header span { color: #7FB0FF; }
.rh-m-main { max-width: 480px; margin: 0 auto; padding: 20px 16px 32px; }
.rh-m-card { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio-lg); box-shadow: var(--sombra); padding: 26px 20px; text-align: center; }
.rh-m-icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: var(--acento-suave); color: var(--acento); }
.rh-m-icon .nx-i { width: 32px; height: 32px; stroke-width: 1.75; }
.rh-m-icon.is-ok { background: var(--ok-bg); color: var(--ok); }
.rh-m-icon.is-warn { background: var(--warn-bg); color: var(--warn); }
.rh-m-icon.is-err { background: var(--err-bg); color: var(--err); }
.rh-m-title { margin: 14px 0 8px; font-size: 1.5rem; font-weight: 700; color: var(--marca); }
.rh-m-title-ok { color: var(--ok-fg); }
.rh-m-title-error { color: var(--err-fg); }
.rh-m-title-aviso { color: var(--warn-fg); }
.rh-m-aviso { background: var(--warn-bg); border: 1px solid #F2D48A; color: var(--warn-fg); border-radius: var(--radio); padding: 10px 12px; }
.rh-m-text { margin: 8px 0; font-size: 1.05rem; }
.rh-m-hora { font-size: 2.4rem; font-weight: 700; color: var(--marca); margin: 4px 0 0; }
.rh-m-input { width: 100%; min-height: 56px; padding: 12px 16px; font: inherit; font-size: 1.5rem; text-align: center; letter-spacing: .12em; text-transform: uppercase; color: var(--texto); background: var(--superficie); border: 2px solid var(--borde-fuerte); border-radius: var(--radio-lg); margin: 6px 0 14px; }
.rh-m-input:focus { outline: 3px solid var(--acento-suave); border-color: var(--acento); }
.rh-m-label { display: block; text-align: left; font-weight: 650; font-size: .95rem; margin-top: 6px; }
.rh-m-timer { margin: 2px 0 14px; color: var(--texto-2); font-size: .95rem; font-variant-numeric: tabular-nums; }
.rh-m-nota { margin-top: 12px; color: var(--err-fg); font-weight: 650; }
.rh-m-btn { display: block; width: 100%; min-height: 56px; padding: 14px; font: inherit; font-size: 1.2rem; font-weight: 700; border: 0; border-radius: var(--radio-lg); background: var(--acento); color: #fff; cursor: pointer; }
.rh-m-btn:hover { background: var(--acento-hover); }
.rh-m-btn:focus-visible { outline: 3px solid var(--marca); outline-offset: 2px; }

/* ---------- Tablas y controles en pantallas pequeñas: objetivos táctiles de 44 px ---------- */
@media (max-width: 760px) {
  .rh-week-title { white-space: normal; }
  .rh-week-toolbar, .rh-week-actions { width: 100%; }
  .rh-week-nav { width: 100%; justify-content: space-between; flex-wrap: nowrap; }
  .rh-week-title { flex: 1; justify-content: center; text-align: center; font-size: .9rem; }
  .rh-btn, .rh-input, .rh-select { min-height: 44px; }
  .rh-btn-sm { min-height: 44px; padding: 6px 14px; }
  .nx-nav-link { min-height: 44px; }
  .rh-input, .rh-select, .rh-textarea { max-width: none; }
  .rh-input-narrow { max-width: none; }
  .rh-filter-form > * { flex: 1 1 140px; }
  h1 { font-size: 1.3rem; }
}
