/* =========================================================
   MODAL DOCUMENTO - ULTRA COMPACTO
========================================================= */

.gm-doc-yui-modal {
  padding: 0 !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  background: #f8fbff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
  height: 76vh !important;
  max-height: 76vh !important;
}

#mrcDivModalDialogCont {
  height: 100%;
  max-height: 76vh;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 4px;
  box-sizing: border-box;
}

.gm-doc-modal {
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  color: #0f172a;
  padding: 6px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: visible !important;
}

/* =========================
   HEADER
========================= */
.gm-doc-header-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid #e6edf7;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #f4f8ff 100%);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.gm-doc-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.gm-doc-header-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.gm-doc-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #e8f0ff;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.gm-doc-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

.gm-doc-subtitle {
  margin-top: 2px;
  font-size: 10px;
  color: #64748b;
  line-height: 1.2;
}

/* =========================
   ACCIONES
========================= */
.gm-doc-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 210px;
}

.gm-doc-actions-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.25px;
  color: #64748b;
}

.gm-doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.gm-action-btn {
  border: none !important;
  border-radius: 9px !important;
  padding: 6px 8px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.16s ease;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  white-space: nowrap;
}

.gm-action-dark {
  background: #0f172a !important;
  color: #ffffff !important;
}

.gm-action-blue {
  background: #2563eb !important;
  color: #ffffff !important;
}

.gm-action-yellow {
  background: #f59e0b !important;
  color: #ffffff !important;
}

.gm-action-red {
  background: #dc2626 !important;
  color: #ffffff !important;
}

.gm-action-gray {
  background: #475569 !important;
  color: #ffffff !important;
}

.gm-action-soft {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

/* =========================
   CHIPS
========================= */
.gm-doc-chip-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.gm-doc-chip {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #e5edf8;
}

.gm-doc-chip-label {
  display: block;
  font-size: 8px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  margin-bottom: 2px;
}

.gm-doc-chip-value {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
  line-height: 1.2;
}

/* =========================
   BODY / GRID
========================= */
.gm-doc-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.gm-doc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}

/* =========================
   CARDS
========================= */
.gm-doc-card {
  background: #ffffff;
  border: 1px solid #e6edf7;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.gm-doc-card-head {
  padding: 8px 8px 0 8px;
}

.gm-doc-card-head-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.gm-doc-card-head h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* =========================
   TABLA
========================= */
.gm-doc-table-wrap {
  padding: 6px 8px 4px 8px;
  overflow-x: auto;
}

.gm-doc-table {
  width: 100%;
  border-collapse: collapse;
}

.gm-doc-table tbody tr {
  border-bottom: 1px solid #eef2f7;
}

.gm-doc-table tbody tr:last-child {
  border-bottom: none;
}

.gm-doc-table th {
  width: 100px;
  background: #f8fbff;
  color: #334155;
  font-weight: 800;
  border: none !important;
  padding: 6px 8px !important;
  vertical-align: top;
  font-size: 10px;
  text-align: left;
}

.gm-doc-table td {
  border: none !important;
  color: #0f172a;
  padding: 6px 8px !important;
  vertical-align: top;
  font-size: 10px;
  text-align: left;
  word-break: break-word;
  line-height: 1.25;
}

.gm-doc-copy {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  padding: 1px 4px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1d4ed8;
  font-size: 8px;
  font-weight: 800;
}

/* =========================
   RECORRIDO
========================= */
.gm-doc-subsection {
  padding: 0 8px 8px 8px;
}

.gm-doc-subsection-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}

.gm-doc-traza {
  background: linear-gradient(180deg, #f8fbff 0%, #f4f8fc 100%);
  border: 1px solid #e6edf7;
  border-radius: 8px;
  padding: 6px;
  max-height: 130px;
  overflow: auto;
  font-size: 9px;
  line-height: 1.25;
  color: #334155;
}

/* =========================
   ADJUNTOS
========================= */
.gm-doc-file-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f8fbff;
  border: 1px solid #e5edf8;
  color: #0f172a;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 700;
  max-width: 100%;
}

