/* v1.3.235 — Odstupy-only central-zone geometry correction.
   The main facade row has eight explicit central tracks:
   Length, Width/Height, p, Openings count, Facade area, Openings area,
   calculated facade area, and Distance. */

html body #facade-table.facade-zoned-table {
  --odstupy-length-column: var(--pbs-column-extra-wide,112px);
  --odstupy-width-column: var(--pbs-column-extra-wide,112px);
  --odstupy-p-column: var(--pbs-column-regular,88px);
  --odstupy-opening-count-column: var(--pbs-column-regular,88px);
  --odstupy-standard-column: var(--pbs-column-regular,88px);
  --odstupy-distance-column: var(--pbs-column-wide,140px);
  --facadeMiddleWidth: calc(
    var(--odstupy-length-column) +
    var(--odstupy-width-column) +
    var(--odstupy-p-column) +
    var(--odstupy-opening-count-column) +
    (var(--odstupy-standard-column) * 3) +
    var(--odstupy-distance-column)
  ) !important;
  --facadeMinTableWidth: calc(
    var(--pbs-left-zone-min,235px) +
    var(--facadeMiddleWidth) +
    var(--facadeRightZone,72px)
  ) !important;
}

/* One authoritative track definition for header, ordinary rows, grouped rows,
   and recovery rows. Length and Width are deliberately identical. */
html body #facade-table.facade-zoned-table .facade-zone-middle-grid {
  display: grid !important;
  grid-template-columns:
    var(--odstupy-length-column)
    var(--odstupy-width-column)
    var(--odstupy-p-column)
    var(--odstupy-opening-count-column)
    var(--odstupy-standard-column)
    var(--odstupy-standard-column)
    var(--odstupy-standard-column)
    var(--odstupy-distance-column) !important;
  width: var(--facadeMiddleWidth) !important;
  min-width: var(--facadeMiddleWidth) !important;
  max-width: var(--facadeMiddleWidth) !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

/* Prevent legacy metric-specific shell sizing from making equal tracks look
   unequal. Both first tracks use the same complete box model. */
html body #facade-table.facade-zoned-table .facade-zone-middle-grid > :nth-child(1),
html body #facade-table.facade-zoned-table .facade-zone-middle-grid > :nth-child(2),
html body #facade-table.facade-zoned-table .facade-zone-middle-grid > :nth-child(1) .num-wrap,
html body #facade-table.facade-zoned-table .facade-zone-middle-grid > :nth-child(2) .num-wrap,
html body #facade-table.facade-zoned-table .facade-zone-middle-grid > :nth-child(1) .metric-input-shell,
html body #facade-table.facade-zoned-table .facade-zone-middle-grid > :nth-child(2) .metric-input-shell {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}
html body #facade-table.facade-zoned-table .facade-zone-middle-grid > :nth-child(1),
html body #facade-table.facade-zoned-table .facade-zone-middle-grid > :nth-child(2) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}

/* p is a standard-width track, not a wide editor track. */
html body #facade-table.facade-zoned-table .facade-zone-middle-grid > :nth-child(3) {
  width: var(--odstupy-p-column) !important;
  min-width: var(--odstupy-p-column) !important;
  max-width: var(--odstupy-p-column) !important;
  box-sizing: border-box !important;
}

/* Center the Fasáda header label inside the identifier track. */
html body #facade-table.facade-zoned-table > thead > tr.facade-zone-header
  > th:first-child .pbs-zone-left-grid > :first-child {
  justify-self: stretch !important;
  text-align: center !important;
  align-self: center !important;
}

/* The Distance track owns its complete extended width. Its text and unit may
   not be clipped or painted beneath the right action zone. */
html body #facade-table.facade-zoned-table .facade-zone-middle-grid > :nth-child(8),
html body #facade-table.facade-zoned-table .facade-distance-value,
html body #facade-table.facade-zoned-table .facade-distance-message,
html body #facade-table.facade-zoned-table .facade-distance-dual {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  white-space: nowrap !important;
  text-overflow: clip !important;
}
html body #facade-table.facade-zoned-table .facade-zone-middle-grid > :nth-child(8) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding-left: 6px !important;
  padding-right: 6px !important;
  position: relative !important;
  z-index: 1 !important;
}

/* Keep physical zones disjoint. The middle cell receives exactly the new sum;
   the right cell starts only after it and remains above no central content. */
html body #facade-table.facade-zoned-table > colgroup > col.facade-zone-middle-col,
html body #facade-table.facade-zoned-table > thead > tr > th:nth-child(2),
html body #facade-table.facade-zoned-table > tbody > tr > td.facade-zone-middle {
  width: var(--facadeMiddleWidth) !important;
  min-width: var(--facadeMiddleWidth) !important;
  max-width: var(--facadeMiddleWidth) !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}
html body #facade-table.facade-zoned-table > colgroup > col.facade-zone-right-col,
html body #facade-table.facade-zoned-table > thead > tr > th:last-child,
html body #facade-table.facade-zoned-table > tbody > tr > td.facade-zone-right {
  width: var(--facadeRightZone,72px) !important;
  min-width: var(--facadeRightZone,72px) !important;
  max-width: var(--facadeRightZone,72px) !important;
  position: relative !important;
  z-index: 2 !important;
  box-sizing: border-box !important;
}
