/* Tally's pages. Tokens are in tokens.css. Motion follows Outpost's bar: numbers tick up,
   the visitor line draws in, the live check flips, and nothing moves for
   prefers-reduced-motion. Animations use opacity and transform only, and every box that
   changes holds its size, so nothing shifts. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.15;
}

h1 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -.02em;
}

a {
  color: inherit;
  text-underline-offset: .2em;
  text-decoration-thickness: 1px;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .9em;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: .05em .3em;
  overflow-wrap: anywhere;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 50;
  background: var(--ink);
  color: var(--on-ink);
  padding: 8px 12px;
  border-radius: var(--radius-control);
  text-decoration: none;
}

.skip:focus {
  top: 12px;
}

/* Frame */

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--chrome);
}

.topbar-inner,
.foot-inner,
.wrap {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 28px;
}

.wrap.narrow {
  max-width: 860px;
}

.topbar-inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark svg,
.tally-draw svg {
  display: block;
  fill: none;
  stroke-linecap: round;
}

.brand-mark svg {
  width: 28px;
  height: 24px;
}

.mark-stroke {
  stroke: var(--ink);
  stroke-width: 2.3;
}

.mark-cross {
  stroke: var(--revenue);
  stroke-width: 2.5;
}

.brand-name {
  font-size: 19px;
  font-weight: 800;
  font-family: var(--font-display);
  letter-spacing: -.01em;
}

.brand-by {
  font-size: 13px;
  color: var(--muted);
  padding-top: 2px;
}

/* The brand links home and its byline's "Outpost" links to Outpost: two links side by
   side (shell::byline), never one inside the other. */
.brand-line {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-maker {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: color .15s ease, text-decoration-color .15s ease;
}

.brand-maker:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

.topnav {
  display: flex;
  gap: 22px;
  margin-left: auto;
  font-size: 14px;
}

.topnav a {
  color: var(--muted);
  text-decoration: none;
}

.topnav a:hover {
  color: var(--ink);
}

.main {
  flex: 1;
  padding: 36px 0 24px;
}

.foot {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.foot-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  padding-bottom: 28px;
}

.foot-quiet {
  color: var(--faint);
}

.foot-link {
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}

.foot-link:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

/* Shared parts */

.page-head {
  margin-bottom: 28px;
}

.page-head h1 {
  font-size: 38px;
  font-weight: 620;
  letter-spacing: -.015em;
}

.lede {
  margin-top: 8px;
  max-width: 62ch;
  font-size: 16px;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 20px 22px;
}

.panel-title {
  font-size: 16px;
  font-weight: 620;
  letter-spacing: 0;
}

.note {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--muted);
  max-width: 72ch;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 560;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.button:hover {
  border-color: var(--faint);
}

.button.primary {
  background: var(--button-bg);
  border-color: var(--button-bg);
  color: var(--button-ink);
}

.button.primary:hover {
  background: var(--button-hover);
  border-color: var(--button-hover);
}

.quiet-link {
  color: var(--muted);
  text-decoration: none;
}

.quiet-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Sites */

.sites-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sites-panel .panel-title {
  margin-bottom: 8px;
}

.empty-note {
  padding: 22px 0 8px;
  color: var(--muted);
}

.site-list {
  list-style: none;
  padding: 0;
}

.site-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--line-2);
}

.site-row:first-child {
  border-top: 0;
}

.site-link {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-decoration: none;
}

