/* pricing
   Loaded by `stylesheet_link_tag :app`, which includes every .css under
   app/assets sorted by filename — so the NUMBER PREFIX IS THE CASCADE ORDER.
   Renaming a file moves it in the cascade. */

/* --- a loaded grid ------------------------------------------------------ */

/* A real grid is 33 columns wide and it gets the whole page — nothing sits
   beside it. The axes have to stay put or you lose which size you are reading.

   min-width:0, or the whole page scrolls sideways on a phone: a grid item
   defaults to min-width:auto, which is the width of its CONTENT, so a
   scrolling table inside one refuses to shrink and pushes the layout out
   instead of scrolling within itself. Measured at 390px before and after. */
.grid-sheet { overflow: auto; max-height: 74vh; min-width: 0; padding: 0; }
.grid-sheet table { border-collapse: separate; border-spacing: 0; }
.grid-sheet th, .grid-sheet td { white-space: nowrap; }

.grid-sheet thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--sunken);
  border-bottom: 1px solid var(--line);
}
.grid-sheet tbody th {
  position: sticky; left: 0; z-index: 1;
  background: var(--sunken);
  border-right: 1px solid var(--line);
  text-align: left;
  font-weight: 600;
}
.grid-sheet thead th:first-child { z-index: 3; left: 0; }
.grid-corner { line-height: 1.25; }

.grid-sheet td { padding: 5px 10px; text-align: right; font-variant-numeric: tabular-nums; }
.grid-sheet th { padding: 5px 10px; font-size: 11.5px; color: var(--ink-3); }

/* The cell a size check landed on. */
.grid-sheet .is-answer {
  background: var(--signal-bg);
  color: var(--signal);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--signal-line);
}

/* --- checking a size ---------------------------------------------------- */

/* A control on the grid, so it lives in the grid's own head rather than in a
   panel beside it. */
.section-head:has(.size-check) { align-items: flex-end; }
.size-check { display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0; }
.size-check .field { margin: 0; width: 88px; }
.size-check .field label { font-size: 11.5px; }

/* Full width under the head, above the numbers it is about. */
.size-answer {
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--sunken);
  font-size: 13.5px;
}
.size-answer b { font-family: var(--mono); font-size: 17px; }
.size-answer.is-refusal {
  border-bottom-color: #EFD0CA;
  background: var(--danger-bg);
  color: var(--danger);
}

/* Reference, under the thing it refers to. */
.grid-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.snippet {
  display: block; padding: 10px;
  background: var(--sunken); border-radius: var(--r); font-size: 12.5px;
}

@media (max-width: 640px) {
  .section-head:has(.size-check) { flex-wrap: wrap; }
  .size-check { width: 100%; }
}

/* --- versions ----------------------------------------------------------- */

.version-line {
  display: flex; align-items: baseline; gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}
.version-line:last-child { border-bottom: 0; }
.version-line .when { font-family: var(--mono); font-size: 13px; min-width: 108px; }
.version-line .what { color: var(--ink-3); font-size: 13px; }

/* --- a price list, in the shape a system exports it ---------------------- */

/* Their column names against ours. Two columns so the pairs read across
   rather than as a long list you scroll and lose your place in. */
.mapping {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 4px 22px;
}
.mapping .field { margin: 0 0 14px; min-width: 0; }
