/* EMTEC — Data tables (cabecera fija + cuerpo con scroll + footer) */

.emtec-card:has(.emtec-datatable) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.emtec-stack--table-fill > .emtec-card:has(.emtec-datatable) {
  flex: 1 1 0;
}

/* —— Panel —— */
.emtec-datatable {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  background: var(--emtec-surface);
  border-top: 1px solid var(--emtec-border);
}

.emtec-datatable--fill {
  flex: 1 1 0;
  min-height: 0;
}

.emtec-datatable__hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  margin: 0;
  padding: 7px 14px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--emtec-primary-dark);
  text-align: center;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border-bottom: 1px solid #dbeafe;
}

.emtec-datatable--overflow-x .emtec-datatable__hint:not([hidden]) {
  display: flex;
}

.emtec-datatable__hint i {
  font-size: 0.82rem;
  opacity: 0.85;
}

/* —— Column titles (fixed, outside vertical scroll) —— */
.emtec-datatable__head {
  flex: 0 0 auto;
  overflow: hidden;
  background: #ffffff;
  border-bottom: 1px solid var(--emtec-border);
  z-index: 3;
}

.emtec-datatable__head .emtec-table {
  margin: 0;
  width: 100%;
  will-change: transform;
}

.emtec-datatable__head th {
  padding: 10px 12px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: var(--emtec-table-head-color, #475569);
  background: #ffffff;
  border: none;
  white-space: nowrap;
  vertical-align: middle;
}

/* —— Scrollable body —— */
.emtec-datatable__body {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  background: var(--emtec-table-row-bg, #ffffff);
}

.emtec-datatable__body:not(.emtec-datatable__body--fill) {
  flex: 0 1 auto;
  max-height: min(420px, 55vh);
}

.emtec-datatable__body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.emtec-datatable__body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.emtec-datatable__body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.emtec-datatable__body .emtec-table {
  margin: 0;
  width: 100%;
  height: auto;
}

.emtec-datatable__body tbody tr {
  height: auto;
}

.emtec-table-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-top: 1px solid var(--emtec-border);
  background: var(--emtec-surface-2);
}

.emtec-table-footer-meta {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--emtec-muted);
  text-align: center;
  line-height: 1.35;
}

/* —— Table base —— */
.emtec-table {
  border-collapse: collapse;
  border-spacing: 0;
  font-size: calc(0.875rem * var(--emtec-table-font-scale, 1));
  line-height: 1.45;
  color: var(--emtec-text);
}

.emtec-table--compact {
  table-layout: fixed;
}

.emtec-table--filterable:not(.emtec-table--observaciones):not(.emtec-table--registros):not(.emtec-table--reparaciones) {
  table-layout: fixed;
}