.site-name {
  color: var(--ink);
  font-weight: 600;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-link:hover .site-name {
  text-decoration: underline;
}

.site-domain,
.site-mode {
  color: var(--muted);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-live {
  color: var(--live-ink);
}

.status-waiting {
  color: var(--muted);
}

.status-waiting::before {
  background: transparent;
  border: 1.5px solid currentColor;
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  color: var(--ink);
  font-size: 14px;
  font-weight: 560;
}

.field-hint {
  color: var(--muted);
  font-size: 13px;
}

.field-error {
  margin-top: -6px;
  color: var(--down);
  font-size: 13.5px;
}

.input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.input::placeholder {
  color: var(--faint);
}

.input:hover {
  border-color: var(--faint);
}

.input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 0;
  border-color: var(--brand);
}

.input[aria-invalid="true"] {
  border-color: var(--down);
}

.modes {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.modes legend {
  padding: 0;
  margin-bottom: 6px;
}

.mode-option {
  position: relative;
  display: block;
  padding: 11px 14px 11px 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}

.mode-option:hover {
  border-color: var(--faint);
}

.mode-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

/* The hand-built radio: a ring that fills with a jade dot. */
.mode-option::before,
.mode-option::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 15px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.mode-option::before {
  border: 1.5px solid var(--faint);
  background: var(--surface);
}

.mode-option::after {
  transform: scale(0);
  background: var(--brand);
  transition: transform .2s var(--ease-out);
  width: 8px;
  height: 8px;
  left: 19px;
  top: 19px;
}

.mode-option:has(.mode-input:checked) {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.mode-option:has(.mode-input:checked)::before {
  border-color: var(--brand);
}

.mode-option:has(.mode-input:checked)::after {
  transform: scale(1);
}

.mode-option:has(.mode-input:focus-visible) {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.mode-body {
  display: grid;
  gap: 1px;
}

.mode-name {
  color: var(--ink);
  font-weight: 600;
}

.mode-summary {
  color: var(--muted);
  font-size: 13.5px;
}

.form .button.primary {
  justify-self: start;
  margin-top: 4px;
}

/* Setup */

.crumbs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--muted);
}

.crumbs a {
  color: var(--muted);
}

.steps {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 16px;
}

.step > p {
  margin-top: 8px;
  color: var(--muted);
}

.step-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  font-weight: 620;
  overflow-wrap: anywhere;
}

.step-n {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--button-bg);
  color: var(--button-ink);
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.snippet {
  position: relative;
  margin-top: 16px;
}

.snippet pre {
  margin: 0;
  padding: 16px 104px 16px 16px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.snippet code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: 13.5px;
}

.button.copy {
  position: absolute;
  top: 10px;
  right: 10px;
  height: 32px;
  min-width: 80px;
  background: transparent;
  border-color: rgba(216, 238, 230, .28);
  color: var(--code-ink);
  display: grid;
}

.button.copy:hover {
  border-color: var(--code-ink);
}

.copy-idle,
.copy-done {
  grid-area: 1 / 1;
  transition: opacity .2s ease, transform .3s var(--ease-out);
}

.copy-done {
  opacity: 0;
  transform: translateY(6px);
}

.button.copy[data-copied] .copy-idle {
  opacity: 0;
  transform: translateY(-6px);
}

.button.copy[data-copied] .copy-done {
  opacity: 1;
  transform: none;
}

/* The live check: two layers in one grid cell, so the flip never changes the height. */
.live-check {
  display: grid;
  margin-top: 16px;
  min-height: 136px;
  padding: 20px 22px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  transition: background-color .6s ease, border-color .6s ease;
}

.live-check[data-state="live"] {
  border-style: solid;
  border-color: var(--live);
  background: var(--live-tint);
}

.live-layer {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
  transition: opacity .45s ease, transform .7s var(--ease-out), visibility 0s linear 0s;
}

.live-check[data-state="waiting"] .live-ok,
.live-check[data-state="live"] .live-waiting {
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, transform .5s var(--ease-out), visibility 0s linear .5s;
}

.live-check[data-state="waiting"] .live-ok {
  transform: translate3d(0, 16px, 0);
}

.live-check[data-state="live"] .live-waiting {
  transform: translate3d(0, -16px, 0);
}

.live-check[data-state="live"] .live-ok {
  transition-delay: .18s;
}

.live-text {
  display: grid;
  gap: 4px;
  min-width: 0;
  justify-items: start;
}

.live-title {
  color: var(--ink);
  font-size: 19px;
  font-weight: 800;
  font-family: var(--font-display);
}

.live-detail {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.live-ok .live-detail {
  color: var(--live-ink);
  font-size: 15.5px;
}

[data-first-visitor] {
  color: var(--ink);
  font-weight: 560;
}

.live-ok .button {
  margin-top: 10px;
}

.beacon {
  position: relative;
  flex: none;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
}

.beacon span,
.beacon::before {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.beacon span {
  width: 14px;
  height: 14px;
  background: var(--faint);
}

.beacon::before {
  width: 52px;
  height: 52px;
  border: 1.5px solid var(--faint);
  opacity: .5;
}

.tally-draw {
  flex: none;
  width: 52px;
}

.tally-draw svg {
  width: 52px;
  height: 45px;
}

.tally-draw .mark-stroke {
  stroke-width: 2.1;
}

.tally-draw .mark-cross {
  stroke-width: 2.4;
}

/* Mode facts */

.mode-facts {
  margin-top: 16px;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 14px;
}

.facts h3 {
  font-size: 14px;
  font-weight: 620;
  margin-bottom: 8px;
}

.facts ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 8px;
}

.facts li {
  position: relative;
  padding-left: 22px;
  font-size: 14px;
}

.facts li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
}

.facts-yes li::before {
  width: 10px;
  height: 5px;
  border-left: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  transform: rotate(-45deg);
}

.facts-no li::before {
  top: 10px;
  width: 10px;
  height: 2px;
  background: var(--faint);
}

/* Dashboard */

.dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 24px;
  margin-bottom: 14px;
}

.dash-title {
  min-width: 0;
}

.dash-title h1 {
  font-size: 38px;
  font-weight: 620;
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
}

.dash-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 6px;
  font-size: 14px;
}

.banner {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-left: 3px solid var(--ink);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  background: var(--surface);
  color: var(--ink-2);
}

/* The period control: a disclosure of links, styled; the script adds keyboard handling,
   closes it from outside and swaps the dashboard in place. */
.menu {
  position: relative;
  margin-left: auto;
}

.menu > summary {
  list-style: none;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu-button {
  height: 42px;
  gap: 10px;
  padding: 0 12px 0 14px;
  user-select: none;
}

.menu-caption {
  color: var(--muted);
  font-weight: 450;
}

.menu-value {
  min-width: 7.6em;
  text-align: left;
}

.chevron {
  width: 12px;
  height: 8px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .25s var(--ease-out);
}

.menu[open] .chevron {
  transform: rotate(180deg);
}

.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 220px;
  list-style: none;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-menu);
  transform-origin: top right;
}

.menu-item {
  position: relative;
  display: block;
  padding: 8px 12px 8px 30px;
  border-radius: 5px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14.5px;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-2);
  color: var(--ink);
  outline-offset: -2px;
}

.menu-item[aria-current]::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 13px;
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  transform: rotate(-45deg);
}

.menu-item[aria-current] {
  color: var(--ink);
  font-weight: 600;
}

[data-swap] {
  transition: opacity .2s ease;
}

[data-swap][aria-busy="true"] {
  opacity: .55;
}

/* The ledger: traffic numbers in one ruled strip, money in a dashed slot beside it. */
.ledger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  gap: 16px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
}

.kpi {
  min-width: 0;
  padding: 18px 20px 16px;
  border-left: 1px solid var(--line-2);
}

.kpi:first-child {
  border-left: 0;
}

.kpi-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  margin: 4px 0 6px;
  color: var(--ink);
  font-size: 44px;
  font-weight: 800;
  font-family: var(--font-display);
  line-height: 1.05;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

