/**
 * UI de listado compartida (base: módulo Dotación / Carné).
 * Usar body.module-app-ui + main.module-app-main.
 */

body.module-app-ui {
  --dot-brand: #d41316;
  --dot-brand-hover: #b01013;
  --dot-brand-border: #b01013;
  --dot-brand-light: #f4d3d5;
  --dot-brand-light-hover: #e8c1c4;
  --dot-surface: #f5f5f5;
  --dot-card: #fff;
  --dot-radius: 12px;
  --dot-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  --font-family-app: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-size-title: 18px;
  --font-size-card-title: 14px;
  --font-size-base: 13px;
  --font-size-sm: 12px;
  --color-text: #333;
  --color-text-muted: #666;
  --color-text-subtle: #64748b;
  --color-border: #eee;
  --color-border-input: #ddd;
  --focus-ring: 0 0 0 3px rgba(212, 19, 22, 0.1);
  background: var(--dot-surface);
  background-image: none;
  font-family: var(--font-family-app);
  font-size: var(--font-size-base);
  color: var(--color-text);
  line-height: 1.6;
}

body.module-app-ui .admin-layout {
  background: transparent;
  padding: 24px 20px;
  max-width: none;
  justify-content: center;
}

body.module-app-ui .module-app-main,
body.module-app-ui .dotacion-app-main {
  width: 80%;
  max-width: 80%;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family-app);
  font-size: var(--font-size-base);
  color: var(--color-text);
}

@media (max-width: 1024px) {
  body.module-app-ui .module-app-main,
  body.module-app-ui .dotacion-app-main {
    width: 100%;
    max-width: 100%;
  }
}

/* Móvil: hueco entre el header de la app y el título de página (el layout llega a padding 0). */
@media (max-width: 900px) {
  body.module-app-ui #adminLayout.admin-layout {
    padding: 16px 10px 20px !important;
  }
}

@media (max-width: 480px) {
  body.module-app-ui #adminLayout.admin-layout {
    padding: 14px 8px 16px !important;
  }
}

body.module-app-ui .demo-section,
body.module-app-ui .section.demo-section {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  width: 100%;
  max-width: none;
  margin: 0;
}

