/* Trueread portal: page-specific rules for venues, add a venue, sales data, the column check, events, accuracy, savings and settings.
   Trueread Noir.
   Shared pieces live in app.css; the contract is docs/portal-classes.md.
   Every rule here hangs off a class only these pages use, so nothing reaches the other pages. */

/* ---------------------------------------------------------------- shared by these pages */
/* A sentence and then a form or a table inside one section body, with one gap between them. */
.section-body.gapped { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.section-body.gapped > p + p { margin-top: 0; }

/* A form beside tables (the column check, events): the form keeps a reading width and the tables take the rest.
   One column until there is room for both. */
.split.lean { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1500px) { .split.lean { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); } }   /* the events table needs about 800px beside the form */

/* ---------------------------------------------------------------- venues: the list is a table and the name is the way in */
table.grid.venues th:nth-child(1) { width: 38%; }
table.grid.venues th:nth-child(2) { width: 34%; }
table.grid.venues .demo-word { margin-left: 8px; }

/* ---------------------------------------------------------------- sales data: three figures, not four */
.figures.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .figures.three { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- column check: the first rows of the uploaded file */
/* One line per row. A long cell is cut short, and a wide file scrolls inside its panel. */
table.grid.preview :is(th, td) { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- events */
/* The name of a day keeps a line to itself until it is long, and what was learned about it keeps a readable width. */
table.grid.events td.strong { min-width: 16ch; }
table.grid.events td.effect { min-width: 24ch; }
/* The two kinds of day, as radio buttons. */
.choice { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.choice legend { padding: 0 0 8px; color: var(--text); font-weight: 500; }

/* ---------------------------------------------------------------- settings */
/* Trading hours beside the roster rules once there is room; one above the other until then. */
.split.settings-top { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1200px) { .split.settings-top { grid-template-columns: minmax(0, 520px) minmax(0, 1fr); align-items: stretch; } }
/* Rows that hold inputs are drawn a little tighter: the inputs give them their height. */
table.grid:is(.hours, .roles) tbody td { padding-top: 8px; padding-bottom: 8px; }
/* A day ticked as closed: its hours are not used, so they step back. */
table.grid.hours tr:has(input[type=checkbox]:checked) input[type=number] { color: var(--muted); }
/* Phones: the four columns are drawn tighter so the whole week fits across without scrolling. */
@media (max-width: 520px) {
  table.grid.hours :is(th, td) { padding-left: 4px; padding-right: 4px; }
  table.grid.hours :is(th, td):first-child { padding-left: var(--pad); }
  table.grid.hours :is(th, td):last-child { padding-right: var(--pad); }
  table.grid.hours thead th { white-space: normal; }
  table.grid.hours input.small { width: 64px; }
}
/* Roles: nine columns in three bands. The band names sit above the column headers and each band starts at a hairline. */
table.grid.roles thead th { white-space: normal; }   /* a long column name takes two lines, so nine columns fit a laptop */
table.grid.roles thead th.band[colspan] { color: var(--text); border-bottom-color: transparent; }
table.grid.roles .band { border-left: 1px solid var(--line); }
/* The button that saves the whole page sits under the last panel. */
.save { padding-top: 4px; }

/* ---------------------------------------------------------------- accuracy */
/* A method's name keeps a readable width; on a phone the figures scroll sideways beside it. */
table.grid.methods td.strong { min-width: 24ch; }

/* ---------------------------------------------------------------- savings */
/* The lead-in: what the figures are, and the switch between day, week, month and year. */
.savings-intro { display: grid; gap: 16px; padding: 24px var(--pad); }
.jump.periods a[aria-current] { background: var(--selected); border-color: var(--text); color: var(--text); }   /* the view you are on: a White rim */
/* A figures panel with a heading over its figures, and sometimes a sentence under them. Both run the full width.
   Where the browser can, the labels, figures and notes share rows, so a label that takes two lines moves every figure down with it. */
.figures.saved > :is(.section-head, .prose) { grid-column: 1 / -1; padding: 0; }
@supports (grid-template-rows: subgrid) {
  .figures.saved .figure { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; align-content: start; }
}
/* The chart: one White bar per period, oldest at the left, on a zero line (Seam). A period where the plain average
   did better hangs below the line. Square bars, like the mark's. The scale's labels (Red Hat Mono, axis size) sit in
   a gutter at the left and the dates run underneath. */
.savechart { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px; margin-top: 16px;
  color: var(--muted); font-family: var(--mono); font-size: 11px; line-height: 16px; font-variant-numeric: tabular-nums; }
.savechart-scale { position: relative; }
.savechart-scale span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; }
.savechart-plot { position: relative; display: flex; gap: 4px; height: 160px; }
.savechart-plot::after { content: ""; position: absolute; left: 0; right: 0; top: var(--zero); height: 1px; background: var(--line-strong); }
.savechart-col { position: relative; flex: 1 1 0; min-width: 0; max-width: 48px; }
.savechart-col i { position: absolute; left: 50%; width: min(100%, 20px); min-height: 2px; background: var(--text); transform: translateX(-50%); }
.savechart-ticks { grid-column: 2; display: flex; gap: 4px; min-height: 16px; }
.savechart-ticks span { display: flex; justify-content: center; flex: 1 1 0; min-width: 0; max-width: 48px; white-space: nowrap; }   /* centred under its bar, however narrow the bar */
/* The table of the same periods. Long column names take two lines; a period keeps its name on one. */
table.grid.savings thead th { white-space: normal; }
table.grid.savings th.num { min-width: 18ch; }
table.grid.savings td.strong { white-space: nowrap; }
table.grid.savings td.strong .range { font-weight: 400; }
/* The one line about savings on the forecast page: the figure in white, the rest as quiet as any other sentence. */
.saving-line b { color: var(--text); }
@media (max-width: 860px) {
  .savings-intro { padding-top: 16px; padding-bottom: 16px; }
}
@media (max-width: 520px) {
  .savechart { grid-template-columns: 48px minmax(0, 1fr); }
  .savechart-plot { height: 128px; }
  .savechart-plot, .savechart-ticks { gap: 2px; }
}
