/* =========================================================
   GlobeWarn — fit.css  (r2)

   The first pass made tables fit and left them looking like a spreadsheet
   that had been shrunk. This pass gives both forms a shape worth reading.

   Wide form: a quiet ledger. Header in small caps, hairline rules, numbers
   aligned on the decimal in tabular figures, the subject column carrying the
   weight. No vertical rules and no zebra stripes — the eye tracks a row
   perfectly well on baseline alone, and every extra line is noise.

   Narrow form: a stack of cards, one per row, with the subject as its title
   and the values in a tidy label-and-value grid underneath. It should look
   like it was designed that way, not like a table that lost.

   The floor is 0.84rem — 14.3 px at the 17 px root — in both forms.
   ========================================================= */

/* --- wide form ----------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-variant-numeric: tabular-nums;
}

table thead th {
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim, #55606d);
  text-align: start;
  padding: 0.3rem 0.75rem 0.45rem 0;
  border-bottom: 1px solid var(--line-strong, #8c99a8);
  white-space: nowrap;
}

table tbody td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--line, #c9d2dc);
  vertical-align: baseline;
  line-height: 1.5;
}

table tbody tr:last-child td { border-bottom: 0; }

/* The last cell should not carry padding into the margin. */
table thead th:last-child,
table tbody td:last-child { padding-right: 0; }

/* The subject column carries the prose and the weight; it takes the slack. */
table td:first-child,
table th:first-child { white-space: normal; }

table tbody td:first-child { font-weight: 600; }

/* Everything after it is short: a status, a count, a cadence. Keeping these
   on one line is what makes the row scannable. */
table td:not(:first-child),
table th:not(:first-child) { white-space: nowrap; }

table th, table td {
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  min-width: 0;
}

/* --- narrow form: one card per row --------------------------------------- */

table.gw-stacked,
table.gw-stacked tbody,
table.gw-stacked tr,
table.gw-stacked td {
  display: block;
  width: 100%;
}

table.gw-stacked { border-collapse: separate; }

table.gw-stacked thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

table.gw-stacked tr {
  margin: 0 0 0.5rem;
  padding: 0.7rem 0.85rem 0.75rem;
  border: 1px solid var(--line, #c9d2dc);
  border-radius: 10px;
  background: var(--panel, #fff);
}

table.gw-stacked tr:last-child { margin-bottom: 0; }

/* The subject is the card's title. */
table.gw-stacked td:first-child {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 0 0 0.5rem;
  margin: 0 0 0.5rem;
  border-bottom: 1px solid var(--line, #c9d2dc);
}

table.gw-stacked td:first-child::before { content: none; }

/* The rest read as a label-and-value list, the labels lined up so the values
   form a column of their own. */
table.gw-stacked td {
  display: grid;
  grid-template-columns: minmax(6.5rem, auto) 1fr;
  align-items: baseline;
  gap: 0.4rem 0.9rem;
  padding: 0.16rem 0;
  border: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: normal;
}

table.gw-stacked td::before {
  content: attr(data-label);
  font-size: 0.84rem;
  letter-spacing: 0.03em;
  color: var(--text-dim, #55606d);
}

/* Values sit against the label column, not flung to the far edge — a long
   gap between a word and its value is the thing that reads as broken. */
table.gw-stacked td { text-align: start; }

/* Narrow phones: the label goes above its value rather than beside it, which
   is better than squeezing both onto one short line. */
@media (max-width: 22rem) {
  table.gw-stacked td {
    grid-template-columns: 1fr;
    gap: 0.05rem;
    padding: 0.3rem 0;
  }
}

/* --- both forms ---------------------------------------------------------- */

/* Anything the page marks as a status keeps its colour and stays whole. */
table .status,
table [data-status] { white-space: nowrap; }