[data-count-to] {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

.kpi-change {
  display: flex;
  flex-wrap: wrap;
  gap: 0 5px;
  min-height: 2.9em;
  font-size: 13px;
  color: var(--faint);
  line-height: 1.45;
}

.kpi-change .amount {
  font-weight: 600;
}

.kpi-change .versus {
  color: var(--faint);
  font-weight: 400;
}

.kpi-change.up {
  color: var(--live-ink);
}

.kpi-change.down {
  color: var(--down);
}

.kpi-change.flat .amount,
.kpi-change.none .amount {
  font-weight: 400;
}

/* "Not enough history to compare yet" wraps without leaving a word alone. */
.kpi-change.none .amount {
  text-wrap: pretty;
}

.live-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.kpi-live[data-live="on"] .live-dot {
  background: var(--live);
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--live);
  opacity: 0;
}

.money {
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border: 1.5px dashed var(--revenue-line);
  border-radius: var(--radius-panel);
}

.money-cells {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* Labels may wrap; the dashes stay on one line. */
.money-cells div {
  display: grid;
  grid-template-rows: 2.6em auto;
}

.money-cells dt {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.3;
}

.money-cells dd {
  align-self: end;
  color: var(--revenue-line);
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-display);
  line-height: 1;
}

.money-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.money-connect {
  color: var(--revenue-ink);
  font-weight: 620;
}

/* Chart */

.chart-panel {
  margin-top: 16px;
  padding-bottom: 14px;
}

.chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 20px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  list-style: none;
  padding: 0;
  font-size: 13px;
  color: var(--muted);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend li::before {
  content: "";
  display: block;
}

.legend-visitors::before {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: var(--visitors);
}

.legend-revenue::before {
  width: 10px;
  height: 12px;
  border-radius: 2px;
  border: 1.5px dashed var(--revenue-line);
}

.chart {
  position: relative;
  margin-top: 8px;
}

/* The y labels sit in a gutter left of the plot; the x labels share the plot's width. */
.chart {
  --chart-gutter: 44px;
}

.chart-plot {
  position: relative;
  height: 260px;
  margin: 24px 0 0 var(--chart-gutter);
}

.chart-data,
.chart-grid,
.chart-marks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-grid,
.chart-marks {
  pointer-events: none;
}

.grid-line {
  stroke: var(--line-2);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.grid-line.base {
  stroke: var(--line);
}

.grid-label {
  fill: var(--faint);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.line {
  fill: none;
  stroke: var(--visitors);
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.area-top {
  stop-color: var(--area-top);
  stop-opacity: .2;
}

.area-bottom {
  stop-color: var(--area-top);
  stop-opacity: .015;
}

.now-dot {
  fill: var(--visitors);
  stroke: var(--surface);
  stroke-width: 2;
}

.now-ring {
  fill: none;
  stroke: var(--visitors);
  stroke-width: 1.5;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.chart-x {
  display: block;
  width: calc(100% - var(--chart-gutter));
  height: 24px;
  margin: 6px 0 0 var(--chart-gutter);
  overflow: visible;
}

.tick {
  fill: var(--muted);
  font-size: 12px;
}

.chart-guide {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: var(--line);
  pointer-events: none;
}

.chart-tip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  display: grid;
  gap: 1px;
  padding: 7px 10px;
  min-width: 96px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-menu);
  font-size: 12.5px;
  pointer-events: none;
  white-space: nowrap;
}

.tip-label {
  color: var(--muted);
}

.tip-value {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

/* Breakdowns */

.breakdowns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.breakdown {
  padding: 18px 18px 14px;
  min-width: 0;
}

.breakdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
}

.tabs {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface-2);
}

.tab {
  padding: 3px 10px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 520;
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease;
}

.tab:hover {
  color: var(--ink);
}

.tab[aria-selected="true"] {
  background: var(--button-bg);
  color: var(--button-ink);
}

.rows-wrap {
  /* Room for eight rows, so changing the tab or the period never moves the page. */
  min-height: 352px;
}

/* Devices: never more than four rows. */
.rows-wrap.few {
  min-height: 196px;
}

/* The head shares the rows' columns, so "Visitors" and "Revenue" sit over their numbers. */
.rows-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 46px;
  gap: 12px;
  margin: 12px 0 4px;
  padding: 0 10px;
  color: var(--faint);
  font-size: 12.5px;
}

.rows-head span:nth-child(n + 2) {
  text-align: right;
}

.rows {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 3px;
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 46px;
  align-items: center;
  gap: 12px;
  height: 36px;
  padding: 0 10px;
}

.with-revenue .rows-head,
.with-revenue .row {
  grid-template-columns: minmax(0, 1fr) 64px 72px;
}

.bar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.bar-visitors {
  fill: var(--visitors-bar);
  transform-box: fill-box;
  transform-origin: left center;
}

.bar-revenue {
  fill: var(--revenue-bar);
}

.row-label,
.row-value,
.row-share {
  position: relative;
}

.row-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.row-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.row-detail {
  flex: 0 1000 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12.5px;
}

/* A country's flag: flag-icons' square SVG (crates/tally-web/src/flag.rs) drawn round, as
   Outpost's pickers draw it, with a hairline ring in the text colour so a white or a dark
   flag keeps its edge in both themes. */
.flag {
  flex: none;
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: -3px;
  align-self: center;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent);
}

.live-detail .flag,
.menu-item .flag {
  margin-right: 7px;
}

