/* ==========================================================
   06 · Product tour: segmented tabs + a browser-chrome app
   (designed at 1120 × 680, scaled to fit)
   ========================================================== */
.tour { padding: 120px 0 40px; position: relative; overflow-x: clip; }
.tour-head { display: grid; gap: 20px; justify-items: center; text-align: center; }
.tour-head .h2 { text-wrap: balance; }

/* ---------- Tabs (segmented, sliding indicator) ---------- */
.tour-tabs {
  position: relative;
  display: flex; width: max-content; max-width: 100%;
  margin: 40px auto 0;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.tt {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border-radius: 10px;
  font-size: 15px; font-weight: 500; color: var(--ink-500);
  transition: color .2s;
}
.tt:hover { color: var(--ink-900); }
.tt[aria-selected="true"] { color: var(--white); }
.tt:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tt-ind {
  position: absolute; top: 5px; left: 0; height: 40px; width: 0;
  border-radius: 10px;
  background: var(--ink-950);
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 6px 14px -4px rgba(11,16,32,.45);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), width .35s cubic-bezier(.2,.7,.2,1);
}

.tour-caps { min-height: 28px; margin: 16px 0 36px; text-align: center; }
.tp-cap { margin: 0; font-size: 16px; color: var(--ink-500); }
.tp[hidden] { display: none; }
.tp.is-active .tp-cap { animation: capIn .4s ease both; }
@keyframes capIn { from { opacity: 0; transform: translateY(4px); } }

/* ---------- Stage + browser chrome ---------- */
.tour-stage { position: relative; }
/* The app mockup speaks a Next.js / Vercel dialect (Geist, 1px hairlines,
   6–8px radii, black primary buttons, quiet status badges, mono numbers)
   so it reads as a real product rather than a landing-page illustration.
   Billing layout is drawn from real products on Mobbin: Midday's KPI row
   and invoice table, Bencho's Stacked bars for daily payments by method, and
   Xero's "owing the most" list. */
.browser {
  --g-bg: #FFFFFF; --g-bg2: #FAFAFA; --g-100: #F2F2F2; --g-200: #EBEBEB; --g-300: #E0E0E0;
  --g-500: #8F8F8F; --g-600: #666666; --g-900: #171717;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  width: 1120px; transform-origin: 0 0;
  border-radius: 14px;
  background: var(--g-bg);
  box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 0 0 8px rgba(255,255,255,.6), 0 2px 4px rgba(0,0,0,.04), 0 24px 60px rgba(20,50,140,.14);
  overflow: hidden;
  font-family: "Geist", var(--font-body); font-size: 13px; color: var(--g-900);
  letter-spacing: -0.005em;
}
.browser .mono { font-family: var(--mono); font-size: .94em; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.ft-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.gi { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.br-bar { display: flex; align-items: center; gap: 14px; height: 42px; padding: 0 14px; background: var(--g-bg2); border-bottom: 1px solid var(--g-200); }
.br-dots { display: flex; gap: 7px; width: 120px; }
.br-dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--g-300); box-shadow: inset 0 0 0 .5px rgba(0,0,0,.12); }
.br-dots i:nth-child(1) { background: #FF5F57; } .br-dots i:nth-child(2) { background: #FEBC2E; } .br-dots i:nth-child(3) { background: #28C840; }
.br-url { flex: 1; max-width: 400px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 6px; height: 26px; border-radius: 6px; background: var(--g-bg); box-shadow: 0 0 0 1px var(--g-200); color: var(--g-500); font-size: 12.5px; }
.br-url .i { color: var(--g-500); }
.br-url em { font-style: normal; color: var(--g-900); }
.br-sp { width: 120px; }

.br-app { display: grid; grid-template-columns: 210px 1fr; height: 704px; }

/* sidebar */
.ts { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border-right: 1px solid var(--g-200); background: var(--g-bg2); }
.ts-team { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px; border-radius: 6px; }
.ts-team b { font-weight: 500; white-space: nowrap; }
.ts-up { margin-left: auto; color: var(--g-500); }
.ts-find { display: flex; align-items: center; gap: 7px; height: 30px; margin: 6px 0 8px; padding: 0 6px 0 9px; border-radius: 6px; background: var(--g-bg); box-shadow: 0 0 0 1px var(--g-200); color: var(--g-500); }
kbd { margin-left: auto; font-family: var(--mono); font-size: 10.5px; padding: 1px 5px; border-radius: 4px; background: var(--g-100); box-shadow: 0 0 0 1px var(--g-200); color: var(--g-600); }
.ts-nav { display: grid; gap: 1px; }
.ts-label { margin: 14px 8px 4px; font-size: 11.5px; color: var(--g-500); }
.ts-item { display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 8px; border-radius: 6px; color: var(--g-600); transition: background-color .2s, color .2s; }
.ts-item .i { color: var(--g-500); }
.ts-item em { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--g-600); background: var(--g-100); box-shadow: 0 0 0 1px var(--g-200); border-radius: 99px; padding: 0 6px; }
.ts-item .bdg { margin-left: auto; }
.ts-item.active { background: var(--g-100); color: var(--g-900); font-weight: 500; }
.ts-item.active .i { color: var(--g-900); }
.ts-user { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 10px 6px 2px; border-top: 1px solid var(--g-200); }
.ts-user .av { --s: 28px; box-shadow: none; }
.ts-user b { display: block; font-weight: 500; font-size: 12.5px; }
.ts-user small { display: block; color: var(--g-500); font-size: 11.5px; }
.ts-user .gi { margin-left: auto; color: var(--g-500); }

