/* TALLYROOM — Wharfside Provisions reporting surface.
   Roles, never raw hex, in the body: light and dark swap in one place.
   Categorical slots 1–3 carry the three sales channels and are validated
   all-pairs in both modes; aqua sits under 3:1 on the light surface, so the
   legend, direct labels and the full table carry identity as well as colour. */

:root {
  color-scheme: light;
  --plane:          #f9f9f7;
  --surface-1:      #fcfcfb;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --grid:           #e1e0d9;
  --axis:           #c3c2b7;
  --hairline:       rgba(11, 11, 11, 0.10);
  --good:           #006300;
  --series-1:       #2a78d6;   /* Online Store  */
  --series-2:       #eb6834;   /* Point of Sale */
  --series-3:       #1baf7a;   /* Wholesale     */
  --chip:           rgba(11, 11, 11, 0.045);
  --chip-on:        #0b0b0b;
  --chip-on-ink:    #fcfcfb;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --plane:          #0d0d0d;
    --surface-1:      #1a1a19;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --grid:           #2c2c2a;
    --axis:           #383835;
    --hairline:       rgba(255, 255, 255, 0.10);
    --good:           #0ca30c;
    --series-1:       #3987e5;
    --series-2:       #d95926;
    --series-3:       #199e70;
    --chip:           rgba(255, 255, 255, 0.06);
    --chip-on:        #ffffff;
    --chip-on-ink:    #0d0d0d;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:          #0d0d0d;
  --surface-1:      #1a1a19;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --grid:           #2c2c2a;
  --axis:           #383835;
  --hairline:       rgba(255, 255, 255, 0.10);
  --good:           #0ca30c;
  --series-1:       #3987e5;
  --series-2:       #d95926;
  --series-3:       #199e70;
  --chip:           rgba(255, 255, 255, 0.06);
  --chip-on:        #ffffff;
  --chip-on-ink:    #0d0d0d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--text-primary);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.tr {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---- masthead ---------------------------------------------------------- */

.tr-mast {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}
.tr-eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tr-title { margin: 0; font-size: 27px; font-weight: 600; letter-spacing: -0.015em; }
.tr-sub   { margin: 4px 0 0; color: var(--text-secondary); font-size: 14px; }

.tr-tie {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface-1);
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.tr-tie-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  flex: none;
}

/* ---- filters ----------------------------------------------------------- */

.tr-filters { display: flex; flex-wrap: wrap; gap: 20px 32px; }
.tr-filter  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tr-filter-label {
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tr-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.tr-seg button {
  appearance: none;
  border: 1px solid transparent;
  background: var(--chip);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.tr-seg button:hover { border-color: var(--hairline); }
.tr-seg button[aria-pressed="true"] {
  background: var(--chip-on);
  color: var(--chip-on-ink);
}
.tr-seg button:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

.tr-scope { margin: -8px 0 0; font-size: 13px; color: var(--text-muted); }

/* ---- figures ----------------------------------------------------------- */

.tr-figures { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 16px; }
@media (max-width: 700px) { .tr-figures { grid-template-columns: 1fr; } }

.tr-hero, .tr-tile, .tr-card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 20px;
}
.tr-hero { display: flex; flex-direction: column; justify-content: center; }
.tr-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 560px) { .tr-tiles { grid-template-columns: 1fr; } }

.tr-tile-label {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tr-hero-value  { margin: 0; font-size: 48px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; }
.tr-tile-value  { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.tr-tile-foot   { margin: 10px 0 0; font-size: 13px; color: var(--text-secondary); }

/* ---- cards, chart ------------------------------------------------------ */

.tr-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.tr-h    { margin: 0; font-size: 15px; font-weight: 600; }
.tr-note { margin: 0; font-size: 13px; color: var(--text-muted); }

.tr-legend { display: flex; gap: 16px; margin: 0; padding: 0; list-style: none; flex-wrap: wrap; }
.tr-legend li { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-secondary); }
.tr-legend i  { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.tr-chart-wrap { position: relative; }
#chart { display: block; width: 100%; height: auto; max-width: 720px; margin: 0 auto; }
#chart text { fill: var(--text-muted); font-size: 12px; font-family: inherit; }
#chart text.tr-val { fill: var(--text-secondary); font-size: 12px; font-weight: 600; }
#chart .tr-grid { stroke: var(--grid); stroke-width: 1; }
#chart .tr-axis { stroke: var(--axis); stroke-width: 1; }
#chart .tr-seg-rect { transition: opacity 120ms ease; }
#chart .tr-band:hover .tr-seg-rect { opacity: 0.82; }
#chart .tr-band.is-current .tr-band-mark { fill: var(--text-primary); }

.tr-tip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.13);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  min-width: 168px;
  transform: translate(-50%, -100%);
}
.tr-tip h3 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.tr-tip dl { margin: 0; display: grid; grid-template-columns: auto auto; gap: 3px 14px; }
.tr-tip dt { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.tr-tip dt i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tr-tip dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.tr-tip .tr-tip-total { border-top: 1px solid var(--hairline); margin-top: 6px; padding-top: 6px; font-weight: 600; }

/* ---- table ------------------------------------------------------------- */

.tr-table-wrap { overflow-x: auto; }
.tr-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tr-table th, .tr-table td { padding: 9px 10px; text-align: right; white-space: nowrap; }
.tr-table th:first-child, .tr-table td:first-child { text-align: left; font-variant-numeric: normal; }
.tr-table thead th {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  border-bottom: 1px solid var(--axis);
}
.tr-table tbody td { border-bottom: 1px solid var(--grid); font-size: 14px; }
.tr-table tbody th { border-bottom: 1px solid var(--grid); font-size: 14px; font-weight: 600; }
.tr-table tbody tr:last-child td { border-bottom: none; }
.tr-table tr.is-total td,
.tr-table tr.is-total th { font-weight: 600; border-top: 1px solid var(--axis); }
.tr-table tr.is-current td { background: var(--chip); }

/* ---- reconciliation ---------------------------------------------------- */

.tr-recon { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0; }
.tr-recon dt { padding: 9px 0; color: var(--text-secondary); font-size: 14px; border-bottom: 1px solid var(--grid); }
.tr-recon dd { padding: 9px 0; margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; border-bottom: 1px solid var(--grid); }
.tr-recon .is-delta { font-weight: 600; border-bottom: none; border-top: 1px solid var(--axis); }
.tr-recon dd.is-delta { color: var(--good); }
.tr-recon-foot { margin: 14px 0 0; font-size: 13px; color: var(--text-muted); }

/* ---- colophon ---------------------------------------------------------- */

.tr-colophon { font-size: 13px; line-height: 1.65; color: var(--text-secondary); }
.tr-colophon p { margin: 0 0 10px; }
.tr-colophon code { font-size: 12px; background: var(--chip); padding: 1px 5px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}