.dot-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.dot-page-header__actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dot-page-title {
  margin: 0;
  font-size: var(--font-size-title, 18px);
  font-weight: 600;
  color: var(--color-text, #333);
  font-family: var(--font-family-app, Roboto, sans-serif);
  text-align: left;
  line-height: 1.3;
}

body.module-app-ui .dot-page-back {
  display: inline-block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text-muted, #666);
  font-size: 13px;
  font-weight: 400;
  font-family: var(--font-family-app, Roboto, sans-serif);
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
}

body.module-app-ui .dot-page-back:hover,
body.module-app-ui .dot-page-back:focus-visible {
  color: var(--dot-brand, #d41316);
  text-decoration: none;
}

.dot-btn-primary,
.dot-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  min-height: 37px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  box-sizing: border-box;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  border: 1px solid transparent;
  font-family: Roboto, sans-serif;
}

.dot-btn-primary i,
.dot-btn-secondary i {
  font-size: 13px;
  line-height: 1;
}

.dot-btn-primary {
  background: var(--dot-brand, #d41316);
  color: #fff;
  border-color: var(--dot-brand-border, #b01013);
}

.dot-btn-primary:hover {
  background: var(--dot-brand-hover, #b01013);
  border-color: #8f0e10;
  color: #fff;
}

.dot-btn-primary i {
  color: #fff;
}

.dot-btn-secondary {
  background: var(--dot-brand-light, #f4d3d5);
  color: var(--dot-brand, #d41316);
  border-color: var(--dot-brand-light, #f4d3d5);
}

.dot-btn-secondary:hover {
  background: var(--dot-brand-light-hover, #e8c1c4);
  border-color: #ddb6b9;
}

.pedidos-search-wrap {
  margin: 0 auto 12px;
  display: flex;
  justify-content: center;
}

.pedidos-search {
  width: min(100%, 520px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

.pedidos-search > i {
  color: #64748b;
  font-size: 13px;
}

.pedidos-search input {
  flex: 1;
  min-width: 0;
  border: none !important;
  outline: none;
  font-size: 13px;
  font-weight: 400;
  background: transparent;
  color: #333;
  font-family: Roboto, sans-serif;
  box-shadow: none !important;
}

.pedidos-search input::placeholder {
  color: #94a3b8;
}

.pedidos-search .btn-pedidos-buscar {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--dot-brand, #d41316);
  background: var(--dot-brand, #d41316);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  font-family: Roboto, sans-serif;
}

.pedidos-search .btn-pedidos-buscar:hover {
  background: var(--dot-brand-hover, #b01013);
  border-color: var(--dot-brand-hover, #b01013);
}

.edd-search-clear-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  color: #64748b;
  background: transparent;
  text-decoration: none;
  flex-shrink: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  line-height: 1;
  box-sizing: border-box;
}

.edd-search-clear-btn[hidden] {
  display: none !important;
}

.edd-search-clear-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.edd-list-card {
  background: #fff;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

.edd-list-card + .edd-list-card {
  margin-top: 14px;
}

.edd-list-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  min-height: 66px;
  box-sizing: border-box;
  border-bottom: 1px solid #eee;
  background: linear-gradient(180deg, #fff 0%, #fafafa 100%);
}

.edd-list-card__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #333;
  line-height: 1.3;
  font-family: Roboto, sans-serif;
}

.edd-list-card__count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: Roboto, sans-serif;
  line-height: 1.3;
}

.edd-list-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  background: #fff;
}

.edd-list-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
  font-family: Roboto, sans-serif;
  font-size: 13px;
}

.edd-list-table th,
.edd-list-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e8e8e8;
  vertical-align: middle;
}

.edd-list-table th {
  font-weight: 700;
  color: #333;
  background: var(--dot-brand-light, #f4d3d5);
  white-space: nowrap;
  border-bottom: 1px solid #e8e8e8;
}

.edd-list-table td {
  color: #333;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.edd-list-table tbody tr:hover {
  background: #fafafa;
}

.edd-list-empty {
  text-align: center;
  color: #64748b;
  padding: 28px 12px !important;
  font-size: 13px;
}

.edd-list-card .btn-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #64748b;
  text-decoration: none;
  cursor: pointer;
}

.edd-list-card .btn-icon:hover {
  background: var(--dot-brand-light, #f4d3d5);
  border-color: #e8c1c4;
  color: var(--dot-brand, #d41316);
}

.dot-vista-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 auto 16px;
  padding: 6px;
  background: #f1f5f9;
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dot-vista-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  background: transparent;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  font-family: Roboto, sans-serif;
}

.dot-vista-tab:hover {
  color: #334155;
  background: rgba(255, 255, 255, 0.7);
}

.dot-vista-tab.is-active {
  color: #0f172a;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.edd-list-col-acciones,
.edd-list-acciones {
  width: 118px;
  min-width: 118px;
  max-width: 132px;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}

.edd-list-acciones .btn-icon + .btn-icon {
  margin-left: 6px;
}

@media (max-width: 720px) {
  .edd-list-table {
    min-width: 0;
  }

  .edd-list-table thead {
    display: none;
  }

  .edd-list-table tr {
    display: block;
    margin: 0 12px 12px;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 8px 10px;
    background: #fff;
  }

  .edd-list-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #f1f5f9;
    padding: 8px 4px;
  }

  .edd-list-table td:last-child {
    border-bottom: none;
  }

  .edd-list-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #64748b;
    flex: 0 0 42%;
  }

  .edd-list-empty {
    display: block !important;
    text-align: center;
    border: none;
    margin: 0;
  }

  .edd-list-empty::before {
    display: none;
  }
}

/* Modal compartido module-app-ui (Formaciones, Incapacidades, …) */
.modal.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 10040;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.modal.open {
  display: flex;
}

.modal .for-modal-card {
  background: #fff;
  border-radius: 12px;
  max-width: min(560px, 100%);
  width: 100%;
  max-height: min(92dvh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family-app, Roboto, sans-serif);
}

.modal .for-modal-card--detalle {
  max-width: min(640px, 100%);
  max-height: min(92dvh, 820px);
}

.modal .for-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #e0e0e0;
  background: #fff;
  flex-shrink: 0;
}

.modal .for-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #333;
  line-height: 1.3;
}

.modal .for-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #666;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-sizing: border-box;
}

.modal .for-modal-close:hover,
.modal .for-modal-close:focus-visible {
  background: #f5f5f5;
  color: var(--dot-brand, #d41316);
  outline: none;
}

.modal .for-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  background: #fff;
}

.modal .for-modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid #e0e0e0;
  background: #fafafa;
  flex-shrink: 0;
}

.for-detalle-dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 20px;
  margin: 0;
}

.for-detalle-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.for-detalle-row--full {
  grid-column: 1 / -1;
}

.for-detalle-row dt {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  line-height: 1.25;
}

.for-detalle-row dd {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: #0f172a;
  line-height: 1.35;
  word-break: break-word;
  white-space: pre-wrap;
}

.for-detalle-empty {
  margin: 0;
  font-size: 13px;
  color: #64748b;
}

.for-detalle-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.for-detalle-section + .for-detalle-section {
  padding-top: 16px;
  border-top: 1px solid #eef2f7;
}

.for-detalle-section__title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
}

.for-detalle-section .for-detalle-dl {
  gap: 12px 16px;
}

.for-detalle-dl--codigo-diagnostico {
  grid-template-columns: 5.75rem minmax(0, 1fr);
  gap: 10px 12px;
}

.for-detalle-dl--codigo-diagnostico .for-detalle-row:first-child dd {
  font-weight: 600;
  letter-spacing: 0.03em;
}

@media (max-width: 560px) {
  .for-detalle-dl {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .for-detalle-dl--codigo-diagnostico {
    grid-template-columns: 5rem minmax(0, 1fr);
  }
}

