/* TikTok report — scoped overrides.
   Loaded after styles.css; every rule is prefixed .yves-page so the other
   report pages are untouched.

   Series colors come from the validated default dataviz palette, kept in the
   documented slot order (that order is the colorblind-safety mechanism).
   Re-run scripts/validate_palette.js before changing any hex. The Yves Rocher
   green stays on chrome — the brand lockup and section eyebrows — never on a
   data mark, where one hue at two lightnesses cannot carry two identities. */

.yves-page {
  --viz-surface: #ffffff;
  --viz-plane: #f7f8f5;

  --viz-ink: #0b0b0b;
  --viz-ink-2: #52514e;
  --viz-ink-muted: #6f6e69; /* 5.11:1 on white — safe for axis ticks */

  --viz-grid: #e1e0d9;
  --viz-axis: #c3c2b7;
  --viz-hairline: rgba(11, 11, 11, 0.1);

  --viz-gmv: #2a78d6; /* slot 1 */
  --viz-cost: #eb6834; /* slot 2 */
  --viz-roi: #008300; /* slot 6 */
  --viz-now: #2a78d6; /* before → after: one hue, */
  --viz-then: #86b6ef; /* two shades */

  --viz-good: #006300; /* 7.54:1 as text */
  --viz-bad: #d03b3b; /* 4.80:1 as text */

  background: var(--viz-plane);
}

/* ---------- deltas: the old greens/reds failed text contrast ---------- */

.yves-page .trend.up,
.yves-page .cell-delta.up,
.yves-page .metric-delta.up,
.yves-page .fn-delta.up,
.yves-page .kpi-sub .up {
  color: var(--viz-good);
}

.yves-page .trend.down,
.yves-page .cell-delta.down,
.yves-page .metric-delta.down,
.yves-page .fn-delta.down,
.yves-page .kpi-sub .down {
  color: var(--viz-bad);
}

/* ---------- panels & tiles ---------- */

.yves-page .panel,
.yves-page .kpi {
  border: 1px solid var(--viz-hairline);
  border-radius: 12px;
  background: var(--viz-surface);
  box-shadow: none;
}

.yves-page .kpi {
  padding: 16px 16px 14px;
}

.yves-page .kpi-label {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--viz-ink-muted);
}

.yves-page .kpi-value {
  margin-top: 6px;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 680;
  letter-spacing: -0.02em;
  color: var(--viz-ink);
  font-variant-numeric: proportional-nums;
}

.yves-page .kpi-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--viz-ink-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- ads type split ---------- */

.yves-page .split-bar-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--viz-grid);
}

.yves-page .split-bar-row:last-child {
  border-bottom: 0;
}

.yves-page .split-bar-label {
  font-size: 13.5px;
  font-weight: 660;
  color: var(--viz-ink);
}

.yves-page .split-metrics {
  color: var(--viz-ink-muted);
  font-variant-numeric: tabular-nums;
}

.yves-page .bar-track {
  background: #eeeeea;
  border-radius: 4px;
  overflow: hidden;
}

.yves-page .bar-fill {
  border-radius: 0 4px 4px 0; /* rounded data-end, square at the baseline */
}

.yves-page .bar-value {
  font-weight: 680;
  color: var(--viz-ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- chart chrome ---------- */

.yves-page .viz-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.yves-page .viz-title {
  margin: 0;
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.01em;
  color: var(--viz-ink);
}

.yves-page .viz-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--viz-ink-muted);
}

.yves-page .viz-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12.5px;
  color: var(--viz-ink-2);
}

.yves-page .viz-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.yves-page .viz-legend i {
  flex: none;
  border-radius: 2px;
}

.yves-page .viz-legend i.key-rect {
  width: 11px;
  height: 11px;
}

.yves-page .viz-legend i.key-line {
  width: 16px;
  height: 2px;
}

.yves-page .viz-figure {
  position: relative;
}