.emtec-datatable__body td {
  height: auto;
  padding: 7px 10px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.35;
  border-bottom: 1px solid var(--emtec-table-row-border, #eef2f6);
  background: var(--emtec-table-row-bg, #ffffff);
  transition: background-color 0.14s ease;
}

.emtec-datatable__body tbody tr:last-child td {
  border-bottom: none;
}

.emtec-datatable__body tbody tr:hover td {
  background: var(--emtec-table-row-hover, #f8fafc);
}

html.emtec-table-striped .emtec-datatable__body tbody tr:nth-child(even) td {
  background: #fafbfd;
}

html.emtec-table-striped .emtec-datatable__body tbody tr:nth-child(even):hover td {
  background: #f4f7fb;
}

.emtec-table .emtec-filter-hidden {
  display: none !important;
}

.emtec-table .emtec-row-edit td,
.emtec-table .emtec-table-empty-row td {
  overflow: visible;
  white-space: normal;
}

.emtec-crud-block:not(.is-editing) .emtec-row-edit {
  display: none;
}

.emtec-table .emtec-row-edit td .emtec-edit-panel {
  text-align: left;
}

.emtec-table .emtec-highlight-cell[data-highlight-wrap="strong"] > strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emtec-cell-clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  line-height: 1.4;
}

.emtec-table .emtec-row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.emtec-table .emtec-row-actions .emtec-btn-sm {
  padding: 5px 8px;
  font-size: 0.72rem;
  white-space: nowrap;
}

.emtec-table .emtec-chip,
.emtec-table .emtec-code {
  margin-inline: auto;
}

.emtec-table .emtec-obs-estado-form,
.emtec-table td .emtec-select-wrap {
  margin-inline: auto;
}

.emtec-table .emtec-registros-fecha time,
.emtec-table .emtec-obs-fecha time {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.emtec-table .emtec-chip {
  padding: 3px 8px;
  font-size: 0.72rem;
  gap: 4px;
}

/* —— Wide tables —— */
.emtec-table--registros,
.emtec-table--observaciones,
.emtec-table--reparaciones {
  table-layout: fixed;
  min-width: 960px;
}

.emtec-datatable--wide .emtec-datatable__head .emtec-table,
.emtec-datatable--wide .emtec-datatable__body .emtec-table {
  min-width: 960px;
}

.emtec-table--registros .emtec-registros-col--usuario { width: 12%; }
.emtec-table--registros .emtec-registros-col--herramienta { width: 18%; }
.emtec-table--registros .emtec-registros-col--codigo { width: 12%; }
.emtec-table--registros .emtec-registros-col--tipo { width: 10%; }
.emtec-table--registros .emtec-registros-col--fecha { width: 14%; }
.emtec-table--registros .emtec-registros-col--obs { width: 34%; }

.emtec-obs-col--fecha { width: 11%; }
.emtec-obs-col--usuario { width: 11%; }
.emtec-obs-col--herramienta { width: 14%; }
.emtec-obs-col--texto { width: 28%; }
.emtec-obs-col--estado { width: 14%; }
.emtec-obs-col--acciones { width: 196px; }

.emtec-table--observaciones .emtec-obs-texto {
  text-align: center;
}

.emtec-table--observaciones .emtec-obs-texto[data-emtec-tooltip] {
  cursor: help;
}

.emtec-table--observaciones .emtec-obs-texto .emtec-cell-clamp-2 {
  text-align: center;
}

.emtec-table--observaciones .emtec-select-trigger {
  min-height: 36px;
}

.emtec-table--observaciones .emtec-select-value-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emtec-table--scan td {
  vertical-align: middle;
}

/* Mis herramientas (técnico): menos ruido en móvil */
@media (max-width: 768px) {
  body.emtec-page-mis-herramientas {
    height: 100dvh;
    overflow: hidden;
  }

  body.emtec-page-mis-herramientas .emtec-main {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body.emtec-page-mis-herramientas .emtec-main > .emtec-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-top: var(--space-sm);
  }

  .emtec-page-mis-herramientas .emtec-card-header {
    display: none;
  }

  .emtec-page-mis-herramientas .emtec-stack--table-fill {
    min-height: 0;
    flex: 1;
  }

  .emtec-page-mis-herramientas .emtec-stack--table-fill > .emtec-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .emtec-page-mis-herramientas .emtec-datatable {
    flex: 1;
    min-height: 0;
  }

  .emtec-page-mis-herramientas .emtec-datatable__body--fill {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .emtec-page-mis-herramientas .emtec-datatable__body--fill > .emtec-table:has(.emtec-table-empty-row) {
    flex: 1;
    min-height: min(42dvh, 280px);
    height: auto;
  }

  .emtec-page-mis-herramientas .emtec-datatable__body--fill .emtec-table-empty-row {
    height: 100%;
  }

  .emtec-page-mis-herramientas .emtec-datatable__body--fill .emtec-table-empty-row td.emtec-empty {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: min(38dvh, 240px);
    height: 100%;
    padding: 28px 16px !important;
  }

  .emtec-page-mis-herramientas .emtec-datatable--cards .emtec-table-empty-row td.emtec-empty {
    min-height: min(38dvh, 240px);
  }

  /* Listas simples (2 columnas: nombre + fecha) — también tras partir cabecera/cuerpo */
  .emtec-datatable--cards .emtec-table--simple-list tbody > tr:not(.emtec-table-empty-row),
  .emtec-datatable--cards[data-emtec-col-count="2"] .emtec-table--body tbody > tr:not(.emtec-table-empty-row),
  .emtec-datatable--cards .emtec-table:has(thead th:nth-child(2)):not(:has(thead th:nth-child(3))) tbody > tr:not(.emtec-table-empty-row) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    align-items: center;
    margin-bottom: 8px;
    padding: 10px 12px;
    border: 1px solid var(--emtec-border);
    border-radius: 12px;
    background: var(--emtec-surface);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  }

  .emtec-datatable--cards .emtec-table--simple-list tbody > tr:not(.emtec-table-empty-row) td,
  .emtec-datatable--cards[data-emtec-col-count="2"] .emtec-table--body tbody > tr:not(.emtec-table-empty-row) td,
  .emtec-datatable--cards .emtec-table:has(thead th:nth-child(2)):not(:has(thead th:nth-child(3))) tbody > tr:not(.emtec-table-empty-row) td {
    display: block;
    padding: 0;
    border: none;
  }

  .emtec-datatable--cards .emtec-table--simple-list tbody > tr:not(.emtec-table-empty-row) td::before,
  .emtec-datatable--cards[data-emtec-col-count="2"] .emtec-table--body tbody > tr:not(.emtec-table-empty-row) td::before,
  .emtec-datatable--cards .emtec-table:has(thead th:nth-child(2)):not(:has(thead th:nth-child(3))) tbody > tr:not(.emtec-table-empty-row) td::before {
    display: none;
  }

  .emtec-datatable--cards .emtec-table--simple-list tbody > tr:not(.emtec-table-empty-row) td:nth-child(1),
  .emtec-datatable--cards[data-emtec-col-count="2"] .emtec-table--body tbody > tr:not(.emtec-table-empty-row) td:nth-child(1),
  .emtec-datatable--cards .emtec-table:has(thead th:nth-child(2)):not(:has(thead th:nth-child(3))) tbody > tr:not(.emtec-table-empty-row) td:nth-child(1) {
    font-weight: 700;
    font-size: 0.9rem;
    text-align: left;
  }

  .emtec-datatable--cards .emtec-table--simple-list tbody > tr:not(.emtec-table-empty-row) td:nth-child(2),
  .emtec-datatable--cards[data-emtec-col-count="2"] .emtec-table--body tbody > tr:not(.emtec-table-empty-row) td:nth-child(2),
  .emtec-datatable--cards .emtec-table:has(thead th:nth-child(2)):not(:has(thead th:nth-child(3))) tbody > tr:not(.emtec-table-empty-row) td:nth-child(2) {
    font-size: 0.78rem;
    color: var(--emtec-muted);
    white-space: nowrap;
    text-align: right;
  }

  .emtec-datatable--cards .emtec-table--simple-list,
  .emtec-datatable--cards[data-emtec-col-count="2"] .emtec-table--body {
    display: block;
    width: 100% !important;
  }

  .emtec-datatable--cards .emtec-table--simple-list tbody,
  .emtec-datatable--cards[data-emtec-col-count="2"] .emtec-table--body tbody {
    display: block;
  }
}

@media (max-width: 768px) {
  .emtec-page-scan.emtec-scan-camera-active .emtec-datatable--cards .emtec-datatable__body tbody tr {
    margin-bottom: 6px;
  }

}

/* —— Empty state —— */
.emtec-empty {
  text-align: center;
  padding: 40px 20px !important;
  color: var(--emtec-muted);
  border: none !important;
  background: radial-gradient(circle at 50% 35%, rgba(26, 86, 196, 0.04) 0%, transparent 62%);
}

.emtec-empty i {
  font-size: 2rem;
  display: block;
  margin: 0 auto 10px;
  opacity: 0.35;
  line-height: 1;
  color: var(--emtec-primary);
}

.emtec-datatable__body--fill:has(> .emtec-table:not(:has(tbody:not([hidden]) tr:not(.emtec-table-empty-row)))) {
  display: flex;
  flex-direction: column;
}

.emtec-datatable__body--fill > .emtec-table:not(:has(tbody:not([hidden]) tr:not(.emtec-table-empty-row))) {
  flex: 1 1 auto;
  height: 100%;
  min-height: 180px;
}

.emtec-datatable__body--fill > .emtec-table:not(:has(tbody:not([hidden]) tr:not(.emtec-table-empty-row))) .emtec-table-empty-row {
  height: 100%;
}

.emtec-datatable__body--fill > .emtec-table:not(:has(tbody:not([hidden]) tr:not(.emtec-table-empty-row))) .emtec-table-empty-row td.emtec-empty {
  height: 100%;
  vertical-align: middle;
}

/* —— Select dropdown above scroll —— */
.emtec-datatable__body:has(.emtec-select-wrap.is-open) {
  overflow: visible;
}

/* —— Mobile: listas compactas —— */
.emtec-datatable--cards .emtec-datatable__head {
  display: none;
}

.emtec-datatable--cards .emtec-datatable__body {
  overflow-x: hidden;
  padding: 6px 8px 10px;
}

.emtec-datatable--cards .emtec-datatable__body .emtec-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 0 !important;
  width: 100% !important;
}

.emtec-datatable--cards .emtec-datatable__body > tbody:not(.emtec-crud-block) {
  display: block;
}

/* Filas CRUD: tarjeta compacta (nombre + meta + acciones) */
.emtec-datatable--cards .emtec-datatable__body tbody.emtec-crud-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title badge"
    "meta meta"
    "actions actions";
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--emtec-border);
  border-radius: 12px;
  background: var(--emtec-surface);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.emtec-datatable--cards .emtec-crud-block tr.emtec-row-view {
  display: contents;
}

.emtec-datatable--cards .emtec-crud-block tr.emtec-row-view td {
  display: block;
  padding: 0;
  border: none;
  text-align: left;
  white-space: normal !important;
}

.emtec-datatable--cards .emtec-crud-block tr.emtec-row-view td::before {
  display: none !important;
}

.emtec-datatable--cards .emtec-crud-block tr.emtec-row-view td:nth-child(1) {
  grid-area: title;
  font-size: 0.92rem;
  line-height: 1.35;
  min-width: 0;
}

.emtec-datatable--cards .emtec-crud-block tr.emtec-row-view td:nth-child(1) strong {
  display: block;
  font-weight: 700;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Inventario herramientas (6 columnas): marca · serie · código */
.emtec-datatable--cards .emtec-table--inventory .emtec-crud-block {
  grid-template-areas:
    "title badge"
    "meta meta"
    "actions actions";
}

.emtec-datatable--cards .emtec-table--inventory .emtec-crud-block tr.emtec-row-view td:nth-child(2),
.emtec-datatable--cards .emtec-table--inventory .emtec-crud-block tr.emtec-row-view td:nth-child(3),
.emtec-datatable--cards .emtec-table--inventory .emtec-crud-block tr.emtec-row-view td:nth-child(4) {
  grid-area: meta;
  display: inline;
  font-size: 0.78rem;
  color: var(--emtec-muted);
  vertical-align: middle;
}

.emtec-datatable--cards .emtec-table--inventory .emtec-crud-block tr.emtec-row-view td:nth-child(2)::after,
.emtec-datatable--cards .emtec-table--inventory .emtec-crud-block tr.emtec-row-view td:nth-child(3)::after {
  content: " · ";
  color: #94a3b8;
}

.emtec-datatable--cards .emtec-table--inventory .emtec-crud-block tr.emtec-row-view td:nth-child(4) .emtec-code {
  font-size: 0.72rem;
  padding: 2px 6px;
  vertical-align: middle;
}

.emtec-datatable--cards .emtec-table--inventory .emtec-crud-block tr.emtec-row-view td:nth-child(5) {
  grid-area: badge;
  justify-self: end;
  align-self: start;
}

.emtec-datatable--cards .emtec-table--inventory .emtec-crud-block tr.emtec-row-view td:nth-child(6) {
  grid-area: actions;
  grid-column: 1 / -1;
  padding-top: 6px;
  margin-top: 2px;
  border-top: 1px solid #f1f5f9;
}

/* Usuarios (5 columnas) */
.emtec-datatable--cards .emtec-table--filterable:not(.emtec-table--inventory):has(thead th:nth-child(5)):not(:has(thead th:nth-child(6))) .emtec-crud-block {
  grid-template-areas:
    "title title"
    "meta badge"
    "actions actions";
}

.emtec-datatable--cards .emtec-table--filterable:not(.emtec-table--inventory):has(thead th:nth-child(5)):not(:has(thead th:nth-child(6))) .emtec-crud-block tr.emtec-row-view td:nth-child(2) {
  grid-area: meta;
  font-size: 0.8rem;
  color: var(--emtec-muted);
}

.emtec-datatable--cards .emtec-table--filterable:not(.emtec-table--inventory):has(thead th:nth-child(5)):not(:has(thead th:nth-child(6))) .emtec-crud-block tr.emtec-row-view td:nth-child(3),
.emtec-datatable--cards .emtec-table--filterable:not(.emtec-table--inventory):has(thead th:nth-child(5)):not(:has(thead th:nth-child(6))) .emtec-crud-block tr.emtec-row-view td:nth-child(4) {
  grid-area: badge;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-self: end;
  justify-content: flex-end;
}

.emtec-datatable--cards .emtec-table--filterable:not(.emtec-table--inventory):has(thead th:nth-child(5)):not(:has(thead th:nth-child(6))) .emtec-crud-block tr.emtec-row-view td:nth-child(5) {
  grid-area: actions;
  grid-column: 1 / -1;
  padding-top: 6px;
  border-top: 1px solid #f1f5f9;
}

/* Marcas (3 columnas) */
.emtec-datatable--cards .emtec-table--filterable:has(thead th:nth-child(3)):not(:has(thead th:nth-child(4))) .emtec-crud-block {
  grid-template-areas:
    "title badge"
    "actions actions";
}

.emtec-datatable--cards .emtec-table--filterable:has(thead th:nth-child(3)):not(:has(thead th:nth-child(4))) .emtec-crud-block tr.emtec-row-view td:nth-child(2) {
  grid-area: badge;
  justify-self: end;
}

.emtec-datatable--cards .emtec-table--filterable:has(thead th:nth-child(3)):not(:has(thead th:nth-child(4))) .emtec-crud-block tr.emtec-row-view td:nth-child(3) {
  grid-area: actions;
  grid-column: 1 / -1;
  padding-top: 6px;
  border-top: 1px solid #f1f5f9;
}

/* Acciones en fila: iconos compactos */
.emtec-datatable--cards .emtec-crud-block .emtec-row-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.emtec-datatable--cards .emtec-crud-block .emtec-row-actions .emtec-btn,
.emtec-datatable--cards .emtec-crud-block .emtec-row-actions form {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
}

.emtec-datatable--cards .emtec-crud-block .emtec-row-actions .emtec-btn {
  min-height: 36px;
  padding: 0 10px;
  font-size: 0;
  gap: 0;
}

.emtec-datatable--cards .emtec-crud-block .emtec-row-actions .emtec-btn i {
  font-size: 0.95rem;
  margin: 0;
}

.emtec-datatable--cards .emtec-crud-block tr.emtec-row-edit {
  display: block;
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--emtec-border);
}

.emtec-datatable--cards .emtec-crud-block tr.emtec-row-edit td {
  display: block;
  padding: 0;
}

/* Tablas anchas / filas especiales: tarjetas con etiquetas */
.emtec-datatable--cards .emtec-datatable__body tbody:not(.emtec-crud-block) > tr.emtec-row-view,
.emtec-datatable--cards .emtec-datatable__body tbody tr.emtec-obs-row,
.emtec-datatable--cards .emtec-datatable__body tbody tr.emtec-registros-row,
.emtec-datatable--cards .emtec-datatable--wide .emtec-datatable__body tbody.emtec-crud-block {
  display: block;
  border: 1px solid var(--emtec-border);
  border-radius: 12px;
  background: var(--emtec-surface);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  margin-bottom: 8px;
  overflow: hidden;
}

.emtec-datatable--cards .emtec-datatable--wide .emtec-crud-block tr.emtec-row-view {
  display: block;
}

.emtec-datatable--cards .emtec-datatable__body tbody:not(.emtec-crud-block) > tr.emtec-row-view td,
.emtec-datatable--cards .emtec-datatable__body tbody tr.emtec-obs-row td,
.emtec-datatable--cards .emtec-datatable__body tbody tr.emtec-registros-row td,
.emtec-datatable--cards .emtec-datatable--wide .emtec-crud-block tr.emtec-row-view td {
  display: grid;
  grid-template-columns: minmax(88px, 32%) 1fr;
  gap: 4px 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}

.emtec-datatable--cards .emtec-datatable__body tbody:not(.emtec-crud-block) > tr.emtec-row-view td::before,
.emtec-datatable--cards .emtec-datatable__body tbody tr.emtec-obs-row td::before,
.emtec-datatable--cards .emtec-datatable__body tbody tr.emtec-registros-row td::before,
.emtec-datatable--cards .emtec-datatable--wide .emtec-crud-block tr.emtec-row-view td::before {
  content: attr(data-label);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--emtec-muted);
}

