/* Customer lifetime pages (§14–17). Brand tokens come from styles.css :root. */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Scope line: fixed-window and sample badges */
.fixed-scope .title-block p { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; white-space: normal; }
.fixed-window,
.sample-flag {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-transform: uppercase;
  white-space: nowrap;
}
.fixed-window { color: var(--midnight); background: var(--soft-blue); border: 1px solid var(--tide); }
.sample-flag { color: var(--orange-text); background: var(--soft-orange); border: 1px solid var(--orange); }

/* Layouts */
.lifetime-grid { display: grid; gap: clamp(20px, 2vw, 32px); }
.lifetime-main, .lifetime-stack { display: grid; align-content: start; gap: 14px; min-width: 0; }
.lifetime-side, .timing-top {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr);
  align-items: start;
  gap: clamp(22px, 2.4vw, 42px);
}
.timing-grid { display: grid; gap: 22px; }
.attribution-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(300px, 1fr);
  align-items: start;
  gap: clamp(22px, 2.4vw, 42px);
}

.lifetime-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
}
.lifetime-toolbar .table-tabs { min-height: 0; }

/* Heat legend */
.heat-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.heat-legend i {
  width: 120px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eaf6fc, var(--tide), var(--surf), var(--midnight));
}
.heat-legend small { flex-basis: 100%; font-size: 11px; font-weight: 800; text-align: right; }

