/* Traditional Brilliance — YouTube + Connected TV.
 *
 * All colour comes from beautiful.css's --bb-* tokens, so the page follows the theme without
 * a single hard-coded hex outside the two brand accents below. Every number on this page is
 * JetBrains Mono + tabular-nums (DESIGN.md), because a screen whose whole argument is
 * "44,000,000 impressions vs 16,500,000 views" is unreadable with proportional digits.
 *
 * The one deliberate departure from the rest of the app: this page leads with a big dark
 * "screen" panel. The buy IS television, and a TV-black frame around the CTV split is the
 * fastest way to say which surface a dollar bought.
 */

.tb-page { padding-bottom: 64px; }
.tb-root { display: flex; flex-direction: column; gap: 18px; }

.tb-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ header */

.tb-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 20px;
  padding: 20px 22px;
  background: var(--bb-surface, #fff);
  border-radius: var(--bb-r-card, 10px);
  box-shadow: var(--bb-sh-card, 0 0 0 1px #E6E1D8);
}
.tb-head-main { flex: 1 1 320px; min-width: 0; }
.tb-eyebrow {
  display: flex; align-items: center; gap: 8px;
  font: 600 10.5px/1 'Outfit', system-ui, sans-serif;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--bb-gold-ink, #A8842C);
  margin-bottom: 7px;
}
.tb-eyebrow svg { width: 15px; height: 15px; flex: none; }
.tb-title {
  margin: 0;
  font: 700 27px/1.15 'Outfit', system-ui, sans-serif;
  letter-spacing: -.018em;
  color: var(--bb-ink, #1A1A1A);
}
.tb-sub {
  margin: 6px 0 0;
  font: 400 13px/1.5 'Outfit', system-ui, sans-serif;
  color: var(--bb-ink-2, #5A564F);
  max-width: 62ch;
}
.tb-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }

/* Chips carry the scope and the caveats. A paragraph callout here reads as tacky and
   AI-made (see the HARD RULE) — reasoning lives in the title attribute. */
.tb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  border-radius: var(--bb-r-chip, 6px);
  background: var(--bb-field, #F1EFE8);
  box-shadow: inset 0 0 0 1px var(--bb-line, #E6E1D8);
  font: 500 11.5px/1.35 'Outfit', system-ui, sans-serif;
  color: var(--bb-ink-2, #5A564F);
  white-space: nowrap;
  cursor: default;
}
.tb-chip b {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700; color: var(--bb-ink, #1A1A1A);
}
.tb-chip.is-warn { background: var(--bb-orange-tint, #FBF2E3); box-shadow: inset 0 0 0 1px var(--bb-orange, #C77D1B); color: var(--bb-orange, #C77D1B); }
.tb-chip.is-warn b { color: var(--bb-orange, #C77D1B); }
.tb-chip.is-bad  { background: var(--bb-red-tint, #F9EBEB);  box-shadow: inset 0 0 0 1px var(--bb-red, #B23B3B);    color: var(--bb-red, #B23B3B); }
.tb-chip.is-bad b { color: var(--bb-red, #B23B3B); }
.tb-chip.is-ok   { background: var(--bb-green-tint, #E9F3ED); box-shadow: inset 0 0 0 1px var(--bb-green, #2E7D52); color: var(--bb-green, #2E7D52); }
.tb-chip.is-ok b { color: var(--bb-green, #2E7D52); }
.tb-chip.is-accent { background: var(--bb-accent-tint, #EAEFF8); box-shadow: inset 0 0 0 1px var(--bb-accent, #0D2A5E); color: var(--bb-accent-ink, #11326D); }
.tb-chip.is-accent b { color: var(--bb-accent-ink, #11326D); }

/* ------------------------------------------------------------------ controls */

.tb-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tb-seg {
  display: inline-flex; padding: 2px;
  background: var(--bb-field, #F1EFE8);
  border-radius: var(--bb-r-control, 8px);
  box-shadow: inset 0 0 0 1px var(--bb-line, #E6E1D8);
}
.tb-seg button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 6px 11px; border-radius: 6px;
  font: 500 12px/1 'Outfit', system-ui, sans-serif;
  color: var(--bb-ink-2, #5A564F);
  transition: background var(--bb-t-fast, .12s), color var(--bb-t-fast, .12s);
}
.tb-seg button:hover { color: var(--bb-ink, #1A1A1A); background: var(--bb-hover, #F4F2EC); }
.tb-seg button.is-on {
  background: var(--bb-surface, #fff); color: var(--bb-accent-ink, #11326D);
  font-weight: 600; box-shadow: var(--bb-sh-btn, 0 1px 2px rgba(13,42,94,.08));
}
.tb-btn {
  appearance: none; cursor: pointer;
  padding: 7px 13px; border: 0; border-radius: var(--bb-r-control, 8px);
  background: var(--bb-surface, #fff); color: var(--bb-ink, #1A1A1A);
  box-shadow: var(--bb-sh-btn, 0 0 0 1px #D4CFC4);
  font: 500 12px/1 'Outfit', system-ui, sans-serif;
  display: inline-flex; align-items: center; gap: 6px;
}
.tb-btn:hover { background: var(--bb-hover, #F4F2EC); }
.tb-btn svg { width: 14px; height: 14px; flex: none; }
.tb-date { display: inline-flex; align-items: center; gap: 6px; }
.tb-date input {
  padding: 6px 8px; border: 0; border-radius: 6px;
  background: var(--bb-field, #F1EFE8);
  box-shadow: inset 0 0 0 1px var(--bb-line, #E6E1D8);
  color: var(--bb-ink, #1A1A1A);
  font: 500 12px/1 'JetBrains Mono', ui-monospace, monospace;
}
.tb-date span { font: 500 11px/1 'Outfit', system-ui, sans-serif; color: var(--bb-ink-3, #8A8578); }

/* ------------------------------------------------------------------ sections */

.tb-sec {
  background: var(--bb-surface, #fff);
  border-radius: var(--bb-r-card, 10px);
  box-shadow: var(--bb-sh-card, 0 0 0 1px #E6E1D8);
  overflow: hidden;
}
.tb-sec-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 15px 20px 13px;
  border-bottom: 1px solid var(--bb-line, #E6E1D8);
}
.tb-sec-head h3 {
  margin: 0; flex: 1 1 auto; min-width: 0;
  font: 600 15px/1.25 'Outfit', system-ui, sans-serif;
  letter-spacing: -.01em; color: var(--bb-ink, #1A1A1A);
}
.tb-sec-head .tb-hint {
  font: 400 11.5px/1.4 'Outfit', system-ui, sans-serif;
  color: var(--bb-ink-3, #8A8578);
}
.tb-sec-body { padding: 18px 20px 20px; }

/* ------------------------------------------------------------------ KPI cards */

.tb-kpis {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
}
.tb-kpi {
  position: relative; overflow: hidden;
  padding: 15px 14px 13px;
  background: var(--bb-surface, #fff);
  border-radius: var(--bb-r-card, 10px);
  box-shadow: var(--bb-sh-card, 0 0 0 1px #E6E1D8);
  transition: transform var(--bb-t-base, .16s) var(--bb-ease-strong, ease), box-shadow var(--bb-t-base, .16s);
}
.tb-kpi:hover { transform: translateY(-2px); box-shadow: var(--bb-sh-raised, 0 2px 10px rgba(13,42,94,.08)); }
.tb-kpi::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--bb-accent, #0D2A5E);
}
.tb-kpi.acc-gold::before  { background: var(--bb-gold, #C9A43F); }
.tb-kpi.acc-green::before { background: var(--bb-green, #2E7D52); }
.tb-kpi.acc-cyan::before  { background: var(--bb-cyan, #16788F); }
.tb-kpi.acc-violet::before{ background: var(--bb-violet, #6B4FA8); }
.tb-kpi.acc-red::before   { background: var(--bb-red, #B23B3B); }
.tb-kpi-label {
  font: 600 10px/1.2 'Outfit', system-ui, sans-serif;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--bb-ink-3, #8A8578);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 5px;
}
.tb-kpi-val {
  font: 700 25px/1.05 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--bb-ink, #1A1A1A);
  letter-spacing: -.02em;
}
.tb-kpi-val small { font-size: 15px; font-weight: 500; color: var(--bb-ink-2, #5A564F); }
.tb-kpi-val.is-absent { color: var(--bb-ink-3, #8A8578); font-size: 16px; font-weight: 500; letter-spacing: 0; }
.tb-kpi-foot {
  margin-top: 7px;
  font: 500 11px/1.35 'Outfit', system-ui, sans-serif;
  color: var(--bb-ink-2, #5A564F);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.tb-kpi-foot .tb-num { font-weight: 600; }
.tb-delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.tb-delta.up   { color: var(--bb-green, #2E7D52); }
.tb-delta.down { color: var(--bb-red, #B23B3B); }
.tb-delta.flat { color: var(--bb-ink-3, #8A8578); }

/* ------------------------------------------------------------------ the screen panel */

/* The CTV answer. Dark on purpose: this is the one panel whose subject is a television. */
.tb-screen {
  border-radius: var(--bb-r-card, 10px);
  overflow: hidden;
  background: linear-gradient(160deg, #0B1220 0%, #12283C 62%, #0D2A5E 100%);
  box-shadow: 0 0 0 1px rgba(13, 42, 94, .35), 0 10px 30px rgba(13, 42, 94, .16);
  color: #F5F3EE;
}
.tb-screen-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px;
  padding: 18px 22px 0;
}
.tb-screen-head h3 {
  margin: 0; font: 600 15px/1.2 'Outfit', system-ui, sans-serif; color: #F5F3EE;
}
.tb-screen-head .tb-hint { font: 400 11.5px/1.4 'Outfit', system-ui, sans-serif; color: #9AA8B8; }
.tb-screen-hero {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 26px;
  padding: 14px 22px 16px;
}
.tb-screen-big {
  font: 700 46px/1 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums; letter-spacing: -.03em;
  color: #fff;
}
.tb-screen-big small { font-size: 22px; font-weight: 500; color: #C9A43F; }
.tb-screen-cap {
  font: 500 12px/1.45 'Outfit', system-ui, sans-serif; color: #C3CEDB;
  padding-bottom: 5px; max-width: 34ch;
}
.tb-screen-cap b { color: #fff; }

/* Stacked share bar. Bare divs with flex-basis, so the geometry IS the number. */
.tb-stack { display: flex; height: 30px; margin: 0 22px; border-radius: 6px; overflow: hidden; background: rgba(255,255,255,.07); }
.tb-stack-seg {
  min-width: 2px; position: relative;
  display: flex; align-items: center; justify-content: center;
  font: 600 10.5px/1 'JetBrains Mono', ui-monospace, monospace;
  color: rgba(255,255,255,.92); overflow: hidden; white-space: nowrap;
  transition: filter var(--bb-t-fast, .12s);
}
.tb-stack-seg:hover { filter: brightness(1.18); }
.tb-stack-seg + .tb-stack-seg { box-shadow: inset 1px 0 0 rgba(11,18,32,.55); }
.tb-legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  padding: 13px 22px 20px;
}
.tb-legend-item { display: flex; align-items: center; gap: 7px; font: 500 11.5px/1.3 'Outfit', system-ui, sans-serif; color: #C3CEDB; }
.tb-legend-dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.tb-legend-item b {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums;
  font-weight: 700; color: #fff;
}
.tb-legend-item span { color: #8FA0B4; }

/* ------------------------------------------------------------------ funnel */

.tb-funnel { display: flex; flex-direction: column; gap: 9px; }
.tb-funnel-row { display: grid; grid-template-columns: 92px 1fr 118px; align-items: center; gap: 12px; }
.tb-funnel-lab { font: 600 11.5px/1 'Outfit', system-ui, sans-serif; color: var(--bb-ink-2, #5A564F); }
.tb-funnel-track { height: 22px; border-radius: 5px; background: var(--bb-canvas, #EFEDE6); overflow: hidden; }
.tb-funnel-fill {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--bb-accent, #0D2A5E), var(--bb-cyan, #16788F));
  transition: width var(--bb-t-slow, .28s) var(--bb-ease-strong, ease);
}
.tb-funnel-val {
  text-align: right;
  font: 600 12.5px/1 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums;
  color: var(--bb-ink, #1A1A1A);
}
.tb-funnel-val span { color: var(--bb-ink-3, #8A8578); font-weight: 500; }

/* ------------------------------------------------------------------ trend chart */

.tb-chart-wrap { position: relative; }
.tb-chart { width: 100%; height: 230px; display: block; overflow: visible; }
.tb-chart .grid { stroke: var(--bb-line, #E6E1D8); stroke-width: 1; }
.tb-chart .axis { fill: var(--bb-ink-3, #8A8578); font: 500 10px 'JetBrains Mono', ui-monospace, monospace; }
.tb-chart .area { fill: url(#tbGrad); }
.tb-chart .line { fill: none; stroke: var(--bb-accent, #0D2A5E); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tb-chart .dot { fill: var(--bb-accent, #0D2A5E); stroke: var(--bb-surface, #fff); stroke-width: 2; }
.tb-chart .hit { fill: transparent; cursor: crosshair; }
.tb-chart-tip {
  position: absolute; pointer-events: none; opacity: 0;
  transform: translate(-50%, -100%);
  padding: 7px 10px; border-radius: 6px;
  background: var(--bb-tip-bg, #12283C); color: var(--bb-tip-fg, #F5F3EE);
  font: 500 11.5px/1.5 'Outfit', system-ui, sans-serif;
  white-space: nowrap; z-index: 4;
  transition: opacity var(--bb-t-fast, .12s);
  box-shadow: 0 6px 20px rgba(13,42,94,.22);
}
.tb-chart-tip.on { opacity: 1; }
.tb-chart-tip b { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.tb-chart-tip i { color: var(--bb-tip-muted, #9AA8B8); font-style: normal; }

/* ------------------------------------------------------------------ campaign cards */

.tb-cmps { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.tb-cmp {
  padding: 15px 16px 14px;
  border-radius: var(--bb-r-card, 10px);
  background: var(--bb-surface, #fff);
  box-shadow: var(--bb-sh-card, 0 0 0 1px #E6E1D8);
  display: flex; flex-direction: column; gap: 11px;
  transition: transform var(--bb-t-base, .16s) var(--bb-ease-strong, ease), box-shadow var(--bb-t-base, .16s);
}
.tb-cmp:hover { transform: translateY(-2px); box-shadow: var(--bb-sh-raised, 0 2px 10px rgba(13,42,94,.08)); }
.tb-cmp-top { display: flex; align-items: flex-start; gap: 10px; }
.tb-cmp-name {
  flex: 1 1 auto; min-width: 0;
  font: 600 13.5px/1.35 'Outfit', system-ui, sans-serif; color: var(--bb-ink, #1A1A1A);
  overflow-wrap: anywhere;
}
.tb-cmp-name em {
  display: block; margin-top: 3px; font-style: normal;
  font: 500 10.5px/1.3 'Outfit', system-ui, sans-serif; color: var(--bb-ink-3, #8A8578);
}
.tb-pill {
  flex: none; padding: 3px 8px; border-radius: var(--bb-r-chip, 6px);
  font: 600 10px/1.3 'Outfit', system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase;
  background: var(--bb-field, #F1EFE8); color: var(--bb-ink-2, #5A564F);
  box-shadow: inset 0 0 0 1px var(--bb-line, #E6E1D8);
  white-space: nowrap;
}
.tb-pill.on  { background: var(--bb-green-tint, #E9F3ED); color: var(--bb-green, #2E7D52); box-shadow: inset 0 0 0 1px var(--bb-green, #2E7D52); }
.tb-pill.off { background: var(--bb-field, #F1EFE8); color: var(--bb-ink-3, #8A8578); }
.tb-cmp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; }
.tb-cell-lab { font: 600 9.5px/1.2 'Outfit', system-ui, sans-serif; letter-spacing: .09em; text-transform: uppercase; color: var(--bb-ink-3, #8A8578); }
.tb-cell-val {
  margin-top: 3px;
  font: 600 14px/1.1 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums;
  color: var(--bb-ink, #1A1A1A);
}
.tb-cell-val.is-absent { font-size: 11.5px; font-weight: 500; color: var(--bb-ink-3, #8A8578); }
.tb-bar { height: 6px; border-radius: 3px; background: var(--bb-canvas, #EFEDE6); overflow: hidden; }
.tb-bar > i { display: block; height: 100%; border-radius: 3px; background: var(--bb-accent, #0D2A5E); }
.tb-cmp-foot { display: flex; flex-wrap: wrap; gap: 5px; }

/* ------------------------------------------------------------------ creatives */

.tb-vids { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); }
.tb-vid {
  border-radius: var(--bb-r-card, 10px); overflow: hidden;
  background: var(--bb-surface, #fff);
  box-shadow: var(--bb-sh-card, 0 0 0 1px #E6E1D8);
  display: flex; flex-direction: column;
  transition: transform var(--bb-t-base, .16s) var(--bb-ease-strong, ease), box-shadow var(--bb-t-base, .16s);
}
.tb-vid:hover { transform: translateY(-3px); box-shadow: var(--bb-sh-overlay, 0 8px 28px rgba(13,42,94,.12)); }
.tb-thumb {
  position: relative; display: block;
  aspect-ratio: 16 / 9; background: #0B1220;
  overflow: hidden; text-decoration: none;
}
.tb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* A thumbnail that 404s must not leave a black hole with no explanation. */
.tb-thumb.is-broken img { display: none; }
.tb-thumb-fallback {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center; flex-direction: column; gap: 6px;
  color: #8FA0B4; font: 500 11px 'Outfit', system-ui, sans-serif; text-align: center; padding: 10px;
}
.tb-thumb.is-broken .tb-thumb-fallback { display: flex; }
.tb-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(11,18,32,0) 40%, rgba(11,18,32,.55) 100%);
  opacity: 0; transition: opacity var(--bb-t-base, .16s);
}
.tb-thumb:hover .tb-play, .tb-thumb:focus-visible .tb-play { opacity: 1; }
.tb-play svg { width: 46px; height: 46px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.45)); }
.tb-dur {
  position: absolute; right: 7px; bottom: 7px;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(11,18,32,.86); color: #fff;
  font: 600 10.5px/1.3 'JetBrains Mono', ui-monospace, monospace;
}
.tb-ring { position: absolute; left: 7px; top: 7px; width: 40px; height: 40px; }
.tb-ring text {
  fill: #fff; font: 700 11px 'JetBrains Mono', ui-monospace, monospace;
  text-anchor: middle; dominant-baseline: central;
}
.tb-ring text tspan { font-size: 7px; font-weight: 500; fill: rgba(255,255,255,.8); }
.tb-vid-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 9px; flex: 1 1 auto; }
.tb-vid-title {
  font: 600 12.5px/1.35 'Outfit', system-ui, sans-serif; color: var(--bb-ink, #1A1A1A);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tb-vid-meta { font: 500 10.5px/1.35 'Outfit', system-ui, sans-serif; color: var(--bb-ink-3, #8A8578); overflow-wrap: anywhere; }
.tb-vid-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: auto; }

/* ------------------------------------------------------------------ share table */

.tb-tbl-wrap { overflow-x: auto; }
.tb-tbl { width: 100%; border-collapse: collapse; min-width: 620px; }
.tb-tbl th {
  text-align: left; padding: 9px 12px;
  background: var(--bb-stripe-bg, #F7F5F0);
  border-bottom: 1px solid var(--bb-line, #E6E1D8);
  font: 600 10px/1.2 'Outfit', system-ui, sans-serif; letter-spacing: .09em; text-transform: uppercase;
  color: var(--bb-ink-2, #5A564F);
  white-space: nowrap;
}
.tb-tbl th.n, .tb-tbl td.n { text-align: right; }
.tb-tbl td {
  padding: 9px 12px; border-bottom: 1px solid var(--bb-line, #E6E1D8);
  font: 500 12.5px/1.4 'Outfit', system-ui, sans-serif; color: var(--bb-ink, #1A1A1A);
}
.tb-tbl td.n {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.tb-tbl tbody tr:hover td { background: var(--bb-hover, #F4F2EC); }
.tb-tbl td.is-absent { color: var(--bb-ink-3, #8A8578); font-weight: 500; font-family: 'Outfit', system-ui, sans-serif; }
.tb-mini { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
/* The BAR gives up width, never the number: "$10,790" wrapped to "$10,79 / 0" when the bar
   held its 60px basis in a narrow column. */
.tb-mini .tb-bar { flex: 0 1 56px; min-width: 22px; }

/* ------------------------------------------------------------------ CRM demand */

.tb-demand { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
.tb-demand-rows { display: flex; flex-direction: column; gap: 8px; }
.tb-demand-row { display: grid; grid-template-columns: 1fr 84px; align-items: center; gap: 12px; }
.tb-demand-lab { font: 500 12.5px/1.3 'Outfit', system-ui, sans-serif; color: var(--bb-ink, #1A1A1A); }
.tb-demand-lab em { font-style: normal; color: var(--bb-ink-3, #8A8578); font-size: 11px; }
.tb-demand-bar { height: 20px; border-radius: 5px; background: var(--bb-canvas, #EFEDE6); overflow: hidden; margin-top: 4px; }
.tb-demand-bar > i { display: block; height: 100%; border-radius: 5px; background: var(--bb-gold, #C9A43F); }
.tb-demand-bar.alt > i { background: var(--bb-violet, #6B4FA8); }
.tb-demand-n {
  text-align: right;
  font: 700 14px/1 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums;
  color: var(--bb-ink, #1A1A1A);
}
.tb-demand-n span { display: block; margin-top: 2px; font: 500 10px 'Outfit', system-ui, sans-serif; color: var(--bb-ink-3, #8A8578); }
.tb-note {
  padding: 13px 15px; border-radius: var(--bb-r-card, 10px);
  background: var(--bb-inset, #FAF9F6);
  box-shadow: inset 0 0 0 1px var(--bb-line, #E6E1D8);
}
.tb-note h4 {
  margin: 0 0 9px;
  font: 600 11px/1.2 'Outfit', system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase;
  color: var(--bb-ink-2, #5A564F);
}
.tb-note ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
/* NOT display:flex. In a flex container every ELEMENT child becomes its own flex item and is
   blockified — only contiguous TEXT runs are wrapped in an anonymous item. With flex here, each
   inline <b> and <code> became a separate column and the prose around them broke mid-word
   ("conve / rsiones", "C/P/M"). The bullet is absolutely positioned instead. */
.tb-note li {
  display: block; position: relative; padding-left: 15px;
  font: 400 12.5px/1.45 'Outfit', system-ui, sans-serif; color: var(--bb-ink-2, #5A564F);
}
.tb-note li::before {
  content: ''; position: absolute; left: 0; top: 8px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--bb-gold, #C9A43F);
}
/* <b> is for NUMBERS (mono, tabular, never broken across lines); <strong> is for an emphasised
   word, which stays in Outfit — mono on prose is what DESIGN.md forbids. */
.tb-note li b {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums;
  color: var(--bb-ink, #1A1A1A); font-weight: 700; white-space: nowrap;
}
.tb-note li strong { font-weight: 600; color: var(--bb-ink, #1A1A1A); }

/* ------------------------------------------------------------------ states */

.tb-empty, .tb-err {
  padding: 34px 22px; text-align: center;
  font: 400 13px/1.6 'Outfit', system-ui, sans-serif; color: var(--bb-ink-2, #5A564F);
}
.tb-empty b, .tb-err b { color: var(--bb-ink, #1A1A1A); }
.tb-err { color: var(--bb-red, #B23B3B); }
.tb-err .tb-btn { margin-top: 14px; }
.tb-skel {
  border-radius: var(--bb-r-card, 10px);
  background: linear-gradient(90deg, var(--bb-canvas, #EFEDE6) 25%, var(--bb-hover, #F4F2EC) 50%, var(--bb-canvas, #EFEDE6) 75%);
  background-size: 200% 100%;
  animation: tbShimmer 1.3s linear infinite;
}
@keyframes tbShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .tb-skel { animation: none; }
  .tb-kpi:hover, .tb-cmp:hover, .tb-vid:hover { transform: none; }
  .tb-funnel-fill { transition: none; }
}

/* ------------------------------------------------------------------ narrow */

/* Keys off the content width (html[data-cw]) like the rest of the app, not the viewport —
   the sidebar's width changes the content box without the viewport moving at all. */
html[data-cw="md"] .tb-demand,
html[data-cw="sm"] .tb-demand,
html[data-cw="xs"] .tb-demand { grid-template-columns: minmax(0, 1fr); }
html[data-cw="sm"] .tb-screen-big,
html[data-cw="xs"] .tb-screen-big { font-size: 36px; }
html[data-cw="xs"] .tb-funnel-row { grid-template-columns: 70px 1fr 92px; }
html[data-cw="xs"] .tb-cmp-grid { grid-template-columns: repeat(2, 1fr); }
html[data-cw="xs"] .tb-title { font-size: 22px; }
html[data-cw="xs"] .tb-head { padding: 16px; }
html[data-cw="xs"] .tb-sec-body { padding: 14px; }

@media (max-width: 640px) {
  .tb-head-side { align-items: flex-start; width: 100%; }
  .tb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-vids { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* ------------------------------------------------------------------ player modal */

/* The embed host is https://www.youtube-nocookie.com, which server.js already names in the
   CSP frame-src. A referrer is required too — helmet's default `no-referrer` makes the player
   answer "Error 153"; server.js sets strict-origin-when-cross-origin for exactly this. */
.tb-modal {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(11, 18, 32, .72);
  backdrop-filter: blur(3px);
  animation: tbFade var(--bb-t-base, .16s) var(--bb-ease-strong, ease);
}
@keyframes tbFade { from { opacity: 0; } to { opacity: 1; } }
.tb-modal-box {
  width: min(920px, 100%);
  background: var(--bb-surface, #fff);
  border-radius: var(--bb-r-card, 10px);
  box-shadow: 0 24px 70px rgba(11, 18, 32, .45);
  overflow: hidden;
}
.tb-modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--bb-line, #E6E1D8);
}
.tb-modal-title {
  flex: 1 1 auto; min-width: 0;
  font: 600 13.5px/1.35 'Outfit', system-ui, sans-serif; color: var(--bb-ink, #1A1A1A);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tb-modal-head .tb-btn { flex: none; text-decoration: none; }
.tb-modal-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.tb-modal-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.tb-note code {
  font: 500 11.5px/1.3 'JetBrains Mono', ui-monospace, monospace;
  padding: 1px 5px; border-radius: 4px;
  background: var(--bb-field, #F1EFE8);
  box-shadow: inset 0 0 0 1px var(--bb-line, #E6E1D8);
  color: var(--bb-ink-2, #5A564F);
}

@media (prefers-reduced-motion: reduce) { .tb-modal { animation: none; } }
@media (max-width: 640px) { .tb-modal { padding: 10px; } .tb-modal-title { white-space: normal; } }

/* A unit glyph beside a monospace number. Mono's space character is a full cell wide, so a
   literal " h" reads as a double gap; the margin does the spacing instead. */
.tb-u { margin-left: .22em; font-weight: 500; opacity: .72; font-size: .68em; }

/* ------------------------------------------------------- screen / surface badge on a campaign */

/* The dot carries the same colour the stacked screen bar uses, so a glance at a campaign card
   and a glance at the big split panel agree without reading either label. */
.tb-pill.screen {
  display: inline-flex; align-items: center; gap: 5px;
  text-transform: none; letter-spacing: 0;
  font-weight: 600;
}
.tb-pill.screen > i {
  width: 7px; height: 7px; border-radius: 2px; flex: none;
  /* An icon in a flex row resolves max-width:100% to 0 (responsive.css). Belt and braces. */
  min-width: 7px;
}
/* A campaign that really is a television buy gets the brand gold, matching the screen panel's
   hero colour. Everything else stays neutral — a mixed buy must not look like a verdict. */
.tb-pill.screen.is-ctv {
  background: var(--bb-gold-tint, #FBF4E2);
  color: var(--bb-gold-ink, #A8842C);
  box-shadow: inset 0 0 0 1px var(--bb-gold, #C9A43F);
}

/* A denominator hangs straight off its numerator — "30 /30 d" reads as two numbers, "30/30 d"
   reads as one fraction. So this one gets NO leading margin, unlike .tb-u. */
.tb-den { font-size: .68em; font-weight: 500; opacity: .72; }

/* The post-buy mirror's total row. A footer that looked like a body row would invite adding the
   two columns that must never be added (reach, frequency). */
.tb-tbl tfoot td {
  border-top: 2px solid var(--bb-line-strong, #D4CFC4);
  border-bottom: 0;
  background: var(--bb-inset, #FAF9F6);
  font-weight: 700;
}
.tb-tbl tfoot td.is-absent { font-weight: 500; }

/* ------------------------------------------------------ trend: metric chips + multi-series */

/* Metric chips are TOGGLES, not a segmented control — several can be on at once. Each carries
   its own line colour in --mc so the chip and the line are the same thing to the eye. */
.tb-mchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-mchip {
  appearance: none; cursor: pointer; border: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: var(--bb-r-chip, 6px);
  background: var(--bb-field, #F1EFE8);
  box-shadow: inset 0 0 0 1px var(--bb-line, #E6E1D8);
  font: 500 11.5px/1.3 'Outfit', system-ui, sans-serif;
  color: var(--bb-ink-2, #5A564F);
  transition: background var(--bb-t-fast, .12s), color var(--bb-t-fast, .12s), box-shadow var(--bb-t-fast, .12s);
}
.tb-mchip::before {
  content: ''; width: 8px; height: 8px; border-radius: 2px; flex: none; min-width: 8px;
  background: var(--mc, var(--bb-ink-3));
  opacity: .3;
}
.tb-mchip:hover { background: var(--bb-hover, #F4F2EC); color: var(--bb-ink, #1A1A1A); }
.tb-mchip.is-on {
  background: var(--bb-surface, #fff);
  color: var(--bb-ink, #1A1A1A); font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--mc, var(--bb-accent)), 0 1px 2px rgba(13,42,94,.06);
}
.tb-mchip.is-on::before { opacity: 1; }

/* The comparison series is dashed and thinner — present, clearly secondary, never confusable
   with the current period. */
.tb-chart .line.cmp { stroke-width: 1.5; stroke-dasharray: 5 4; opacity: .62; }
/* The 100 baseline of an indexed chart. Without it "above/below last time" is invisible. */
.tb-chart .base { stroke: var(--bb-ink-3, #8A8578); stroke-width: 1; stroke-dasharray: 2 3; opacity: .75; }
/* A PARTIAL bucket is plotted hollow. Filled, a half week reads as a real collapse. */
.tb-chart .dot { stroke-width: 2; }
.tb-chart .dot.part { stroke-dasharray: 2 2; }
.tb-chart .axis.part { fill: var(--bb-orange, #C77D1B); }
.tb-legend.tb-legend-light { padding: 12px 0 0; gap: 6px 18px; }
.tb-legend-lt { color: var(--bb-ink-2, #5A564F); }
.tb-legend-lt b { color: var(--bb-ink, #1A1A1A); }
.tb-legend-lt span.tb-legend-dot { border-radius: 2px; }

/* The trend lines carry their colour INLINE (one per metric), so these rules must not set
   stroke/fill — a CSS declaration beats an SVG presentation attribute, which is exactly how
   every series ended up navy. Geometry only here. */
.tb-chart .line[style*="stroke"] { stroke: revert-layer; }
