/* Westlyn CRO board.
 *
 * Light mode only, by request. Tokens are named the way shadcn/ui names them so a later port to
 * Tailwind is mechanical. Every figure is tabular-figure — proportional digits make a dense table
 * wobble column to column and the whole thing reads as amateur.
 */

:root {
  --bg:            #F6F6F7;
  --card:          #FFFFFF;
  --border:        #E7E7EA;
  --border-strong: #D6D6DB;
  --fg:            #111114;
  --fg-2:          #3F3F46;
  --muted:         #71717A;
  --faint:         #A1A1AA;
  --ghost:         #F4F4F5;

  --good:    #15803D;
  --good-bg: #EFFDF3;
  --good-br: #BBF7D0;
  --warn:    #B45309;
  --warn-bg: #FFFBEB;
  --warn-br: #FDE68A;
  --bad:     #B91C1C;
  --bad-bg:  #FEF2F2;
  --bad-br:  #FECACA;
  --teal:    #0F766E;
  --accent:  #2563EB;
  --accent-bg:#EFF6FF;

  --r: 8px;
  --r-lg: 12px;
  --shadow: 0 1px 2px rgba(16,17,20,.04), 0 1px 1px rgba(16,17,20,.03);
  --nav-h: 54px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 14px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

/* ── nav bar ──────────────────────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  height: var(--nav-h); padding: 0 20px;
  background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--fg); font-size: 14.5px; letter-spacing: -.01em;
  margin-right: 6px;
}
.brand b { font-weight: 650; }
.brand .mark {
  width: 22px; height: 22px; border-radius: 6px; background: var(--teal); flex: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M7 22l6-11 4.5 6 3.5-6 4.5 11' stroke='white' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 100%;
}

.tabs { display: flex; gap: 2px; margin-left: 12px; }
.tabs a {
  padding: 6px 12px; border-radius: 7px; text-decoration: none;
  color: var(--muted); font-size: 13.5px; font-weight: 500;
}
.tabs a:hover { background: var(--ghost); color: var(--fg-2); }
.tabs a.on { background: var(--ghost); color: var(--fg); font-weight: 600; }

.grow { flex: 1; }

.freshness {
  font-size: 11.5px; font-weight: 550; padding: 4px 9px; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-br);
  white-space: nowrap;
}
.freshness.ok { background: var(--good-bg); color: var(--good); border-color: var(--good-br); }

/* ── controls ─────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r);
  border: 1px solid var(--border-strong); background: #fff; color: var(--fg-2);
  font: 500 13px/1 inherit; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--ghost); }
.btn.icon { padding: 0; width: 32px; justify-content: center; font-size: 15px; }
.btn-primary { background: var(--fg); border-color: var(--fg); color: #fff; }
.btn-primary:hover { background: #27272A; }

.seg { display: inline-flex; background: var(--ghost); border-radius: var(--r); padding: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted);
  font: 500 13px/1 inherit; padding: 7px 11px; border-radius: 6px; cursor: pointer;
}
.seg button.on { background: #fff; color: var(--fg); box-shadow: var(--shadow); font-weight: 600; }

select.picker {
  height: 32px; padding: 0 28px 0 10px; border-radius: var(--r);
  border: 1px solid var(--border-strong); background: #fff; color: var(--fg-2);
  font: 500 13px/1 inherit; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%2371717A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 12px;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 550;
  border: 1px solid var(--border); background: #fff; color: var(--fg-2);
}
.chip.g { background: var(--good-bg); border-color: var(--good-br); color: var(--good); }
.chip.w { background: var(--warn-bg); border-color: var(--warn-br); color: var(--warn); }
.chip.b { background: var(--accent-bg); border-color: #BFDBFE; color: #1D4ED8; }

/* ── layout ───────────────────────────────────────────────────────────────────────────── */
.wrap { max-width: 1440px; margin: 0 auto; padding: 24px 24px 80px; }
.row { display: flex; align-items: center; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px; border-bottom: 1px solid var(--border);
}
.card-hd h2 { margin: 0; font-size: 14px; font-weight: 620; letter-spacing: -.01em; }

h1 { margin: 0; font-size: 20px; font-weight: 620; letter-spacing: -.02em; }
.sub { color: var(--muted); font-size: 13px; }
.lbl { font-size: 9.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.mut { color: var(--muted); }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.teal { color: var(--teal); }
.pend { color: var(--faint); font-weight: 500; }

.loading, .empty {
  padding: 80px 20px; text-align: center; color: var(--faint); font-size: 14px;
}
.errbox {
  max-width: 640px; margin: 60px auto; padding: 18px 20px;
  background: var(--bad-bg); border: 1px solid var(--bad-br); border-radius: var(--r-lg);
  color: #7F1D1D; font-size: 13.5px; line-height: 1.6;
}

/* ── page previews ────────────────────────────────────────────────────────────────────── */
.shot { position: relative; overflow: hidden; background: #FBFBFC; border-bottom: 1px solid var(--border); }
.shot img { width: 100%; display: block; }
.shot::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 54px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff); pointer-events: none;
}
.shot.blank {
  display: flex; align-items: center; justify-content: center;
  color: var(--faint); font-size: 12px; background: var(--ghost);
}
.shot.blank::after { display: none; }

/* ── pages grid ───────────────────────────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }

a.tile { text-decoration: none; color: inherit; display: block; }
.tile .card { overflow: hidden; transition: box-shadow .13s ease, transform .13s ease; }
a.tile:hover .card { box-shadow: 0 6px 20px rgba(16,17,20,.10); transform: translateY(-2px); }
.tile .shot { height: 172px; }
.tile.product .card { border-color: #CFE7E3; }

.tbody { padding: 15px 17px 17px; }
.tname { font-size: 15px; font-weight: 620; letter-spacing: -.02em; }
.tpath { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px 8px;
  margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--border);
}
.stats .n { font-size: 16px; font-weight: 620; letter-spacing: -.025em; margin-top: 3px; }

/* ── teardown ─────────────────────────────────────────────────────────────────────────── */
.strip-metrics {
  display: flex; align-items: stretch; background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden;
}
.strip-metrics > div { padding: 11px 20px; border-right: 1px solid var(--border); flex: 1; }
.strip-metrics > div:last-child { border-right: 0; }
.strip-metrics .v { font-size: 17px; font-weight: 620; letter-spacing: -.025em; margin-top: 2px; }

.layout { display: grid; grid-template-columns: 288px 1fr; gap: 16px; align-items: start; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── heatmap stack ───────────────────────────────────────────────────────────────────────
 * Four layers over one mobile capture, in z order:
 *   img     the page as a phone renders it
 *   .veil   retention as a white wash — cold depths fade out
 *   .dot    CTA clicks, positioned as a fraction of the document
 *   .marker the fold, and the median reach line
 * The gutter sits beside the page rather than on it, so the retention scale is readable without
 * fighting the screenshot for contrast. */
/* Scrolls inside its own panel. These pages are eight to nineteen screens tall — rendered at
 * full height the card is ~5,000px and everything below it on the teardown becomes unreachable.
 * The gutter is a flex sibling of the canvas, so it scrolls with the page and stays aligned. */
.pageview {
  position: relative; display: flex; align-items: stretch;
  max-height: 620px; overflow-y: auto; overscroll-behavior: contain;
}
.pageview .canvas { position: relative; flex: 1; min-width: 0; }
.pageview img { width: 100%; display: block; }

.gutter { position: relative; width: 22px; flex: none; border-right: 1px solid var(--border); }
.gutter .gl {
  position: absolute; left: 50%; transform: translate(-50%, -50%);
  font-size: 8.5px; font-weight: 700; color: #fff; white-space: nowrap;
  text-shadow: 0 0 3px rgba(0,0,0,.55); letter-spacing: -.02em;
}

.veil { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

.pageview .dot {
  position: absolute; z-index: 3; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(220,38,38,.62) 0%, rgba(249,115,22,.34) 45%, rgba(249,115,22,0) 70%);
}

.marker { position: absolute; left: 0; right: 0; height: 0; z-index: 4; }
.marker .line { border-top: 2px dashed var(--warn); }
.marker .lab {
  position: absolute; right: 6px; top: -10px; background: var(--warn); color: #fff;
  font-size: 9.5px; font-weight: 650; padding: 3px 6px; border-radius: 5px; white-space: nowrap;
}
.marker.faint .line { border-top-color: var(--faint); }
.marker.faint .lab  { background: var(--muted); }
.marker.fold .line  { border-top: 2px solid #111114; }
.marker.fold .lab   { background: #111114; }

.coll { padding: 15px 18px 17px; }
.slot {
  display: grid; grid-template-columns: 1fr 60px 56px 58px; gap: 10px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.slot:last-child { border-bottom: 0; }
.slot > div:not(:first-child) { text-align: right; }
.slot .depth { font-size: 11.5px; color: var(--faint); }

.eng { display: grid; grid-template-columns: 74px 1fr 54px; gap: 11px; align-items: center; padding: 7px 0; }
.eng .k { font-size: 12px; color: var(--muted); text-align: right; }
.eng .t { height: 16px; border-radius: 4px; background: var(--ghost); overflow: hidden; }
.eng .t i { display: block; height: 100%; border-radius: 4px; background: var(--teal); }
.eng .v { font-size: 12.5px; text-align: right; }

.hatch { background-image: repeating-linear-gradient(135deg,#F4F4F5,#F4F4F5 4px,#EAEAEC 4px,#EAEAEC 8px); }

.note {
  padding: 11px 18px; border-top: 1px solid var(--border); background: #FBFDFF;
  font-size: 12.5px; color: #1E3A8A; line-height: 1.5; margin: 0;
}

/* ── tables ───────────────────────────────────────────────────────────────────────────── */
.arow, .ahd { display: grid; gap: 10px; align-items: center; }
.ahd {
  padding: 10px 18px; border-bottom: 1px solid var(--border);
  font-size: 10.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--faint);
}
.arow { padding: 12px 18px; border-bottom: 1px solid var(--border); font-size: 13px; }
.arow:last-child { border-bottom: 0; }
.arow:hover { background: #FCFCFD; }
.ahd div:not(:first-child), .arow > div:not(:first-child) { text-align: right; }
.aname { font-weight: 550; letter-spacing: -.005em; }

/* ── compare ──────────────────────────────────────────────────────────────────────────── */
.verdict {
  background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--warn);
  border-radius: var(--r-lg); padding: 17px 22px 19px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.verdict h2 { margin: 0 0 8px; font-size: 16px; font-weight: 620; letter-spacing: -.02em; }
.verdict p  { margin: 0; font-size: 13.5px; color: var(--fg-2); line-height: 1.65; }

.vgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
a.vlink { text-decoration: none; color: inherit; display: block; }
a.vlink .vcard { transition: box-shadow .13s, transform .13s; }
a.vlink:hover .vcard { box-shadow: 0 6px 20px rgba(16,17,20,.10); transform: translateY(-2px); }
.vcard { background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.vcard.win { border-color: var(--good-br); box-shadow: 0 0 0 1px var(--good-br), var(--shadow); }
.vhd { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.vtag {
  width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex: none;
}
.vbody { display: grid; grid-template-columns: 132px 1fr; gap: 16px; padding: 16px; }
.vbody .shot { height: 222px; border: 1px solid var(--border); border-radius: 7px; }
.vstats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; align-content: start; }
.vstat b { font-size: 19px; font-weight: 620; letter-spacing: -.025em; display: block; margin-top: 3px; }
/* every stat reserves a delta line, so the two cards stay row-aligned when only one has a figure */
.vstat s { font-size: 11.5px; color: var(--muted); text-decoration: none; display: block; min-height: 16px; margin-top: 2px; }
.opener { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--accent); font-weight: 550; }

.chd, .crow { display: grid; grid-template-columns: 224px 1fr 1fr 116px 104px; gap: 16px; align-items: center; }
.chd {
  padding: 10px 18px; border-bottom: 1px solid var(--border);
  font-size: 10.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--faint);
}
.chd div:nth-child(4), .chd div:nth-child(5) { text-align: right; }
.crow { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.crow:last-child { border-bottom: 0; }
.crow .met { font-size: 13.5px; font-weight: 600; }
.crow .met s { display: block; font-size: 11.5px; color: var(--faint); text-decoration: none; font-weight: 400; margin-top: 2px; }
.mb { display: flex; align-items: center; gap: 10px; }
.mb .t { flex: 1; height: 22px; border-radius: 5px; background: var(--ghost); overflow: hidden; }
.mb .t i { display: block; height: 100%; border-radius: 5px; }
.mb .n { font-size: 15px; font-weight: 620; width: 82px; text-align: right; letter-spacing: -.02em; }
.fillA { background: #94A3B8; } .fillB { background: var(--teal); }
.dcell { text-align: right; font-size: 14px; font-weight: 650; letter-spacing: -.015em; }

.qual { text-align: right; }
.qual span {
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 5px;
}
.q-meas  { background: var(--good-bg); color: var(--good); }
.q-alloc { background: #FFF7ED; color: var(--warn); }
.q-coll  { background: var(--accent-bg); color: #1D4ED8; }

.split2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── token gate ───────────────────────────────────────────────────────────────────────── */
.gate {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.gatecard {
  width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: 0 8px 30px rgba(16,17,20,.08); padding: 26px 26px 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.gatecard h1 { font-size: 18px; }
.gatecard p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.gatecard input {
  height: 36px; padding: 0 11px; border-radius: var(--r);
  border: 1px solid var(--border-strong); font: 400 13px inherit; color: var(--fg);
}
.gatecard .btn { height: 36px; justify-content: center; }
.gateerr { font-size: 12.5px; color: var(--bad); }

@media (max-width: 900px) {
  .layout, .two, .vgrid, .split2, .grid { grid-template-columns: 1fr; }
  .strip-metrics { flex-wrap: wrap; }
  .strip-metrics > div { flex: 1 1 33%; border-bottom: 1px solid var(--border); }
  .chd, .crow { grid-template-columns: 1fr; gap: 8px; }
  .chd { display: none; }
  .wrap { padding: 18px 14px 60px; }
}

/* Marks a window where the money columns cover more days than the on-page columns do. */
.warnpill {
  display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px;
  background: var(--warn-bg); border: 1px solid var(--warn-br); color: var(--warn);
  font-size: 11px; font-weight: 600;
}
/* Product pages the tracker has seen but that carry no attributable orders yet. */
.tile.variant .card { border-style: dashed; }

/* Which source the session numbers came from — it changes what CVR means, so it is always shown. */
.basispill {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; border: 1px solid;
}
.basispill.measured  { background: var(--good-bg); border-color: var(--good-br); color: var(--good); }
.basispill.allocated { background: #FFF7ED; border-color: var(--warn-br); color: var(--warn); }

/* Two URLs serving the same document — their separate conversion rates are not a comparison. */
.dupflag {
  display: inline-block; margin-left: 7px; padding: 2px 7px; border-radius: 5px;
  background: var(--warn-bg); border: 1px solid var(--warn-br); color: var(--warn);
  font-size: 10px; font-weight: 650; letter-spacing: .01em; vertical-align: 2px;
}
