/* ==========================================================================
   products/ost/css/screens.css — Online Seller Tax Tracker's own screen styles.

   Everything visual comes from Core's tokens, as in the other products, so a
   customer who owns two isn't switching between two pieces of software.
   Nothing here redefines a token. Every class is prefixed ost-.
   ========================================================================== */

/* ---- The screen column --------------------------------------------------- */
.ost-screen {
  max-width: var(--content-max-width);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.ost-profile {
  margin-bottom: var(--space-5);
}

.ost-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ost-card.ost-card > * { margin-top: 0; margin-bottom: 0; }

.ost-card__title { margin: 0; }

.ost-screen-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  column-gap: var(--space-4);
  row-gap: var(--space-2);
}

.ost-screen-header__text {
  flex: 1 1 18rem;
  min-width: 0;
}

.ost-screen-header__title { margin: 0 0 var(--space-1); }
.ost-screen-header__context { margin: 0; }

.ost-year-switch {
  margin: 0;
  flex: 0 1 auto;
  min-width: 12rem;
}

.ost-year-switch .enum-select__field { width: auto; min-width: 12rem; }

/* ---- Notes ---------------------------------------------------------------
   The same tints as Core's alert banner, so a warning here reads like one
   everywhere else. Text keeps the primary colour for contrast in both themes. */
.ost-note {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-hairline);
  background: var(--surface-canvas);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ost-note p { margin: 0; color: var(--text-primary); }

.ost-note--info {
  background: rgba(47, 184, 172, 0.06);
  border-color: rgba(47, 184, 172, 0.28);
}

.ost-note--caution {
  background: rgba(232, 184, 75, 0.1);
  border-color: rgba(232, 184, 75, 0.36);
}

.ost-note--attention {
  background: rgba(255, 107, 94, 0.08);
  border-color: rgba(255, 107, 94, 0.32);
}

.ost-attention-text { color: var(--status-attention-text); }

/* ---- Forms ------------------------------------------------------------------ */
.ost-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ost-form > .field,
.ost-form .ost-field { margin-bottom: var(--space-2); }

.ost-field .text-field,
.ost-field .enum-select__field {
  max-width: 32rem;
}

.ost-textarea {
  min-height: 4.5rem;
  resize: vertical;
  font: inherit;
}

.ost-error {
  color: var(--status-attention-text);
  margin: 0;
}

.ost-error:empty { display: none; }

.ost-inline-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-4);
  align-items: flex-start;
}

.ost-inline-fields > .field { flex: 0 1 14rem; min-width: 10rem; margin-bottom: var(--space-2); }
.ost-inline-fields .text-field,
.ost-inline-fields .enum-select__field { max-width: 100%; width: 100%; }

.ost-choices {
  border: 0;
  padding: 0;
  margin: 0 0 var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ost-choices > legend { margin-bottom: var(--space-2); padding: 0; }

.ost-choices--row {
  flex-direction: row;
  flex-wrap: wrap;
  column-gap: var(--space-4);
}

.ost-choices--row > legend { width: 100%; }

.ost-choices--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--space-2) var(--space-4);
}

.ost-choices--grid > legend { grid-column: 1 / -1; }

.ost-choice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.ost-choice input {
  margin-top: 0.3rem;
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  accent-color: var(--accent-teal-button);
}

.ost-choice__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.ost-choice__hint { color: var(--text-secondary); }

.ost-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.ost-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent-teal-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font: inherit;
}

.ost-subcard {
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--surface-canvas);
}

.ost-subcard > h3 { margin: 0; }

/* A lone button in a column keeps its own width rather than stretching. */
.ost-card > .button,
.ost-subcard > .button,
.ost-form > .button,
.ost-card > label.button,
.ost-decision-row > .button { align-self: flex-start; }
.ost-subcard .text-field,
.ost-subcard .enum-select__field { background: var(--surface-card); }

/* ---- Tables ------------------------------------------------------------------ */
.ost-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

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

.ost-table th,
.ost-table td {
  text-align: left;
  padding: var(--space-2) var(--space-2);
  border-bottom: 1px solid var(--border-hairline);
  vertical-align: top;
}

.ost-table thead th {
  font-size: var(--text-label-size);
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.ost-table .ost-num { text-align: right; white-space: nowrap; }

.ost-table__actions {
  white-space: nowrap;
  text-align: right;
}

.ost-table__actions .button { padding-left: var(--space-1); padding-right: var(--space-1); }

.ost-row--total th,
.ost-row--total td { font-weight: 600; }

.ost-row--part td:first-child { padding-left: var(--space-4); color: var(--text-secondary); }

.ost-row-label { font-weight: 400; }

.ost-cell-note {
  display: block;
  color: var(--text-secondary);
}

.ost-tag {
  display: inline-block;
  margin-left: var(--space-2);
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface-canvas);
  border: 1px solid var(--border-hairline);
  font-size: var(--text-label-size);
  color: var(--text-secondary);
}

