/* Detail (S-05): product table, payouts, what-if, data health and delivery, share panel. */
.only-phone-block { display: none; }
.strong { font-weight: 600; }
.neg { color: var(--danger); }
.pill--sm { padding: 1px var(--space-2); }
.pill--neutral { background: var(--surface-sunken); color: var(--ink); }
.pill--demo { background: var(--surface-sunken); color: var(--ink); font-size: 12px; line-height: 16px; letter-spacing: 0.02em; }

/* ---- profit per product */
.products-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-6); }
.search { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.search label { font-size: 13px; line-height: 18px; font-weight: 600; }
.search input {
  min-height: 44px;
  min-width: 220px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
}
.pt-scroll { overflow-x: auto; }
.pt { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 14px; line-height: 21px; }
.pt thead th { padding: 10px var(--space-2); background: var(--surface-sunken); font-size: 13px; line-height: 18px; font-weight: 600; text-align: left; white-space: nowrap; }
.pt thead th:first-child { border-radius: var(--radius-md) 0 0 0; }
.pt thead th:last-child { border-radius: 0 var(--radius-md) 0 0; }
.pt td, .pt tbody th { padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; }
.pt .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; line-height: 18px; white-space: nowrap; }
.pt .num.strong { font-weight: 600; }
.pt-num { width: 28px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }
.pt-row--other th, .pt-row--other td { color: var(--ink-muted); }
.pt-row--total th, .pt-row--total td { border-top: 1px solid var(--ink); border-bottom: 0; font-weight: 700; }
.pt-row.is-open th, .pt-row.is-open td { background: var(--paper); border-bottom: 0; }
.pt-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  margin: -10px 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 21px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.chev { display: inline-flex; color: var(--ink-muted); transition: transform 150ms cubic-bezier(0.23, 1, 0.32, 1); }
.chev--open { transform: rotate(90deg); }
.pt-detail td { padding: var(--space-4) var(--space-4) 20px 52px; background: var(--paper); border-bottom: 1px solid var(--line); }
.pt-insight { font-size: 14px; line-height: 21px; font-weight: 600; margin-bottom: var(--space-3); }
.pt-split { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 18px; }
.pt-split th, .pt-split td { padding: var(--space-2) var(--space-3) var(--space-2) 0; border-top: 1px solid var(--line); text-align: left; font-weight: 600; }
.pt-split thead th { border-top: 0; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.pt-split .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 400; }
.pt-split .num.strong { font-weight: 600; }
.pt-empty { padding: 20px var(--space-3); font-size: 14px; line-height: 21px; color: var(--ink-muted); }
.pt-cards { list-style: none; margin: 0; padding: 0; }
.pt-card { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.pt-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.pt-toggle--card { margin: -12px 0 -8px; align-items: flex-start; padding-top: 12px; }
.pt-toggle--card .chev { padding-top: 3px; }
.pt-card__name { font-size: 14px; line-height: 20px; font-weight: 600; }
.pt-card__profit { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap; }
.pt-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.pt-card__detail { margin-top: var(--space-2); padding: var(--space-3); border-radius: var(--radius-md); background: var(--paper); }
.pt-card__detail .pt-insight { font-size: 13px; line-height: 19px; margin-bottom: var(--space-2); }
.pt-card__split { list-style: none; margin: 0; padding: 0; }
.pt-card__split li { display: flex; justify-content: space-between; gap: var(--space-2); padding-top: 6px; margin-top: 6px; border-top: 1px solid var(--line); font-size: 12px; line-height: 16px; }

/* ---- returns by product and ad spend */
.card--returns { flex: 1.2 1 480px; }
.card--ads { flex: 1 1 420px; }
.card--costs { flex: 1 1 100%; }
.mp-bar { display: flex; height: 10px; margin: var(--space-2) 0; border-radius: 3px; overflow: hidden; }
.mp-seg { display: block; min-width: 0; height: 100%; }
.mp-seg + .mp-seg { border-left: 1px solid var(--surface-raised); }
.swatch--packaging { background: var(--ink-muted); }
.swatch--payments { background: color-mix(in srgb, var(--ink-muted) 62%, var(--surface-raised)); }
.swatch--tax { background: repeating-linear-gradient(45deg, var(--ink-muted) 0 2px, transparent 2px 5px); border: 1px solid var(--ink-muted); }
.rt-scroll { overflow-x: auto; }
.rt { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.rt th, .rt td { padding: 10px var(--space-2); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.rt thead th { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); background: var(--surface-sunken); }
.rt tbody th { font-weight: 600; }
.rt .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
.rt-row--other th, .rt-row--other td { color: var(--ink-muted); }
.rt-row--total th, .rt-row--total td { border-top: 1px solid var(--ink); border-bottom: 0; font-weight: 700; }
.rt-rate { display: inline-flex; align-items: center; gap: var(--space-2); }
.rt-bar { display: block; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--surface-sunken); }
.rt-bar__fill { display: block; height: 6px; min-width: 2px; border-radius: 3px; background: var(--ink-muted); }
.rt-bar__fill--high { background: var(--warn); }
.ad-row__note { font-size: 13px; line-height: 18px; color: var(--ink-muted); }

/* ---- tiles used by payouts and the what-if */
.tiles { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.tile { flex: 1 1 150px; min-width: 0; padding: 14px; border-radius: var(--radius-md); background: var(--surface-sunken); display: flex; flex-direction: column; gap: 2px; }
.tile--accent { background: var(--insights-soft); }
.tile--accent .tile__label { color: var(--insights); font-weight: 600; }
.tile__label { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.tile__value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 20px; line-height: 26px; font-weight: 600; }
.tile__value--lg { font-size: 22px; line-height: 28px; }
.tile__note { font-size: 12px; line-height: 16px; color: var(--ink-muted); }

/* ---- payouts */
.card--payouts { flex: 1 1 420px; }
.pay-rows { list-style: none; margin: 0; padding: 0; }
.pay-row { display: flex; flex-direction: column; gap: 6px; padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.pay-row__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-1) var(--space-3); font-size: 14px; line-height: 20px; }
.pay-row__top .mono { font-size: 13px; }
.pay-row__out { font-weight: 400; color: var(--ink-muted); font-size: 13px; }
.pay-bar { display: flex; gap: 2px; height: 12px; }
.pay-row.is-out .pay-bar { opacity: 0.45; }
.pay-bar__paid { min-width: 2px; border-radius: 2px; background: var(--insights); }
.pay-bar__held, .swatch--held { min-width: 2px; border-radius: 2px; background: repeating-linear-gradient(45deg, var(--insights) 0 2px, transparent 2px 5px); border: 1px solid var(--insights); }
.pay-row__note { font-size: 12px; line-height: 16px; color: var(--ink-muted); }

/* ---- what-if */
.card--whatif { flex: 1.2 1 520px; }
.wi-control { display: flex; flex-direction: column; gap: var(--space-2); }
.wi-control__top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-3); }
.wi-control label { font-size: 14px; line-height: 21px; font-weight: 600; }
.wi-rate { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 20px; line-height: 28px; font-weight: 600; }
.wi-control input[type="range"] { width: 100%; min-height: 44px; margin: 0; accent-color: var(--insights); }
.wi-scale { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.wi-presets { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.wi-change { font-size: 14px; line-height: 21px; font-weight: 600; }

/* ---- data health and delivery */
.health { display: flex; flex-wrap: wrap; gap: var(--space-6) 40px; }
.health__checks { list-style: none; margin: 0; padding: 0; flex: 1 1 420px; min-width: 0; }
.health__check { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 21px; }
.health__check .pill { flex: 0 0 auto; }
.health__detail { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.health__delivery { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.health__block { display: flex; flex-direction: column; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.health__block--row { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.health__title { font-size: 14px; line-height: 21px; font-weight: 600; }
.health__note { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.health__demo { font-size: 12px; line-height: 17px; color: var(--ink-muted); }
.rule-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---- share panel (fallback when the clipboard is not available) */
.share-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-8);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line);
}
.share-panel__title { font-size: 14px; line-height: 21px; font-weight: 600; }
.share-panel__url { flex: 1 1 320px; min-width: 0; min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); font-family: var(--font-mono); font-size: 13px; }
.print-only { display: none; }

@media (max-width: 599px) {
  .only-wide-block { display: none; }
  .only-phone-block { display: block; }
  .card--products { order: 11; }
  .card--returns { order: 12; }
  .card--ads { order: 13; }
  .card--costs { order: 14; }
  .card--payouts { order: 15; }
  .card--whatif { order: 16; }
  .card--health { order: 17; }
  .rt th, .rt td { padding: var(--space-2) var(--space-1); }
  .rt .pt-num { display: none; }
  .rt .num { font-size: 12px; }
  .rt-rate { flex-direction: column-reverse; align-items: flex-end; gap: 2px; }
  .rt-bar { margin-left: auto; width: 64px; }
  .search { flex-direction: column; align-items: stretch; width: 100%; }
  .search input { min-width: 0; width: 100%; }
  .tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .tile { padding: var(--space-3); }
  .tile__value--lg { font-size: 18px; line-height: 24px; }
  .card--whatif .tile:last-child { grid-column: 1 / -1; }
  .pay-row__note { display: none; }
  .wi-control label { font-size: 13px; line-height: 18px; }
  .rule-chips { flex-direction: column; }
  .health__check { font-size: 14px; line-height: 20px; }
  .health__detail { font-size: 12px; line-height: 16px; }
  .share-panel { padding: var(--space-3) var(--space-4); }
}
@media (max-width: 399px) {
  .rt th, .rt td { padding-left: 2px; padding-right: 2px; }
}
