/* The Stats page's own styles (phase 2, lane S); portal.css holds everything shared. These are
   mockup/phase2.css's rules for the stats screen, copied as they are, with two changes the page's CSP
   needs (it allows no inline style): the axis labels' places come from classes and attributes here,
   not from style attributes. */

/* ---- Six figures: three across on a wide screen, two on a phone ---------------------------------- */
.figures--six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1040px) { .figures--six { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- One row of controls above everything it scopes (the period, the download) ------------------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1.5rem; margin: 0 0 1.5rem; }

/* ---- Charts: inline SVG marks, and text that is never scaled, so the words stay sharp at any width
   The bars are drawn in percentages with no viewBox, so a 4px rounded top stays round at any width;
   each bar runs past the plot's bottom edge, which clips it, so the end at the baseline is square. */
.chart { margin: 0; }
.chart + .chart { margin-top: 1.6rem; }
.chart figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .4rem 1.2rem; margin-bottom: .8rem; color: var(--lead); font-size: var(--type-small); }
.chart-key { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.chart-grid { display: grid; grid-template-columns: 2.9rem minmax(0, 1fr); }
.chart-y { position: relative; }
.chart-y span { position: absolute; right: .7rem; color: var(--quiet); font-size: .72rem; line-height: 1; font-variant-numeric: tabular-nums; transform: translateY(-50%); }
.chart-y .y-top { top: 4%; }
.chart-y .y-mid { top: 52%; }
.chart-y .y-zero { top: 100%; }
.chart-plot { display: block; width: 100%; overflow: hidden; border-bottom: 1px solid var(--line); }
.chart-plot--clicks { height: 132px; }
.chart-plot--money { height: 104px; }
.chart-plot .grid { stroke: var(--rule); stroke-width: 1; }
.chart-plot .bar { fill: var(--azure); }
.chart-plot .bar--pending { fill: var(--amber); }
.chart-plot .bar--approved { fill: var(--teal); }
.chart-plot .dot--reversed { fill: var(--red); }
.chart-plot .bar:hover { opacity: .78; }
/* The day labels: an SVG of their own, each placed by its x attribute, free to hang past the ends. */
.chart-x { display: block; grid-column: 2; width: 100%; height: 1.7rem; overflow: visible; }
.chart-x text { fill: var(--quiet); font-size: .72rem; }

/* ---- The day table: five columns on a phone, all seven from 761px -------------------------------- */
.data-table--days .num:not(:last-child) { padding-right: 1.5rem; }
.data-table .zero { color: var(--quiet); }
.reversed-note { display: block; margin-top: .25rem; color: var(--red); font-size: .72rem; white-space: nowrap; }
@media (max-width: 760px) {
  .hide-phone { display: none; }
  .data-table--days { font-size: .82rem; }
  .data-table--days :is(th, td) { padding-right: .8rem; }
  .data-table--days .num:not(:last-child) { padding-right: .8rem; }
}

/* ---- Every sale and the CSV form, here with the new home: the sales heading clears the fixed header
   through the page's own scroll padding (portal.css) --- */
#sales-title:focus { outline: none; }

/* ---- Doc 170 cards 16, 18 and 19: the funnel against the same days before, and the latest events beside it.
   The funnel is a list, one row per step; a bar's length is its step's share of the clicks. Latest marks an
   event this browser has not shown before with a dot (and "New:" for a screen reader). ------------------- */
.card.dates { margin: 0 0 1.5rem; }
.grid-2--funnel .card-head { align-items: baseline; }
.grid-2--funnel .card-head .quiet { font-size: .78rem; }
.grid-2--funnel .more { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; color: #fff; font-size: .8rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.grid-2--funnel .more svg { width: 15px; height: 15px; color: var(--icon); }
.funnel { margin: 1.2rem 0 0; padding: 0; list-style: none; }
.funnel li { display: grid; grid-template-columns: 8rem minmax(0, 1fr) minmax(7.5rem, auto); align-items: center; gap: .4rem 1.2rem; padding: .9rem 0; border-top: 1px solid var(--rule); }
.funnel .what { color: var(--lead); font-size: .86rem; line-height: 1.3; }
.funnel .what small, .funnel .val small { display: block; margin-top: .25rem; color: var(--quiet); font: 400 .72rem/1.3 var(--sans); }
.funnel-bar { display: block; width: 100%; height: 30px; }
.funnel-bar .track { fill: rgba(209, 221, 255, .08); }
.funnel-bar .fill { fill: var(--azure); }
.funnel .val { text-align: right; font: 400 1.6rem/1 var(--austin); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .funnel li { grid-template-columns: minmax(0, 1fr) auto; }
  .funnel .funnel-bar, .funnel li > span:nth-child(2):empty { grid-column: 1 / -1; grid-row: 2; }
}
.feed { margin: 1.1rem 0 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.feed li { display: grid; grid-template-columns: 1rem minmax(0, 1fr) auto; gap: .2rem .75rem; align-items: baseline; padding: .95rem 0; border-bottom: 1px solid var(--rule); font-size: .9rem; line-height: 1.4; }
.feed li:last-child { border-bottom: 0; }
.feed li::before { width: 7px; height: 7px; border-radius: 50%; background: transparent; content: ""; }
.feed li.new::before { background: var(--azure); box-shadow: 0 0 0 4px rgba(50, 95, 255, .2); }
.feed small { display: block; margin-top: .25rem; color: var(--quiet); font-size: .78rem; }
.feed time { color: var(--quiet); font-size: .76rem; white-space: nowrap; }

/* ---- Doc 205 item 2 (held for Max): a sale's road from the click to the day impact.com pays, under its sale.
   Five steps across on a wide screen, one under another on a phone (mockup/doc205/sale.html). ------------- */
.road-row td { padding-top: 0; }
.road-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.road { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; margin: 0 0 .2rem; padding: 1.2rem 1.2rem 1rem; list-style: none; border: 1px solid var(--rule); border-radius: 18px; background: rgba(255, 255, 255, .03); }
.road li { position: relative; padding-top: 1.6rem; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.road li::before { position: absolute; top: 0; left: 0; width: 12px; height: 12px; border-radius: 50%; background: #29324a; box-shadow: 0 0 0 4px rgba(10, 17, 34, .9); content: ""; }
.road li::after { position: absolute; top: 5px; right: -12px; left: 20px; height: 2px; background: rgba(209, 221, 255, .16); content: ""; }
.road li:last-child::after { display: none; }
.road li.done::before { background: var(--teal); }
.road li.now::before { background: var(--azure); box-shadow: 0 0 0 4px rgba(50, 95, 255, .25); }
.road strong { display: block; margin-bottom: .3rem; color: #fff; font: 400 1.2rem/1.05 var(--austin); letter-spacing: -.012em; }
@media (max-width: 760px) {
  .data-table--stack tr.road-row { display: block; margin-top: -.3rem; padding: 0; border: 0; background: none; }
  .road { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 1rem; }
  .road li { padding: 0 0 1.1rem 1.8rem; }
  .road li::after { top: 16px; right: auto; bottom: 0; left: 5px; width: 2px; height: auto; }
  .road li:last-child { padding-bottom: 0; }
}

/* Doc 205 item 3: where your clicks come from. */
.bars { margin: 1.2rem 0 0; padding: 0; list-style: none; }
.bars li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 3.5rem; align-items: center; gap: .4rem 1rem; padding: .7rem 0; border-top: 1px solid var(--rule); }
.bars .what { color: var(--lead); font-size: .86rem; line-height: 1.3; }
.bars .what small { display: block; margin-top: .2rem; color: var(--quiet); font-size: .72rem; }
.bars svg { display: block; width: 100%; height: 22px; }
.bars .track { fill: rgba(209, 221, 255, .08); }
.bars .fill { fill: var(--azure); }
.bars .fill--teal { fill: var(--teal); }
.bars .val { text-align: right; font: 400 1.35rem/1 var(--austin); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .bars li { grid-template-columns: 7.5rem minmax(0, 1fr) 2.8rem; } }
#devices .note-line { margin-top: 1rem; color: var(--muted); font-size: .85rem; }
