/* Hallmark · /funnel/audit + /funnel/report shared layer (sc-88439) · theme: UpHex brand (locked, Living Town)
 * Ported from the approved prototype (prototypes/pack-optimize-report). Loaded on the report, the audit and (since
 * sc-88652, prototypes/pack-onboarding-steps) every onboarding step, scoped under .pack-report / .pack-audit / .pack-onboard.
 * The prototype's colour names are aliased here onto base-app tokens (tokens.css + its report additions);
 * no rule below inlines a colour.
 * pre-emit critique: P5 H5 E4 S5 R4 V4
 */
.pack-report,
.pack-audit,
.pack-onboard {
  /* prototype names → base-app tokens */
  --color-blue: var(--color-alpine);
  --color-blue-deep: var(--color-accent-deep);
  --color-action: var(--color-accent);
  --color-navy: var(--color-ink);
  --color-navy-deep: var(--color-night);
  --color-navy-raised: var(--color-night-raised);
  --color-canvas: var(--color-paper);
  --color-soft-blue: var(--color-accent-wash);
  --color-blue-wash: var(--color-accent-wash-2);
  --color-rule-strong: var(--color-rule);
  --color-hair: var(--color-rule-2);
  --color-teal: var(--color-signal-soft);
  --color-on-navy: var(--color-on-forest);
  --color-on-navy-2: var(--color-on-night-2);
  --color-on-navy-accent: var(--color-on-night-accent);
  --color-line-on-navy: var(--color-line-on-night);
  --color-fill-on-navy: var(--color-fill-on-night);
  --color-blue-tint: var(--color-alpine-tint);
  --color-blue-glow: var(--color-alpine-glow);
  --color-blue-haze: var(--color-alpine-haze);
  --color-line-on-navy-strong: var(--color-line-on-night-strong);
  --shadow-glow: 0 0 0 6px var(--color-alpine-haze);

  /* the report's scale (scoped: the rest of the app keeps its own) */
  --shell: 1240px;
  --header-h: 4.75rem;
  --text-sm: 0.875rem;
  --text-2xl: clamp(1.875rem, 3vw + 0.75rem, 2.75rem);
  --text-3xl: clamp(2.25rem, 4.5vw + 0.75rem, 4rem);
  --space-4xl: 9rem;
  --radius-card: 16px;
  --radius-field: 10px;
  --shadow-lift: var(--shadow-night-lift);

  & img, & svg { display: block; max-width: 100%; }
  & ul, & ol { margin: 0; padding: 0; list-style: none; }
  & em { font-family: var(--font-editorial); font-style: italic; font-weight: 500; color: var(--color-blue); letter-spacing: -0.01em; }
  .shell { width: min(100% - 2rem, var(--shell)); margin-inline: auto; }
  .kicker { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); }
  .kicker--on-navy { color: var(--color-on-navy-2); }

  /* buttons */
  .button {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
    min-height: 52px; padding: 0 var(--space-lg); border: 0; border-radius: var(--radius-pill);
    background: var(--color-action); color: var(--color-surface);
    font: 700 var(--text-md)/1 var(--font-body); white-space: nowrap; text-decoration: none; cursor: pointer;
    box-shadow: 0 10px 24px -12px var(--color-blue-deep);
    transition: background-color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
  }
  .button:hover { background: var(--color-blue-deep); }
  .button:active { transform: translateY(1px); }
  .button:disabled, .button[aria-disabled="true"] { background: var(--color-rule-strong); color: var(--color-muted); box-shadow: none; cursor: not-allowed; transform: none; }
  .button--ghost { background: transparent; color: var(--color-navy); box-shadow: inset 0 0 0 1.5px var(--color-rule-strong); }
  .button--ghost:hover { background: var(--color-surface); box-shadow: inset 0 0 0 1.5px var(--color-navy); }
  .button--block { width: 100%; }
  .button__soon { padding: 3px 10px; border-radius: var(--radius-pill); background: var(--color-surface); color: var(--color-muted); font-size: var(--text-xs); font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
  .button:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }

  /* small parts */
  .dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--color-teal); }
  .trust { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--text-sm); font-weight: 600; color: var(--color-muted); }
  .note {
    display: flex; gap: var(--space-sm); align-items: flex-start; padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-field); background: var(--color-soft-blue); box-shadow: inset 0 0 0 1px var(--color-blue-wash);
    font-size: var(--text-sm); font-weight: 600; color: var(--color-navy);
  }
  .note strong { color: var(--color-blue-deep); }
  .u-figure { font-variant-numeric: tabular-nums; }

  /* the tape (shared with uphex.com/pack/optimize) */
  .tape { margin: 0; padding: var(--space-lg); border-radius: var(--radius-panel); background: var(--color-navy-deep); color: var(--color-on-navy); box-shadow: var(--shadow-lift), inset 0 0 0 1px var(--color-fill-on-navy); }
  .tape__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-sm); flex-wrap: wrap; padding: 0 var(--space-2xs) var(--space-md); }
  .tape__live { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 800; color: var(--color-on-navy-accent); white-space: nowrap; }
  .tape__live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-blue); box-shadow: 0 0 0 4px var(--color-blue-haze); animation: pack-report-live 1.6s var(--ease-in-out) infinite; }
  .tape__scan {
    position: absolute; left: 0; right: 0; top: 50%; height: 2px; transform: translateY(-1px); background: var(--color-blue);
    box-shadow: 0 0 18px 3px var(--color-blue-glow), 0 0 60px 10px var(--color-blue-haze);
  }

  /* ---- shared since sc-88652: the audit's tape window + checklist rows (audit, analyze, research, account loading) */
  .checklist li { display: flex; align-items: center; gap: var(--space-sm); font-weight: 700; color: var(--color-muted); transition: color var(--dur-short) var(--ease-out); }
  .checklist__mark { position: relative; width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--color-rule-strong); transition: background-color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out); }
  .checklist li.is-done { color: var(--color-navy); }
  .checklist li.is-done .checklist__mark { background: var(--color-blue); border-color: var(--color-blue); }
  .checklist li.is-done .checklist__mark::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid var(--color-surface); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
  /* tape window — same machine as /pack/optimize, fed the real flagged searches */
  .tape__window {
    --row: 46px;
    position: relative; height: calc(var(--row) * 6); overflow: hidden; border-radius: var(--radius-card); background: var(--color-navy);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 12%, black 88%, transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, black 12%, black 88%, transparent 100%);
  }
  .tape__layer { position: absolute; inset: 0; }
  .tape__layer--raw { clip-path: inset(0 0 50% 0); }
  .tape__layer--sorted { clip-path: inset(50% 0 0 0); }
  .tape__list { will-change: transform; }
  .tape__row { height: var(--row); display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-xs); padding: 0 var(--space-sm); border-bottom: 1px solid var(--color-fill-on-navy); font-size: var(--text-sm); font-weight: 600; }
  .tape__term { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tape__cost { font-variant-numeric: tabular-nums; color: var(--color-on-navy-2); }
  .tape__pill { display: none; padding: 2px 10px; border-radius: var(--radius-pill); font-size: 0.66rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
  [data-sorted] .tape__pill { display: inline-block; }
  [data-sorted] .tape__row--waste { background: var(--color-blue-tint); }
  [data-sorted] .tape__row--waste .tape__term, [data-sorted] .tape__row--waste .tape__cost { color: var(--color-on-navy-2); text-decoration: line-through; text-decoration-color: var(--color-on-navy-accent); text-decoration-thickness: 2px; }
  [data-sorted] .tape__row--waste .tape__pill { background: var(--color-blue); color: var(--color-surface); }
  [data-sorted] .tape__row--others .tape__pill { background: var(--color-fill-on-navy); color: var(--color-on-navy-2); box-shadow: inset 0 0 0 1px var(--color-line-on-navy); }
  /* reading phase: the terms aren't known yet, so rows are honest blanks */
  .tape__row--blank .tape__term::before { content: ""; display: block; height: 10px; width: var(--w, 60%); border-radius: var(--radius-pill); background: var(--color-line-on-navy); }
  .tape__foot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); padding: var(--space-md) var(--space-2xs) 0; }
  .tape__foot-label { display: block; font-size: var(--text-xs); color: var(--color-on-navy-2); font-weight: 600; }
  .tape__foot-value { font: 800 var(--text-xl)/1.1 var(--font-display); letter-spacing: -0.03em; }
  .tape__foot-value--waste { color: var(--color-on-navy-accent); }
  &.no-motion .tape__window { height: auto; -webkit-mask-image: none; mask-image: none; }
  &.no-motion .tape__layer--raw, &.no-motion .tape__scan { display: none; }
  &.no-motion .tape__layer--sorted { position: static; clip-path: none; }

  .tape__window.is-settled .tape__layer--raw, .tape__window.is-settled .tape__scan { display: none; }
  .tape__window.is-settled .tape__layer--sorted { clip-path: none; }
  .checklist li.is-now { color: var(--color-navy); }
  .checklist li.is-now .checklist__mark { border-color: var(--color-blue); }
  @media (max-width: 479px) {
    .tape__row { grid-template-columns: minmax(0, 1fr) auto; }
    [data-sorted] .tape__pill { display: none; }
  }
  @media (min-width: 760px) {
    .tape__window { --row: 52px; height: calc(var(--row) * 7); }
    .tape__row { gap: var(--space-sm); padding: 0 var(--space-md); }
  }

  /* ---- shared since sc-88652: the report's town tile, split card, receipt slip, night close, route and tiers */
  .town-tile { display: none; margin: 0; border-radius: var(--radius-panel); overflow: hidden; aspect-ratio: 16 / 9; box-shadow: var(--shadow-lift); }
  .town-tile img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; }
  .split { position: relative; padding: var(--space-md) var(--space-md) var(--space-sm); border-radius: var(--radius-card); background: var(--color-surface); border: 1px solid var(--color-hair); box-shadow: var(--shadow-soft); }
  .split__title { font: 800 var(--text-base)/1.2 var(--font-display); letter-spacing: -0.01em; }
  .split__bar { display: flex; gap: 3px; background: var(--color-canvas); height: 20px; margin-top: var(--space-sm); border-radius: var(--radius-pill); overflow: hidden; }
  .split__seg { display: block; flex: 0 1 auto; min-width: 10px; }
  .split__legend { display: grid; margin-top: var(--space-xs); }
  .split__item { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: var(--space-sm); padding: 7px 0; border-top: 1px solid var(--color-hair); font-size: var(--text-sm); font-weight: 700; }
  .split__item:first-child { border-top: 0; }
  .split__swatch { width: 12px; height: 12px; border-radius: 4px; }
  .split__label small { display: none; font-size: var(--text-xs); font-weight: 500; color: var(--color-muted); }
  .split__amount { font-weight: 800; }
  @media (min-width: 760px) {
    .town-tile { display: block; }
    .split { margin: -4.5rem var(--space-lg) 0; padding: var(--space-lg) var(--space-lg) var(--space-md); box-shadow: var(--shadow-lift); }
    .split__title { font-size: var(--text-md); }
    .split__bar { height: 26px; }
    .split__label small { display: block; }
    .split__item { padding: 9px 0; }
  }
  .slip-wrap { filter: drop-shadow(0 18px 30px var(--color-blue-haze)); min-width: 0; }
  .slip {
    position: relative; padding: var(--space-xl) var(--space-lg); background: var(--color-surface);
    -webkit-mask: radial-gradient(circle 7px at 12px 0, transparent 97%, black) -12px 0 / 24px 51% repeat-x, radial-gradient(circle 7px at 12px 100%, transparent 97%, black) -12px 100% / 24px 51% repeat-x;
            mask: radial-gradient(circle 7px at 12px 0, transparent 97%, black) -12px 0 / 24px 51% repeat-x, radial-gradient(circle 7px at 12px 100%, transparent 97%, black) -12px 100% / 24px 51% repeat-x;
  }
  .slip__scan { position: absolute; z-index: 2; left: 0; right: 0; top: 0; height: 2px; opacity: 0; pointer-events: none; background: var(--color-blue); box-shadow: 0 0 16px 3px var(--color-blue-glow), 0 0 50px 10px var(--color-blue-haze); }
  .slip__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-xs) var(--space-md); padding-bottom: var(--space-md); border-bottom: 2px dashed var(--color-rule-strong); }
  .slip__brand { display: flex; align-items: center; gap: var(--space-xs); font: 800 var(--text-md)/1 var(--font-display); letter-spacing: -0.02em; }
  .slip__brand img { width: 28px; height: 28px; border-radius: 8px; }
  .slip__meta { font-size: var(--text-sm); font-weight: 600; color: var(--color-muted); }
  .rgroup { margin-top: var(--space-lg); }
  .rgroup__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-md); padding-bottom: var(--space-2xs); }
  .rgroup__head h3 { font: 800 var(--text-md)/1.25 var(--font-display); letter-spacing: -0.015em; }
  .rgroup__head span { font-size: var(--text-xs); font-weight: 700; color: var(--color-muted); white-space: nowrap; }
  .rgroup__sub { display: flex; justify-content: space-between; padding-top: var(--space-xs); font-size: var(--text-sm); font-weight: 700; color: var(--color-muted); }
  .rgroup__sub .u-figure { color: var(--color-navy); font-weight: 800; }
  .slip__total { margin-top: var(--space-lg); padding-top: var(--space-md); border-top: 2px dashed var(--color-rule-strong); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--space-2xs) var(--space-md); }
  .slip__total-label { font: 800 var(--text-md)/1.2 var(--font-display); }
  .slip__total-value { grid-row: span 2; font: 800 var(--text-2xl)/1 var(--font-display); letter-spacing: -0.04em; color: var(--color-blue-deep); }
  .slip__total-note { font-size: var(--text-sm); color: var(--color-muted); }
  .close { position: relative; overflow: hidden; background: var(--color-navy-deep); color: var(--color-on-navy); }
  .close__scene { position: absolute; inset: 0; }
  .close__scene img, .close__overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .close__scene img { filter: brightness(0.38) saturate(1.25) hue-rotate(-12deg); transform: scale(1.04); }
  .close__scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--color-navy-deep) 0%, var(--color-night-fade) 55%, var(--color-night-clear) 100%); }
  .route { fill: none; stroke-linecap: round; stroke-linejoin: round; }
  .route--night { stroke: var(--color-blue); stroke-width: 8; filter: drop-shadow(0 0 14px var(--color-blue-glow)); }
  .tiers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xs); width: min(100%, 40rem); margin-top: var(--space-xs); }
  .tiers__step { position: relative; display: grid; gap: 2px; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-card); background: var(--color-night-fade); box-shadow: inset 0 0 0 1px var(--color-line-on-navy); }
  .tiers__spend { font-size: var(--text-xs); font-weight: 700; color: var(--color-on-navy-2); }
  .tiers__step strong { font: 800 var(--text-xl)/1.1 var(--font-display); letter-spacing: -0.03em; }
  .tiers__step small { font-size: 0.5em; margin-left: 2px; color: var(--color-on-navy-2); letter-spacing: 0; }
  .tiers__step.is-yours { background: var(--color-blue); box-shadow: 0 0 0 4px var(--color-blue-haze); }
  .tiers__step.is-yours .tiers__spend, .tiers__step.is-yours small { color: var(--color-on-navy); }
  .tiers__you { position: absolute; top: var(--space-sm); right: var(--space-sm); padding: 1px 8px; border-radius: var(--radius-pill); background: var(--color-surface); color: var(--color-blue-deep); font-size: var(--text-xs); font-weight: 800; }
  @media (min-width: 760px) { .tiers { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
  /* the route is drawn per crop; each SVG only shows at its breakpoint */
  .close__overlay--square { display: none; }
  @media (max-width: 759px) {
    .close__overlay--wide { display: none; }
    .close__overlay--square { display: block; }
    .close__scene { inset: 0 0 auto 0; aspect-ratio: 1; overflow: hidden; }
    .close__scene::after { background: linear-gradient(180deg, var(--color-night-clear) 0%, var(--color-night-fade) 62%, var(--color-navy-deep) 100%); }
  }
}
@keyframes pack-report-live { 50% { opacity: 0.35; } }

html:has(.pack-report) { scroll-behavior: smooth; scroll-padding-top: var(--space-md); }

@media (prefers-reduced-motion: reduce) {
  html:has(.pack-report) { scroll-behavior: auto; }
  .pack-report *, .pack-report *::before, .pack-report *::after,
  .pack-audit *, .pack-audit *::before, .pack-audit *::after,
  .pack-onboard *, .pack-onboard *::before, .pack-onboard *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* The shared funnel header's back link is 38px; on these pages it meets the 44px target floor. */
.pack-report .pack-funnel__back,
.pack-audit .pack-funnel__back,
.pack-onboard .pack-funnel__back { width: 44px; height: 44px; }
.pack-audit .u-nowrap { white-space: nowrap; }