.yves-page .viz-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.yves-page .viz-svg .grid-line {
  stroke: var(--viz-grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.yves-page .viz-svg .axis-line {
  stroke: var(--viz-axis);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.yves-page .viz-svg .tick-text {
  fill: var(--viz-ink-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.yves-page .viz-svg .plot-name {
  fill: var(--viz-ink-2);
  font-size: 12px;
  font-weight: 650;
}

.yves-page .viz-svg .viz-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.yves-page .viz-svg .viz-dot {
  stroke: var(--viz-surface);
  stroke-width: 2; /* surface ring */
}

.yves-page .viz-svg .end-label {
  fill: var(--viz-ink);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.yves-page .viz-svg .crosshair {
  stroke: var(--viz-ink);
  stroke-width: 1;
  opacity: 0.28;
  pointer-events: none;
}

.yves-page .viz-svg .hit-band {
  fill: transparent;
  cursor: crosshair;
}

.yves-page .viz-svg .hit-band.is-active {
  fill: rgba(11, 11, 11, 0.035);
}

/* the old fixed height cropped the new stacked plots */
.yves-page .combo-chart.chart-fixed,
.yves-page .combo-chart.chart-fixed .viz-svg {
  height: auto;
  max-height: none;
}

/* ---------- tooltip ---------- */

.yves-page .viz-tip {
  position: absolute;
  z-index: 20;
  min-width: 210px;
  padding: 11px 14px;
  border: 1px solid var(--viz-hairline);
  border-radius: 10px;
  background: var(--viz-surface);
  box-shadow: 0 10px 28px rgba(11, 11, 11, 0.12);
  font-size: 12.5px;
  color: var(--viz-ink-2);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.yves-page .viz-tip[data-open="true"] {
  opacity: 1;
}

.yves-page .viz-tip-head {
  margin-bottom: 7px;
  font-weight: 650;
  color: var(--viz-ink);
}

.yves-page .viz-tip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.yves-page .viz-tip-row i {
  flex: none;
  width: 14px;
  height: 2px;
  border-radius: 2px;
}

/* values lead, labels follow */
.yves-page .viz-tip-row b {
  margin-left: auto;
  padding-left: 18px;
  font-weight: 680;
  color: var(--viz-ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- video funnel: dumbbell per stage ---------- */

.yves-page .fn-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  font-size: 12.5px;
  color: var(--viz-ink-2);
}

.yves-page .fn-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.yves-page .fn-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.yves-page .fn-legend .fn-note {
  margin-left: auto;
  color: var(--viz-ink-muted);
}

.yves-page .fn-list {
  display: grid;
  gap: 6px;
}

.yves-page .fn-row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 250px;
  align-items: center;
  gap: 20px;
  padding: 14px 8px;
  border-radius: 8px;
}

.yves-page .fn-row:hover {
  background: rgba(11, 11, 11, 0.025);
}

.yves-page .fn-stage {
  display: block;
  font-size: 13.5px;
  font-weight: 660;
  color: var(--viz-ink);
}

.yves-page .fn-rate {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--viz-ink-muted);
  font-variant-numeric: tabular-nums;
}

.yves-page .fn-track {
  position: relative;
  height: 18px;
  margin: 0 9px;
}

.yves-page .fn-track::before {
  content: "";
  position: absolute;
  left: -9px;
  right: -9px;
  top: 50%;
  height: 1px;
  background: var(--viz-grid);
}

.yves-page .fn-conn {
  position: absolute;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 2px;
  background: var(--viz-then);
}

.yves-page .fn-dot {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--viz-surface); /* surface ring */
}

.yves-page .fn-dot.now {
  background: var(--viz-now);
}

.yves-page .fn-dot.then {
  background: var(--viz-then);
}

.yves-page .fn-values {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.yves-page .fn-values b {
  font-size: 15px;
  font-weight: 680;
  color: var(--viz-ink);
}

.yves-page .fn-values span {
  font-size: 11.5px;
  color: var(--viz-ink-muted);
}

.yves-page .fn-values .fn-delta {
  font-size: 12px;
  font-weight: 660;
}

/* ---------- tables ---------- */

.yves-page .table-wrap {
  border: 1px solid var(--viz-hairline);
  border-radius: 12px;
  background: var(--viz-surface);
  overflow-x: auto;
}

.yves-page .table-wrap table {
  border-collapse: collapse;
  width: 100%;
}

.yves-page .table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 14px;
  border-bottom: 1px solid var(--viz-grid);
  background: var(--viz-surface);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--viz-ink-muted);
  text-align: right;
  white-space: nowrap;
}

.yves-page .table-wrap th:first-child {
  text-align: left;
}

.yves-page .table-wrap td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--viz-grid);
  font-size: 12.5px;
  text-align: right;
  color: var(--viz-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.yves-page .table-wrap td:first-child {
  text-align: left;
  white-space: normal;
}

.yves-page .table-wrap tbody tr:hover {
  background: rgba(11, 11, 11, 0.02);
}

.yves-page .table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.yves-page tr.total-row td {
  border-top: 1px solid var(--viz-axis);
  background: #f7f8f5;
  font-weight: 680;
}

.yves-page .cell-delta,
.yves-page .metric-delta {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--viz-ink-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- ranked bar charts (single series → slot 1) ---------- */

.yves-page .sku-bar,
.yves-page .account-bar {
  fill: var(--viz-gmv);
}

.yves-page .sku-label,
.yves-page .account-label {
  fill: var(--viz-ink);
  font-size: 12.5px;
}

.yves-page .sku-variant-label {
  fill: var(--viz-ink-muted);
  font-size: 11px;
}

.yves-page .sku-value,
.yves-page .account-value {
  fill: var(--viz-ink);
  font-size: 12.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ---------- tabs ---------- */

.yves-page .metric-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--viz-hairline);
  border-radius: 9px;
  background: #f2f2ef;
  width: fit-content;
}

.yves-page .metric-tab {
  padding: 6px 14px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--viz-ink-2);
  font-size: 12.5px;
  font-weight: 620;
  cursor: pointer;
}

.yves-page .metric-tab.active {
  background: var(--viz-surface);
  color: var(--viz-ink);
  box-shadow: 0 1px 2px rgba(11, 11, 11, 0.08);
}

@media (max-width: 900px) {
  .yves-page .fn-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
  }

  .yves-page .fn-track {
    grid-column: 1 / -1;
    order: 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .yves-page .viz-tip {
    transition: none;
  }
}
