/**
 * Editorial chart tables + matrices (PRC-style).
 * Horizontal rules only — no cell grid.
 */

.bhi-chart-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Flex/grid parents expand to intrinsic nowrap table width unless min-width is 0. */
.entry-content .bhi-chart-wrap,
.gb-grid-column .bhi-chart-wrap,
.gb-container .bhi-chart-wrap {
  max-width: 100%;
  min-width: 0;
}

.entry-content .gb-grid-wrapper,
.entry-content .gb-grid-column,
.entry-content .gb-container {
  min-width: 0;
  max-width: 100%;
}

.bhi-chart-description {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.45;
  color: #444;
}

.bhi-data-table-container,
.bhi-semantic-matrix-container,
.bhi-pivot-table-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.bhi-data-table,
.bhi-semantic-matrix,
.bhi-pivot-table {
  width: max-content;
  min-width: 100%;
  max-width: none;
  border-collapse: collapse;
  border-spacing: 0;
  background: transparent;
  font-size: 14px;
  line-height: 1.35;
  color: #1a1a1a;
}

.bhi-data-table thead th,
.bhi-semantic-matrix thead th,
.bhi-pivot-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #555;
  background: transparent;
  border: 0;
  border-bottom: 2px solid #1a1a1a;
  white-space: nowrap;
  vertical-align: bottom;
}

.bhi-data-table thead th.is-numeric,
.bhi-semantic-matrix thead th:not(.row-header),
.bhi-pivot-table thead th.is-numeric {
  text-align: right;
}

.bhi-data-table tbody td,
.bhi-semantic-matrix tbody td,
.bhi-pivot-table tbody td,
.bhi-data-table tfoot td,
.bhi-semantic-matrix tfoot td,
.bhi-pivot-table tfoot td {
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid #e6e6e6;
  vertical-align: top;
  background: transparent;
}

.bhi-data-table tbody tr:last-child td,
.bhi-semantic-matrix tbody tr:last-child td,
.bhi-pivot-table tbody tr:last-child td {
  border-bottom-color: #cfcfcf;
}

.bhi-data-table tbody tr:hover td,
.bhi-semantic-matrix tbody tr:hover td,
.bhi-pivot-table tbody tr:hover td {
  background: rgba(0, 0, 0, 0.025);
}

.bhi-data-table td.is-numeric,
.bhi-semantic-matrix td.numeric,
.bhi-pivot-table td.is-numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}

.bhi-data-table td.is-empty,
.bhi-semantic-matrix td.is-empty {
  color: #bbb;
}

.bhi-data-table td.is-boolean-yes {
  color: #1c475f;
  font-weight: 600;
}

.bhi-data-table .row-label,
.bhi-semantic-matrix .row-header,
.bhi-pivot-table .row-header {
  text-align: left;
  font-weight: 550;
  color: #111;
  white-space: nowrap;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
  box-shadow: 4px 0 8px -6px rgba(0, 0, 0, 0.18);
}

.bhi-semantic-matrix thead .row-header,
.bhi-pivot-table thead .row-header {
  z-index: 2;
  background: #fff;
}

.bhi-data-table tfoot td,
.bhi-semantic-matrix tfoot td,
.bhi-pivot-table tfoot td,
.bhi-semantic-matrix .totals-row td,
.bhi-data-table .bhi-table-totals td {
  font-weight: 700;
  border-top: 2px solid #1a1a1a;
  border-bottom: 0;
  background: transparent;
  padding-top: 11px;
}

.bhi-semantic-matrix .year-header {
  text-align: center;
  font-weight: 700;
  border-bottom: 1px solid #cfcfcf;
}

.bhi-table-pagination {
  margin-top: 8px;
  font-size: 12px;
  color: #666;
}

/* Editor design attributes — applied when tableStyle is not `semantic`. */
.bhi-data-table-container.is-styled {
  background: var(--bhi-table-bg, #ffffff);
  padding: var(--bhi-table-pad, 16px);
  border: var(--bhi-table-bw, 1px) solid var(--bhi-table-bc, #e0e0e0);
  border-radius: var(--bhi-table-radius, 4px);
  box-sizing: border-box;
  overflow: hidden;
}

.bhi-data-table-container.is-styled .bhi-data-table {
  width: 100%;
  min-width: 100%;
  color: var(--bhi-table-text, #1e1e1e);
  background: transparent;
}

.bhi-data-table-container.is-styled .bhi-data-table thead th {
  background: var(--bhi-table-header-bg, #f0f0f1);
  color: var(--bhi-table-header-text, #1e1e1e);
  border: 0;
  border-bottom: 1px solid var(--bhi-table-bc, #e0e0e0);
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--bhi-table-header-size, 14px);
  font-weight: var(--bhi-table-header-weight, 600);
  padding: var(--bhi-table-cell-pad, 8px) 12px;
}

.bhi-data-table-container.is-styled .bhi-data-table tbody td,
.bhi-data-table-container.is-styled .bhi-data-table tfoot td {
  background: transparent;
  color: inherit;
  padding: var(--bhi-table-cell-pad, 8px) 12px;
  border: 0;
  border-bottom: 1px solid var(--bhi-table-bc, #e0e0e0);
}

.bhi-data-table-container.is-styled.enable-zebra .bhi-data-table tbody tr:nth-child(even) td {
  background: var(--bhi-table-zebra, #f9f9f9);
}

.bhi-data-table-container.is-styled.enable-row-hover .bhi-data-table tbody tr:hover td {
  background: var(--bhi-table-hover, #e8f4fc);
}

@media (max-width: 640px) {
  .bhi-data-table,
  .bhi-semantic-matrix,
  .bhi-pivot-table {
    font-size: 13px;
  }

  .bhi-data-table thead th,
  .bhi-semantic-matrix thead th,
  .bhi-pivot-table thead th,
  .bhi-data-table tbody td,
  .bhi-semantic-matrix tbody td,
  .bhi-pivot-table tbody td {
    padding: 8px 10px;
  }
}