.emtec-datatable--cards .emtec-datatable__body tbody tr td:last-child {
  border-bottom: none;
}

.emtec-datatable--cards .emtec-datatable__body tbody:not(.emtec-crud-block) > tr.emtec-row-view td:last-child,
.emtec-datatable--cards .emtec-datatable__body tbody tr.emtec-obs-row td:last-child,
.emtec-datatable--cards .emtec-datatable__body tbody tr.emtec-registros-row td:last-child {
  background: var(--emtec-surface-2);
  padding-top: 10px;
}

.emtec-datatable--cards .emtec-table-empty-row {
  display: block;
  margin-bottom: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

.emtec-datatable--cards .emtec-table-empty-row td::before {
  display: none !important;
}

.emtec-datatable--cards .emtec-table-empty-row td.emtec-empty {
  display: block !important;
  padding: 32px 16px !important;
  text-align: center;
}

.emtec-datatable--cards tbody.emtec-filter-hidden {
  display: none !important;
}

/* —— Page layout helpers —— */
.emtec-main.emtec-main--table-layout {
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.emtec-main.emtec-main--table-layout .emtec-content {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.emtec-stack--table-fill {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.emtec-card:has(.emtec-datatable) .emtec-card-header {
  flex: 0 0 auto;
  padding: var(--space-md) var(--space-lg);
  background: var(--emtec-surface);
  border-bottom: 1px solid var(--emtec-border);
}

.emtec-card:has(.emtec-datatable) .emtec-card-header h2,
.emtec-card:has(.emtec-datatable) .emtec-card-header h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0;
}

@media (max-width: 768px) {
  .emtec-main.emtec-main--table-layout > .emtec-content {
    padding: 10px;
  }

  .emtec-card:has(.emtec-datatable) .emtec-card-header {
    padding: var(--space-sm) var(--space-md);
  }

  .emtec-card-header--mobile-compact .emtec-card-header-start {
    display: none;
  }

  .emtec-card-header--mobile-compact .emtec-card-header-actions {
    width: 100%;
  }

  .emtec-table-footer {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .emtec-chip {
    font-size: 0.68rem;
    padding: 3px 8px;
  }
}
