:root {
  /* ONEST Brand */
  --onest-blue-900: #003E75;
  --onest-blue-700: #00549E;
  --onest-blue-500: #1677BD;
  --onest-blue-100: #EAF3FA;

  --onest-green-700: #2B9138;
  --onest-green-500: #39B54A;
  --onest-green-100: #EAF7EC;

  /* Neutral */
  --gray-950: #20252B;
  --gray-700: #475467;
  --gray-500: #667085;
  --gray-300: #D0D5DD;
  --gray-200: #E1E6EB;
  --gray-100: #F2F4F7;
  --gray-50: #F8FAFC;
  --white: #FFFFFF;

  /* Semantic */
  --success: #22A447;
  --success-bg: #EAF7EC;
  --warning: #F59E0B;
  --warning-bg: #FEF6E7;
  --danger: #D92D20;
  --danger-bg: #FCEAE9;
  --info: #1677BD;
  --info-bg: #EAF3FA;
  --neutral: #667085;
  --neutral-bg: #F2F4F7;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* App aliases */
  --ink: var(--gray-950);
  --muted: var(--gray-500);
  --paper: #F5F7F9;
  --surface: var(--white);
  --surface-2: var(--gray-100);
  --border: var(--onest-border, #E1E6EB);
  --accent: var(--onest-blue-700);
  --accent-dark: var(--onest-blue-900);
  --accent-ink: #FFFFFF;
  --focus: 0 0 0 3px rgba(0, 84, 158, 0.12);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", "Arial", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.display {
  font-family: "Montserrat", "Arial", sans-serif;
  letter-spacing: -0.01em;
}

.mono,
.num {
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--onest-blue-700);
}

button {
  font-family: inherit;
}

::selection {
  background: rgba(0, 84, 158, 0.16);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-sm);
}

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

.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: var(--onest-blue-900);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  gap: 24px;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--onest-blue-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  color: #fff;
  font-size: 14px;
  flex: 0 0 auto;
}

.brand-logo {
  height: 42px;
  width: auto;
  max-width: 170px;
  flex: 0 0 auto;
  object-fit: contain;
  display: block;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text b {
  font-family: "Montserrat", sans-serif;
  font-size: 15px;
  font-weight: 700;
}

.brand-text span {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.64);
  letter-spacing: .02em;
}

.who {
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.who .name {
  font-weight: 600;
  font-size: 14px;
}

.who .role {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.64);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.who button {
  margin-top: 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #fff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.who button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, 0.48);
  padding: 10px 12px 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 13.6px;
  font-weight: 500;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.2s ease;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-left-color: var(--onest-green-500);
}

.nav a .dot {
  display: none;
}

.sidebar-foot {
  margin-top: auto;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.44);
  padding: 0 8px;
  line-height: 1.5;
}

.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #fff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 64px;
  max-width: 1180px;
}

.topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 4px;
}

h1.page-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0;
  font-family: "Montserrat", sans-serif;
}

p.lede {
  color: var(--muted);
  max-width: 62ch;
  margin: 8px 0 0;
  font-size: 14px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat .n {
  font-family: "Montserrat", sans-serif;
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--onest-blue-700);
}

.stat .l {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 24px;
}

.grid-courses {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.course-detail-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.course-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}

.course-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.course-detail-head h3 {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 600;
  font-family: "Montserrat", sans-serif;
}

.course-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px 20px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.course-card .norma {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

.course-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  font-family: "Montserrat", sans-serif;
}

.course-meta {
  display: flex;
  gap: 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.course-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: .01em;
  width: fit-content;
}

.chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.chip.pend {
  background: var(--neutral-bg);
  color: var(--neutral);
}

.chip.pend .dot {
  background: var(--neutral);
}

.chip.curso {
  background: var(--warning-bg);
  color: var(--warning);
}

.chip.curso .dot {
  background: var(--warning);
}

.chip.ok {
  background: var(--success-bg);
  color: var(--success);
}

.chip.ok .dot {
  background: var(--success);
}

.chip.venc {
  background: var(--danger-bg);
  color: var(--danger);
}