.ost-columns th:first-child { width: 40%; }

.ost-span-cell,
.ost-incomplete {
  vertical-align: middle;
  text-align: left;
  background: var(--surface-canvas);
}

.ost-incomplete { color: var(--status-caution-text); font-weight: 600; }

.ost-cell-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
}

.ost-hours { max-width: 6rem; }

.ost-refund-date {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin-top: var(--space-1);
}

.ost-refund-date .text-field { max-width: 11rem; padding-top: 2px; padding-bottom: 2px; }

/* ---- Figures lists ------------------------------------------------------------ */
.ost-figures {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-variant-numeric: tabular-nums;
}

.ost-figures__row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--border-hairline);
}

.ost-figures__row dt,
.ost-figures__row dd { margin: 0; }

.ost-figures__row dt { min-width: 0; overflow-wrap: anywhere; }

.ost-figures__value { text-align: right; max-width: 65%; overflow-wrap: anywhere; }

.ost-figures__row--part dt { padding-left: var(--space-3); color: var(--text-secondary); }
.ost-figures__row--part dd { font-weight: 400; }
.ost-figures__row--total { border-bottom-width: 2px; }

/* ---- Lists of things ------------------------------------------------------------ */
.ost-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ost-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
}

.ost-row__main { flex: 1 1 12rem; min-width: 0; }
.ost-row__main p { margin: 0; overflow-wrap: anywhere; }
.ost-row .field { margin: 0; flex: 0 1 16rem; }

.ost-decision-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border-hairline);
}

.ost-decision-row p { margin: 0; }

.ost-badges {
  margin: 0;
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ost-badges p { margin: 0; }

.ost-badge-examples {
  margin: var(--space-1) 0 0;
  padding-left: 1.1rem;
}

.ost-checks,
.ost-figures-used,
.ost-entered-figures {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ost-check {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-card);
  border: 1px solid rgba(232, 184, 75, 0.36);
  background: rgba(232, 184, 75, 0.08);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  align-items: flex-start;
}

.ost-check p { margin: 0; color: var(--text-primary); }

.ost-check--attention {
  border-color: rgba(255, 107, 94, 0.32);
  background: rgba(255, 107, 94, 0.07);
}

.ost-figures-used li p { margin: 0; }
.ost-figures-used li { padding-bottom: var(--space-2); border-bottom: 1px solid var(--border-hairline); }

.ost-entered-figures li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}