.row-value {
  color: var(--ink);
  font-weight: 580;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.row-share {
  color: var(--muted);
  font-size: 12.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rows-empty {
  padding: 40px 10px;
  color: var(--muted);
  text-align: center;
}

.dash-note {
  margin-top: 18px;
}

/* Error pages */

[data-page="error"] .main {
  padding-top: 80px;
}

/* Narrower screens */

@media (max-width: 1100px) {
  .ledger {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .sites-layout,
  .breakdowns {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi:nth-child(3) {
    border-left: 0;
  }

  .kpi:nth-child(n + 3) {
    border-top: 1px solid var(--line-2);
  }
}

@media (max-width: 640px) {
  .topbar-inner,
  .foot-inner,
  .wrap {
    padding: 0 16px;
  }

  .topnav a:last-child {
    display: none;
  }

  .main {
    padding-top: 24px;
  }

  .page-head h1,
  .dash-title h1 {
    font-size: 30px;
  }

  .kpi {
    padding: 14px 14px 12px;
  }

  .kpi-value {
    font-size: 34px;
  }

  .money-cells dd {
    font-size: 22px;
  }

  .chart {
    --chart-gutter: 34px;
  }

  .chart-plot {
    height: 190px;
  }

  .tick.minor {
    display: none;
  }

  .panel {
    padding: 16px;
  }

  .breakdown {
    padding: 16px 12px 12px;
  }

  .row,
  .rows-head {
    padding: 0 8px;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) 56px 40px;
  }

  .with-revenue .rows-head,
  .with-revenue .row {
    grid-template-columns: minmax(0, 1fr) 52px 64px;
  }

  .site-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .site-mode {
    display: none;
  }

  .facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .live-layer {
    align-items: flex-start;
    gap: 14px;
  }

  .snippet pre {
    padding: 52px 14px 14px;
  }

  .foot-inner {
    flex-direction: column;
    gap: 4px;
  }
}

/* Motion */

@media (prefers-reduced-motion: no-preference) {
  /* The visitor line and its area draw in left to right. */
  .reveal {
    transform-box: view-box;
    transform-origin: 0 0;
    animation: tally-reveal var(--duration-draw) var(--ease-in-out) .1s both;
  }

  .now-dot {
    animation: tally-fade .4s ease calc(var(--duration-draw) + .05s) both;
  }

  .now-ring {
    animation: tally-ring 2.4s var(--ease-out) calc(var(--duration-draw) + .2s) infinite;
  }

  /* Row bars grow from their start. */
  .bar-visitors {
    animation: tally-grow .9s var(--ease-out) .15s both;
  }

  .rows .row:nth-child(2) .bar-visitors { animation-delay: .19s; }
  .rows .row:nth-child(3) .bar-visitors { animation-delay: .23s; }
  .rows .row:nth-child(4) .bar-visitors { animation-delay: .27s; }
  .rows .row:nth-child(5) .bar-visitors { animation-delay: .31s; }
  .rows .row:nth-child(6) .bar-visitors { animation-delay: .35s; }
  .rows .row:nth-child(7) .bar-visitors { animation-delay: .39s; }
  .rows .row:nth-child(8) .bar-visitors { animation-delay: .43s; }

  .menu[open] .menu-list {
    animation: tally-menu .2s var(--ease-out) both;
  }

  .kpi-live[data-live="on"] .live-dot::after {
    animation: tally-ping 2s var(--ease-out) infinite;
  }

  /* Waiting: the beacon breathes. */
  .live-check[data-state="waiting"] .beacon::before {
    animation: tally-breathe 2s var(--ease-in-out) infinite;
  }

  .live-check[data-state="waiting"] .beacon span {
    animation: tally-pulse 2s var(--ease-in-out) infinite;
  }

  /* Live, after a flip: the four strokes, then the fifth across them. */
  .live-check[data-flipped] .tally-draw path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: tally-draw .9s var(--ease-in-out) .35s forwards;
  }

  .live-check[data-flipped] .tally-draw .mark-cross {
    animation-duration: .45s;
    animation-delay: 1.2s;
  }

  .live-check[data-flipped] .tally-draw svg {
    animation: tally-pop .5s var(--ease-out) 1.55s both;
  }
}

@keyframes tally-reveal {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes tally-grow {
  from {
    transform: scaleX(0);
  }
}

@keyframes tally-fade {
  from {
    opacity: 0;
  }
}

@keyframes tally-menu {
  from {
    opacity: 0;
    transform: translate3d(0, -4px, 0) scale(.98);
  }
}

@keyframes tally-ring {
  0% {
    opacity: .7;
    transform: scale(.45);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

@keyframes tally-ping {
  0% {
    opacity: .8;
    transform: scale(.6);
  }
  80%,
  100% {
    opacity: 0;
    transform: scale(1.9);
  }
}

@keyframes tally-breathe {
  0%,
  100% {
    opacity: .15;
    transform: scale(.55);
  }
  50% {
    opacity: .6;
    transform: scale(1);
  }
}

@keyframes tally-pulse {
  0%,
  100% {
    transform: scale(.85);
  }
  50% {
    transform: scale(1);
  }
}

@keyframes tally-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes tally-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ------------------------------------------------------------------ Wave 2: revenue
   The money strip, revenue bars and row overlays on the dashboard; sales with their
   receipts; coverage with its fix-it list; the payment integrations. Revenue is coral.
   A receipt's rail is the visitors' blue up to the credited visit and turns coral where
   the link ties it to money; a break in it is dashed. */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.section-title {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.narrow-col {
  max-width: 860px;
}

/* A site's pages */

.site-nav {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.site-nav ul {
  display: flex;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  /* With a dozen pages the tabs outgrow a phone: they scroll sideways inside this strip
     (the page itself never does), the current tab is brought into view by app.js, and
     the 1px below keeps the current tab's underline on the nav's border. */
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding-bottom: 1px;
  margin-bottom: -1px;
}

.site-nav ul::-webkit-scrollbar {
  display: none;
}

.site-nav li {
  flex: none;
}

@media (max-width: 760px) {
  .site-nav ul:not([data-at-end]) {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
  }
}

.site-tab {
  position: relative;
  display: block;
  padding: 8px 0 11px;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 520;
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s ease;
}

.site-tab:hover {
  color: var(--ink);
}

.site-tab[aria-current] {
  color: var(--ink);
}

.site-tab[aria-current]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--button-bg);
}

/* The money strip: revenue, conversion, revenue per visitor and coverage, above the
   traffic numbers once payments are connected. */
.ledger.has-revenue {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.money-strip {
  overflow: hidden;
}

.kpi-revenue .kpi-value {
  color: var(--revenue-ink);
}

.kpi-note {
  margin-top: -2px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.kpi-coverage {
  display: grid;
  align-content: start;
  background: var(--surface-2);
}

.kpi-coverage .kpi-value {
  margin-bottom: 10px;
}

.coverage-meter,
.import-meter {
  display: block;
  width: 100%;
  height: 6px;
  overflow: visible;
}

.meter-track {
  fill: var(--line);
}

.coverage-meter .meter-fill {
  fill: var(--revenue);
}

.import-meter .meter-fill {
  fill: var(--brand);
}

.coverage-line {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.coverage-link {
  color: var(--revenue-ink);
  font-weight: 600;
  white-space: nowrap;
}

/* The chart's revenue: bars behind the line, read off the right axis. */
.chart.has-revenue {
  --chart-gutter-right: 52px;
}

.chart.has-revenue .chart-plot {
  margin-right: var(--chart-gutter-right);
}

.chart.has-revenue .chart-x {
  width: calc(100% - var(--chart-gutter) - var(--chart-gutter-right));
}

.revenue-bar {
  fill: var(--revenue);
  opacity: .82;
}

.revenue-label {
  fill: var(--revenue-ink);
}

.legend-revenue.on::before {
  width: 10px;
  height: 12px;
  border: 0;
  border-radius: 2px;
  background: var(--revenue);
}

.tip-revenue {
  color: var(--revenue-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tip-revenue:empty {
  display: none;
}

/* Breakdown rows: the coral segment continues the visitor bar, as long as the row's
   share of the panel's top revenue. */
.bar-revenue {
  fill: var(--revenue-bar);
  transform-box: fill-box;
  transform-origin: left center;
}

.row-revenue {
  position: relative;
  color: var(--revenue-ink);
  font-weight: 580;
  font-size: 13.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row-revenue.none {
  color: var(--faint);
  font-weight: 400;
}

.row-revenue.negative {
  color: var(--down);
}

.rows-note {
  margin-top: 10px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

/* Sales */

.subnav {
  margin-bottom: 20px;
}

.sales-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: 18px;
}

.sales-coverage {
  display: grid;
  gap: 8px;
  width: min(100%, 360px);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
}

.sales-coverage:hover .sales-coverage-text {
  color: var(--ink);
}

.sales-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.tab-count {
  margin-left: 6px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.tab[aria-selected="true"] .tab-count {
  color: inherit;
  opacity: .7;
}

.sales-range {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.sales-panel {
  padding: 6px 0;
}

/* One grid for the column heads and every row, so the columns line up. */
.sales-cols,
.sale-row {
  display: grid;
  grid-template-columns: 116px 96px 108px minmax(0, 1.25fr) minmax(0, 1fr) 104px 14px;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
}

.sales-cols {
  height: 34px;
  color: var(--faint);
  font-size: 12.5px;
}

.sales-cols span:first-child {
  text-align: right;
}

.sales {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sale {
  border-top: 1px solid var(--line-2);
}

.sale-row {
  min-height: 52px;
  padding-top: 8px;
  padding-bottom: 8px;
  list-style: none;
  cursor: pointer;
  transition: background-color .15s ease;
}

.sale-row::-webkit-details-marker {
  display: none;
}

.sale-row:hover {
  background: var(--surface-2);
}

.sale-row:focus-visible {
  outline-offset: -2px;
}

.sale-amount {
  display: grid;
  justify-items: end;
  color: var(--ink);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.sale-amount.negative {
  color: var(--down);
}

.sale-charged {
  color: var(--muted);
  font-size: 12px;
  font-weight: 450;
}

.sale-kind,
.sale-when,
.sale-method {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale[data-kind="refund"] .sale-kind,
.sale[data-kind="chargeback"] .sale-kind {
  color: var(--down);
}

.sale-when {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sale-source {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.sale-source-name {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-channel {
  flex: 0 1000 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-source.unlinked,
.sale[data-linked="no"] .sale-method {
  color: var(--faint);
}

.sale-chevron {
  width: 12px;
  height: 8px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .3s var(--ease-out);
}

.sale-details[open] .sale-chevron {
  transform: rotate(180deg);
}

.sale-details[open] .sale-row {
  background: var(--surface-2);
}

/* Confidence: three steps, filled from the left. */
.confidence {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.confidence-meter {
  display: inline-grid;
  grid-template-columns: repeat(3, 5px);
  gap: 2px;
}

.confidence-meter span {
  height: 11px;
  border-radius: 1px;
  background: var(--line);
}

.confidence[data-level="1"] .confidence-meter span:nth-child(-n + 1),
.confidence[data-level="2"] .confidence-meter span:nth-child(-n + 2),
.confidence[data-level="3"] .confidence-meter span {
  background: var(--ink-2);
}

.confidence[data-level="0"] {
  color: var(--faint);
}

/* The receipt: the evidence chain, unfolded under its row. */
.receipt {
  margin: 0 18px 16px;
  padding: 18px 22px 8px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius-control) var(--radius-control);
  background: var(--surface);
}

.receipt-title {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.chain {
  margin: 0;
  padding: 0;
  list-style: none;
}

.proof {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 18px;
}

/* The rail from each node to the next. */
.chain .proof::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 16px;
  bottom: -2px;
  width: 2px;
  border-radius: 1px;
  background: var(--visitors);
  transform-origin: top center;
}

.chain .proof:last-child::before {
  display: none;
}

.chain .proof[data-step="link"]::before {
  background: var(--revenue);
}

.chain .proof[data-step="parent"]::before,
.chain .proof[data-step="gap"]::before {
  background: repeating-linear-gradient(to bottom, var(--faint) 0 4px, transparent 4px 8px);
}

.node {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  margin: 5px 0 0 5px;
  border: 2px solid var(--visitors);
  border-radius: 50%;
  background: var(--surface);
}

.proof[data-step="visits"] .node {
  width: 8px;
  height: 8px;
  margin: 7px 0 0 7px;
  border: 0;
  background: var(--visitors);
}

.proof[data-step="credited"] .node {
  background: var(--visitors);
  box-shadow: 0 0 0 4px var(--visitors-bar);
}

.proof[data-step="link"] .node {
  border-color: var(--revenue);
  background: var(--revenue);
}

.proof[data-step="payment"] .node {
  border-color: var(--revenue-ink);
  border-radius: 3px;
  background: var(--revenue-ink);
}

.proof[data-step="parent"] .node {
  border-color: var(--faint);
  border-radius: 3px;
}

.proof[data-step="gap"] .node {
  border: 2px dashed var(--faint);
}

.proof-body {
  min-width: 0;
}

.proof-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
}

.proof-title {
  color: var(--ink);
  font-weight: 620;
}

.proof[data-step="payment"] .proof-title {
  color: var(--revenue-ink);
}

.proof-when {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.proof-line {
  margin-top: 2px;
  max-width: 72ch;
  color: var(--ink-2);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.proof-line + .proof-line {
  color: var(--muted);
  font-size: 13.5px;
}

.proof-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--revenue-ink);
  font-size: 14px;
  font-weight: 600;
}

.proof[data-step="parent"] .proof-link {
  color: var(--ink-2);
}

/* Ids: whole, in mono, each with its copy button. */
.ids {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.id-row {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.id-row dt {
  color: var(--muted);
  font-size: 12.5px;
}

.id-row dd,
.account-facts dd {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.id {
  min-width: 0;
  padding: 2px 6px;
  color: var(--ink);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.copy-id {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}

.copy-id:hover {
  border-color: var(--faint);
  color: var(--ink);
}

.copy-id svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-check {
  opacity: 0;
  stroke: var(--live-ink);
  stroke-width: 1.8;
}

.copy-back,
.copy-front,
.copy-check {
  transition: opacity .2s ease;
}

.copy-id[data-copied] .copy-back,
.copy-id[data-copied] .copy-front {
  opacity: 0;
}

.copy-id[data-copied] .copy-check {
  opacity: 1;
}

.sales-empty {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 36px 22px;
  color: var(--muted);
}

.sales-empty-title {
  color: var(--ink);
  font-size: 17px;
  font-weight: 620;
}

.sales-empty .button {
  margin-top: 6px;
}

.pager {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* Coverage */

.coverage-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.coverage-number {
  margin-top: 6px;
  color: var(--revenue-ink);
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.coverage-caption {
  margin-top: 6px;
  color: var(--muted);
}

.coverage-explain {
  margin-top: 14px;
  max-width: 70ch;
  color: var(--ink-2);
}

.method-ledger {
  margin-top: 22px;
}

.ledger-bar {
  display: block;
  width: 100%;
  height: 16px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}

.segment {
  stroke: var(--surface);
  stroke-width: 2;
}

/* Strongest methods darkest: from the revenue ink down to its palest tint. */
[data-method="checkout_metadata"] {
  --tone: var(--revenue-ink);
}

[data-method="payment_link"] {
  --tone: color-mix(in srgb, var(--revenue-ink) 45%, var(--revenue));
}

[data-method="success_page"] {
  --tone: var(--revenue);
}

[data-method="email_match"] {
  --tone: color-mix(in srgb, var(--revenue) 55%, var(--surface));
}

[data-method="renewal"] {
  --tone: var(--revenue-line);
}

[data-method="refund_of"] {
  --tone: var(--revenue-bar);
}

.segment {
  fill: var(--tone, var(--revenue));
}

.segment[data-method="none"] {
  fill: url(#tally-unlinked);
}

.hatch-ground {
  fill: var(--surface-2);
}

.hatch-line {
  fill: var(--faint);
  opacity: .55;
}

.methods {
  display: grid;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.method {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 120px 110px 84px;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line-2);
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--tone, var(--revenue));
}

.method[data-method="none"] .swatch {
  background: repeating-linear-gradient(45deg, var(--faint) 0 2px, var(--surface-2) 2px 5px);
}

.method-name {
  display: grid;
  min-width: 0;
}

.method-label {
  color: var(--ink);
  font-weight: 560;
}

.method-detail {
  color: var(--muted);
  font-size: 13px;
}

.method-count {
  color: var(--muted);
  font-size: 13.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.method-money {
  color: var(--ink);
  font-weight: 620;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.method[data-method="none"] .method-money {
  color: var(--muted);
}

.fixes {
  margin-top: 28px;
}

.fixes .lede {
  margin-top: 4px;
}

.fix-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.fixes-empty {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-panel);
  color: var(--muted);
}

.fix {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  scroll-margin-top: 24px;
}

.fix:target {
  border-color: var(--revenue-line);
}

.fix-money {
  display: grid;
  align-content: start;
  gap: 2px;
}

.fix-amount {
  color: var(--revenue-ink);
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.fix-count {
  color: var(--muted);
  font-size: 13px;
}

.fix-title {
  font-size: 17px;
  font-weight: 640;
}

.fix-detail {
  margin-top: 6px;
  max-width: 70ch;
  color: var(--ink-2);
  font-size: 14.5px;
}

/* Snippet tabs: radios styled as tabs, so they work without the script; every panel
   shares one cell, so switching never moves the page. */
.snips {
  margin-top: 14px;
}

.snip-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  margin: 0 0 8px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface-2);
}

.snip-tab {
  position: relative;
  padding: 3px 11px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 520;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}

.snip-tab:hover {
  color: var(--ink);
}

.snip-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.snip-tab:has(.snip-input:checked) {
  background: var(--button-bg);
  color: var(--button-ink);
}

.snip-tab:has(.snip-input:focus-visible) {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.snip-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.snip-panels {
  display: grid;
}

.snip-panel {
  position: relative;
  grid-area: 1 / 1;
  visibility: hidden;
}

.snip-panel pre {
  margin: 0;
  padding: 16px 104px 16px 16px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.snip-panel code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

.snips:has(.snip-tab:nth-of-type(1) .snip-input:checked) .snip-panel:nth-of-type(1),
.snips:has(.snip-tab:nth-of-type(2) .snip-input:checked) .snip-panel:nth-of-type(2),
.snips:has(.snip-tab:nth-of-type(3) .snip-input:checked) .snip-panel:nth-of-type(3),
.snips:has(.snip-tab:nth-of-type(4) .snip-input:checked) .snip-panel:nth-of-type(4),
.snips:has(.snip-tab:nth-of-type(5) .snip-input:checked) .snip-panel:nth-of-type(5),
.snips:has(.snip-tab:nth-of-type(6) .snip-input:checked) .snip-panel:nth-of-type(6),
.snips:has(.snip-tab:nth-of-type(7) .snip-input:checked) .snip-panel:nth-of-type(7) {
  visibility: visible;
}

/* Integrations */

.notice {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-left: 3px solid var(--live);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  background: var(--live-tint);
  color: var(--ink);
}

.account {
  margin-bottom: 16px;
}

.account-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
}

.provider {
  color: var(--muted);
  font-size: 13px;
}

.account-name {
  font-size: 20px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.test-badge {
  padding: 3px 8px;
  border: 1px dashed var(--brand);
  border-radius: 4px;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 620;
  white-space: nowrap;
}

.account-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto));
  justify-content: start;
  gap: 8px 32px;
  margin: 16px 0 0;
}

.account-facts dt {
  color: var(--muted);
  font-size: 12.5px;
}

.account-facts dd {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.account-state {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-control);
  background: var(--surface-2);
}

.state-line {
  color: var(--ink);
  font-weight: 560;
}

.account-state.ok .state-line::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 8px 1px 0;
  border-radius: 50%;
  background: var(--live);
}

.account-state.error {
  background: var(--down-tint);
}

.account-state.error .state-line {
  color: var(--down);
}

.state-detail {
  color: var(--muted);
  font-size: 13.5px;
}

.confirm {
  margin-top: 16px;
}

.confirm > summary {
  list-style: none;
}

.confirm > summary::-webkit-details-marker {
  display: none;
}

.button.danger-quiet {
  color: var(--down);
}

.confirm[open] > summary {
  border-color: var(--down);
}

.confirm-body {
  display: grid;
  justify-items: start;
  gap: 12px;
  max-width: 62ch;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--ink-2);
  font-size: 14px;
}

.button.danger {
  border-color: var(--down);
  background: var(--down);
  color: #ffffff;
}

.button.danger:hover {
  border-color: var(--down);
  opacity: .9;
}

.connect-title {
  font-size: 18px;
  font-weight: 650;
}

.connect-steps {
  margin-top: 16px;
}

.connect-steps > .step {
  display: block;
  padding: 0 0 4px;
}

.connect-steps > .step + .step {
  padding-top: 16px;
  border-top: 1px solid var(--line-2);
}

.connect-steps > .step > p {
  margin-top: 8px;
  color: var(--muted);
}

.connect-steps .step-title {
  font-size: 16px;
}

.table-scroll {
  margin-top: 12px;
  overflow-x: auto;
}

.permissions {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.permissions th,
.permissions td {
  padding: 7px 12px 7px 0;
  border-top: 1px solid var(--line-2);
  text-align: left;
  vertical-align: top;
}

.permissions thead th {
  border-top: 0;
  color: var(--faint);
  font-size: 12.5px;
  font-weight: 500;
}

.permissions tbody th {
  color: var(--ink);
  font-weight: 560;
  white-space: nowrap;
}

.permissions .access {
  color: var(--ink-2);
  white-space: nowrap;
}

.permissions .access.write {
  color: var(--ink);
  font-weight: 650;
}

.permissions .why {
  color: var(--muted);
}

/* WooCommerce's one-click connect, above the manual steps, and its approval page. */
.woo-one-click {
  margin: 4px 0 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.woo-grants {
  margin: 14px 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--ink-2);
}

.woo-approve-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* A Shopify store's tracking on its account card: the pixel's state and the link that
   switches the theme app embed on. */
.store-setup {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  display: grid;
  gap: 8px;
  justify-items: start;
}

.connect-form {
  max-width: 520px;
}

.input.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
}

.another {
  margin-top: 8px;
}

.another > summary {
  display: inline-block;
  color: var(--ink-2);
  font-weight: 560;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: .25em;
  cursor: pointer;
  list-style: none;
}

.another > summary:hover {
  text-decoration-color: currentColor;
}

/* Round 4: one connect panel per provider, each unfolding from its row. */

.connect-choices {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.connect-choices-title {
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 620;
}

.connect-choice {
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

.connect-choice > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 14px 44px 14px 18px;
  position: relative;
  border-radius: var(--radius-panel);
  cursor: pointer;
  list-style: none;
}

.connect-choice > summary::-webkit-details-marker {
  display: none;
}

.connect-choice > summary::after {
  content: "";
  position: absolute;
  top: 20px;
  right: 20px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .2s var(--ease-out);
}

.connect-choice[open] > summary::after {
  transform: translateY(3px) rotate(-135deg);
}

.connect-choice > summary:hover .connect-summary-name {
  color: var(--brand);
}

.connect-choice > summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.connect-summary-name {
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
}

.connect-summary-note {
  color: var(--muted);
  font-size: 13.5px;
}

.connect-choice > .panel.connect {
  border: 0;
  border-top: 1px solid var(--line-2);
  border-radius: 0 0 var(--radius-panel) var(--radius-panel);
}

.webhook-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13.5px;
}

.webhook-line .id {
  overflow-wrap: anywhere;
}

.webhook-label {
  color: var(--muted);
  font-size: 12.5px;
}

.webhook-note {
  max-width: 68ch;
  margin-top: 6px;
}

.sales-lede {
  margin-top: 0;
}

.another > summary::-webkit-details-marker {
  display: none;
}

.another[open] > .connect {
  margin-top: 12px;
}

@media (max-width: 1100px) {
  .sales-cols,
  .sale-row {
    grid-template-columns: 108px 88px 96px minmax(0, 1.2fr) minmax(0, 1fr) 96px 14px;
    gap: 12px;
  }
}

@media (max-width: 900px) {
  .sales-cols {
    display: none;
  }

  /* Each sale in two columns: amount and when, source and kind, method and confidence. */
  .sale-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "amount when"
      "source kind"
      "method confidence";
    gap: 4px 12px;
    padding: 12px 16px;
  }

  .sale-amount {
    grid-area: amount;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-items: start;
    gap: 0 8px;
  }

  .sale-when {
    grid-area: when;
    text-align: right;
  }

  .sale-source {
    grid-area: source;
  }

  .sale-kind {
    grid-area: kind;
    color: var(--muted);
    text-align: right;
  }

  .sale-method {
    grid-area: method;
    color: var(--muted);
    font-size: 13px;
  }

  .confidence {
    grid-area: confidence;
    justify-self: end;
    font-size: 13px;
  }

  .sale-chevron {
    display: none;
  }

  .method {
    grid-template-columns: 12px minmax(0, 1fr) auto;
    grid-template-areas:
      "swatch name money"
      ". confidence count";
    gap: 4px 12px;
  }

  .method .swatch {
    grid-area: swatch;
  }

  .method-name {
    grid-area: name;
  }

  .method-confidence {
    grid-area: confidence;
  }

  .method-count {
    grid-area: count;
  }

  .method-money {
    grid-area: money;
  }

  .account-facts {
    grid-template-columns: repeat(2, minmax(0, auto));
  }
}

@media (max-width: 640px) {
  .site-nav ul {
    gap: 18px;
  }

  .site-tab {
    font-size: 14px;
  }

  .receipt {
    margin: 0 8px 12px;
    padding: 14px 12px 4px;
  }

  .id-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .coverage-number {
    font-size: 48px;
  }

  .fix {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .snip-panel pre {
    padding: 52px 14px 14px;
  }

  .chart.has-revenue {
    --chart-gutter-right: 40px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* Revenue bars grow up from the baseline, then the row overlays continue the visitor
     bars, and meters fill. */
  .revenue-bars {
    transform-box: view-box;
    transform-origin: 50% 100%;
    animation: tally-rise 1s var(--ease-out) .2s both;
  }

  .bar-revenue {
    animation: tally-grow .8s var(--ease-out) .6s both;
  }

  .rows .row:nth-child(2) .bar-revenue { animation-delay: .64s; }
  .rows .row:nth-child(3) .bar-revenue { animation-delay: .68s; }
  .rows .row:nth-child(4) .bar-revenue { animation-delay: .72s; }
  .rows .row:nth-child(5) .bar-revenue { animation-delay: .76s; }
  .rows .row:nth-child(6) .bar-revenue { animation-delay: .8s; }
  .rows .row:nth-child(7) .bar-revenue { animation-delay: .84s; }
  .rows .row:nth-child(8) .bar-revenue { animation-delay: .88s; }

  .meter-fill {
    transform-box: fill-box;
    transform-origin: left center;
    animation: tally-grow 1.1s var(--ease-out) .3s both;
  }

  .ledger-segments {
    transform-box: fill-box;
    transform-origin: left center;
    animation: tally-grow 1.2s var(--ease-out) .15s both;
  }

  /* A receipt unfolds in place: the row's height eases open, then the rail draws down
     and each step arrives in order. */
  :root {
    interpolate-size: allow-keywords;
  }

  .sale-details::details-content,
  .confirm::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size .45s var(--ease-out), content-visibility .45s allow-discrete;
  }

  .sale-details[open]::details-content,
  .confirm[open]::details-content {
    block-size: auto;
  }

  .sale-details[open] .chain .proof {
    animation: tally-step .5s var(--ease-out) both;
  }

  .sale-details[open] .chain .proof::before {
    animation: tally-rail .45s var(--ease-in-out) both;
  }

  .sale-details[open] .chain .proof:nth-child(1) { animation-delay: .08s; }
  .sale-details[open] .chain .proof:nth-child(2) { animation-delay: .16s; }
  .sale-details[open] .chain .proof:nth-child(3) { animation-delay: .24s; }
  .sale-details[open] .chain .proof:nth-child(4) { animation-delay: .32s; }
  .sale-details[open] .chain .proof:nth-child(5) { animation-delay: .4s; }
  .sale-details[open] .chain .proof:nth-child(6) { animation-delay: .48s; }
  .sale-details[open] .chain .proof:nth-child(7) { animation-delay: .56s; }

  .sale-details[open] .chain .proof:nth-child(1)::before { animation-delay: .2s; }
  .sale-details[open] .chain .proof:nth-child(2)::before { animation-delay: .28s; }
  .sale-details[open] .chain .proof:nth-child(3)::before { animation-delay: .36s; }
  .sale-details[open] .chain .proof:nth-child(4)::before { animation-delay: .44s; }
  .sale-details[open] .chain .proof:nth-child(5)::before { animation-delay: .52s; }
  .sale-details[open] .chain .proof:nth-child(6)::before { animation-delay: .6s; }
}

@keyframes tally-rise {
  from {
    transform: scaleY(0);
  }
}

@keyframes tally-step {
  from {
    opacity: 0;
    transform: translate3d(0, 6px, 0);
  }
}

@keyframes tally-rail {
  from {
    transform: scaleY(0);
  }
}