/* company marks: a small enamel tile, glyph from assets/logos.svg */
.lg { width: 26px; height: 26px; flex: none; border-radius: 7px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(150deg, var(--c1, #444), var(--c2, #111));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 -1px 2px rgba(0,0,0,.18), 0 0 0 .5px rgba(0,0,0,.18), 0 1px 2px rgba(0,0,0,.12); }
.lg svg { width: 56%; height: 56%; fill: currentColor; filter: drop-shadow(0 1px 0 rgba(0,0,0,.2)); }
.k-riverside { --c1: #9A6A48; --c2: #4A2A18; } .k-saltvik { --c1: #19806C; --c2: #0A3B33; }
.k-parklane { --c1: #FF7A8A; --c2: #E0405E; }  .k-tread { --c1: #D4763E; --c2: #7A3412; }
.k-hale { --c1: #9B85F5; --c2: #5B3ED6; }      .k-lowtide { --c1: #1BB3A0; --c2: #0B4F66; }
.k-castell { --c1: #4B87FF; --c2: #1843BD; }   .k-wordshop { --c1: #FF8A72; --c2: #E0405E; }
.k-holm { --c1: #C9683C; --c2: #6E2E14; }      .k-barlow { --c1: #3A4A75; --c2: #14213D; }
.k-nadia { --c1: #8E74F2; --c2: #4F33C8; }     .k-ashby { --c1: #19806C; --c2: #0A3B33; }

/* badges (Geist style: tinted fill, coloured text, optional dot) */
.bdg { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.bdg i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.bdg.sm { height: 18px; padding: 0 6px; font-size: 11px; }
.b-gray { background: var(--g-100); color: var(--g-600); box-shadow: inset 0 0 0 1px var(--g-200); }
.b-blue { background: #EAF2FF; color: #0062D1; }
.b-green { background: #E8F7EC; color: #237A3B; }
.b-amber { background: #FFF4D6; color: #A35200; }
.b-red { background: #FFECEC; color: #C42B31; }

/* buttons */
.gbtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 500; background: var(--g-bg); color: var(--g-900); box-shadow: 0 0 0 1px var(--g-200), 0 1px 2px rgba(0,0,0,.04); white-space: nowrap; }
.gbtn.pri { background: var(--g-900); color: #fff; box-shadow: 0 0 0 1px var(--g-900), inset 0 1px 0 rgba(255,255,255,.14); }
.gbtn .gi { width: 13px; height: 13px; }

/* views */
.tv-wrap { position: relative; overflow: hidden; }
.tv { position: absolute; inset: 0; padding: 22px 26px; opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .35s ease, transform .45s cubic-bezier(.2,.7,.2,1), visibility 0s linear .35s; }
.tv.is-active { opacity: 1; visibility: visible; transform: none; transition: opacity .35s ease, transform .45s cubic-bezier(.2,.7,.2,1); }
.tv-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.tv-title { font-size: 22px; font-weight: 600; letter-spacing: -0.035em; }
.tv-title .crumb { color: var(--g-500); font-weight: 500; }
.tv-head small { display: block; margin-top: 2px; color: var(--g-600); font-size: 13px; }
.tv-actions { display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; padding: 2px; border-radius: 7px; background: var(--g-100); box-shadow: inset 0 0 0 1px var(--g-200); }
.seg span { padding: 4px 10px; border-radius: 5px; font-size: 12.5px; color: var(--g-600); }
.seg .on { background: var(--g-bg); color: var(--g-900); font-weight: 500; box-shadow: 0 0 0 1px var(--g-200), 0 1px 2px rgba(0,0,0,.06); }
.muted { color: var(--g-600); font-style: normal; }
.num { text-align: right; }

/* 1 · Portals */
.tb { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.chips, .tb-r { display: flex; gap: 6px; align-items: center; }
.chip-g { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px; color: var(--g-600); box-shadow: inset 0 0 0 1px var(--g-200); }
.chip-g i { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--g-500); }
.chip-g.on { background: var(--g-900); color: #fff; box-shadow: none; } .chip-g.on i { color: #A1A1A1; }
.vtog { display: inline-flex; border-radius: 6px; box-shadow: 0 0 0 1px var(--g-200); overflow: hidden; }
.vtog span { width: 32px; height: 30px; display: grid; place-items: center; color: var(--g-500); }
.vtog .on { background: var(--g-100); color: var(--g-900); }
.pt-table { border-radius: 10px; box-shadow: 0 0 0 1px var(--g-200); overflow: hidden; }
.pt-row { display: grid; grid-template-columns: 2.5fr 1.1fr .8fr .8fr 1fr 1fr; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--g-200); }
.pt-row:hover { background: var(--g-bg2); }
.pt-th { border-top: 0; background: var(--g-bg2); padding-block: 9px; font-size: 12.5px; color: var(--g-600); }
.pt-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pt-name .lg { width: 30px; height: 30px; border-radius: 50%; }
.pt-name b { display: block; font-weight: 500; }
.pt-name small { color: var(--g-500); font-size: 12px; }
.unread { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; background: #0070F3; color: #fff; font-style: normal; font-family: var(--mono); font-size: 11px; }

/* 2 · Board */
.kb { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kb-col { --tone: var(--g-500); padding: 8px; border-radius: 10px; background: var(--g-bg2); box-shadow: inset 0 0 0 1px var(--g-200); display: grid; gap: 8px; align-content: start; }
.kb-col[data-tone="blue"]  { --tone: #0070F3; }
.kb-col[data-tone="amber"] { --tone: #F5A623; }
.kb-col[data-tone="green"] { --tone: #2EA44F; }
.kb-h { display: flex; align-items: center; gap: 7px; padding: 4px 4px 2px; font-weight: 500; }
.kb-h em { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--g-500); }
.kb-add { margin-left: auto; color: var(--g-500); }
.kb-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--tone); }
.kb-col[data-tone="green"] .kb-dot { background: var(--tone); }
.kb-card { padding: 10px 11px; border-radius: 8px; background: var(--g-bg); box-shadow: 0 0 0 1px var(--g-200), 0 1px 2px rgba(0,0,0,.04); display: grid; gap: 7px; }
.kb-top { display: flex; align-items: center; gap: 7px; color: var(--g-600); font-size: 12px; }
.kb-top .lg { width: 18px; height: 18px; border-radius: 50%; }
.kb-more { margin-left: auto; color: var(--g-500); }
.kb-t { font-weight: 500; font-size: 13px; line-height: 1.3; }
.kb-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.kb-tags .bdg { height: 20px; font-size: 11px; }
.kb-prog { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--g-600); }
.kb-bar { flex: 1; height: 4px; border-radius: 9px; background: var(--g-100); overflow: hidden; }
.kb-bar i { display: block; height: 100%; border-radius: inherit; background: var(--tone); }
.kb-foot { display: flex; align-items: center; justify-content: space-between; color: var(--g-600); font-size: 12px; }
.kb-foot .av { --s: 22px; box-shadow: 0 0 0 2px #fff; }
.kb-due { display: inline-flex; align-items: center; gap: 4px; }
.kb-due.warn { color: #A35200; } .kb-due.done { color: var(--g-500); text-decoration: line-through; }

/* 3 · Files */
.fo-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.fo { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; box-shadow: 0 0 0 1px var(--g-200), 0 1px 2px rgba(0,0,0,.04); }
.foic { width: 34px; height: 27px; flex: none; filter: drop-shadow(0 2px 3px rgba(28,77,245,.25)); }
.fo b { display: block; font-weight: 500; } .fo small { color: var(--g-500); font-size: 11.5px; }
.fg-wrap { display: grid; grid-template-columns: 1fr 330px; gap: 16px; }
.fg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-content: start; }
.fg-item { padding: 5px; border-radius: 10px; background: var(--g-bg); box-shadow: 0 0 0 1px var(--g-200), 0 1px 2px rgba(0,0,0,.04); }
.fg-item.sel { box-shadow: 0 0 0 1.5px #0070F3, 0 0 0 4.5px rgba(0,112,243,.15); }
.fg-th { position: relative; height: 104px; border-radius: 6px; overflow: hidden; background: var(--g-100); }
.fg-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fg-th::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.fg-ver { position: absolute; top: 6px; left: 6px; padding: 1px 6px; border-radius: 5px; font-size: 10.5px; color: #fff; background: rgba(23,23,23,.62); backdrop-filter: blur(6px); }
.fg-meta { display: flex; align-items: center; gap: 8px; padding: 7px 3px 2px; min-width: 0; }
.ftic { width: 22px; height: 28px; flex: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.14)); }
.fg-meta span { min-width: 0; }
.fg-meta b { display: block; font-weight: 500; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fg-meta small { display: block; color: var(--g-500); font-size: 11.5px; white-space: nowrap; }
.fg-preview { padding: 10px; border-radius: 10px; box-shadow: 0 0 0 1px var(--g-200), 0 4px 14px rgba(0,0,0,.05); display: grid; gap: 10px; align-content: start; }
.fp-head { display: flex; align-items: center; gap: 8px; } .fp-head .ftic { width: 18px; height: 23px; } .fp-head b { font-weight: 500; } .fp-head .bdg { margin-left: auto; }
.fp-img { position: relative; height: 178px; border-radius: 7px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.fp-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.pin { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50% 50% 50% 4px; background: #0070F3; color: #fff; font-family: var(--mono); font-size: 11px; font-weight: 500; box-shadow: 0 0 0 2px #fff, 0 4px 10px rgba(0,112,243,.4); }
.pin.sm { width: 16px; height: 16px; font-size: 9.5px; box-shadow: none; margin-right: 4px; vertical-align: 1px; }
.fp-img .pin { position: absolute; }
.fp-c { display: flex; gap: 9px; padding-top: 2px; }
.fp-c .av { --s: 26px; box-shadow: none; }
.fp-c p { margin: 0; color: var(--g-900); line-height: 1.45; font-size: 12.5px; }
.fp-m { color: var(--g-600) !important; font-size: 12px !important; } .fp-m b { color: var(--g-900); font-weight: 500; }
.fp-input { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 8px; border-radius: 8px; box-shadow: 0 0 0 1px var(--g-200); color: var(--g-500); }
.fp-input .av { --s: 22px; box-shadow: none; }

/* 4 · Billing */
.bl { display: grid; gap: 10px; }
.bk-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.bk { position: relative; padding: 12px 14px; border-radius: 10px; box-shadow: 0 0 0 1px var(--g-200), 0 1px 2px rgba(0,0,0,.04); display: grid; gap: 2px; overflow: hidden; }
.bk small { color: var(--g-600); font-size: 12px; }
.bk b { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.bk b.mono { font-size: 21px; letter-spacing: -0.04em; }
.bk span { font-size: 11.5px; color: var(--g-500); }
.bk .pos { color: #237A3B; } .bk .neg { color: #C42B31; }
.bk.score span { max-width: 16ch; }
.barcode { position: absolute; right: 12px; bottom: 12px; width: 84px; height: 28px; fill: var(--g-900); }
.bl-mid { display: grid; grid-template-columns: 548px 300px; gap: 10px; align-items: stretch; }
.ow { padding: 12px 12px 6px; border-radius: 10px; box-shadow: 0 0 0 1px var(--g-200), 0 1px 2px rgba(0,0,0,.04); }
.ow-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; } .ow-h b { font-weight: 500; }
.lnk { display: inline-flex; align-items: center; gap: 3px; color: var(--g-600); font-size: 12px; }
.ow-r { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-top: 1px solid var(--g-100); }
.ow-r:first-of-type { border-top: 0; }
.ow-r .lg { width: 24px; height: 24px; border-radius: 50%; }
.ow-r b { display: block; font-weight: 500; font-size: 12.5px; } .ow-r small { display: block; font-size: 11.5px; color: var(--g-500); } .ow-r small.neg { color: #C42B31; }
.ow-r > .mono { margin-left: auto; }
.bi { border-radius: 10px; box-shadow: 0 0 0 1px var(--g-200); overflow: hidden; }
.bi-row { display: grid; grid-template-columns: 18px 86px 104px 76px 1.6fr 96px 1fr 24px; align-items: center; gap: 10px; padding: 7px 14px; border-top: 1px solid var(--g-200); font-size: 12.5px; }
.bi-th { border-top: 0; background: var(--g-bg2); color: var(--g-600); font-size: 12px; }
.bi-row .pt-name { gap: 8px; } .bi-row .lg { width: 20px; height: 20px; border-radius: 50%; }
.bi-row .pt-name b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bi-row .gi { color: var(--g-500); }
.cbx { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--g-300); background: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  .tour { padding: 72px 0 24px; }
  .tour-head { justify-items: start; text-align: left; }
  .tour-tabs { margin-top: 28px; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tour-tabs::-webkit-scrollbar { display: none; }
  .tt { flex: 1 0 auto; justify-content: center; padding: 0 12px; font-size: 14px; gap: 6px; }
  .tt .i { display: none; }
  .tour-caps { text-align: left; margin: 14px 0 24px; min-height: 48px; }
  .tp-cap { font-size: 15px; }
  .browser { border-radius: 14px; }
}


/* ══ Stacked bars ═══ js/stacked-bars.js (from Bencho, MIT) ══════════
   Token mapping (Bencho -> this project). The card lives inside the
   tour's app mockup, so it takes that mockup's own Geist tokens, set
   on the component's wrapper so nothing leaks out:
     --fill-slab  the card surface: --g-bg, the app's white
     --fill-on    ink on it: --g-900, the app's text colour
     --font-ui    Geist, the app's UI font
     --pane-edge  the hairline every app card has: --g-200
                  (the wrapper sets data-stroke="on" so it draws)
     --c, --i, --stb-r, --stb-rr
                  not tokens: a segment's colour, a column's index and
                  the bar radii, written per element by the script     */
.bl-stb {
  --fill-slab: var(--g-bg);
  --fill-on: var(--g-900);
  --font-ui: "Geist", var(--font-body);
  --pane-edge: var(--g-200);
}
/* placement: square the card to the app's 10px radius, and swap the
   first three series to the HomeBase ribbon blues (amber stays for the
   fourth so it reads apart; red stays for failed payments) */
.bl-stb .stb { border-radius: 10px; box-shadow: 0 0 0 1px var(--pane-edge), 0 1px 2px rgba(0,0,0,.04); letter-spacing: 0; }
.bl-stb .stb[data-colour="on"] { --stb-c1: #1C4DF5; --stb-c2: #4B87FF; --stb-c3: #A3C6FF; --stb-c4: #F2C46D; }
.bl-stb .stb-num { font-family: var(--mono); letter-spacing: -0.05em; }

/* ══ Stacked bars (lab/StackedBars.tsx) ═══ */
.stb {
  --stb-c1: color-mix(in srgb, var(--fill-on, #17181a) 100%, var(--fill-slab, #ffffff));
  --stb-c2: color-mix(in srgb, var(--fill-on, #17181a) 78%, var(--fill-slab, #ffffff));
  --stb-c3: color-mix(in srgb, var(--fill-on, #17181a) 60%, var(--fill-slab, #ffffff));
  --stb-c4: color-mix(in srgb, var(--fill-on, #17181a) 44%, var(--fill-slab, #ffffff));
  --stb-c5: color-mix(in srgb, var(--fill-on, #17181a) 32%, var(--fill-slab, #ffffff));
  --stb-c6: color-mix(in srgb, var(--fill-on, #17181a) 22%, var(--fill-slab, #ffffff));
  --stb-alert: color-mix(in srgb, var(--fill-on, #17181a) 100%, var(--fill-slab, #ffffff));
  --stb-soft: color-mix(in srgb, var(--fill-on, #17181a) 72%, var(--fill-slab, #ffffff));
  --stb-mute: color-mix(in srgb, var(--fill-on, #17181a) 52%, var(--fill-slab, #ffffff));
  --stb-faint: color-mix(in srgb, var(--fill-on, #17181a) 32%, var(--fill-slab, #ffffff));
  --stb-w6: color-mix(in srgb, var(--fill-on, #17181a) 6%, transparent);
  --stb-w12: color-mix(in srgb, var(--fill-on, #17181a) 12%, transparent);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  box-sizing: border-box;
  border-radius: 20px;
  background: var(--fill-slab, #ffffff);
  color: var(--fill-on, #17181a);
  font-family: var(--font-ui);
  font-size: 13px;
  user-select: none;
  -webkit-user-select: none;}

.stb[data-colour="on"] {
  --stb-c1: #9d7bf5; --stb-c2: #5b8def; --stb-c3: #9ab8db;
  --stb-c4: #f2c46d; --stb-c5: #74dcae; --stb-c6: #e57bb8;
  --stb-alert: #e5484d;}

[data-stroke="on"] .stb { box-shadow: 0 0 0 1px var(--pane-edge); }

/* header: icon tile, title, Day / Week */
.stb-head { display: flex; align-items: center; gap: 12px; }

.stb-titles { flex: 1; min-width: 0; }

.stb-title { font-size: 14px; font-weight: 500; letter-spacing: -0.01em; line-height: 18px; }

.stb-sub { font-size: 12px; color: var(--stb-mute); line-height: 16px; font-variant-numeric: tabular-nums; }

.stb-seg-ctl {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 2px;
  border-radius: 10px;
  background: var(--stb-w6);}

.stb-thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc(50% - 2px);
  border-radius: 8px;
  background: var(--fill-slab, #ffffff);
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);}

.stb-seg-ctl[data-mode="Week"] .stb-thumb { transform: translateX(100%); }

.stb-tab {
  position: relative;
  appearance: none;
  border: 0;
  background: none;
  padding: 0 10px;
  height: 28px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--stb-mute);
  cursor: pointer;
  border-radius: 8px;
  transition: color 160ms ease, scale 160ms cubic-bezier(0.22, 1, 0.36, 1);}

.stb-tab[data-on] { color: var(--fill-on, #17181a); }

.stb-tab:hover:not([data-on]) { color: var(--stb-soft); }

.stb-tab:active { scale: 0.96; }

.stb-tab:focus-visible { outline: 2px solid #2231dd; outline-offset: 0; }

/* the one figure */
.stb-figure { display: flex; align-items: baseline; gap: 8px; margin-bottom: -4px; }

.stb-num {
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 32px;
  font-variant-numeric: tabular-nums;}

.stb-unit { font-size: 13px; color: var(--stb-mute); }

/* Price flow's pop in: each character rises a touch from below, out
   of a slight blur and from nothing, a hair past its mark — left to
   right, 70ms apart */
.stb-digit { display: inline-block; }

.stb-digit[data-pop] {
  animation: stb-pop 500ms cubic-bezier(0.34, 1.45, 0.64, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);}

@media (prefers-reduced-motion: reduce) {
  .stb-digit[data-pop] { animation: none; }
}

/* the plot: absolutely placed columns, each segment its own rounded box */
.stb-plot { position: relative; width: 100%; touch-action: none; cursor: crosshair; }

.stb-base {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--stb-w12);}

.stb-col { position: absolute; top: 0; bottom: 0; }

.stb-bar,
.stb-esc {
  position: absolute;
  left: 0;
  right: 0;
  border-radius: var(--stb-r);
  transition:
    height 600ms cubic-bezier(0.22, 1, 0.36, 1) calc(var(--i) * 14ms),
    bottom 600ms cubic-bezier(0.22, 1, 0.36, 1) calc(var(--i) * 14ms),
    background-color 160ms ease;}

.stb-bar { background-color: var(--c); }

.stb-esc { background-color: var(--stb-alert); }

/* Mono: escalated is full ink, hatched, so it never reads as Identity */
.stb[data-colour="off"] .stb-esc {
  background-image: repeating-linear-gradient(-45deg, transparent 0 1.5px, var(--fill-slab, #ffffff) 1.5px 3px);}

/* scrubbing: the others step back by mixing toward the slab */
.stb[data-scrub] .stb-col:not([data-on]) .stb-bar {
  background-color: color-mix(in srgb, var(--c) 38%, var(--fill-slab, #ffffff));}

.stb[data-scrub] .stb-col:not([data-on]) .stb-esc {
  background-color: color-mix(in srgb, var(--stb-alert) 38%, var(--fill-slab, #ffffff));}

.stb-ring {
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  border: 1.5px solid var(--stb-mute);
  border-radius: var(--stb-rr);
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;}

.stb[data-scrub] .stb-ring { opacity: 1; }

/* the tooltip: beside the column, gliding on a spring */
.stb-tip {
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--fill-slab, #ffffff);
  /* filled like the card, parted from the bars by a soft grey hairline */
  border: 1px solid color-mix(in srgb, var(--fill-on, #17181a) 10%, var(--fill-slab, #ffffff));
  font-size: 12px;
  line-height: 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;}

.stb[data-scrub] .stb-tip { opacity: 1; }

.stb-tip-head,
.stb-tip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.stb-tip-head { justify-content: space-between; color: var(--stb-mute); margin-bottom: 2px; }

.stb-tip b { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--fill-on, #17181a); }

.stb-tip-row span { flex: 1; color: var(--stb-soft); }

.stb-tip-row b { font-weight: 400; }

.stb-tip-row i {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background-color: var(--c);}

.stb-tip-row[data-esc] i { background-color: var(--stb-alert); }

.stb[data-colour="off"] .stb-tip-row[data-esc] i {
  background-image: repeating-linear-gradient(-45deg, transparent 0 1.5px, var(--fill-slab, #ffffff) 1.5px 3px);}

/* one tiny footer: first and last date */
.stb-axis {
  display: flex;
  justify-content: space-between;
  margin-top: -8px;
  font-size: 11px;
  line-height: 14px;
  color: var(--stb-faint);
  font-variant-numeric: tabular-nums;}

@keyframes stb-pop {
  from { transform: translateY(0.18em); opacity: 0; filter: blur(2px); }
  to { transform: none; opacity: 1; filter: blur(0); }}