.ost-result {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ost-result p { margin: 0; }

.ost-attention {
  border-left: 3px solid var(--accent-gold);
  padding-left: var(--space-3);
}

/* ---- Phones ------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .ost-year-switch { flex: 1 1 100%; }
  .ost-year-switch .enum-select__field { width: 100%; }
  .ost-inline-fields > .field { flex: 1 1 100%; }
  .ost-columns th:first-child { width: auto; }
  .ost-figures__row { flex-wrap: wrap; }
}

/* ---- Printed documents ----------------------------------------------------------------
   Built in their own root and shown only when printing (export/printRecords.js). */
.ost-print-root { display: none; }

.ost-doc {
  font-family: var(--font-family);
  color: #000;
  background: #fff;
  font-size: 10.5pt;
  line-height: 1.4;
}

.ost-doc__header { margin-bottom: 6mm; border-bottom: 1px solid #999; padding-bottom: 3mm; }
.ost-doc__brand { margin: 0; font-size: 9pt; color: #444; }
.ost-doc__title { margin: 1mm 0; font-size: 18pt; }
.ost-doc__subtitle,
.ost-doc__printed { margin: 0; color: #333; }
.ost-doc__section { margin: 0 0 6mm; }
.ost-doc__h2 { font-size: 13pt; margin: 0 0 2mm; break-after: avoid; }
.ost-doc__h3 { font-size: 11pt; margin: 3mm 0 1mm; break-after: avoid; }
.ost-doc__strong { font-weight: 600; }
.ost-doc p { margin: 0 0 2mm; }

.ost-doc__table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 3mm;
  font-variant-numeric: tabular-nums;
}

.ost-doc__table th,
.ost-doc__table td {
  border-bottom: 1px solid #ccc;
  padding: 1mm 1.5mm;
  text-align: left;
  vertical-align: top;
}

.ost-doc__table thead th { border-bottom: 1px solid #666; font-size: 9pt; }
.ost-doc__table tbody th { font-weight: 400; }
.ost-doc__table .ost-num { text-align: right; white-space: nowrap; }
.ost-doc__table tr { break-inside: avoid; }
.ost-doc__total th,
.ost-doc__total td { font-weight: 600; }
.ost-doc__table--small { font-size: 9pt; }
.ost-doc__footer { margin-top: 6mm; border-top: 1px solid #999; padding-top: 2mm; font-size: 9pt; color: #333; }

/* ---- Overview (§4a) ------------------------------------------------------
 *
 * The charts are Core's components, and their SVG text is styled in the
 * CALCULATOR's stylesheet (products/sa-tax/css/screens.css), which no package
 * but the calculator's ships. Core's own components.css has the wrappers and
 * the legend but not these. So the tracker carries its own copy, scoped to its
 * screens so it can reach nothing else.
 *
 * It is a copy, and copies drift: unifying these into core/css/components.css
 * is a Core change, and it belongs with calculator 3.1 rather than here, where
 * it would alter three packages that are on sale. Recorded in
 * docs/OUTSTANDING.md so the Core session picks it up.
 */
/* These ten rules were this product's own copy of Core's chart defaults,
   written because Core did not provide them and an unstyled chart was the
   alternative. Core provides them from 20 September 2026 (fault C-14), so the
   copy is removed rather than left to drift from the original. The tracker's
   genuine OVERRIDES — the larger type at wider viewports, and the overview
   row's month labels — stay below, because those are this product's choices
   rather than a restatement of the defaults. */

/* The two income charts, side by side on a wide screen and stacked on a narrow
 * one. The month chart gets the wider column: it has twelve bars to the ring's
 * handful of slices. minmax(0, …) so a chart can shrink inside its column
 * instead of pushing the row wider than the screen. */
.ost-overview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: var(--space-4);
  /* Stretch, not start: the two cards end level, which is what makes them read
   * as one row rather than two things that happen to be beside each other. */
  align-items: stretch;
}

.ost-overview-row > * { margin: 0; }

@media (max-width: 900px) {
  .ost-overview-row { grid-template-columns: minmax(0, 1fr); }
}

/* In a column narrower than the chart's own width, its text scales down with
 * it, so the month labels get the same treatment as on a phone. */
@media (max-width: 1400px) {
  .ost-overview-row .bar-chart__month-label { font-size: 15px; }
}

/* The ring sits in the middle of its card. The two cards in the row end level,
 * so the shorter one has room left over, and the ring pinned to the top of it
 * left a pool of white space underneath (the owner, 17 September 2026). */
.ost-overview-chart-card { display: flex; flex-direction: column; }
.ost-overview-chart-card .donut-chart {
  flex: 1;
  justify-content: center;
  align-content: center;
}

/* The Overview's income-by-month chart (ui/monthChart.js). Its own, because
 * Core's draws no figure and shows nothing on hover. */
.ost-chart__month { font-size: 12px; fill: var(--text-secondary); }
.ost-chart__bar { transition: opacity var(--motion-fast) var(--motion-easing); }
.ost-chart:hover .ost-chart__bar { opacity: 0.85; }
.ost-chart__hit:hover + .ost-chart__bar { opacity: 1; }

/* The figures under it. Hidden wherever a pointer can hover, because the
 * tooltip is there and twelve months of figures would swamp a card meant to be
 * glanced at (the owner, 17 September 2026). Shown on a touch screen, where a
 * tooltip can never appear. */
.ost-chart-figures {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

.ost-chart-figures li {
  display: flex;
  flex-direction: column;
  min-width: 5.5rem;
}

.ost-chart-figures__value { font-variant-numeric: tabular-nums; }

@media (hover: hover) and (pointer: fine) {
  .ost-chart-figures { display: none; }
}

@media (max-width: 1400px) {
  .ost-overview-row .ost-chart__month { font-size: 15px; }
}

/* One line per platform: the name, then what its report is likely to say. */
.ost-overview-platforms {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ost-overview-platform {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-hairline);
}

.ost-overview-platform span:last-child { color: var(--text-secondary); }
.ost-overview-platform--attention { border-color: rgba(255, 107, 94, 0.32); background: rgba(255, 107, 94, 0.07); }
.ost-overview-platform--caution { border-color: rgba(232, 184, 75, 0.36); background: rgba(232, 184, 75, 0.08); }

/* A chart's SVG scales to the width it is given, and its text scales with it.
 * On a phone a 560-unit chart is drawn about 340px wide, which took 12px text
 * down to about 7px — too small to read. The sizes below are in the chart's own
 * units, so raising them here is what keeps the rendered text at a readable
 * size on a narrow screen. The label column is 140 units wide and the longest
 * short label ("Working from home") still fits at 15. */
@media (max-width: 700px) {
  .ost-screen .bar-chart__label { font-size: 14px; }
  .ost-screen .bar-chart__value { font-size: 14px; }
  .ost-screen .bar-chart__month-label { font-size: 15px; }
  .ost-screen .donut-chart__centre-value { font-size: 17px; }
  .ost-screen .donut-chart__centre-label { font-size: 12px; }
}

@media print {
  /* Only while a document is being printed, so printing the page any other
     way still prints the page. */
  body:has(> .ost-print-root) > *:not(.ost-print-root) { display: none !important; }
  .ost-print-root { display: block !important; }
  .ost-no-print { display: none !important; }

  @page { margin: 0; }

  .ost-doc {
    padding: 16mm 14mm;
    box-sizing: border-box;
  }
}
