/*
 * PBS central table geometry contract — v1.3.265
 *
 * This is the only authoritative specification for table row height,
 * table control height and table icon-button footprint.
 */
:root {
  --pbs-table-row-height: 32px;
  --pbs-table-control-height: 28px;
  --pbs-table-icon-size: 28px;
  --pbs-table-cell-padding-block: 2px;
  --pbs-table-corner-radius: 4px;

  /* Central fixed table-column widths. */
  --oneThirdSize: 32px;
  --pbs-column-half: 44px;
  --pbs-column-narrow: 66px;
  --pbs-column-regular: 88px;
  --pbs-column-extra-wide: 112px;
  --pbs-table-action-border: #000;

  /* Compatibility aliases: references only, never independent values. */
  --pbs-unified-table-row-height: var(--pbs-table-row-height);
  --pbs-unified-table-control-height: var(--pbs-table-control-height);
  --pbs-unified-table-icon-size: var(--pbs-table-icon-size);
  --pbs-header-row-height: var(--pbs-table-row-height);
  --pbs-data-row-height: var(--pbs-table-row-height);
  --pbs-main-header-row-height: var(--pbs-table-row-height);
  --pbs-row-height: var(--pbs-table-row-height);
  --pbs-table-input-height: var(--pbs-table-control-height);
}

/* All main tables and nested subtables use the same row geometry. */
:is(
  #main-table, #fc-table, #facade-table,
  table.subtable, table.room-subtable, table.openings-table,
  table.opening-table, table.segment-table, table.facade-table,
  table.fc-subtable, table.fc-room-table, table.room-table
) :is(thead, tbody, tfoot) > tr,
:is(
  #main-table, #fc-table, #facade-table,
  table.subtable, table.room-subtable, table.openings-table,
  table.opening-table, table.segment-table, table.facade-table,
  table.fc-subtable, table.fc-room-table, table.room-table
) > tr {
  height: var(--pbs-table-row-height) !important;
  min-height: var(--pbs-table-row-height) !important;
  max-height: var(--pbs-table-row-height) !important;
}

:is(
  #main-table, #fc-table, #facade-table,
  table.subtable, table.room-subtable, table.openings-table,
  table.opening-table, table.segment-table, table.facade-table,
  table.fc-subtable, table.fc-room-table, table.room-table
) tr > :is(th, td) {
  height: var(--pbs-table-row-height) !important;
  min-height: var(--pbs-table-row-height) !important;
  max-height: var(--pbs-table-row-height) !important;
  padding-top: var(--pbs-table-cell-padding-block) !important;
  padding-bottom: var(--pbs-table-cell-padding-block) !important;
  box-sizing: border-box !important;
  vertical-align: middle !important;
}

/* Every table icon button, including plus buttons in add/footer rows. */
:is(
  #main-table, #fc-table, #facade-table,
  table.subtable, table.room-subtable, table.openings-table,
  table.opening-table, table.segment-table, table.facade-table,
  table.fc-subtable, table.fc-room-table, table.room-table
) :is(
  button.icon-btn, span.icon-btn, .icon-btn,
  button.pbs-add-new-icon, .pbs-add-new-icon,
  button.btn-add-room-left, .btn-add-room-left,
  button.icon-add, .icon-add,
  .fc-icon-placeholder
) {
  width: var(--pbs-table-icon-size) !important;
  min-width: var(--pbs-table-icon-size) !important;
  max-width: var(--pbs-table-icon-size) !important;
  height: var(--pbs-table-icon-size) !important;
  min-height: var(--pbs-table-icon-size) !important;
  max-height: var(--pbs-table-icon-size) !important;
  flex: 0 0 var(--pbs-table-icon-size) !important;
  flex-basis: var(--pbs-table-icon-size) !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Table editors reference the same central control height. */
:is(
  #main-table, #fc-table, #facade-table,
  table.subtable, table.room-subtable, table.openings-table,
  table.opening-table, table.segment-table, table.facade-table,
  table.fc-subtable, table.fc-room-table, table.room-table
) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  height: var(--pbs-table-control-height) !important;
  min-height: var(--pbs-table-control-height) !important;
  max-height: var(--pbs-table-control-height) !important;
  box-sizing: border-box !important;
}

/* Unified rounded outer corners for the first header row and final bottom row. */
:is(
  #main-table, #fc-table, #facade-table,
  table.subtable, table.room-subtable, table.openings-table,
  table.opening-table, table.segment-table, table.facade-table,
  table.fc-subtable, table.fc-room-table, table.room-table
) {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border-radius: var(--pbs-table-corner-radius) !important;
  overflow: hidden !important;
}

:is(#main-table, #fc-table, #facade-table,
    table.subtable, table.room-subtable, table.openings-table,
    table.opening-table, table.segment-table, table.facade-table,
    table.fc-subtable, table.fc-room-table, table.room-table)
> :is(thead, tbody):first-child > tr:first-child > :first-child {
  border-top-left-radius: var(--pbs-table-corner-radius) !important;
}
:is(#main-table, #fc-table, #facade-table,
    table.subtable, table.room-subtable, table.openings-table,
    table.opening-table, table.segment-table, table.facade-table,
    table.fc-subtable, table.fc-room-table, table.room-table)
> :is(thead, tbody):first-child > tr:first-child > :last-child {
  border-top-right-radius: var(--pbs-table-corner-radius) !important;
}
:is(#main-table, #fc-table, #facade-table,
    table.subtable, table.room-subtable, table.openings-table,
    table.opening-table, table.segment-table, table.facade-table,
    table.fc-subtable, table.fc-room-table, table.room-table)
> :is(tfoot, tbody):last-child > tr:last-child > :first-child {
  border-bottom-left-radius: var(--pbs-table-corner-radius) !important;
}
:is(#main-table, #fc-table, #facade-table,
    table.subtable, table.room-subtable, table.openings-table,
    table.opening-table, table.segment-table, table.facade-table,
    table.fc-subtable, table.fc-room-table, table.room-table)
> :is(tfoot, tbody):last-child > tr:last-child > :last-child {
  border-bottom-right-radius: var(--pbs-table-corner-radius) !important;
}

/* Fire Compartments: white document and white arrow buttons use black borders. */
#fc-table :is(.icon-create, .icon-assign-empty, .icon-assign) {
  border-color: var(--pbs-table-action-border) !important;
}