/* Cohort triangle */
.cohort-scroll {
  max-height: 640px;
  overflow: auto;
  border-top: 3px solid var(--surf);
  scrollbar-color: var(--tide) var(--soft-blue);
  scrollbar-width: thin;
}
.cohort-scroll:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.cohort-table {
  border-collapse: separate;
  border-spacing: 0;
  color: var(--midnight);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.cohort-table th,
.cohort-table td {
  min-width: 46px;
  padding: 5px 6px;
  border-right: 1px solid #fff;
  border-bottom: 1px solid #fff;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}
.cohort-table thead th {
  position: sticky;
  z-index: 3;
  top: 0;
  color: var(--muted);
  background: var(--panel-strong);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}
.cohort-table tbody th,
.cohort-table thead th:first-child,
.cohort-table tfoot th {
  position: sticky;
  left: 0;
  min-width: 62px;
  text-align: left;
}
.cohort-table tbody th { z-index: 1; background: #fff; font-weight: 800; }
.cohort-table thead th:first-child { z-index: 4; }
.cohort-table td.cohort-n,
.cohort-table thead th:nth-child(2) {
  position: sticky;
  left: 62px;
  min-width: 70px;
  color: var(--muted);
  border-right: 2px solid var(--line);
}
.cohort-table td.cohort-n { z-index: 1; background: #fff; }
.cohort-table thead th:nth-child(2) { z-index: 4; }
.cohort-table td.on-dark { color: #fff; }
.cohort-table td.cohort-empty { background: transparent; }
.cohort-table td.cohort-base { color: var(--muted); background: var(--panel-strong); }
.cohort-table tfoot th,
.cohort-table tfoot td {
  position: sticky;
  z-index: 2;
  color: var(--midnight);
  background: var(--soft-orange);
  border-top: 1px solid var(--orange);
  font-weight: 800;
}
.cohort-table tfoot tr:first-child th,
.cohort-table tfoot tr:first-child td { bottom: 25px; }
.cohort-table tfoot tr:last-child th,
.cohort-table tfoot tr:last-child td { bottom: 0; color: var(--orange-text); font-weight: 800; }
.cohort-table tfoot th { z-index: 3; }

/* Side cards */
.lifetime-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.lifetime-card h3 {
  margin: 0 0 10px;
  color: var(--midnight);
  font-size: clamp(14px, 0.9vw, 17px);
  font-weight: 800;
}
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.mini-table th, .mini-table td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.mini-table thead th { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.mini-table tbody th { color: var(--midnight); font-weight: 800; text-align: left; white-space: nowrap; }
.mini-table td { font-weight: 800; }
.mini-table td.note { color: var(--muted); font-size: 11px; font-weight: 800; text-align: left; }
.stat-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0; }
.stat-strip div { display: grid; gap: 2px; }
.stat-strip dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.stat-strip dd { margin: 0; color: var(--midnight); font-size: 17px; font-weight: 800; }

/* Timing table */
.timing-table .diagnostic-table tbody th { white-space: nowrap; }
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 3px; vertical-align: 0; }
.low-n {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  color: var(--orange-text); background: var(--soft-orange); font-size: 10px; text-transform: uppercase;
}

/* Attribution table */
.attribution-table .diagnostic-table { min-width: 760px; }
.attribution-table thead tr.group th {
  color: var(--midnight);
  font-size: 11px;
  text-align: center;
  border-bottom: 0;
}
.attribution-table thead tr:nth-child(2) th { top: 31px; }
.attribution-table th.clean-head { background: var(--soft-green); }
.attribution-table thead tr.group th.clean-head { color: var(--green); }
.attribution-table tbody tr.total th,
.attribution-table tbody tr.total td { border-top: 2px solid var(--line); background: var(--panel); }
.attribution-table tbody tr.artifact th { color: var(--muted); }
.attribution-table td.removed {
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
  font-weight: 800;
  text-align: center;
}
.attribution-table td.benchmark { color: var(--green); font-weight: 800; }
.attribution-table tbody tr.benchmark-row th { color: var(--green); }
.attribution-notes ul { margin: 0; padding-left: 18px; color: var(--midnight); font-size: 13px; line-height: 1.45; }
.attribution-notes li + li { margin-top: 8px; }

/* §15 cohort reach table */
.reach-scroll { max-height: 560px; }
.reach-table { width: 100%; border-collapse: separate; border-spacing: 0; color: var(--midnight); font-size: 12px; font-variant-numeric: tabular-nums; }
.reach-table th, .reach-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.reach-table thead th { position: sticky; top: 0; z-index: 2; color: var(--muted); background: var(--panel-strong); font-size: 10px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.reach-table tbody th, .reach-table tfoot th { text-align: left; font-weight: 800; }
.reach-table td b { display: block; font-weight: 800; }
.reach-table td small { display: block; color: var(--muted); font-size: 10px; font-weight: 800; }
.reach-table tr.young th, .reach-table tr.young td { color: var(--muted); background: var(--panel); }
.reach-table tr.young td b { font-weight: 800; }
.reach-table tfoot th, .reach-table tfoot td { position: sticky; bottom: 0; background: var(--soft-orange); border-top: 1px solid var(--orange); font-weight: 800; }

/* §17 purchase patterns */
.patterns-grid { display: grid; gap: clamp(20px, 2vw, 32px); }
.patterns-side { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); align-items: start; gap: clamp(22px, 2.4vw, 42px); }
.patterns-table .diagnostic-table { min-width: 1020px; }
.patterns-table .diagnostic-table tbody th { max-width: 220px; white-space: normal; }
.patterns-table td b { display: block; }
.patterns-table td small { display: block; color: var(--muted); font-size: 10px; font-weight: 800; }
.patterns-table td.rank { color: var(--muted); text-align: left; }
.patterns-table td.next { min-width: 230px; text-align: left; white-space: normal; }
.patterns-table td.next ol { margin: 0; padding-left: 16px; font-weight: 800; line-height: 1.35; }
.patterns-table td.next small { display: inline; }
.patterns-table td.muted, .patterns-table .muted { color: var(--muted); }
.patterns-table tfoot th, .patterns-table tfoot td { padding: 10px 9px; border-top: 2px solid var(--orange); background: var(--soft-orange); font-weight: 800; text-align: right; }
.patterns-table tfoot th { text-align: left; }
.path-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.path-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; }
.path-list i { color: var(--orange); font-style: normal; font-weight: 800; }
.path-list b { padding: 2px 8px; border-radius: 999px; background: var(--soft-blue); color: var(--midnight); font-size: 12px; }
.split-bar { height: 12px; border-radius: 999px; background: var(--tide); overflow: hidden; margin-bottom: 10px; }
.split-bar span { display: block; height: 100%; background: var(--midnight); }
.stat-strip.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-strip small { color: var(--muted); font-size: 11px; font-weight: 800; }
.attribution-notes .definition { margin: 0 0 14px; color: var(--midnight); font-size: 13px; line-height: 1.5; }

@media (max-width: 1179px) {
  .patterns-side { grid-template-columns: minmax(0, 1fr); }
  .lifetime-side, .timing-top, .attribution-grid { grid-template-columns: minmax(0, 1fr); }
  .cohort-scroll { max-height: 520px; }
}

@media (max-width: 767px) {
  .fixed-window, .sample-flag { margin: 6px 6px 0 0; white-space: normal; }
  .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .heat-legend small { text-align: left; }
}
.patterns-table thead th:nth-child(2) { text-align: left; }

/* V2.1 phase 2: curves run full width; summary cards pair up under them. */
.lifetime-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: clamp(22px, 2.4vw, 42px); }
@media (max-width: 1179px) { .lifetime-pair { grid-template-columns: minmax(0, 1fr); } }
/* One full-width column: a wide table scrolls inside its card instead of widening the slide on a phone. */
.lifetime-grid, .timing-grid { grid-template-columns: minmax(0, 1fr); }

/* V2.1 cohort months (v21-10): every cell prints its calendar month next to the value, e.g. "DEC-2024 6.7%".
   Cohort labels read OCT-2024, so the sticky first column is wider and the second column's offset follows it. */
.cohort-key { margin: 0; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.45; }
.cohort-table tbody th,
.cohort-table thead th:first-child,
.cohort-table tfoot th { width: 84px; min-width: 84px; }
.cohort-table td.cohort-n,
.cohort-table thead th:nth-child(2) { left: 84px; }
.cohort-table td { min-width: 88px; }
.cohort-table td.cohort-n, .cohort-table td.cohort-empty { min-width: 46px; }
.cohort-table td .cal-month {
  margin-right: 6px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.02em;
}
.cohort-table tfoot td { min-width: 88px; }

/* C11: the 10-week rate is the Manual Attribution headline. */
.attribution-table tbody tr.headline-row th,
.attribution-table tbody tr.headline-row td { border-top: 2px solid var(--green); background: var(--soft-green); }
.attribution-table tbody tr.headline-row td.muted { color: var(--muted); font-size: 11px; font-style: italic; text-align: center; }
.attribution-table tbody tr.headline-row td small { color: var(--muted); font-size: 11px; font-weight: 800; }

@media (max-width: 767px) {
  .cohort-table tbody th,
  .cohort-table thead th:first-child,
  .cohort-table tfoot th { width: 74px; min-width: 74px; }
  /* Phone: only the cohort label stays pinned, so more month cells fit on screen. */
  .cohort-table td.cohort-n,
  .cohort-table thead th:nth-child(2) { position: static; min-width: 56px; }
  .cohort-table thead th:nth-child(2) { position: sticky; left: auto; z-index: 3; }
}
/* Legend matches the stepped heat scale (light ramp | dark ramp). */
.heat-legend i { background: linear-gradient(90deg, #eaf6fc 0%, var(--tide) 50%, var(--surf) 50%, var(--midnight) 100%); }

