/*
 * ald-IA · estilos.
 * Panel de operación: fondo gris claro, superficies blancas con borde fino y marca en rojo; los botones avanzan en verde y cierran en rojo. Fuente del sistema (San Francisco, Segoe UI Variable, Roboto): la CSP no permite
 * fuentes externas.
 */

:root {
  --font: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #f9f9fa;
  --surface-3: #f0f0f2;
  --border: #e6e6e9;
  --border-strong: #d6d6db;
  --text: #1a1a1d;
  --text-2: #3f3f46;
  --muted: #67676f;

  /* Rojo de ald-IA (decisión del usuario, 2026-11-05): lo activo y la marca. Blanco sobre él: 5.1:1; él sobre --brand-soft: 4.5:1. */
  --primary: #dc0026;
  --primary-hover: #b80020;
  --brand: #dc0026;
  --brand-soft: #fdecef;
  --ink: #1c1c20;

  /* Botones que avanzan o confirman: verde. Blanco sobre él: 5.4:1. Los que cierran, cancelan o borran van en --danger. */
  --go: #0e7a3c;
  --go-hover: #0b6331;

  /* Vencido: rojo vino, para no confundir su V con la R de Revisar. Sobre su fondo: 8.3:1. */
  --expired: #8a1538;
  --expired-bg: #fbeef2;

  --success: #0e7a3c;
  --success-bg: #ecf8f0;
  --success-line: #b5e1c4;
  --danger: #d10024;
  --danger-bg: #fdf0ef;
  --danger-line: #f2c1bc;
  --warning: #935d00;
  --warning-bg: #fff7e5;
  --warning-line: #efd59f;
  --info: #1d4fd6;
  --info-bg: #eef3ff;
  --info-line: #c2d2fa;

  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgb(20 20 25 / 7%);
  --shadow: 0 1px 2px rgb(20 20 25 / 6%), 0 3px 8px rgb(20 20 25 / 7%);
  --shadow-lg: 0 14px 36px rgb(20 20 25 / 16%), 0 2px 6px rgb(20 20 25 / 8%);
  --ring: 0 0 0 3px rgb(220 0 38 / 22%);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --sidebar-w: 264px;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  caret-color: var(--text);
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
dd {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

::selection {
  color: var(--text);
  background: var(--brand-soft);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  color: #fff;
  background: var(--primary);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.95em;
}

.small .mono {
  font-size: inherit;
}

code {
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

kbd {
  font-family: var(--font);
}

.link {
  padding: 0;
  font-weight: 500;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  cursor: pointer;
  background: none;
  border: 0;
}

.link:hover {
  text-decoration-color: currentColor;
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: background-color 150ms, border-color 150ms, box-shadow 150ms;
}

.btn:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn--primary {
  color: #fff;
  background: var(--go);
  border-color: var(--go);
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover:not(:disabled) {
  background: var(--go-hover);
}

.btn--danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.btn--danger:hover:not(:disabled) {
  background: #a8001d;
}

/* Variantes antiguas: mismo aspecto que el botón con borde. */
.btn--ghost,
.btn--light,
.btn--white {
  color: var(--text);
}

.btn--small {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn--block {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--text-2);
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background-color 150ms, border-color 150ms, color 150ms;
}

.icon-btn:hover,
.icon-btn[aria-expanded="true"][aria-haspopup] {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.icon-btn--small {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}

.icon-btn--quiet {
  width: 32px;
  height: 32px;
  color: var(--muted);
  background: none;
  border-color: transparent;
  border-radius: var(--radius-sm);
}

.icon-btn--quiet:hover {
  background: var(--surface-3);
  border-color: transparent;
}

/* ---------- Formularios ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 16px;
}

.field {
  display: grid;
  gap: 6px;
  align-content: start;
}

.field--full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.field__error {
  min-height: 18px;
  font-size: 12px;
  color: var(--danger);
}

.req {
  color: var(--danger);
}

.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 150ms, box-shadow 150ms;
}

.input::placeholder {
  color: var(--muted);
}

.input:hover:not(:disabled, [readonly]) {
  border-color: #b9bec6;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.input[readonly],
.input:disabled {
  color: var(--muted);
  background: var(--surface-2);
}

.input:disabled {
  cursor: not-allowed;
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

.input--upper {
  text-transform: uppercase;
}

/* Contraseña con botón de ojo para mostrarla u ocultarla */
.password {
  position: relative;
}

.password__input {
  padding-right: 44px;
}

.password__toggle {
  position: absolute;
  top: 4px;
  right: 4px;
}

.input--code {
  height: 48px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3em;
  text-align: center;
}

select.input {
  padding-right: 36px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23646b76' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* ---------- Avisos ---------- */

.alert {
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.alert--error {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger-line);
}

.alert--warning {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: var(--warning-line);
}

.alert--success {
  color: var(--success);
  background: var(--success-bg);
  border-color: var(--success-line);
}

.banner {
  padding: 10px 24px;
  font-size: 13px;
  text-align: center;
}

.banner--error {
  color: var(--danger);
  background: var(--danger-bg);
  border-bottom: 1px solid var(--danger-line);
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid;
  border-radius: 999px;
}

.pill--success { color: var(--success); background: var(--success-bg); border-color: var(--success-line); }
.pill--danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.pill--warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-line); }
.pill--info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.pill--credential { color: var(--info); background: var(--info-bg); border-color: var(--info); }
.pill--norights { color: var(--danger); background: var(--danger-bg); border-color: var(--danger); }
.pill--baja { color: var(--muted); background: var(--surface-3); border-color: var(--border-strong); }
.pill--expired { color: var(--expired); background: var(--expired-bg); border-color: var(--expired); }

/* Estado en una sola letra; en la tabla es un botón que muestra la palabra y el detalle. */
.pill--short {
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
}

button.pill--short {
  font-family: inherit;
  cursor: pointer;
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--muted);
}

/* Atención y Dashboard: la leyenda también filtra por estado. */
.status-legend__item {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 2px 8px 2px 2px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
}

.status-legend__item:hover { color: var(--text); background: var(--surface-2); }

.status-legend__item.is-selected {
  color: var(--text);
  font-weight: 600;
  border-color: var(--border-strong);
}

.badge {
  display: inline-block;
  padding: 1px 8px;
  font-size: 12px;
  border-radius: 999px;
}

.badge--missing {
  color: var(--muted);
  border: 1px dashed var(--border-strong);
}

/* ---------- Marca ---------- */

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand--link {
  padding: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius);
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  background: var(--brand);
  border-radius: var(--radius);
}

.brand__mark .icon {
  width: 22px;
  height: 22px;
}

.brand__name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand__ia {
  color: var(--brand);
}

/* ---------- Acceso: tarjeta central con pistas de circuito hacia las esquinas ---------- */

.auth {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  padding: 24px 16px;
  overflow: auto;
  background: var(--bg);
}

/* Un amanecer quieto: el trabajo aquí es recibir a personas, y la pantalla no debe distraer. */
.auth__sunrise {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.auth__sunrise circle {
  fill: var(--brand);
  fill-opacity: 0.035;
}

.auth__card {
  position: relative;
  display: grid;
  gap: 18px;
  width: min(440px, 100%);
  padding: 32px;
  margin: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}

.auth__head {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}

.auth__logo-row {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.auth__logo {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.auth__logo .icon {
  width: 34px;
  height: 34px;
}

.auth__name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth__title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.auth__sub {
  color: var(--muted);
}

.auth__foot {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.auth__form {
  display: grid;
  gap: 16px;
}

.auth .btn--primary {
  height: 44px;
}

.auth__links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.auth__steps {
  display: grid;
  gap: 6px;
  padding-left: 20px;
  color: var(--text-2);
}

.auth__qr {
  justify-self: center;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auth__codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 24px;
  padding: 12px 12px 12px 36px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auth__check,
.confirm-check {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Campo con icono a la izquierda. */
.input-icon {
  position: relative;
}

.input-icon__glyph {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.input-icon .input {
  height: 44px;
  padding-left: 40px;
}

@media (max-width: 720px) {
  .auth__sunrise {
    display: none;
  }

  .auth__card {
    padding: 24px 20px;
  }
}

/* ---------- Estructura ---------- */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 8px;
  width: var(--sidebar-w);
  height: 100vh;
  padding: 20px 14px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  /* Al ocultarse se desliza a la izquierda y el contenido gana el espacio; visibility evita el foco en lo oculto. */
  transition: margin-left 280ms var(--ease), opacity 200ms, visibility 0s;
}

body.nav-collapsed .sidebar {
  margin-left: calc(-1 * var(--sidebar-w));
  visibility: hidden;
  opacity: 0;
  transition: margin-left 280ms var(--ease), opacity 200ms, visibility 0s linear 280ms;
}

.sidebar__head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 16px 8px;
}

.nav {
  display: grid;
  gap: 2px;
}

.nav__label {
  padding: 16px 10px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.nav__item {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  transition: background-color 150ms, color 150ms;
}

.nav__item:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-3);
}

.nav__item:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.nav__item.is-disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.nav__item.is-active {
  font-weight: 600;
  color: var(--primary);
  background: var(--brand-soft);
}

.nav__item:has(+ input:focus-visible) {
  outline: 2px solid var(--primary);
}

.sidebar__foot {
  display: grid;
  gap: 4px;
  padding-top: 12px;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.user {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 8px 10px;
}

.user__avatar,
.person__avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 50%;
}

.user__avatar {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.user__email {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scrim {
  display: none;
}

.main {
  --main-x: 32px;
  --main-top: 28px;
  flex: 1;
  min-width: 0;
  padding: var(--main-top) var(--main-x) 48px;
}

.page-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.page-head__menu {
  display: none;
}

body.nav-collapsed .page-head__menu {
  display: inline-grid;
  animation: fade-in 200ms var(--ease);
}
.page-head__brand {
  display: none;
  flex: none;
}
body.nav-collapsed .page-head__brand {
  display: flex;
  animation: fade-in 200ms var(--ease);
}
/* Con el menú lateral oculto, el encabezado es la barra de navegación: fija, de lado a lado y pegada arriba.
   Queda debajo del cajón, los menús y los avisos. */
body.nav-collapsed .page-head {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  padding: 12px var(--main-x);
  margin: calc(-1 * var(--main-top)) calc(-1 * var(--main-x)) 24px;
  background: var(--brand-soft);
  border-bottom: 1px solid var(--border-strong);
  box-shadow: 0 2px 8px rgb(20 20 25 / 8%);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.page-head__text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.page-head__title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.page-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Estado vacío ---------- */

.dropzone {
  display: grid;
  gap: 8px;
  justify-items: center;
  max-width: 640px;
  padding: 56px 32px;
  margin: 40px auto;
  text-align: center;
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  transition: border-color 150ms, background-color 150ms;
}

.dropzone h2 {
  font-size: 18px;
  font-weight: 700;
}

.dropzone p {
  max-width: 52ch;
  color: var(--text-2);
}

.dropzone__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.dropzone--active {
  background: var(--surface-2);
  border-color: var(--primary);
}

/* Bloqueo por cierre del día pendiente */
.dropzone--lock {
  border-style: solid;
  border-color: var(--warning-line);
}

.lock__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

/* ---------- Métricas ---------- */

.stat {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: baseline;
  padding: 18px 20px;
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 150ms, box-shadow 150ms;
}

.stat:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.stat__icon {
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 18px;
  color: var(--primary);
  background: var(--brand-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.stat--warning .stat__icon { color: var(--warning); }
.stat--danger .stat__icon { color: var(--danger); }
.stat--info .stat__icon { color: var(--info); }
.stat--success .stat__value { color: var(--success); }

.stat__value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat__label {
  font-weight: 600;
  color: var(--text-2);
}

.stat__detail {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Asistente ---------- */

.command {
  display: grid;
  gap: 6px;
}

.command__form {
  display: flex;
  gap: 10px;
  align-items: center;
  height: 52px;
  padding: 0 8px 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 150ms, box-shadow 150ms;
}

.command__form:focus-within {
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.command__icon {
  color: var(--brand);
}

.command__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  background: none;
  border: 0;
  outline: none;
}

.command__input::placeholder {
  color: var(--muted);
}

.command__kbd {
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.command__hint {
  padding-left: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Tabla ---------- */

.panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.panel__title {
  font-size: 16px;
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.toolbar__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search {
  position: relative;
}

.search__icon {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.search__input {
  width: 300px;
  padding-left: 38px;
}

.select {
  width: auto;
}

.result-count {
  padding: 0 20px 12px;
  font-size: 12px;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--border);
}

/* Paginador debajo de cada tabla (ui.pager): filas por página, rango y Anterior / Siguiente. */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.pager__size {
  width: auto;
  min-width: 0;
}

.pager__status {
  flex: 1 1 auto;
  font-variant-numeric: tabular-nums;
}

.pager__nav {
  display: flex;
  gap: 8px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
}

.table thead th {
  position: sticky;
  top: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.table tbody td {
  border-top: 1px solid var(--border);
}

.table tbody tr:first-child td {
  border-top: 0;
}

.table tbody tr {
  transition: background-color 150ms;
}

.table tbody tr:hover {
  background: #fafbfc;
}

.table tr.group-start td {
  border-top-color: var(--border-strong);
}

.table .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.person {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 240px;
}

.person__text {
  display: grid;
  min-width: 0;
}

.person__name {
  font-weight: 600;
}

.person__role {
  font-size: 12px;
  color: var(--muted);
}

.table tr.is-beneficiary .person {
  padding-left: 24px;
}

.table tr.is-beneficiary .person__avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
  background: var(--surface);
}

.table tr.is-titular .person__avatar {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.table .email {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table .address {
  min-width: 220px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table .status {
  white-space: nowrap;
}

.table .status .pill + .pill {
  margin-left: 4px;
}

.table .status {
  width: 1%;
}

.table .actions {
  width: 1%;
  padding-right: 0;
  white-space: nowrap;
}

/* ---------- Menú de acciones de una fila ---------- */

.row-menu {
  position: fixed;
  top: var(--menu-top, 0);
  left: var(--menu-left, 0);
  z-index: 45;
  display: grid;
  gap: 2px;
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  animation: menu-in 160ms var(--ease);
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

.row-menu__note {
  padding: 2px 10px 8px;
  font-size: 12px;
  color: var(--muted);
}

/* Baja lógica: sigue en la tabla, en gris */
tr.is-baja td { color: var(--muted); background: var(--surface-2); }
tr.is-baja .person { opacity: .7; }

.row-menu__title {
  max-width: 260px;
  padding: 6px 10px 8px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.row-menu__item {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
}

.row-menu__item .icon {
  color: var(--muted);
}

.row-menu__item:hover,
.row-menu__item:focus-visible {
  background: var(--surface-3);
}

.row-menu__item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.row-menu__item:disabled {
  color: var(--muted);
  cursor: not-allowed;
  background: none;
}

/* WhatsApp: QR para escanear con el celular */
.whatsapp__qr {
  display: block;
  margin: 12px auto;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.whatsapp__text {
  margin: 8px 0 0;
  padding: 10px 12px;
  white-space: pre-wrap;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
}

.table .empty {
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
}

/* ---------- Diálogos ---------- */

.dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.dialog[open] {
  animation: dialog-in 200ms var(--ease);
}

/* Al cerrar el visor de fotos el foco regresa al diálogo de atrás: es un contenedor, no lleva marco. */
.dialog:focus-visible {
  outline: none;
}

.dialog--narrow {
  width: min(480px, calc(100vw - 32px));
}

.dialog::backdrop {
  background: rgb(17 19 24 / 40%);
}

.dialog__body {
  display: grid;
  gap: 14px;
  padding: 24px;
}

/* Título con la X para cerrar; se queda arriba al bajar en formularios largos. */
.dialog__head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: -24px -24px 0;
  padding: 16px 16px 8px 24px;
  background: var(--surface);
}

.dialog__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

.help-list {
  display: grid;
  gap: 6px;
  padding-left: 20px;
}

.choice-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.choice {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 150ms, background-color 150ms;
}

.choice:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--primary);
}

.choice:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.diff {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  padding: 12px 14px;
  margin-top: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.diff dt {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.diff__new {
  font-weight: 600;
}

/* ---------- Notificaciones ---------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 40px));
  pointer-events: none; /* los avisos no tienen botones: no deben tapar lo que está detrás */
}

.toast {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 12px 14px;
  font-size: 13px;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: toast-in 200ms var(--ease);
}

.toast::before {
  flex: none;
  width: 8px;
  height: 8px;
  content: "";
  background: #9097a2;
  border-radius: 50%;
  transform: translateY(-1px);
}

.toast--success::before { background: #3ccb7f; }
.toast--warning::before { background: #f5b83d; }
.toast--error::before { background: #ff5a4f; }
.toast--info::before { background: #7aa2ff; }

.toast--leaving {
  opacity: 0;
  transition: opacity 200ms;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- Lectura de la INE ---------- */

.ine-slots {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

/* Compacto: la vista previa a la izquierda; título y botones a la derecha. */
.ine-slot {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  column-gap: 12px;
  row-gap: 6px;
  align-items: center;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ine-slot__title {
  grid-column: 2;
  align-self: end;
  font-size: 13px;
  font-weight: 600;
}

.ine-slot__preview {
  grid-row: 1 / 3;
  grid-column: 1;
  display: grid;
  place-items: center;
  aspect-ratio: 86 / 54; /* proporción de la credencial */
  overflow: hidden;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.ine-slot__preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ine-slot__actions {
  grid-column: 2;
  align-self: start;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* En la foto de la cita los botones van solos, debajo de la vista previa. */
.photo-slot .ine-slot__actions {
  grid-column: auto;
}

/* ---------- Foto de la cita ---------- */

.photo-slot {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 12px;
  margin-top: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.photo-slot__preview {
  display: grid;
  place-items: center;
  width: min(100%, 240px);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  padding: 8px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.photo-slot__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* La vista previa se abre en grande al tocarla (ui.zoomableImage). */
.image-zoom {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  cursor: zoom-in;
  background: none;
  border: 0;
  border-radius: inherit;
}

.image-zoom::after {
  content: 'Ver en grande';
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgb(17 19 24 / 65%);
  border-radius: 999px;
}

.image-zoom:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.dialog--image {
  width: min(960px, calc(100vw - 32px));
}

/* Lo que se resta es el título y los márgenes del diálogo. */
.image-zoom-full {
  display: block;
  width: 100%;
  height: calc(100dvh - 150px);
  object-fit: contain;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.ine-camera {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.ine-camera video {
  width: 100%;
  max-height: min(35vh, 260px);
  background: #000;
  border-radius: var(--radius);
}

/* Se ve lo mismo que se guarda: 3:4, como config.photo.aspect. */
.camera-frame {
  position: relative;
  height: min(55vh, 420px);
  aspect-ratio: 3 / 4;
  max-width: 100%;
  margin-inline: auto;
  overflow: hidden;
  background: #000;
  border-radius: var(--radius);
}

.camera-frame video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: 0;
}

.camera-frame::after {
  position: absolute;
  inset: 10% 18% 22%;
  pointer-events: none;
  content: '';
  border: 2px dashed rgb(255 255 255 / 0.8);
  border-radius: 50%;
}

.camera-hint {
  text-align: center;
}

.ine-camera__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.ine-loading {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--info);
  background: var(--info-bg);
  border: 1px solid var(--info-line);
  border-radius: var(--radius-sm);
}

.ine-compare {
  font-size: 12px;
  border: 1px solid var(--border);
}

.ine-compare th,
.ine-compare td {
  padding: 5px 10px;
  line-height: 1.35;
}

.ine-compare thead th {
  font-size: 12px;
}

.ine-compare th[scope="row"] {
  font-weight: 600;
  white-space: nowrap;
}

.ine-compare td {
  border-top: 1px solid var(--border);
  word-break: break-word;
}

.ine-compare tbody th {
  border-top: 1px solid var(--border);
}

.ine-compare__diff td {
  font-weight: 600;
  background: var(--warning-bg);
}

/* Cuando hay dos valores se toca el que se queda; el otro se apaga. */
.ine-choice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: pointer;
}

.ine-choice input {
  flex: none;
  margin-top: 2px;
}

.ine-compare__diff:has(input:checked) .ine-choice:not(:has(input:checked)) {
  font-weight: 400;
  color: var(--muted);
}

.ine-compare__same td:last-child {
  color: var(--success);
}

.ine-contact {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 8px 12px 2px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ine-contact .input {
  height: 34px;
  font-size: 13px;
}

.ine-contact legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

/* ---------- Pantallas medianas y chicas ---------- */

@media (max-width: 1200px) {
  .search__input {
    width: 240px;
  }
}

@media (max-width: 960px) {
  .sidebar,
  body.nav-collapsed .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    margin-left: 0;
    visibility: hidden;
    opacity: 1;
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform 260ms var(--ease), visibility 0s linear 260ms;
  }

  body.nav-open .sidebar {
    visibility: visible;
    transform: none;
    transition: transform 260ms var(--ease), visibility 0s;
  }

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: block;
    background: rgb(17 19 24 / 40%);
  }

  .page-head__menu {
    display: inline-grid;
  }
  .page-head__brand {
    display: flex;
  }
  /* Aquí el menú lateral siempre está escondido en un cajón: misma barra que en escritorio con el menú oculto. */
  .page-head {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 20;
    padding: 12px var(--main-x);
    margin: calc(-1 * var(--main-top)) calc(-1 * var(--main-x)) 16px;
    background: var(--brand-soft);
    border-bottom: 1px solid var(--border-strong);
    box-shadow: 0 2px 8px rgb(20 20 25 / 8%);
  }

  .main {
    --main-x: 16px;
    --main-top: 16px;
    padding: var(--main-top) var(--main-x) 40px;
  }





}

@media (max-width: 640px) {
  .stat {
    padding: 14px;
  }

  .stat__icon {
    width: 34px;
    height: 34px;
    margin-bottom: 12px;
  }

  .stat__value {
    font-size: 22px;
  }

  .command__kbd {
    display: none;
  }

  .command__form {
    flex-wrap: wrap;
    height: auto;
    padding: 10px;
  }

  .command__icon {
    display: none;
  }

  .command__input {
    flex-basis: 100%;
    height: 36px;
  }

  .command__form .btn {
    flex: 1;
  }

  .toolbar {
    padding: 14px 16px;
  }

  .toolbar__controls,
  .search,
  .search__input,
  .select {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .dialog__body {
    padding: 20px;
  }

  .dialog__actions .btn {
    flex: 1;
  }

}

/* ---------- Atención: lo primero que se ve con el padrón cargado ---------- */

.home {
  display: grid;
  gap: 16px;
}

.home__hero {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 40px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.home__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: var(--primary);
  background: var(--brand-soft);
  border-radius: var(--radius);
}

.home__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stat.is-selected {
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.day-steps {
  display: grid;
  gap: 6px;
  padding-left: 20px;
  margin: 0 auto;
  text-align: left;
}

.dropzone .btn--large {
  margin-block: 6px;
}

.btn--large {
  height: 48px;
  padding: 0 28px;
  font-size: 15px;
}

/* Ocho tarjetas: dos filas de cuatro en escritorio y de dos en dos en el teléfono, para que ninguna quede sola. */
.home__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 640px) {
  .home__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* El número va arriba: "inconsistencias" no cabe a su lado en cuatro columnas. */
.home__stats .stat {
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  padding: 14px;
}

.home__stats .stat__label {
  font-size: 13px;
  overflow-wrap: break-word;
}

.stat--credential .stat__value {
  color: var(--info);
}

.stat--expired .stat__value {
  color: var(--expired);
}

.stat--norights .stat__value {
  color: var(--danger);
}

.stat--info .stat__value {
  color: var(--info);
}

/* ---------- Wizards: indicador de pasos, personas y tarjetas ---------- */

/* Nada en amarillo mientras se atiende a alguien (decisión del usuario, 2026-11-04). */
#dayGuideNotices .alert--warning,
.wizard-body .alert--warning {
  color: var(--text-2);
  background: var(--surface-2);
  border-color: var(--border);
}

.wizard-notices {
  display: grid;
  gap: 8px;
}

.wizard-notices:empty {
  display: none;
}

/* Misma altura en todos los pasos: solo el contenido se desplaza y los botones no se mueven. */
.dialog--wizard {
  width: min(760px, calc(100vw - 32px));
  height: min(820px, calc(100dvh - 48px));
  overflow: hidden;
}

.dialog--wizard .dialog__body {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* El padding con margen negativo evita que se recorte el anillo de foco. */
.dialog--wizard .wizard-body {
  flex: 1;
  align-content: start;
  min-height: 0;
  padding: 4px;
  margin: -4px;
  overflow-y: auto;
}

.dialog--wizard .dialog__actions {
  margin-top: auto;
}

.dialog--wizard .wizard-notices {
  flex-shrink: 0;
  max-height: 25dvh;
  overflow-y: auto;
}

/* Los pasos cortos van centrados; "safe" no corta el inicio si el contenido no cabe. */
#dayGuideBody,
.dialog--wizard .wizard-body:has(> .wizard-done) {
  align-content: safe center;
}

/* Datos que ya tiene: el texto a la izquierda, Corregir y Actualizar con INE a la derecha. */
.ine-info-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
}

.ine-info-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Listo de cada persona: cómo quedó, en el centro, y debajo lo que sigue. */
.dialog--wizard .wizard-body:has(> .person-done) {
  align-content: safe center;
}

.person-done {
  display: grid;
  gap: 12px;
  justify-items: center;
  width: min(100%, 480px);
  margin-inline: auto;
  text-align: center;
}

.person-done__mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 50%;
}

.person-done__mark.is-complete {
  color: var(--success);
  background: var(--success-bg);
}

.person-done__mark.is-pending {
  color: var(--info);
  background: var(--info-bg);
}

.person-done__credential {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.person-done__mark .icon {
  width: 28px;
  height: 28px;
}

.person-done__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.person-done .missing-note {
  margin-top: 0;
  font-size: 14px;
}

.person-done__facts {
  width: 100%;
  padding: 0;
  margin: 12px 0 0;
  text-align: left;
  list-style: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.person-done__facts li {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  color: var(--text-2);
}

.person-done__facts li + li {
  border-top: 1px solid var(--border);
}

.person-done__facts .icon {
  flex: none;
  color: var(--muted);
}

.person-done__facts strong {
  color: var(--text);
}

/* Comparación con la INE: más compacta para que quepa sin desplazar. */
#wizardBody:has(.ine-compare) {
  gap: 8px;
}

/* Mismo orden en cada paso: salir o regresar a la izquierda, la acción principal a la derecha. */
.dialog--wizard .dialog__actions > .btn--danger:first-child,
.dialog--wizard .dialog__actions > .btn--ghost:first-child {
  margin-right: auto;
}

/* La cámara de la foto se ajusta al espacio del paso para no tener que desplazar.
   Lo que se resta es el aviso de la cámara y sus botones; si está el aviso de vencido, también ese. */
#wizardBody:has(.camera-frame) {
  container-type: size;
}

#wizardBody .camera-frame {
  height: clamp(180px, calc(100cqh - 90px), 420px);
}

#wizardBody:has(> .alert) .camera-frame {
  height: clamp(180px, calc(100cqh - 170px), 420px);
}

/* La vista previa de ese paso también se ajusta. Lo que se resta es el marco y el botón de subir archivo. */
#wizardBody:has(.camera-frame) .photo-slot__preview {
  width: auto;
  height: clamp(160px, calc(100cqh - 80px), 320px);
  max-width: 100%;
}

#wizardBody:has(.camera-frame):has(> .alert) .photo-slot__preview {
  height: clamp(160px, calc(100cqh - 160px), 320px);
}

/* Inicio del día tiene su propia altura: la de su paso más alto, Cargar Excel.
   Si hay advertencias o un error crece con ellos, para que el contenido no se aplaste. */
@media (min-width: 641px) {
  /* fit-content y no auto: en un dialog modal, auto lo estira a toda la pantalla. */
  #dayGuideDialog {
    height: fit-content;
    overflow-y: auto;
  }

  #dayGuideDialog .dialog__body {
    height: auto;
    min-height: 368px;
  }

  #dayGuideBody {
    flex: 1 0 auto;
    overflow-y: visible;
  }
}

.dialog__title:focus {
  outline: none;
}

.stepper {
  display: flex;
  padding: 0;
  margin: 0;
  list-style: none;
}

.stepper__step {
  position: relative;
  display: grid;
  flex: 1 1 0;
  gap: 6px;
  justify-items: center;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* La línea entre pasos va detrás de cada círculo. */
.stepper__step::before {
  position: absolute;
  top: 12px;
  right: 50%;
  left: -50%;
  height: 2px;
  content: "";
  background: var(--border-strong);
}

.stepper__step:first-child::before {
  display: none;
}

.stepper__step.is-done::before,
.stepper__step.is-current::before {
  background: var(--primary);
}

.stepper__btn {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
  justify-items: center;
  min-width: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius);
}

.stepper__btn:hover .stepper__label {
  color: var(--text);
  text-decoration: underline;
}

.stepper__btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
}

.stepper__dot {
  position: relative;
  z-index: 1; /* encima de la línea del paso siguiente */
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: 13px;
  font-weight: 700;
  color: var(--surface);
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: 50%;
}

.stepper__step.is-done .stepper__dot {
  background: var(--primary);
  border-color: var(--primary);
}

.stepper__step.is-current .stepper__dot {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.stepper__step.is-current.is-done .stepper__dot {
  color: var(--brand);
}

.stepper__step.is-current .stepper__label {
  font-weight: 700;
  color: var(--text);
}

.stepper-compact {
  display: none;
}

.person-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.person-chips:empty,
.wizard-body:empty {
  display: none;
}

.person-chip {
  padding: 4px 12px;
  font: inherit;
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.person-chip:not(:disabled):not(.is-current) {
  cursor: pointer;
}

.person-chip:not(:disabled):not(.is-current):hover {
  color: var(--text);
  border-color: var(--brand);
}

.person-chip.is-current {
  cursor: default;
}

.person-chip.is-absent {
  color: var(--muted);
}

.person-chip.is-current {
  font-weight: 700;
  color: var(--text);
  background: var(--surface);
  border-color: var(--brand);
}

.wizard-person {
  padding: 10px 12px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.wizard-body {
  display: grid;
  gap: 14px;
}

.wizard-body > .btn {
  justify-self: start;
}

.ine-question {
  font-weight: 700;
}

.match-note {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--info);
}

.next-visit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.wizard-done {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.family-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.family-list__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.family-list__item.is-focus {
  background: var(--surface-2);
  border-color: var(--brand);
}

.family-list__item.is-baja {
  color: var(--muted);
  background: var(--surface-2);
}

.family-removed {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

/* El titular falleció: quién firma por la familia y, mientras no firme, cómo cambiarlo (2026-11-10). */
.family-responsable {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.family-responsable p {
  margin: 0;
}

.family-list__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

/* Revisar: la foto al lado de sus datos. */

.missing-note {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-2);
}

.alert--dismissible {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}

.ine-loading .icon {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  color: var(--brand);
}

@media (pointer: coarse) {
  .icon-btn--small {
    width: 44px;
    height: 44px;
  }
}

.status-pill {
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 999px;
}

.status-pill--info {
  color: var(--info);
  background: var(--info-bg);
}

.status-pill--ok {
  color: var(--success);
  background: var(--success-bg);
  border-color: var(--success-line);
}

.status-pill--warn {
  color: var(--primary);
  background: var(--brand-soft);
  border-color: var(--border);
}

.status-pill--muted {
  color: var(--muted);
  background: var(--surface-3);
  border-color: var(--border);
}

.identity-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  font-weight: 600;
  background: var(--danger-bg);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-sm);
}

.action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.action-card {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 22px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 150ms, box-shadow 150ms;
}

.action-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.day-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.day-stat {
  display: grid;
  gap: 2px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.day-stat__value {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.day-guide-file {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.btn.is-busy {
  pointer-events: none;
  opacity: 0.6;
}

@media (max-width: 640px) {
  .dialog--wizard {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .stepper {
    display: none;
  }

  .stepper-compact {
    display: block;
    font-weight: 600;
  }

  .family-list__item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .family-list__actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .day-stats {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}

/* Selector de fecha y hora (datetime-picker.js): calendario y reloj de manecillas */
.dtp {
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dtp__header {
  display: grid;
  gap: 6px;
  padding: 14px 12px 8px;
  text-align: center;
  background: var(--surface-3);
}

.dtp__date {
  justify-self: center;
  padding: 2px 8px;
  font: inherit;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
}

.dtp__date.is-empty {
  color: var(--muted);
}

.dtp__bar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.dtp__bar .icon-btn[aria-pressed="true"] {
  color: var(--text);
  background: var(--surface);
}

.dtp__time {
  display: flex;
  gap: 2px;
  align-items: center;
  font-size: 22px;
  color: var(--muted);
}

.dtp__part {
  min-width: 34px;
  padding: 0 4px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
}

.dtp__part.is-active {
  font-weight: 700;
  color: var(--text);
}

.dtp__periods {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 8px;
}

.dtp__period {
  padding: 1px 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.dtp__period[aria-pressed="true"] {
  color: #fff;
  background: var(--text);
  border-color: var(--text);
}

.dtp__body {
  padding: 10px 12px;
}

.dtp__month {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.dtp__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.dtp__weekday {
  padding: 4px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.dtp__day {
  aspect-ratio: 1;
  max-height: 40px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 50%;
}

.dtp__day:hover:not(:disabled) {
  background: var(--surface-3);
}

.dtp__day.is-today {
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--border);
}

.dtp__day[aria-pressed="true"] {
  color: #fff;
  background: var(--text);
}

.dtp__day:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.45;
}

.dtp__clock-wrap {
  display: grid;
  justify-items: center;
}

.dtp__clock {
  display: block;
  width: min(240px, 100%);
  height: auto;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

/* Sin el recuadro azul del navegador al hacer clic; con teclado se marca el borde del círculo. */
.dtp__clock:focus {
  outline: none;
}

.dtp__clock:focus-visible .dtp__face {
  stroke: var(--text);
  stroke-width: 2;
}

.dtp__face {
  fill: var(--surface-3);
}

.dtp__hand {
  stroke: var(--text);
  stroke-width: 2;
}

.dtp__knob,
.dtp__pivot {
  fill: var(--text);
}

.dtp__num {
  font-size: 14px;
  fill: var(--text);
  pointer-events: none;
}

.dtp__num.is-selected {
  font-weight: 700;
  fill: #fff;
}

.dtp__hint {
  margin: 4px 0 0;
}

.dtp__footer {
  display: flex;
  justify-content: flex-end;
  padding: 0 12px 10px;
}

.dtp__footer:has(.dtp__clear[hidden]) {
  display: none;
}

/* Fecha citado en Editar: botón que abre el calendario y el reloj */
.citado {
  display: flex;
  gap: 8px;
  align-items: center;
}

.citado__value {
  flex: 1;
  font: inherit;
  color: var(--text);
  min-width: 0;
  text-align: left;
  cursor: pointer;
}

/* Menú Mi cuenta (acordeón) */
.account__toggle {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  color: inherit;
  text-align: left;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  transition: background-color 150ms;
}
.account__toggle:hover { background: var(--border); }
.account__toggle .user__email { flex: 1; }
.account__chevron {
  flex: none;
  transition: transform 150ms;
  transform: rotate(180deg);
}
.account__toggle[aria-expanded="true"] .account__chevron { transform: none; }
.account__menu {
  display: grid;
  gap: 4px;
}

/* Mis accesos */
.access {
  display: grid;
  gap: 16px;
}
.access__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.access-stat {
  display: grid;
  gap: 4px;
  padding: 16px;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.access-stat__value { font-size: 18px; }
.access-stat--danger .access-stat__value { color: var(--danger); }
.access-flag { margin-left: 8px; }
.access-date {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}
.access-date .input { width: auto; }

/* Dashboard: el selector Todos / Solo míos solo muestra las opciones con permiso. */
.dashboard__scope {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Lo elegido en oscuro: el rojo es para cerrar o cancelar y el verde para avanzar. */
.dashboard__scope .btn[aria-pressed="true"] {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

/* Tarjetas KPI del Dashboard: número grande, nota con el % y, en dos de ellas, un anillo (diseño elegido, 2026-11-05). */
.dashboard__kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpi {
  position: relative;
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 118px;
  padding: 16px 18px;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 150ms, box-shadow 150ms;
}

.kpi:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.kpi:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.kpi.is-selected {
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.kpi__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.kpi__value {
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.kpi__note {
  font-size: 12px;
  color: var(--muted);
}

.kpi--ring { padding-right: 80px; }
.kpi--warning .kpi__value { color: var(--warning); }
.kpi--expired .kpi__value { color: var(--expired); }

.kpi__ring {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 52px;
  height: 52px;
  transform: translateY(-50%);
}

.kpi__ring-track,
.kpi__ring-bar {
  fill: none;
  stroke-width: 5;
}

.kpi__ring-track { stroke: var(--surface-3); }
.kpi__ring-bar { stroke: var(--primary); stroke-linecap: round; }
.kpi--success .kpi__ring-bar { stroke: var(--success); }

@media (max-width: 960px) {
  .dashboard__kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Barra de la tabla: búsqueda por empleado y botón Filtros con cuántos hay puestos. */
.dashboard__search {
  width: 220px;
}

.dashboard__badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
}

/* Panel de filtros: se abre bajo la barra, con X arriba a la derecha. */
.dashboard-filters {
  display: grid;
  gap: 14px;
  margin: 0 20px 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.dashboard-filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-filters__title {
  font-size: 15px;
  font-weight: 700;
}

.dashboard-filters__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.dashboard-filters__grid .input { width: 100%; }

.dashboard-filters__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

/* Chips de los filtros puestos. */
.dashboard-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 14px;
}

.chip {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 30px;
  padding: 0 4px 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--brand-soft);
  border: 1px solid transparent;
  border-radius: 999px;
}

.chip__remove {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  color: inherit;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 999px;
}

.chip__remove:hover { background: rgb(220 0 38 / 12%); }
.chip__remove:focus-visible { outline: none; box-shadow: var(--ring); }
.chip__remove .icon { width: 14px; height: 14px; }

/* Estado con punto de color y la palabra: mismos colores que las pills de Atención. */
.status-dot {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.status-dot::before {
  flex: none;
  width: 8px;
  height: 8px;
  content: "";
  background: var(--muted);
  border-radius: 50%;
}

.status-dot--success::before { background: var(--success); }
.status-dot--credential::before,
.status-dot--info::before { background: var(--info); }
.status-dot--warning::before { background: var(--warning); }
.status-dot--danger::before,
.status-dot--norights::before { background: var(--danger); }
.status-dot--expired::before { background: var(--expired); }
.status-dot--baja::before { background: var(--border-strong); }

@media (max-width: 640px) {
  .dashboard__search { width: 100%; }
  .dashboard .toolbar__controls { width: 100%; }
  .dashboard .search { flex: 1; }
  .dashboard-filters { margin-inline: 12px; }
  .dashboard-chips { padding-inline: 12px; }
}

/* Aviso de CURP repetida */
.curp-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 12px;
  margin-block: 12px;
}

.curp-person {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.curp-person__title {
  margin: 0 0 4px;
}

.curp-person__facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  margin: 8px 0 0;
  font-size: 0.875rem;
}

.curp-person__facts dt {
  color: var(--muted, inherit);
}

.curp-person__facts dd {
  margin: 0;
}

/* Wizard: datos que la persona ya tiene, solo para consulta */
.info-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  padding: 16px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.info-facts dt {
  color: var(--muted);
}

.info-facts dd {
  margin: 0;
  font-weight: 600;
}

/* Llenar con INE, dentro de Editar */
#recordIne {
  display: grid;
  gap: 8px;
  justify-items: start;
  margin-block-end: 12px;
}

#recordIne > * {
  max-width: 100%;
}

.ine-fill__result {
  display: grid;
  gap: 8px;
  width: 100%;
}

.ine-fill__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Eliminar beneficiario, en rojo también en el menú de la fila */
.row-menu__item--danger,
.row-menu__item--danger .icon {
  color: var(--danger);
}

.row-menu__item--danger:hover,
.row-menu__item--danger:focus-visible {
  color: var(--danger);
  background: var(--danger-bg);
}

/* WhatsApp: revisar el mensaje antes del QR */
.wa-message {
  display: grid;
  gap: 16px;
  min-width: min(32rem, 100%);
}

.wa-message__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg, #f6f6f7);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.wa-message__fact {
  display: grid;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.wa-message__field {
  display: grid;
  gap: 6px;
}

.wa-message__head,
.wa-message__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wa-message__head label {
  font-weight: 600;
}

/* Tamaño fijo: si el texto no cabe, se desplaza por dentro. */
.wa-message__text {
  display: block;
  width: 100%;
  height: 10.5rem;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
}

.wa-message__count {
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.wa-message__count.is-over {
  color: var(--danger);
  font-weight: 600;
}