.chip.venc .dot {
  background: var(--danger);
}

/* Checkbox de selección en tablas (constancias en lote): objetivo táctil 24px visual dentro de una celda de 44px */
input[type="checkbox"].chk-cert,
input[type="checkbox"].chk-empleado-lote,
input[type="checkbox"]#chk-todos-empleados-lote {
  width: 20px;
  height: 20px;
  accent-color: var(--onest-blue-700);
  cursor: pointer;
}

td:has(.chk-cert),
td:has(.chk-empleado-lote),
th:has(#chk-todos-empleados-lote) {
  width: 44px;
  text-align: center;
}

/* Foco visible también sobre fondos oscuros (sidebar) */
.sidebar :focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.45);
}

.btn {
  appearance: none;
  border: none;
  background: var(--onest-blue-700);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  transition: background 0.2s ease;
}

.btn:hover {
  background: var(--onest-blue-900);
}

.btn:active {
  background: var(--onest-blue-900);
}

.btn.ghost {
  background: #fff;
  color: var(--onest-blue-700);
  border: 1px solid var(--onest-blue-700);
}

.btn.ghost:hover {
  background: var(--onest-blue-100);
}

.btn.success {
  background: var(--onest-green-500);
  color: #fff;
}

.btn.success:hover {
  background: var(--onest-green-700);
}

.btn.sm {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 16px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  padding: 0;
}

.back-link:hover {
  color: var(--onest-blue-700);
}

.temario {
  margin: 16px 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.temario li {
  display: flex;
  gap: 12px;
  font-size: 14px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
}

.temario li .idx {
  color: var(--onest-blue-700);
  font-weight: 700;
  flex: 0 0 auto;
}

.opt-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  max-height: 220px;
  overflow-y: auto;
}

.opt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
}

.opt input {
  accent-color: var(--onest-blue-700);
}

form.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
}

.field input,
.field select {
  font-family: inherit;
  font-size: 14px;
  height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--onest-blue-700);
  box-shadow: var(--focus);
}

.hint {
  font-size: 12.5px;
  color: var(--muted);
}

.error-text {
  font-size: 12.5px;
  color: var(--danger);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width:640px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  font-size: 12px;
  color: var(--gray-700);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  background: var(--gray-100);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--gray-200);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--gray-50);
}

.table-wrap {
  overflow-x: auto;
}

td.mono {
  font-size: 12.5px;
}

th.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cert {
  background: #fff;
  border: 1.5px solid #000;
  padding: 14px 18px;
  font-family: Arial, Helvetica, sans-serif;
  color: #000;
  max-width: 900px;
  margin: 0 auto;
}

.cert-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.cert-logo {
  height: 38px;
  width: auto;
  max-width: 160px;
  flex: 0 0 auto;
  object-fit: contain;
  display: block;
}

.cert-head h2 {
  margin: 0;
  font-size: 14px;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  text-align: center;
}

.cert-head .sub {
  font-size: 10.5px;
  color: #333;
  text-align: center;
  margin-top: 2px;
}

.cert-folio {
  font-size: 10.5px;
  text-align: right;
  color: #333;
  flex: 0 0 auto;
}

.cert-folio b {
  display: block;
  color: #000;
  font-size: 13px;
}

.cert-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
  border: 1px solid #000;
}

.cert-table caption {
  background: #000;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: left;
  padding: 4px 8px;
  caption-side: top;
  letter-spacing: .02em;
}

.cert-table td {
  border: 1px solid #000;
  padding: 5px 8px;
  vertical-align: top;
  font-size: 11.5px;
}

.cert-table td.k {
  font-size: 9px;
  color: #333;
  text-transform: uppercase;
  letter-spacing: .02em;
  padding-bottom: 2px;
}

.cert-row-label {
  display: block;
}

.cert-row-value {
  display: block;
  font-weight: 700;
  font-size: 12.5px;
  margin-top: 2px;
  font-family: "Courier New", monospace;
  letter-spacing: .03em;
}

.cert-row-value.small {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 600;
  letter-spacing: 0;
}

.cert-sign {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-top: 34px;
  padding: 0 8px;
}

