/*
 * L2/P-01 - Contrato compartido para informes integrados de DISAL BI.
 * Este archivo es el único propietario de la geometría exterior, la pila y las
 * superficies de primer nivel de los informes inscritos.
 */

body.disal-report-layout {
  background: transparent;
}

body.orders-lateral-embedded.disal-report-layout .page {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0 24px;
}

body.orders-lateral-embedded.disal-report-layout .shell,
[data-report-layout-root] {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

[data-report-layout-root] {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.report-layout-summary,
.report-layout-summary-host {
  display: grid;
  gap: 8px;
  min-width: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.report-layout-panel {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
  position: relative;
  background: rgba(255, 255, 255, 0.88);
  border-width: 1px;
  border-style: solid;
  border-color: rgba(148, 174, 209, 0.55);
  border-radius: 24px;
  box-shadow: none;
  gap: normal;
}

.report-layout-panel--kpi {
  display: block;
  overflow: hidden;
}

.report-layout-panel--analytic {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.report-layout-panel--filter {
  display: none;
  overflow: visible;
  z-index: 18;
}

[data-report-layout-root] :is(
  .orders-v2-card,
  .orders-12m-table-card,
  .sheet-studio-aside-card,
  .sheet-studio-card
)::before {
  content: none;
}

@media (min-width: 921px) {
  .report-layout-panel--filter {
    display: block;
  }
}

@media (max-width: 980px) {
  body.orders-lateral-embedded.disal-report-layout .page {
    padding: 0 0 16px;
  }
}

/* Base visual aprobada en Diseño > Informe Modelo. */
[data-report-layout-root].report-layout-model-base {
  width: min(100%, 1687px);
  margin-inline: auto;
  padding: 2px 0 24px;
}

.report-layout-model-base {
  display: grid;
  gap: var(--space-3, 10px);
  min-width: 0;
}

.report-layout-model-base .report-layout-masthead,
body.report-model .report-layout-model-base .report-layout-masthead {
  display: grid;
  gap: 14px;
  min-width: 0;
  margin: 0;
  /* El encabezado comparte la guía horizontal de los paneles del informe. */
  padding: 10px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.report-layout-model-base .report-layout-masthead > div:first-child,
.report-layout-model-base .report-layout-panel-header > div:first-child,
body.report-model .report-layout-model-base .report-layout-masthead > div:first-child,
body.report-model .report-layout-model-base .report-layout-panel-header > div:first-child {
  display: grid;
  gap: 7px;
  min-width: 0;
  /* Separa la lectura del borde del panel: 1px de compensación + 10px de aire. */
  padding-inline-start: 11px;
}

.report-layout-model-base .report-layout-masthead h1,
.report-layout-model-base .report-layout-panel-header h2,
body.report-model .report-layout-model-base .report-layout-masthead h1,
body.report-model .report-layout-model-base .report-layout-panel-header h2 {
  margin: 0;
  color: var(--ink, #17233b);
}

.report-layout-model-base .report-layout-masthead h1,
body.report-model .report-layout-model-base .report-layout-masthead h1 {
  font-size: var(--fs-title-lg, 28px);
  font-weight: var(--dashboard-type-weight-regular, 500);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.report-layout-model-base .report-layout-masthead p,
.report-layout-model-base .report-layout-panel-header p,
body.report-model .report-layout-model-base .report-layout-masthead p,
body.report-model .report-layout-model-base .report-layout-panel-header p {
  display: -webkit-box;
  max-width: 60%;
  margin: 0;
  overflow: hidden;
  color: var(--muted, #63708a);
  font-size: var(--fs-body, 15px);
  font-weight: 400;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.report-layout-model-base .report-layout-panel,
body.report-model .report-layout-model-base .report-layout-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 18px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(148, 174, 209, 0.55);
  border-radius: 24px;
  box-shadow: none;
}

.report-layout-model-base .report-layout-panel-header,
body.report-model .report-layout-model-base .report-layout-panel-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  min-width: 0;
}

.report-layout-model-base .report-layout-panel-header h2,
body.report-model .report-layout-model-base .report-layout-panel-header h2 {
  font-size: var(--fs-title-md, 22px);
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  line-height: 1.05;
}

.report-layout-model-base .master-filter-panel,
body.report-model .report-layout-model-base .master-filter-panel {
  box-shadow: none;
}

/* F1 conserva sus overlays, pero su wrapper es estrictamente técnico: la
   propia fila del filtro es la única superficie visible. */
.report-layout-model-base .master-filter-panel.report-layout-panel,
body.report-model .report-layout-model-base .master-filter-panel.report-layout-panel {
  margin: 0;
  padding: 0;
  min-height: 0;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: visible;
}

/* Primitivas estructurales del patrón canónico de Diseño > Informe Modelo.
   Organizan secciones y retículas sin crear una segunda superficie visual. */
.report-layout-model-base .report-section,
.report-layout-model-base .section-header,
.report-layout-model-base .panel-grid {
  box-sizing: border-box;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.report-layout-model-base .report-section {
  display: grid;
  gap: 12px;
}

/* La entrada a una sección tiene más aire que la relación título → panel.
   El shell aporta 10px y este margen completa una separación de 18px. */
.report-layout-model-base .report-section:has(> .section-header) {
  margin-block-start: 8px;
}

.report-layout-model-base .section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.report-layout-model-base .section-heading {
  display: grid;
  gap: var(--space-1, 4px);
  min-width: 0;
  max-width: 60%;
  /* Separa la lectura del borde del panel: 1px de compensación + 10px de aire. */
  padding-inline-start: 11px;
}

.report-layout-model-base .section-heading h2 {
  margin: 0;
  color: var(--ink, #17233b);
  font-size: var(--fs-title-md, 22px);
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  line-height: 1.05;
}

.report-layout-model-base .section-heading p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted, #63708a);
  font-size: var(--fs-body, 15px);
  font-weight: 400;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.report-layout-model-base .section-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.report-layout-model-base .panel-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
}

/* K2 conserva su propia retícula: con seis indicadores cada card ocupa 1/6
   del ancho disponible, en lugar de heredar las doce columnas estructurales. */
.report-layout-model-base .panel-grid.disal-kpi-grid {
  grid-template-columns: repeat(var(--disal-kpi-columns, 6), minmax(0, 1fr));
}

.report-layout-model-base .panel-grid > .panel {
  grid-column: span 12;
  min-width: 0;
}

.report-layout-model-base .panel-grid > .panel-full { grid-column: span 12; }
.report-layout-model-base .panel-grid > .panel-half { grid-column: span 6; }
.report-layout-model-base .panel-grid > .panel-third { grid-column: span 4; }
.report-layout-model-base .panel-grid > .panel-quarter { grid-column: span 3; }
.report-layout-model-base .panel-grid > .panel-wide { grid-column: span 8; }
.report-layout-model-base .panel-grid > .panel-narrow { grid-column: span 4; }

.report-layout-model-base .panel-grid > .panel-compact { min-block-size: 180px; }
.report-layout-model-base .panel-grid > .panel-standard { min-block-size: 280px; }
.report-layout-model-base .panel-grid > .panel-tall { min-block-size: 420px; }

/* T1 / R1-D — Matriz jerárquica heredable.
   La tabla es el único objeto del panel de detalle: table-shell y table-wrap
   conservan sólo la función técnica, mientras la matriz aporta su geometría
   de períodos, jerarquía y drill-down. */
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-table-shell {
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-head h3,
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-head p {
  margin: 0;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-head h3 {
  color: var(--ink, #17233b);
  font-size: var(--fs-title-sm, 16px);
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  line-height: 1.2;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-head p {
  display: -webkit-box;
  max-width: 60%;
  overflow: hidden;
  color: var(--muted, #63708a);
  font-size: var(--fs-data-sm, 13px);
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-tag {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 999px;
  background: rgba(239, 246, 255, 0.78);
  color: #254c92;
  font-size: var(--fs-micro, 11px);
  font-variant-numeric: tabular-nums;
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  line-height: 1;
}

/* T1 usa columnas semánticas y una grilla calculada por el contrato. La
   dimensión primaria recibe siempre el remanente; importe, porcentaje,
   cantidad, fecha y estado se reservan por su contenido real. Ninguna regla
   global puede reemplazar esta geometría con una tabla fija o porcentual. */
.report-layout-model-base [data-disal-component="T1"][data-t1-auto-layout="true"] :is(.model-r1d-columns, .model-r1d-row) {
  grid-template-columns: var(--t1-grid-template, minmax(0, 1fr) max-content max-content max-content max-content) !important;
}

.report-layout-model-base [data-disal-component="T1"][data-t1-auto-layout="true"] [data-table-role="dimension"],
.report-layout-model-base [data-disal-component="T1"][data-t1-auto-layout="true"] [data-table-role="description"] {
  min-width: 0;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.report-layout-model-base [data-disal-component="T1"][data-t1-auto-layout="true"] :is([data-table-role="importe"], [data-table-role="porcentaje"], [data-table-role="cantidad"], [data-table-role="fecha"], [data-table-role="estado"]) {
  overflow: visible;
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-overflow: clip;
  white-space: nowrap;
}

.report-layout-model-base [data-disal-component="T1"][data-t1-auto-layout="true"] .sort-head {
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.report-layout-model-base [data-disal-component="T1"][data-t1-auto-layout="true"] .model-r1d-matrix {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-md, 14px);
  background: rgba(248, 250, 252, 0.58);
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] :is(.model-r1d-columns, .model-r1d-row) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(4, max-content);
  align-items: center;
  column-gap: 6px;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-columns {
  height: 25px;
  padding: 0 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(241, 245, 249, 0.9);
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-columns .sort-head {
  color: var(--muted, #63708a);
  font-size: 10px;
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  text-align: right;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-columns .sort-head:first-child { text-align: left; }

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-list {
  display: grid;
  gap: 4px;
  padding: 4px 0;
}

/* Desde la fila 16 el único scroll permitido pertenece al cuerpo. El
   encabezado queda fuera de este viewport y la grilla conserva el mismo ancho. */
.report-layout-model-base [data-disal-component="T1"][data-t1-vertical-scroll="true"] .model-r1d-list {
  max-block-size: 544px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-row {
  min-height: 36px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.78);
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-row[data-level="1"] { background: rgba(239, 246, 255, 0.82); }

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-name {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  color: var(--ink-soft, #374151);
  font-size: 12px;
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  line-height: 1.15;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-row[data-level="1"] .model-r1d-name { padding-left: 18px; }

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-expander {
  display: inline-grid;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 999px;
  background: #fff;
  color: #2563eb;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  line-height: 1;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-cell {
  min-width: 0;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(219, 234, 254, 0.64);
  color: #254c92;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-cell[data-tone="soft"] {
  background: rgba(252, 231, 243, 0.62);
  color: #6b4a65;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-note {
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid rgba(204, 219, 241, 0.76);
  color: var(--muted, #63708a);
  font-size: var(--fs-micro, 11px);
  line-height: 1.45;
}

/* R1-D exacto de Diseño > Tarjetas. La marca T1 convierte la muestra visual
   en un componente heredable: misma geometría, colores y jerarquía, con la
   distribución semántica calculada por el contrato para evitar desbordes. */
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-pattern-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3, 10px);
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-pattern-heading > div {
  display: grid;
  gap: var(--space-1, 4px);
  min-width: 0;
}

.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-pattern-heading :is(h3, p) { margin: 0; }
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-pattern-heading h3 {
  color: var(--ink, #17233b);
  font-size: var(--fs-title-sm, 16px);
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  line-height: 1.2;
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-pattern-heading p {
  max-width: 60%;
  color: var(--muted, #63708a);
  font-size: var(--fs-data-sm, 13px);
  line-height: 1.4;
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-pattern-code {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid rgba(180, 204, 239, 0.72);
  border-radius: 999px;
  background: rgba(239, 246, 255, 0.82);
  color: #17489f;
  font-size: var(--fs-micro, 11px);
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  white-space: nowrap;
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-matrix {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-md, 14px);
  background: rgba(248, 250, 252, 0.58);
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] :is(.data-row-matrix-header, .data-row-matrix-row) {
  display: grid;
  grid-template-columns: minmax(156px, 1.35fr) repeat(3, minmax(58px, 0.5fr)) minmax(68px, 0.62fr);
  align-items: center;
  column-gap: 6px;
}
.report-layout-model-base [data-disal-component="T1"][data-t1-auto-layout="true"] :is(.data-row-matrix-header, .data-row-matrix-row) {
  grid-template-columns: var(--t1-grid-template, minmax(0, 1fr) max-content max-content max-content max-content) !important;
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-matrix-header {
  min-height: 25px;
  padding: 0 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(241, 245, 249, 0.9);
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-matrix-header span {
  min-width: 0;
  color: var(--muted, #63708a);
  font-size: 10px;
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-align: right;
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-matrix-header span:first-child { text-align: left; }
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-matrix-list {
  display: grid;
  gap: 4px;
  padding: 4px 0;
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-matrix-row {
  min-height: 36px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.78);
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-matrix-row[data-level="1"] { background: rgba(239, 246, 255, 0.82); }
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-matrix-name {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  color: var(--ink-soft, #374151);
  font-size: 12px;
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-matrix-row[data-level="1"] .data-row-matrix-name { padding-left: 18px; }
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-matrix-expander {
  display: inline-grid;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 999px;
  background: #fff;
  color: #2563eb;
  font: inherit;
  font-size: 10px;
  line-height: 1;
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] button.data-row-matrix-expander { cursor: pointer; }
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-matrix-cell {
  min-width: 0;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(219, 234, 254, 0.64);
  color: #254c92;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-matrix-cell[data-tone="soft"] {
  background: rgba(252, 231, 243, 0.62);
  color: #6b4a65;
}
.report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-pattern-note {
  margin: 0;
  padding-top: var(--space-3, 10px);
  border-top: 1px solid rgba(204, 219, 241, 0.76);
  color: var(--muted, #63708a);
  font-size: var(--fs-micro, 11px);
  line-height: 1.45;
}

/* Copia literal de Diseño > Tarjetas / R1-D.
   No se adapta ni se reconstruye: Informe Modelo recibe el mismo bloque, las
   mismas clases y los mismos valores de la fuente aprobada. */
.report-layout-model-base .data-row-pattern-card {
  --data-row-tone: #2563eb;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid rgba(204, 219, 241, 0.92);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.report-layout-model-base .data-row-pattern-card--matrix { grid-column: 1 / -1; }

.report-layout-model-base .data-row-pattern-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.report-layout-model-base .data-row-pattern-heading > div {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.report-layout-model-base .data-row-pattern-heading h3,
.report-layout-model-base .data-row-pattern-heading p { margin: 0; }

.report-layout-model-base .data-row-pattern-heading h3 {
  color: var(--ink);
  font-size: var(--fs-title-sm);
  font-weight: var(--dashboard-type-weight-emphasis);
  line-height: 1.2;
}

.report-layout-model-base .data-row-pattern-heading p {
  color: var(--muted);
  font-size: var(--fs-data-sm);
  line-height: 1.4;
}

.report-layout-model-base .data-row-pattern-code {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid rgba(180, 204, 239, 0.72);
  border-radius: 999px;
  background: rgba(239, 246, 255, 0.82);
  color: #17489f;
  font-size: var(--fs-micro);
  font-weight: var(--dashboard-type-weight-emphasis);
  white-space: nowrap;
}

.report-layout-model-base .data-row-matrix {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-md);
  background: rgba(248, 250, 252, 0.58);
}

.report-layout-model-base .data-row-matrix-header,
.report-layout-model-base .data-row-matrix-row {
  display: grid;
  grid-template-columns: minmax(156px, 1.35fr) repeat(3, minmax(58px, 0.5fr)) minmax(68px, 0.62fr);
  align-items: center;
  column-gap: 6px;
}

.report-layout-model-base .data-row-matrix-header {
  height: 25px;
  padding: 0 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(241, 245, 249, 0.9);
}

.report-layout-model-base .data-row-matrix-header span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: var(--dashboard-type-weight-emphasis);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-layout-model-base .data-row-matrix-header span:first-child { text-align: left; }

.report-layout-model-base .data-row-matrix-list { display: grid; gap: 4px; padding: 4px 0; }

.report-layout-model-base .data-row-matrix-row { min-height: 36px; padding: 5px 8px; background: rgba(255, 255, 255, 0.78); }
.report-layout-model-base .data-row-matrix-row[data-level="1"] { background: rgba(239, 246, 255, 0.82); }

.report-layout-model-base .data-row-matrix-name {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: var(--dashboard-type-weight-emphasis);
  line-height: 1.15;
}

.report-layout-model-base .data-row-matrix-row[data-level="1"] .data-row-matrix-name { padding-left: 18px; }

.report-layout-model-base .data-row-matrix-expander {
  display: inline-grid;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  place-items: center;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 999px;
  background: #fff;
  color: #2563eb;
  font-size: 10px;
  font-weight: var(--dashboard-type-weight-emphasis);
  line-height: 1;
}

.report-layout-model-base .data-row-matrix-cell {
  min-width: 0;
  padding: 4px 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(219, 234, 254, 0.64);
  color: #254c92;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: var(--dashboard-type-weight-emphasis);
  line-height: 1;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-layout-model-base .data-row-matrix-cell[data-tone="soft"] { background: rgba(252, 231, 243, 0.62); color: #6b4a65; }

.report-layout-model-base .data-row-pattern-note {
  margin: 0;
  padding-top: var(--space-3);
  border-top: 1px solid rgba(204, 219, 241, 0.76);
  color: var(--muted);
  font-size: var(--fs-micro);
  line-height: 1.45;
}

/* Variante reutilizable de Diseño > Informe Modelo: una sección analítica es
   una única superficie P-01. El título, la descripción y los módulos viven
   dentro de ese panel; las unidades internas se ordenan planas con divisores. */
body.report-model .report-layout-model-base .report-section:has(> .section-header) {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  margin-block-start: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(148, 174, 209, 0.55);
  border-radius: 24px;
  box-shadow: none;
}

body.report-model .report-layout-model-base .report-section:has(> .section-header) > .section-header {
  flex: 0 0 auto;
  gap: 0;
  padding: 0 0 9px;
  border-bottom: 1px solid var(--disal-line-soft, rgba(148, 163, 184, 0.24));
}

body.report-model .report-layout-model-base .report-section:has(> .section-header) > .section-header .section-heading {
  max-width: 100%;
  padding-inline-start: 0;
}

body.report-model .report-layout-model-base .report-section:has(> .section-header) > .panel-grid {
  flex: 1 1 auto;
  gap: 0;
  padding-top: 10px;
}

body.report-model .report-layout-model-base .report-section:has(> .section-header) > .panel-grid > .model-analytic-panel {
  min-block-size: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* IM5/IM6 declaran su composición, no la infieren del ID de la sección.
   split-2 y split-3 comparten una única superficie P-01: los módulos quedan
   planos, sin gap ni caja propia, y se separan con un divisor continuo. */
body.report-model .report-layout-model-base .panel-grid[data-panel-composition] {
  gap: 0 !important;
}

body.report-model .report-layout-model-base .panel-grid[data-panel-composition] > .model-analytic-panel {
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.report-model .report-layout-model-base .panel-grid:is([data-panel-composition="split-2"], [data-panel-composition="split-3"]) > .model-analytic-panel + .model-analytic-panel {
  padding-inline-start: 12px;
  border-inline-start: 1px solid var(--disal-line-soft, rgba(148, 163, 184, 0.24)) !important;
}

body.report-model .report-layout-model-base .panel-grid:is([data-panel-composition="split-2"], [data-panel-composition="split-3"]) > .model-analytic-panel:not(:last-child) {
  padding-inline-end: 12px;
}

/* Puente de adopción para informes existentes: conserva su semántica y
   contenido propio, pero los inscribe en las proporciones del Informe Modelo.
   No crea un wrapper visual adicional ni altera la lógica de cada hoja. */
body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] {
  --page-width-gutter: 0px;
  --page-width-max: 1687px;
}

/* Base estructural: Teclum conserva el shell de aplicación, pero su informe
   usa el lienzo, ritmo y grilla transparente del Modelo. */
body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] > .shell,
body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .finanzas-sheet-view {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* Filtro compacto: reutiliza los filtros reales de Teclum (período y moneda)
   sin introducir una dimensión ajena al informe. */
body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] :is(.dashboard-period-row, .finance-currency-switch) {
  min-height: 40px;
  padding: 4px;
  border: 1px solid rgba(148, 174, 209, 0.55);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: none;
}

/* K2: misma retícula compacta de seis indicadores del Modelo, usando las
   tarjetas semánticas ya existentes de Teclum. */
body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .principal-kpi-grid {
  grid-template-columns: repeat(var(--disal-kpi-columns, 6), minmax(0, 1fr));
  gap: 10px;
}

body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .finanzas-sheet-view > .panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 18px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(148, 174, 209, 0.55);
  border-radius: 24px;
  box-shadow: none;
}

body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .panel-header,
body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .detail-block-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
}

body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] :is(.panel-header, .detail-block-header) > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
  max-width: 60%;
  padding-inline-start: 11px;
}

body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] :is(.panel-header, .detail-block-header) h2 {
  margin: 0;
  color: var(--ink, #17233b);
  font-size: var(--fs-title-md, 22px);
  font-weight: var(--dashboard-type-weight-emphasis, 700);
  line-height: 1.05;
}

body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] :is(.panel-header, .detail-block-header) p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted, #63708a);
  font-size: var(--fs-body, 15px);
  font-weight: 400;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .principal-kpi-grid {
  grid-auto-rows: minmax(132px, auto);
  gap: 12px;
}

body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .principal-kpi-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 132px;
  padding: 11px 11px 4px 14px;
  border: 1px solid color-mix(in srgb, var(--kpi-color) 18%, rgba(203, 213, 225, 0.72));
  border-radius: 14px;
  background: linear-gradient(160deg, #ffffff 0%, color-mix(in srgb, var(--kpi-color) 7%, #ffffff) 100%);
  box-shadow: var(--shadow-card-soft, 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 20px rgba(15, 23, 42, 0.06));
}

body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .principal-kpi-card .kpi-name {
  color: var(--ink, #111827);
  font-size: var(--fs-data-sm, 14px);
  font-weight: var(--dashboard-type-weight-emphasis, 500);
  line-height: 1.2;
  text-transform: none;
}

body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .principal-kpi-card .kpi-value {
  color: var(--ink, #111827);
  font-size: var(--fs-title-md, 24px);
  font-weight: var(--dashboard-type-weight-emphasis, 500);
  line-height: 1;
  letter-spacing: -0.03em;
}

body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .principal-kpi-card .kpi-note {
  padding-top: 0;
  border-top: 0;
  font-size: var(--fs-micro, 13px);
  line-height: 1.35;
}

/* P-01: dentro de Teclum, tablas y gráficos pertenecen directamente al panel
   temático. Sus shells sólo conservan la función técnica de layout/overflow,
   sin repetir una segunda superficie visual. Las KPI cards son unidades
   semánticas y no forman parte de esta normalización. */
body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .finanzas-sheet-view[data-sheet-view="eerr-teclum"] :is(.table-shell, .table-wrap, .monthly-shell, .region-chart-card, .other-chart-card) {
  margin: 0;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Igual que los módulos hermanos de Informe Modelo: el espacio interno se
   ordena con divisores, nunca con una segunda caja. */
body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .finanzas-sheet-view[data-sheet-view="eerr-teclum"] > .panel > .panel-gap {
  padding-top: 14px;
  border-top: 1px solid var(--disal-line-soft, rgba(148, 163, 184, 0.24));
}

body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .finanzas-sheet-view[data-sheet-view="eerr-teclum"] :is(.metric-highlight-grid, .other-highlight-grid, .expense-share-grid) > * + * {
  padding-inline-start: 14px !important;
  border-inline-start: 1px solid var(--disal-line-soft, rgba(148, 163, 184, 0.24)) !important;
}

body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .finanzas-sheet-view[data-sheet-view="eerr-teclum"] :is(.metric-highlight-grid, .other-highlight-grid, .expense-share-grid) > :first-child {
  padding-inline-end: 14px !important;
}

@media (max-width: 980px) {
  body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .finanzas-sheet-view > .panel {
    /* Teclum conserva un override legacy con !important para el panel móvil;
       la adopción debe prevalecer sólo dentro de esta hoja inscrita. */
    padding: 9px !important;
    border-radius: 24px !important;
  }

  /* El shell móvil identifica #resumen con un selector por ID; conserva la
     misma superficie heredada que el resto de los paneles de Teclum. */
  html body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .finanzas-sheet-view > #resumen.panel {
    padding: 9px !important;
  }

  body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .finanzas-sheet-view[data-sheet-view="eerr-teclum"] :is(.metric-highlight-grid, .other-highlight-grid, .expense-share-grid) > * + * {
    padding: 14px 0 0 !important;
    border-top: 1px solid var(--disal-line-soft, rgba(148, 163, 184, 0.24));
    border-inline-start: 0 !important;
  }

  body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] .finanzas-sheet-view[data-sheet-view="eerr-teclum"] :is(.metric-highlight-grid, .other-highlight-grid, .expense-share-grid) > :first-child {
    padding-inline-end: 0 !important;
  }

  body.theme-soft-rounded.report-variant-analytics.teclum-report [data-report-inheritance="modelo-informe"] :is(.panel-header, .detail-block-header) > div:first-child {
    max-width: 100%;
  }
}

@media (max-width: 980px) {
  body.report-model .report-layout-model-base .report-section:has(> .section-header) {
    padding: 9px;
  }

  body.report-model .report-layout-model-base .panel-grid:is([data-panel-composition="split-2"], [data-panel-composition="split-3"]) > .model-analytic-panel + .model-analytic-panel {
    padding: 10px 0 0;
    border-top: 1px solid var(--disal-line-soft, rgba(148, 163, 184, 0.24)) !important;
    border-inline-start: 0 !important;
  }

  body.report-model .report-layout-model-base .panel-grid:is([data-panel-composition="split-2"], [data-panel-composition="split-3"]) > .model-analytic-panel:not(:last-child) {
    padding-inline-end: 0;
  }
}

@media (max-width: 980px) {
  .report-layout-model-base .section-header {
    display: grid;
  }

  .report-layout-model-base .section-heading {
    max-width: 100%;
  }

  .report-layout-model-base .section-actions {
    justify-content: flex-start;
  }

  .report-layout-model-base .panel-grid > :is(.panel-half, .panel-third, .panel-quarter, .panel-wide, .panel-narrow) {
    grid-column: span 12;
  }

  .report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] :is(.model-r1d-columns, .model-r1d-row) {
    grid-template-columns: minmax(0, 1fr) minmax(62px, auto) minmax(68px, auto);
  }

  .report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] :is(.data-row-matrix-header, .data-row-matrix-row) {
    grid-template-columns: minmax(0, 1fr) minmax(62px, auto) minmax(68px, auto);
  }

  .report-layout-model-base [data-disal-component="T1"][data-t1-auto-layout="true"] :is(.model-r1d-columns, .model-r1d-row) {
    grid-template-columns: var(--t1-mobile-grid-template, minmax(0, 1fr) max-content max-content) !important;
  }

  .report-layout-model-base [data-disal-component="T1"][data-t1-auto-layout="true"] :is(.data-row-matrix-header, .data-row-matrix-row) {
    grid-template-columns: var(--t1-mobile-grid-template, minmax(0, 1fr) max-content max-content) !important;
  }

  .report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] [data-period="previous"] { display: none; }

  .report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .model-r1d-head p { max-width: 100%; }
  .report-layout-model-base [data-disal-component="T1"][data-disal-pattern="R1-D"] .data-row-pattern-heading p { max-width: 100%; }

  /* Copia literal del corte responsive de R1-D en Diseño > Tarjetas. */
  .report-layout-model-base .data-row-matrix-header,
  .report-layout-model-base .data-row-matrix-row {
    grid-template-columns: minmax(0, 1fr) minmax(62px, auto) minmax(68px, auto);
  }

  .report-layout-model-base .data-row-matrix-header [data-period="previous"],
  .report-layout-model-base .data-row-matrix-row [data-period="previous"] { display: none; }
}

@media (max-width: 980px) {
  [data-report-layout-root].report-layout-model-base {
    width: 100%;
    padding: 6px;
    box-sizing: border-box;
  }

  .report-layout-model-base .report-layout-masthead,
  .report-layout-model-base .report-layout-panel {
    padding: var(--mobile-panel-padding, 9px);
  }

  .report-layout-model-base .report-layout-masthead p,
  .report-layout-model-base .report-layout-panel-header p {
    max-width: 100%;
  }
}