.gm-doc-file-badge span {
  display: inline-block;
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gm-doc-adjunto-box {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  flex: 1;
}

.gm-doc-preview {
  border: 1px solid #e6edf7;
  border-radius: 10px;
  overflow: auto !important;
  background: #ffffff;
  min-height: 190px;
  height: 280px;
  max-height: 280px;
}

.gm-doc-pdfview {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.gm-doc-download {
  display: flex;
  align-items: center;
}

.gm-doc-download-bottom {
  justify-content: flex-end;
}

.gm-doc-download-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f8fbff;
  border: 1px solid #e6edf7;
  color: #0f172a;
  font-size: 10px;
  font-weight: 700;
  transition: all 0.16s ease;
}

.gm-file-pdf,
.gm-file-word,
.gm-file-generic {
  font-size: 14px;
}

/* =========================
   ESTADOS / LOADING
========================= */
.gm-doc-empty {
  min-height: 150px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #f1f5f9 100%);
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 14px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.3;
}

.gm-doc-loading {
  min-height: 150px;
  border: 1px solid #dbe7f5;
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.gm-doc-loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.gm-doc-loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #dbeafe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: gmDocSpin 0.85s linear infinite;
}

.gm-doc-loading-title {
  font-size: 11px;
  font-weight: 800;
  color: #1e293b;
}

.gm-doc-loading-subtitle {
  font-size: 10px;
  color: #64748b;
  max-width: 180px;
  line-height: 1.3;
}

@keyframes gmDocSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* =========================
   DOCX
========================= */
.gm-docx-render-area {
  width: 100%;
  height: 100%;
  overflow: auto !important;
  background: linear-gradient(180deg, #eef3f8 0%, #eaf0f6 100%);
  padding: 8px;
  box-sizing: border-box;
}

.gm-docx-render-area .docx-wrapper {
  background: transparent !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 0 !important;
}

.gm-docx-render-area .docx-wrapper > section.docx,
.gm-docx-render-area .docx-wrapper .docx {
  width: 520px !important;
  max-width: 520px !important;
  min-height: 720px !important;
  background: #ffffff !important;
  border: 1px solid #d7dee8 !important;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08) !important;
  border-radius: 4px !important;
  margin: 0 auto !important;
  padding: 26px 22px !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

.gm-docx-render-area .docx-wrapper > section.docx p,
.gm-docx-render-area .docx-wrapper > section.docx span,
.gm-docx-render-area .docx-wrapper > section.docx div,
.gm-docx-render-area .docx-wrapper > section.docx td,
.gm-docx-render-area .docx-wrapper > section.docx th,
.gm-docx-render-area .docx-wrapper > section.docx li,
.gm-docx-render-area .docx-wrapper .docx p,
.gm-docx-render-area .docx-wrapper .docx span,
.gm-docx-render-area .docx-wrapper .docx div,
.gm-docx-render-area .docx-wrapper .docx td,
.gm-docx-render-area .docx-wrapper .docx th,
.gm-docx-render-area .docx-wrapper .docx li {
  max-width: 100% !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  line-height: 1.25 !important;
  font-size: 11px !important;
}

/* =========================
   SCROLLS
========================= */
#mrcDivModalDialogCont::-webkit-scrollbar,
.gm-doc-preview::-webkit-scrollbar,
.gm-docx-render-area::-webkit-scrollbar,
.gm-doc-table-wrap::-webkit-scrollbar,
.gm-doc-traza::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

#mrcDivModalDialogCont::-webkit-scrollbar-thumb,
.gm-doc-preview::-webkit-scrollbar-thumb,
.gm-docx-render-area::-webkit-scrollbar-thumb,
.gm-doc-table-wrap::-webkit-scrollbar-thumb,
.gm-doc-traza::-webkit-scrollbar-thumb {
  background: #b8c4d1;
  border-radius: 10px;
}

#mrcDivModalDialogCont::-webkit-scrollbar-track,
.gm-doc-preview::-webkit-scrollbar-track,
.gm-docx-render-area::-webkit-scrollbar-track,
.gm-doc-table-wrap::-webkit-scrollbar-track,
.gm-doc-traza::-webkit-scrollbar-track {
  background: #edf2f7;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1000px) {
  .gm-doc-grid {
    grid-template-columns: 1fr;
  }

  .gm-doc-preview {
    height: 250px;
    max-height: 250px;
  }
}

@media (max-width: 768px) {
  .gm-doc-yui-modal {
    height: 86vh !important;
    max-height: 86vh !important;
  }

  #mrcDivModalDialogCont {
    max-height: 86vh;
  }

  .gm-doc-header-top {
    flex-direction: column;
    align-items: stretch;
  }

  .gm-doc-header-actions {
    min-width: 100%;
    width: 100%;
    align-items: flex-start;
  }

  .gm-doc-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .gm-action-btn {
    width: 100%;
  }

  .gm-doc-chip-group {
    grid-template-columns: 1fr;
  }

  .gm-doc-preview {
    height: 240px;
    max-height: 240px;
  }

  .gm-doc-download-link {
    width: 100%;
    justify-content: center;
  }

  .gm-docx-render-area .docx-wrapper > section.docx,
  .gm-docx-render-area .docx-wrapper .docx {
    width: 320px !important;
    max-width: 320px !important;
    min-height: 480px !important;
    padding: 14px 12px !important;
  }
}
/* El visor ocupa el alto disponible junto a los datos del documento. */
.gm-doc-grid > .gm-doc-card-adjuntos { align-self:stretch; }
.gm-doc-card-adjuntos .gm-doc-adjunto-box { flex:1;min-height:0; }
.gm-doc-card-adjuntos .gm-doc-preview {
  position:relative;flex:1;height:auto;max-height:none;min-height:340px;
  overflow:hidden !important;
}
.gm-doc-card-adjuntos .gm-doc-pdfview {
  position:absolute;inset:0;width:100%;height:100%;
}
@media(max-width:1000px){
  .gm-doc-card-adjuntos .gm-doc-preview {flex:auto;height:65vh;min-height:320px;}
}