.sign-line {
  border-top: 1px solid #000;
  padding-top: 6px;
  font-size: 10px;
  color: #000;
  text-align: center;
  line-height: 1.4;
}

.cert-note {
  margin-top: 18px;
  font-size: 9px;
  color: #333;
  border-top: 1px dashed #999;
  padding-top: 8px;
  line-height: 1.5;
}

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.loading-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13.5px;
  padding: 48px 0;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 2px solid var(--border);
  border-top-color: var(--onest-blue-700);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 1.4s;
  }
}

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.dash-hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  margin-bottom: 18px;
  align-items: stretch;
}

.dash-donut-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.dash-donut-label {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.dash-donut-label b {
  font-size: 13.5px;
}

.dash-donut-label span {
  font-size: 11.5px;
  color: var(--muted);
}

.dash-stats {
  margin-bottom: 0;
}

.donut {
  width: 120px;
  height: 120px;
  max-width: 100%;
}

.donut-text {
  font-family: "Montserrat", sans-serif;
  font-size: 20px;
  font-weight: 700;
  fill: var(--ink);
}

.barh-track {
  width: 100%;
  height: 8px;
  border-radius: 99px;
  background: var(--gray-100);
  overflow: hidden;
}

.barh-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
}

.predio-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.predio-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-2);
}

.predio-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
}

.predio-card-top .tasa {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  color: var(--onest-blue-700);
}

.predio-card-meta {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width:900px) {
  .dash-hero {
    grid-template-columns: 1fr;
  }
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--paper);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-card .brand {
  margin-bottom: 20px;
}

.login-card .brand-mark {
  background: var(--onest-blue-700);
}

.login-card .brand-text span {
  color: var(--muted);
}

.login-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.role-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius-md);
}

