
:root {
  --ground: #F4F4EF;
  --panel: #FFFFFF;
  --ink: #121212;
  --muted: #5C5C58;
  --hair: #D6D6CF;
  --soft: #EDEDE7;
  --bar-text: #FAFAF7;
  --bar-muted: #B5B5AE;
  --bar-link: #E4E4DE;
  --series-b: #A8A8A0;
  --est: #B8280B;
  --sans: 'Archivo', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.45; }
a { color: var(--ink); text-underline-offset: 2px; }
a:hover { color: var(--est); }
h1, h2, h3, p { margin: 0; }
h3 { font-size: 13px; font-weight: 800; }

/* top bar: one row on a desk, two on a phone (brand and sign out, then the menu, which scrolls in its own row) */
.bar { background: var(--ink); color: var(--bar-text); }
.bar-in { max-width: 1280px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; column-gap: 28px; min-height: 56px; }
.brand { flex: 0 0 auto; font-weight: 800; font-size: 16px; letter-spacing: -0.01em; color: var(--bar-text); text-decoration: none; padding: 12px 0; white-space: nowrap; }
.brand:hover { color: var(--bar-text); }
.brand-sub { color: var(--bar-muted); font-weight: 400; }
.nav { display: flex; column-gap: 2px; flex: 1 1 auto; min-width: 0; }
.nav a { text-decoration: none; padding: 0 11px; min-height: 44px; display: inline-flex; align-items: center; color: var(--bar-link); white-space: nowrap; }
.nav a:hover { color: var(--bar-text); text-decoration: underline; }
.nav a[aria-current="page"] { background: var(--bar-text); color: var(--ink); font-weight: 600; text-decoration: none; }
.who { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 14px; }
.who-name { font-family: var(--mono); font-size: 12px; color: var(--bar-muted); max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who form { margin: 0; }
.who button { min-height: 36px; padding: 0 12px; background: transparent; color: var(--bar-text); border: 1px solid var(--bar-muted); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.who button:hover { border-color: var(--bar-text); }

/* page */
.page { max-width: 1280px; margin: 0 auto; padding: 28px 28px 56px; display: flex; flex-direction: column; gap: 24px; }
.narrow { max-width: 460px; margin: 64px auto 56px; padding: 32px 32px 36px; background: var(--panel); border-top: 6px solid var(--ink); display: flex; flex-direction: column; gap: 18px; }
.narrow .form, .narrow .field { align-self: stretch; }
.narrow .field input[type] { width: 100%; }
.narrow .flash, .narrow .error { background: var(--ground); }
.narrow .form .btn { align-self: flex-start; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 14px; }
.head h1, .narrow h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.head h1 .sub { color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
.back { margin-bottom: -10px; font-size: 13px; }
.action-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.action-bar .back { margin: 0; }
.action-bar .action p { margin: 0; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; margin-bottom: -14px; }
.section-head h2 { font-size: 15px; font-weight: 800; }
.rules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px 24px; }

/* period and metric buttons */
.periods { display: flex; flex-wrap: wrap; }
.periods button, .periods a { min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; background: var(--panel); color: var(--ink); border: 1px solid var(--ink); border-left-width: 0; font: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
.periods > :first-child { border-left-width: 1px; }
.periods .on, .periods [aria-pressed="true"], .periods [aria-current] { background: var(--ink); color: var(--bar-text); font-weight: 600; }

/* labels and figures */
.label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.est { color: var(--est); }
.label.est { color: var(--est); }

/* totals strip: figures never break inside a number */
.totals { display: flex; flex-wrap: wrap; background: var(--panel); border-top: 6px solid var(--ink); border-bottom: 1px solid var(--ink); }
.total { flex: 1 1 140px; min-width: 0; padding: 16px 20px 18px; border-left: 1px solid var(--hair); }
.total:first-child { border-left: 0; }
.total .num { display: block; font-size: 24px; font-weight: 500; margin-top: 14px; white-space: nowrap; }
.total-lead { flex: 2 1 300px; }
.total-lead .num { font-size: 52px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; margin-top: 8px; }
.total-key { flex: 1.6 1 220px; }
.total-key .num { font-weight: 600; }

/* panels */
/* A panel's flex sizing applies only side by side in a .panels row. Directly in the page, which is a
   flex column, a flex-basis would be a height. In a row, a panel keeps its own height. */
.panels { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.panel { min-width: 0; background: var(--panel); border-top: 2px solid var(--ink); padding: 18px 22px 20px; }
.panels > .panel { flex: 1 1 320px; }
.panels > .panel-wide { flex: 3 1 520px; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin-bottom: 8px; }
.panel-head h2, .panel-head h3 { margin: 0; }
.panel h2 { font-size: 15px; font-weight: 800; }
.panel > h2 { margin-bottom: 8px; }
.panel > p + p { margin-top: 10px; }
.panel > .field-note { margin-top: 10px; }
.panel > form, .panel > p + form, .table-box + form, .rows + form { margin-top: 14px; }
.panel > * + .link-actions { margin-top: 12px; }
.panel > form + p { margin-top: 12px; }
/* A part of one panel under its own small heading (an access request's copy: answers, consent records, the visit). */
.panel > h3.part { margin: 24px 0 4px; }
.more { margin-top: 12px; font-size: 13px; }
.more a { display: inline-flex; align-items: center; min-height: 32px; }

/* data table: the box scrolls, never the page */
.table-box { overflow-x: auto; position: relative; }
.data { border-collapse: collapse; width: 100%; }
.data th { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: right; vertical-align: bottom; padding: 8px 0 8px 14px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.data td { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; text-align: right; vertical-align: top; padding: 9px 0 9px 14px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
.data th:first-child, .data td:first-child { text-align: left; padding-left: 0; }
.data td:first-child { font-family: var(--sans); font-size: 14px; font-weight: 600; white-space: normal; overflow-wrap: anywhere; min-width: 12ch; }
.data td:last-child { font-weight: 600; }
.data th.left, .data td.left { text-align: left; }
.data td.nowrap { white-space: nowrap; }
.data td .note { font-family: var(--sans); font-size: 12px; }
.form > .group { align-self: stretch; }
.data td.wrap { white-space: normal; text-align: left; font-family: var(--sans); font-weight: 400; min-width: 16ch; overflow-wrap: anywhere; }
.data td.text { font-family: var(--sans); text-align: left; }
.data th.text { text-align: left; }
.data td.status-failed, .data td.status-incomplete { font-family: var(--sans); font-weight: 800; }
.data td.status-incomplete { color: var(--est); }
.data td .row-note { font-family: var(--sans); font-weight: 400; white-space: normal; }
.data td .label { font-size: 10px; }
.data form { margin: 0; }
.data td .btn { font-family: var(--sans); font-weight: 600; }
.data tr.zero td { color: var(--muted); }
.data tr.sum td { border-top: 2px solid var(--ink); font-weight: 600; }
.data tr.group th { text-align: left; padding: 18px 0 6px; border-bottom: 1px solid var(--ink); color: var(--ink); font-size: 12px; }
.data tr.shown td { border-bottom: 0; }
.data tr.token-row td { font-family: var(--sans); font-weight: 400; padding-top: 0; }
.data tr.group:first-child th { padding-top: 10px; }
.data tr.group th .muted { font-weight: 400; letter-spacing: 0; text-transform: none; margin-left: 8px; }
.data tr.group h3 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.group-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.group-head .btn { min-height: 36px; font-size: 12px; letter-spacing: 0; text-transform: none; }
.open-cell { display: flex; align-items: center; gap: 10px; justify-content: flex-start; }
.toolbar { margin: 12px 0 0; }
.data td.name { font-weight: 600; min-width: 20ch; }
.data .sub-row td:first-child { padding-left: 14px; font-weight: 400; }
.data-narrow { width: auto; min-width: 360px; }
/* the Dashboard's Offers table: the name takes the slack, the figures sit together at the right, each as wide as it needs */
.offer-figures th:not(:first-child), .offer-figures td:not(:first-child) { width: 1%; padding-left: 28px; }
.data tfoot td { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 600; }

/* list rows */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--hair); }
.row:last-child { border-bottom: 0; }
.row-main { min-width: 0; overflow-wrap: anywhere; }
.row-title { font-weight: 600; }
a.row-title { display: inline-flex; align-items: center; min-height: 32px; }
.row-note { font-size: 12px; color: var(--muted); }
.row .num { font-weight: 500; }
/* a person's sign-ins on a partner's page */
.seen { display: flex; flex-wrap: wrap; gap: 2px 18px; margin: 6px 0 0; font-size: 12px; }
.seen div { display: flex; gap: 6px; }
.seen dt { color: var(--muted); }
.seen dd { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* the Activity table: refusals and failed sign-ins carry a heavier line */
.data.activity tr.flagged td, .data.quality tr.flagged td { font-weight: 600; }
.data.activity td.wrap { min-width: 14ch; }
.data.activity td.what { min-width: 24ch; }
.data.activity td.ip { white-space: normal; overflow-wrap: anywhere; min-width: 20ch; }
/* a table with many figure columns: its headings wrap at word breaks, so the columns fit a desk screen */
.data.many th { white-space: normal; }
.pager { display: flex; gap: 20px; }

/* buttons */
.btn { min-height: 44px; padding: 0 18px; background: var(--ink); color: var(--bar-text); border: 1px solid var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--panel); color: var(--ink); }
.btn-plain { background: var(--panel); color: var(--ink); font-weight: 400; }
.btn-plain:hover { background: var(--ink); color: var(--bar-text); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 13px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
:focus-visible { outline: 2px solid var(--est); outline-offset: 2px; }
.nav a:focus-visible, .who button:focus-visible { outline-color: var(--bar-text); }

/* the date range control on a dashboard's heading line: six presets and Custom as one mono caps
   strip, the active one in black. Custom opens From, To, and Apply under the strip's right end, and
   the heading line grows to hold them, so nothing is covered. */
.head .range { margin-left: auto; }
.head #data-through { font-size: 13px; flex: 0 1 auto; max-width: 48ch; }
.viewing { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 10px 16px; background: var(--ink); color: var(--bar-text); }
.range { display: flex; flex-wrap: wrap; align-items: flex-start; padding-left: 1px; }
.range-presets { display: flex; flex-wrap: wrap; }
.range-presets a, .range-custom > summary { min-height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; margin-left: -1px; background: var(--panel); color: var(--ink); border: 1px solid var(--ink); font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; white-space: nowrap; }
.range-presets a:hover, .range-custom > summary:hover { color: var(--ink); text-decoration: underline; }
.range-presets a[aria-current], .range-on > summary, .range-on > summary:hover { background: var(--ink); color: var(--bar-text); font-weight: 600; }
.range-custom { position: relative; }
.range-custom > summary { width: auto; list-style: none; }
.range-custom > summary::-webkit-details-marker { display: none; }
.range-custom[open] { margin-bottom: 60px; }
.range-custom[open] > summary { margin-bottom: 0; }
.range-custom > form { position: absolute; right: 0; top: 52px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.range-field { display: inline-flex; align-items: center; gap: 6px; }
.range-field .label { font-family: var(--mono); font-weight: 500; }
.range-field input { min-height: 44px; padding: 0 8px; font-family: var(--mono); font-size: 13px; background: var(--panel); color: var(--ink); border: 1px solid var(--ink); border-radius: 0; width: 16ch; max-width: 100%; }
.range-custom .btn { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; padding: 0 14px; }

/* forms: each field is as wide as what goes in it */
.form { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.field { display: flex; flex-direction: column; gap: 6px; max-width: 100%; min-width: 0; }
.field input, .field select, .field textarea { font: inherit; font-size: 15px; background: var(--panel); color: var(--ink); border: 1px solid var(--ink); border-radius: 0; max-width: 100%; }
.field input, .field select { min-height: 44px; padding: 0 10px; }
.field select { width: auto; text-overflow: ellipsis; }
.field select.wide { width: 34ch; }
.field input[type="email"] { width: 32ch; }
.field input[type="password"] { width: 24ch; }
.field input[type="date"], .field input.date { width: 17ch; font-family: var(--mono); }
/* our own calendar, under a date field (script.ts) */
.cal { position: absolute; z-index: 30; width: 272px; padding: 10px 10px 12px; background: var(--panel); border: 1px solid var(--ink); border-top-width: 4px; }
.cal[hidden] { display: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-size: 14px; font-weight: 600; }
.cal-step { width: 36px; height: 36px; padding: 0; background: var(--panel); color: var(--ink); border: 1px solid var(--ink); border-radius: 0; font: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.cal-step:hover { background: var(--ink); color: var(--bar-text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-week { padding: 4px 0; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: center; }
.cal-day { height: 34px; padding: 0; background: var(--panel); color: var(--ink); border: 1px solid transparent; border-radius: 0; font-family: var(--mono); font-size: 13px; cursor: pointer; }
.cal-day:hover { border-color: var(--ink); }
.cal-today { border-color: var(--hair); font-weight: 600; }
.cal-on, .cal-on:hover { background: var(--ink); color: var(--bar-text); border-color: var(--ink); }
.cal-day:disabled, .cal-day:disabled:hover { color: var(--hair); border-color: transparent; cursor: default; }
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; }
.field-note { font-size: 12px; color: var(--muted); max-width: 90ch; }
.field input.text { width: 32ch; }
.field input.short { width: 16ch; }
.field-wide { width: 100%; }
.field-grow { flex: 1 1 420px; }
.field-grow textarea { width: 100%; }
.field input.url { width: 100%; font-family: var(--mono); font-size: 13px; }
.field textarea { width: 60ch; padding: 10px; }
.group { border: 0; border-top: 1px solid var(--hair); margin: 0; padding: 12px 0 0; min-width: 0; max-width: 100%; }
.group legend { padding: 0 8px 0 0; }
.group > .form-inline { margin-top: 8px; }
.group > .field-note { margin-top: 8px; }
.advanced > .group { margin-top: 6px; padding-top: 14px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 20px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.check input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--ink); }

/* estimate labels in table heads */
.data th.est { color: var(--est); }

/* dashboard tiles: six, each the period large over one line for the period before it. Revenue is the widest. */
.tiles { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--panel); border-top: 6px solid var(--ink); border-bottom: 1px solid var(--ink); }
.tile { min-width: 0; padding: 16px 18px 16px; border-left: 1px solid var(--hair); display: flex; flex-direction: column; }
.tile:first-child { border-left: 0; }
.tile[data-tile="revenue"] { grid-column: span 2; }
.tile-sub { font-size: 12px; color: var(--muted); margin-top: 10px; }
.tile-num { display: block; font-size: 26px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; white-space: nowrap; }
.tile[data-tile="revenue"] .tile-num { font-size: 40px; letter-spacing: -0.04em; }
.tile-prev { margin: auto 0 0; padding-top: 8px; border-top: 1px solid var(--hair); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 10px; font-size: 12px; }
.tile-num + .tile-prev { margin-top: 12px; }
.tile-prev-words { color: var(--muted); }
.tile-prev .num { white-space: nowrap; margin-left: auto; }
.notes { display: flex; flex-direction: column; gap: 4px; }
.none { color: var(--muted); font-weight: 400; }
.tiles-quiet .tile-num, .tiles-quiet .tile-prev .num { color: var(--muted); font-weight: 400; }

/* charts (chart.ts): vertical bars over a three-line scale; the box scrolls when the bars need more room */
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.legend { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.legend .num { color: var(--ink); font-weight: 600; }
.legend .num.est { color: var(--est); }
.swatch { width: 12px; height: 12px; display: block; flex: 0 0 auto; }
.swatch-a { background: var(--ink); }
.swatch-b { background: var(--series-b); }
.swatch-est { background: var(--panel); border: 2px solid var(--est); }
.chart-box { overflow-x: auto; margin-top: 6px; padding-top: 10px; position: relative; }
.chart { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; min-width: 300px; }
.chart-month { min-width: 640px; }
.chart-wide { min-width: 900px; }
.chart-y { height: 200px; display: flex; flex-direction: column; justify-content: space-between; text-align: right; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.chart-y span { line-height: 1; transform: translateY(-50%); }
.chart-y span:last-child { transform: translateY(50%); }
.chart-plot { list-style: none; margin: 0; padding: 0; display: flex; position: relative; }
.chart-plot::before, .chart-plot::after { content: ''; position: absolute; left: 0; right: 0; border-top: 1px solid var(--soft); pointer-events: none; }
.chart-plot::before { top: 0; }
.chart-plot::after { top: 100px; }
.chart-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.chart-bars { height: 200px; display: flex; align-items: flex-end; justify-content: center; gap: 1px; padding: 0 12%; border-bottom: 1px solid var(--ink); position: relative; z-index: 1; }
.chart-pair .chart-bars { padding: 0 10%; }
.cbar { display: block; flex: 1 1 0; max-width: 22px; min-width: 1px; }
.cbar-a { background: var(--ink); }
.cbar-b { background: var(--series-b); }
.cbar-est { background: var(--panel); border: 2px solid var(--est); border-bottom: 0; }
.cbar-none { background: transparent; }
.chart-x { height: 20px; padding-top: 5px; font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: visible; }
.chart-empty { height: 200px; margin-top: 14px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--ink); border-top: 1px solid var(--soft); color: var(--muted); text-align: center; padding: 0 16px; }
/* a chart with nothing to draw: one line and the next step, about a third of the chart's height */
.chart-none { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; margin-top: 6px; padding: 12px 0; border-top: 1px solid var(--soft); border-bottom: 1px solid var(--ink); }
.chart-none p { color: var(--muted); max-width: 70ch; }
.chart-figures { margin-top: 10px; }
.chart-figures > summary { font-weight: 400; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* links and statuses */
.link-item { display: flex; flex-direction: column; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--hair); }
.link-item:last-child { border-bottom: 0; }
.link-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 16px; }
.link-head .row-main { flex: 1 1 320px; }
.link-state { display: flex; align-items: center; gap: 12px; }
.link-state form, .row form { margin: 0; }
.link-url { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.link-url .field { flex: 1 1 360px; }
.status { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.status-paused, .status-void, .status-draft, .status-pending, .status-not_approved { color: var(--muted); }
.link-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row > .link-actions { flex-wrap: nowrap; flex-shrink: 0; }
.data td.num:first-child { font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--muted); min-width: 0; }
.link-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; }
details { max-width: 100%; }
details > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; width: max-content; max-width: 100%; }
details[open] > summary { margin-bottom: 8px; }
.advanced { display: flex; flex-direction: column; gap: 16px; border-top: 1px solid var(--hair); padding-top: 4px; width: 100%; }
.link-item > details > summary, .rename > summary { font-weight: 400; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
/* The hidden attribute always hides, whatever display a class gives (search, select all). */
[hidden] { display: none !important; }
.finder input { width: 100%; max-width: 420px; }
.check-all { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--ink); padding: 0 12px; background: var(--panel); }
.cats { display: flex; flex-wrap: wrap; gap: 6px; }
.cats a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 1px solid var(--hair); background: var(--panel); text-decoration: none; font-size: 13px; }
.cats a .num { color: var(--muted); font-size: 12px; }
.cats a[aria-current] { border-color: var(--ink); background: var(--ink); color: var(--bar-text); }
.cats a[aria-current] .num { color: var(--bar-muted); }
.offer .row-title { font-size: inherit; }
.offer .btn { flex-shrink: 0; }

/* the partner's offers: one table, a heading row per category */
.offer-table td.id { color: var(--muted); font-size: 12px; width: 5ch; }
.offer-table td:first-child { min-width: 0; font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--muted); }
.filters { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cats > .label { align-self: center; min-width: 9ch; }
@media (min-width: 761px) { .panel-head .cats, .panel-head .filters { flex: 1 1 600px; } .panel-head .filters .cats { flex: none; } .panel-head .finder { flex: 0 1 300px; } }
.offer-table td.name { white-space: normal; text-align: left; font-family: var(--sans); font-weight: 600; font-size: 14px; min-width: 22ch; overflow-wrap: anywhere; }
.offer-table td.name a { text-decoration: none; }
.offer-table td.name a:hover { text-decoration: underline; }
.offer-table td.rules-cell { white-space: normal; text-align: left; font-family: var(--sans); font-size: 12px; color: var(--muted); min-width: 22ch; max-width: 46ch; }
.offer-table td.rules-cell .label { margin-right: 4px; }
.offer-table td.act { width: 1%; }
.offer-table td { vertical-align: middle; }

/* offer rules */
.rules { margin: 4px 0 0; display: flex; flex-direction: column; gap: 10px; }
.rule dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.request-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0; }

/* messages */
.flash, .error { padding: 12px 16px; background: var(--panel); border-left: 4px solid var(--ink); }
.error { font-weight: 600; }
p.error, .row-note.error { color: var(--ink); }
.data .error, .panel h2.error { padding: 0; border: 0; background: none; }
.empty { padding: 28px 0 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* invoices */
.invoice-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 24px; margin-top: 0; }
.print-page { max-width: 960px; margin: 0 auto; padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.print-page h1 { font-size: 22px; font-weight: 800; }
.print-brand { display: none; font-weight: 800; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }

@media print {
  @page { margin: 14mm; }
  body { background: #FFFFFF; font-size: 10pt; }
  .bar, .no-print, .who, .nav, form, details > summary { display: none !important; }
  .page, .print-page { max-width: none; padding: 0; gap: 12pt; }
  .panel { padding: 6pt 0; border-top: 1px solid #000000; }
  .totals { border-top: 2px solid #000000; }
  .total { padding: 6pt 10pt; }
  .total .num { font-size: 15pt; margin-top: 4pt; }
  .table-box { overflow: visible; }
  .data th, .data td { padding-top: 4pt; padding-bottom: 4pt; }
  .data td { font-size: 9pt; }
  .data td:first-child { font-size: 10pt; }
  .data tr { break-inside: avoid; }
  .print-brand { display: block; }
  .invoice-head { grid-template-columns: repeat(3, 1fr); }
  a { text-decoration: none; }
}

/* public site (www): one statement and a few ruled lines. No bar, no panels, no buttons. */
.site { display: flex; flex-direction: column; min-height: 100vh; padding: 0 56px; font-size: 17px; line-height: 1.5; }
.site main { flex-grow: 1; }
.site-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; column-gap: 32px; row-gap: 4px; padding: 30px 0 18px; border-bottom: 6px solid var(--ink); }
.site-mark { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.site-signin { font-weight: 600; font-size: 15px; padding: 12px 0; display: inline-flex; align-items: center; min-height: 44px; }
.site-say { margin: 0; padding: 96px 0 104px; font-size: clamp(52px, 10vw, 136px); font-weight: 800; line-height: 0.92; letter-spacing: -0.055em; max-width: 10ch; overflow-wrap: break-word; }
.site-lines { margin: 0; border-top: 1px solid var(--ink); }
.site-line { display: flex; flex-wrap: wrap; column-gap: 40px; row-gap: 4px; padding: 18px 0 20px; border-bottom: 1px solid var(--ink); }
.site-line dt { flex: 0 0 220px; font-size: 12px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); padding-top: 7px; }
.site-line dd { flex: 1 1 420px; min-width: 0; margin: 0; font-size: 24px; line-height: 1.35; letter-spacing: -0.01em; max-width: 40ch; }
.site-foot { padding: 26px 0 30px; font-size: 13px; color: var(--muted); }

/* a desk narrower than the full bar: the signed-in address gives way first */
@media (max-width: 1240px) {
  .who-name { display: none; }
  .nav { overflow-x: auto; flex-basis: 0; }
  .nav:has(> a:nth-child(10)) a { padding: 0 6px; }
}
/* the admin's menu (ten entries) fills the bar on any desk: the signed-in address gives way there too */
.nav:has(> a:nth-child(10)) + .who .who-name { display: none; }
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tile:nth-child(4) { border-left: 0; }
  .tile:nth-child(n+4) { border-top: 1px solid var(--hair); }
}

/* phone width */
@media (max-width: 760px) {
  .bar-in { padding: 0 16px; flex-wrap: wrap; column-gap: 12px; }
  .brand { flex: 1 1 auto; }
  .who { order: 2; }
  .nav { order: 3; flex: 1 1 100%; overflow-x: auto; margin: 0 -16px; padding: 0 16px 6px; }
  .who-name { display: none; }
  .who button { min-height: 44px; }
  .page { padding: 20px 16px 40px; gap: 18px; }
  .narrow { margin: 20px 16px 40px; padding: 24px 20px 28px; }
  .head h1 { font-size: 20px; }
  .head h1 .sub { display: block; font-size: 15px; }
  .totals { display: grid; grid-template-columns: 1fr 1fr; }
  .total, .total:first-child { border-left: 0; border-top: 1px solid var(--hair); padding: 12px 16px 14px; }
  .total:nth-child(even) { border-left: 1px solid var(--hair); }
  .total-lead, .total-key { grid-column: span 2; }
  .total-key { order: -1; border-top: 0; }
  .total-lead { order: -2; }
  .total-lead + .total-key { border-top: 1px solid var(--hair); }
  .total-lead ~ .total:nth-child(even), .total-key ~ .total:nth-child(even) { border-left: 0; }
  .total-lead ~ .total:nth-child(odd), .total-key ~ .total:nth-child(odd) { border-left: 1px solid var(--hair); }
  .total:first-child { border-top: 0; }
  .total .num { font-size: 20px; margin-top: 6px; }
  .total-lead .num { font-size: 38px; }
  .total-key .num { font-size: 28px; }
  .panel { padding: 16px; }
  /* a shown token stays in view, with its Copy button, while the table scrolls under it */
  .data tr.token-row .link-url { position: sticky; left: 0; max-width: calc(100vw - 64px); }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile, .tile:nth-child(4) { border-left: 0; border-top: 1px solid var(--hair); padding: 14px 16px; }
  .tile:nth-child(3), .tile:nth-child(5) { border-left: 1px solid var(--hair); }
  .tile[data-tile="revenue"] { grid-column: span 2; order: -1; border-top: 0; }
  /* A chart wider than the phone opens at its right end, on the latest days, and scrolls back. */
  .chart-box { direction: rtl; }
  .chart-box > .chart { direction: ltr; }
  .tile-num { font-size: 22px; }
  .tile:last-child { grid-column: span 2; border-left: 0; }
  .periods a, .periods button { padding: 0 10px; font-size: 13px; }
  .tile[data-tile="revenue"] .tile-num { font-size: 34px; }
  .tile-prev { font-size: 11px; }
  .data td:first-child { min-width: 14ch; max-width: 22ch; }
  .data.offer-table td:first-child { min-width: 0; }
  .offer-table th:nth-child(1), .offer-table td.id, .offer-table th:nth-child(4), .offer-table td.rules-cell { display: none; }
  .offer-table td.name { min-width: 15ch; }
  .offer-table td.text { white-space: normal; }
  .field input.text, .field input[type="email"], .field select.wide, .field select { width: 100%; }
  .form-inline > .field { flex: 1 1 100%; }
  .form-inline > .field.half { flex: 1 1 40%; }
  .field textarea { width: 100%; }
  .checks { grid-template-columns: 1fr; }
  .check { min-height: 44px; }
  .cats a, .more a, a.row-title, .panel-head > a, .back a { min-height: 44px; display: inline-flex; align-items: center; }
  .btn-small, .group-head .btn { min-height: 44px; }
  .site { padding: 0 20px; }
  .site-say { padding: 56px 0 60px; }
  .site-line dt { flex-basis: 100%; padding-top: 0; }
  .site-line dd { font-size: 20px; }
  .head .range { margin-left: 0; flex: 1 1 100%; }
  .range { padding-top: 1px; }
  .head #data-through { flex: 1 1 100%; max-width: none; margin-top: -4px; }
  .offer-figures th:not(:first-child), .offer-figures td:not(:first-child) { padding-left: 14px; }
  .range-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); flex: 1 1 100%; }
  .range-presets a { margin: -1px 0 0 -1px; padding: 0 6px; }
  .range-custom { flex: 1 1 100%; position: static; }
  .range-custom[open] { margin-bottom: 0; }
  .range-custom > summary { display: flex; width: auto; margin: -1px 0 0 -1px; }
  .range-custom > form { position: static; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-top: 10px; white-space: normal; }
  .range-field { flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; }
  .range-field input { width: 100%; }
  .range-custom .btn { grid-column: span 2; }
}

/* phone width: each activity row is one block, time and address on top, what happened under them */
@media (max-width: 760px) {
  .data.activity thead { display: none; }
  .data.activity, .data.activity tbody { display: block; }
  .data.activity tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
  .data.activity td { display: block; padding: 0; border: 0; min-width: 0; max-width: none; text-align: left; white-space: normal; }
  .data.activity td:first-child { grid-column: 1; grid-row: 1; font-size: 13px; white-space: nowrap; }
  .data.activity td.ip { grid-column: 2; grid-row: 1; font-size: 12px; text-align: right; color: var(--muted); overflow-wrap: anywhere; }
  .data.activity td.what { grid-column: 1 / -1; grid-row: 2; font-size: 14px; font-weight: 600; }
  .data.activity td.wrap:not(.what) { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
}