.role-toggle button {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.role-toggle button.active {
  background: var(--surface);
  color: var(--onest-blue-700);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.banner-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 16px;
}

.cert-page {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 2px dashed var(--border);
  position: relative;
}

.cert-page:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.cert-page::before {
  content: "Constancia " attr(data-idx) " de " attr(data-total);
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

@media (max-width:820px) {
  .shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .nav {
    flex-direction: row;
  }

  .who {
    display: none;
  }

  .main {
    padding: 20px;
  }
}

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

.dc3-document {
  width: 200mm;
  max-width: 100%;
  min-height: 263mm;
  margin: 0 auto;
  background: #fff;
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  box-sizing: border-box;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ==========================================================
   ENCABEZADO
   ========================================================== */

.dc3-header {
  text-align: center;
  margin-bottom: 12px;
}

.dc3-format {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 3px;
}

.dc3-title {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
}

/* ==========================================================
   SECCIONES
   ========================================================== */

.dc3-section {
  width: 100%;
  margin-bottom: 15px;
  border-left: 1px solid #000;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  box-sizing: border-box;
}

.dc3-section-title {
  background: #000;
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 5px;
  text-transform: uppercase;
  box-sizing: border-box;
}

/* ==========================================================
   CAMPOS
   ========================================================== */

.dc3-field {
  padding: 4px 6px;
  border-top: 1px solid #000;
  box-sizing: border-box;
  min-height: 42px;
}

.dc3-full {
  width: 100%;
}

.dc3-label {
  display: block;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 400;
  margin-bottom: 3px;
}

.dc3-value {
  display: block;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  min-height: 16px;
}

/* ==========================================================
   CURP
   ========================================================== */

.dc3-worker-row {
  display: grid;
  grid-template-columns: 72% 28%;
  border-top: 1px solid #000;
}

.dc3-curp-container {
  padding: 5px;
  border-right: 1px solid #000;
  box-sizing: border-box;
}

.dc3-occupation {
  padding: 5px;
  box-sizing: border-box;
  font-size: 10px;
  line-height: 1.25;
}

.dc3-occupation strong {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 500;
}

/* ==========================================================
   CASILLAS CURP / RFC
   ========================================================== */

.dc3-box-row {
  display: flex;
  width: 100%;
  margin-top: 5px;
}

.dc3-char {
  flex: 1 1 0;
  min-width: 0;
  height: 34px;
  border-top: 1px solid #000;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-size: 12px;
  font-family: "Courier New", monospace;
  font-weight: 700;
}

.dc3-char:first-child {
  border-left: 1px solid #000;
}

/* ==========================================================
   RFC
   ========================================================== */

.dc3-rfc-row {
  border-top: 1px solid #000;
  padding: 5px;
  box-sizing: border-box;
}

.dc3-rfc-label {
  margin-bottom: 4px;
}

.dc3-rfc-boxes {
  width: 50%;
}

.dc3-rfc-boxes .dc3-char {
  height: 36px;
}

/* ==========================================================
   CURSO Y FECHAS
   ========================================================== */

.dc3-course-row {
  display: grid;
  grid-template-columns: 22% 11% 67%;
  border-top: 1px solid #000;
  box-sizing: border-box;
}

.dc3-hours {
  padding: 5px;
  border-right: 1px solid #000;
  box-sizing: border-box;
}

.dc3-big-value {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 500;
}

.dc3-period-label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-right: 1px solid #000;
  box-sizing: border-box;
  line-height: 1.2;
}

.dc3-period {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.dc3-period-block {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 4px;
  box-sizing: border-box;
}

.dc3-period-word {
  margin-right: 5px;
  font-size: 10px;
}

.dc3-period-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ==========================================================
   FECHA
   ========================================================== */

.dc3-date {
  display: flex;
  width: 100%;
  gap: 4px;
}

.dc3-date-group {
  flex: 1;
  text-align: center;
}

.dc3-date-title {
  display: block;
  font-size: 9px;
  margin-bottom: 2px;
}

.dc3-date-boxes {
  display: flex;
}

.dc3-date-boxes .dc3-char {
  height: 31px;
  font-size: 10px;
}

/* ==========================================================
   DECLARACIÓN
   ========================================================== */

.dc3-declaration {
  border: 1px solid #000;
  text-align: center;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.35;
  padding: 10px 12px;
  margin-top: 16px;
}

/* ==========================================================
   FIRMAS
   ========================================================== */

.dc3-signatures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  border-left: 1px solid #000;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 18px 35px 12px;
  box-sizing: border-box;
}

.dc3-signature {
  text-align: center;
  display: flex;
  flex-direction: column;
  min-height: 145px;
}

.dc3-signature-role {
  font-size: 11px;
  min-height: 34px;
  line-height: 1.3;
}

.dc3-signature-space {
  height: 40px;
}

.dc3-signature-name {
  font-size: 10.5px;
  min-height: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 4px;
}

.dc3-signature-line {
  border-bottom: 1px solid #000;
  width: 100%;
  margin-top: 4px;
}

.dc3-signature-caption {
  font-size: 10px;
  margin-top: 4px;
}

/* ============================================================
   SELECT BUSCABLE
   ============================================================ */

.searchable-select {
  position: relative;
  min-width: 0;
}

.searchable-select label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
}

.searchable-control {
  position: relative;
  width: 100%;
}

.searchable-control input {
  box-sizing: border-box;
  width: 100%;
  height: 44px;
  padding: 0 44px 0 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  outline: none;
}

.searchable-control input:focus {
  border-color: var(--onest-blue-700);
  box-shadow: var(--focus);
}

.searchable-arrow {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-500);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.searchable-arrow:hover {
  background: var(--gray-100);
}

.searchable-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 1000;
  box-sizing: border-box;
  max-height: 260px;
  padding: 6px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
}

/* Evita que el menú aparezca cuando tiene [hidden] */
.searchable-menu[hidden] {
  display: none !important;
}

.search-option {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-option:hover {
  background: var(--gray-50);
}

.search-option[hidden] {
  display: none !important;
}

/* ============================================================
   GRID DE FILTROS
   ============================================================ */

.empleados-filtros-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  overflow: visible;
}

@media (max-width: 900px) {
  .empleados-filtros-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
}

.modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  padding: 24px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.modal-head h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.modal-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-700);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--gray-100);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ==========================================================
   EMISIÓN POR LOTE - CONSTANCIAS DC-3
   ========================================================== */

.section-kicker {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0 0 14px;
}

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

.avatar-mini {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Montserrat", sans-serif;
  font-size: 11px;
  font-weight: 700;
  background: var(--onest-blue-100);
  color: var(--onest-blue-700);
}

/* Resalta la fila cuando su checkbox está marcado */
tr:has(.chk-empleado-lote:checked) td {
  background: var(--onest-blue-100);
}

.badge-contador {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  background: var(--neutral-bg);
  color: var(--neutral);
  transition: background .2s ease, color .2s ease;
}

.badge-contador.has-selection {
  background: var(--success-bg);
  color: var(--success);
  font-weight: 600;
}

/* Barra de acción inferior fija, visible al hacer scroll en listas largas */
.emitir-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

.emitir-bar .btn-row {
  align-items: center;
  justify-content: space-between;
}

/* ============================================================
   EMISIÓN POR LOTE - MODAL DE PROGRESO / RESULTADO
   ============================================================ */

.modal-lote-estado,
.modal-lote-resultado {
  text-align: center;
}

.emision-spinner {
  width: 46px;
  height: 46px;
  margin: 4px auto 22px;
  border: 4px solid var(--onest-blue-100);
  border-top-color: var(--onest-blue-700);
  border-radius: 50%;
  animation: spinner-emision-lote 0.8s linear infinite;
}

@keyframes spinner-emision-lote {
  to {
    transform: rotate(360deg);
  }
}

.resultado-lote-ok,
.resultado-lote-warning {
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 26px;
  font-weight: 800;
}

.resultado-lote-ok {
  color: var(--success);
  background: var(--success-bg);
}

.resultado-lote-warning {
  color: var(--warning);
  background: var(--warning-bg);
}

.resultado-lote-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0;
}

.resultado-lote-grid > div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.resultado-lote-grid span,
.resultado-lote-grid strong {
  display: block;
}

.resultado-lote-grid strong {
  margin-top: 6px;
  font-size: 22px;
  font-family: "Montserrat", sans-serif;
}

.modal-lote-resultado .modal-actions {
  justify-content: center;
}

/* ==========================================================
   TABLA DE CONSTANCIAS - ADMIN
   ========================================================== */

.admin-cert-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-cert-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
  border-collapse: collapse;
}

.admin-cert-table th,
.admin-cert-table td {
  padding: 12px 14px;
  vertical-align: middle;
}

.admin-cert-table .col-curso {
  width: 24%;
  min-width: 220px;
}

.admin-cert-table .col-horas {
  width: 8%;
  min-width: 80px;
  text-align: center;
  white-space: nowrap;
}

.admin-cert-table .col-folio {
  width: 15%;
  min-width: 145px;
  white-space: nowrap;
}

.admin-cert-table .col-fecha {
  width: 13%;
  min-width: 135px;
}

.admin-cert-table .col-capacitador {
  width: 19%;
  min-width: 180px;
}

.admin-cert-table .col-estatus {
  width: 8%;
  min-width: 100px;
  text-align: center;
}

/* ==========================================================
   IMPRESIÓN
   ========================================================== */

@media print {

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  .no-print,
  .sidebar,
  .back-link,
  .topline {
    display: none !important;
  }

  .shell {
    display: block !important;
    width: auto !important;
    min-height: 0 !important;
  }

  .main {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .cert {
    box-shadow: none;
    border-width: 2px;
  }

  .cert-page {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    page-break-after: always;
  }

  .cert-page:last-child {
    page-break-after: auto;
  }

  .cert-page::before {
    display: none;
  }

  /* MISMO TAMAÑO QUE LA VISTA PREVIA */
  .dc3-document {
    width: 200mm !important;
    max-width: 200mm !important;
    min-height: 263mm !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    transform: none !important;
    zoom: 1 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .dc3-document,
  .dc3-document * {
    box-sizing: border-box !important;
  }

  /* Evita que elementos importantes se partan entre páginas */
  .dc3-section,
  .dc3-course-row,
  .dc3-declaration,
  .dc3-signatures {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  @page {
    size: letter portrait;
    margin: 8mm;
  }
}