/* The Organ v2 — white luxury. One accent: gold #a8874f. */
:root {
  --bg: #ffffff;
  --paper: #fbfaf8;
  --plate: #f6f3ee;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #8e8e93;
  --line: #e8e8ed;
  --line-2: #d2d2d7;
  --accent: #a8874f;
  --accent-ink: #ffffff;
  --accent-soft: #f5efe4;
  --warn: #9a5b12;
  --warn-soft: #fbf3e6;
  --ok: #3d6b45;
  --tier-top: #c9b58a;
  --tier-heart: #8e8e93;
  --tier-base: #48484a;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  --radius: 18px;
  --gutter: 16px;
  --nav-h: 76px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.47 var(--sans);
  letter-spacing: -0.01em; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, output { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; }
.skip:focus { top: 12px; }

/* ---------- masthead + progress ---------- */
.masthead { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,0.96); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); }
.masthead-row { max-width: 1120px; margin: 0 auto; padding: 12px var(--gutter) 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.brand-sub { color: var(--accent); font-weight: 500; }
.lab-link { color: var(--ink-2); font-size: 13px; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 4px; }
.lab-link:hover { color: var(--ink); }
.progress { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter) 10px; }
.progress ol { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.progress li { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress li .num { font-variant-numeric: tabular-nums; margin-right: 2px; }
.progress li.done { color: var(--ink-2); }
.progress li[aria-current="step"] { color: var(--ink); font-weight: 600; }
.progress-track { height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 25%; background: var(--accent); transition: width .45s cubic-bezier(.2,.7,.2,1); }

/* ---------- layout ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 8px var(--gutter) calc(var(--nav-h) + 40px); outline: none; }
/* No entrance animation on steps: a paused animation (background tab) would leave a step invisible. */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.step-head { padding: 28px 0 20px; max-width: 640px; }
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
h1:focus, h2:focus { outline: none; }
h1 { margin: 0; font-size: clamp(30px, 7vw, 48px); line-height: 1.06; letter-spacing: -0.035em; font-weight: 700; outline: none; }
h2 { margin: 0; font-size: 21px; letter-spacing: -0.02em; font-weight: 600; }
h3 { margin: 0; font-size: 17px; letter-spacing: -0.015em; font-weight: 600; }
.lede { margin: 10px 0 0; color: var(--ink-2); font-size: 17px; }
.fine { margin: 14px 0 0; font-size: 12px; color: var(--ink-3); }

/* ---------- buttons ---------- */
.primary, .secondary, .ghost { min-height: 44px; border-radius: 999px; padding: 0 22px; border: 1px solid transparent; font-weight: 500; font-size: 15px; transition: background .2s, color .2s, border-color .2s, opacity .2s; }
.primary { background: var(--ink); color: #fff; }
.primary:hover { background: #000; }
.primary.gold { background: var(--accent); }
.primary.gold:hover { background: #967644; }
.primary[aria-disabled="true"], .primary:disabled { opacity: 0.32; cursor: not-allowed; }
.secondary { background: transparent; color: var(--ink); border-color: var(--line-2); }
.secondary:hover { border-color: var(--ink-3); }
.ghost { background: var(--paper); color: var(--ink); border-color: var(--line); padding: 0 16px; font-size: 14px; }
.ghost:hover { border-color: var(--line-2); }

/* ---------- step 1 ---------- */
.types { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .types { grid-template-columns: repeat(4, 1fr); } }
.type { text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px; min-height: 44px; display: grid; gap: 6px; position: relative; transition: border-color .2s, box-shadow .2s; }
.type:hover { border-color: var(--line-2); }
.type[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 10px 30px -18px rgba(168,135,79,.6); }
.type-short { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.type-name { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.type-range { font-size: 28px; font-weight: 300; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.type-range small { font-size: 13px; color: var(--ink-2); font-weight: 400; letter-spacing: 0; margin-left: 4px; }
.type-blurb { font-size: 14px; color: var(--ink-2); }
.type-std { font-size: 11px; color: var(--ink-3); }
.type .tick { position: absolute; right: 14px; top: 14px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; }
.type[aria-checked="true"] .tick { background: var(--accent); border-color: var(--accent); }
.type[aria-checked="true"] .tick::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }

.oil { margin-top: 24px; padding: 20px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); }
.oil-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.oil-label { margin: 0; font-weight: 600; }
.oil-hint { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
.oil-hint.out { color: var(--warn); }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.step-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg); font-size: 20px; line-height: 1; display: grid; place-items: center; }
.step-btn:hover { border-color: var(--ink-3); }
.step-btn:disabled { opacity: .3; cursor: not-allowed; }
.stepper output { min-width: 58px; text-align: center; font-size: 24px; font-weight: 300; font-variant-numeric: tabular-nums; }
.oil-bar { position: relative; height: 10px; margin-top: 16px; border-radius: 6px; background: #eeeef1; overflow: hidden; }
.oil-range { position: absolute; top: 0; bottom: 0; z-index: 1; background: rgba(255,255,255,.28); border-left: 1.5px solid var(--ink); border-right: 1.5px solid var(--ink); }
.oil-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 6px; transition: width .3s; }
.oil-foot { margin: 10px 0 0; font-size: 12px; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.oil-legend-range { margin-left: 8px; color: var(--ink-3); }
.oil-legend-range::before { content: ""; display: inline-block; width: 10px; height: 8px; border-left: 1.5px solid var(--ink); border-right: 1.5px solid var(--ink); margin-right: 5px; vertical-align: -1px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot.gold { background: var(--accent); }
.dot.pale { background: #e3e3e8; margin-left: 8px; }

/* ---------- pyramid summary ---------- */
.pyramid-summary { display: flex; gap: 16px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin-bottom: 8px; }
.pyramid-summary svg { flex: none; width: 76px; height: 64px; }
.pyr-rows { display: grid; gap: 3px; min-width: 0; font-size: 13px; }
.pyr-row { display: flex; gap: 8px; min-width: 0; }
.pyr-row b { flex: none; width: 58px; font-weight: 600; }
.pyr-row span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pyr-row .count { flex: none; color: var(--ink-3); font-variant-numeric: tabular-nums; width: 30px; }

/* ---------- carousels ---------- */
.carousel { margin-top: 26px; }
.carousel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.carousel-title { display: grid; gap: 2px; min-width: 0; }
.carousel-sub { font-size: 13px; color: var(--ink-2); }
.carousel-sub.warn { color: var(--warn); }
.count-pill { display: inline-block; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 2px 9px; border-radius: 999px; background: var(--plate); color: var(--ink-2); margin-left: 6px; vertical-align: 2px; }
.count-pill.on { background: var(--accent-soft); color: var(--accent); }
.arrows { display: flex; gap: 8px; flex: none; }
.arrow { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg); display: grid; place-items: center; }
.arrow:disabled { opacity: .3; cursor: default; }
.arrow svg { width: 16px; height: 16px; }
.track {
  display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter); padding: 4px var(--gutter) 14px; margin: 0 calc(-1 * var(--gutter));
  scrollbar-width: none; scroll-behavior: smooth;
}
.track::-webkit-scrollbar { display: none; }
.track:focus-visible { outline-offset: -2px; }

.card {
  flex: 0 0 min(76%, 260px); scroll-snap-align: start; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 0; overflow: hidden;
  display: flex; flex-direction: column; position: relative; transition: border-color .2s, box-shadow .2s, transform .2s;
}
@media (min-width: 720px) { .card { flex-basis: 232px; } }
.card:hover { border-color: var(--line-2); }
.card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 14px 34px -22px rgba(168,135,79,.8); }
.card[aria-disabled="true"] { opacity: .45; }
.card .plate { background: linear-gradient(180deg, var(--plate), #fbf9f6); display: grid; place-items: center; padding: 10px 0 2px; }
.illo { width: 132px; height: 132px; display: block; }
@media (max-width: 480px) { .card .illo { width: 108px; height: 108px; } .card .style { min-height: 0; } }
.card .body { padding: 12px 14px 14px; display: grid; gap: 4px; }
.card .name { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.card .family { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.card .style { font-size: 13px; color: var(--ink-2); min-height: 38px; }
.meters { display: grid; gap: 5px; margin-top: 6px; }
.meter { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-2); }
.meter .bar { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.meter .bar span { display: block; height: 100%; background: var(--ink); }
.meter .v { font-variant-numeric: tabular-nums; color: var(--ink); min-width: 56px; text-align: right; }
.card .check { position: absolute; right: 12px; top: 12px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(255,255,255,.9); display: grid; place-items: center; }
.card[aria-pressed="true"] .check { background: var(--accent); border-color: var(--accent); }
.card[aria-pressed="true"] .check::after { content: ""; width: 10px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }

/* share cards (step 3) */
.share-card { flex: 0 0 min(80%, 280px); scroll-snap-align: start; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 14px; display: grid; gap: 10px; }
@media (min-width: 720px) { .share-card { flex-basis: 264px; } }
.share-card.over { border-color: #e2c9a0; background: var(--warn-soft); }
.share-top { display: flex; gap: 10px; align-items: center; }
.share-top .illo { width: 60px; height: 60px; flex: none; background: var(--plate); border-radius: 14px; }
.share-top .who { min-width: 0; }
.share-top .name { font-weight: 600; font-size: 16px; letter-spacing: -0.02em; }
.share-top .family { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.share-val { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.share-val output { font-size: 34px; font-weight: 300; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.share-val output small { font-size: 13px; color: var(--ink-2); letter-spacing: 0; margin-left: 2px; }
.share-range { width: 100%; height: 44px; accent-color: var(--accent); margin: 0; }
.share-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.share-meta .over-note { color: var(--warn); }

/* ---------- live formula ---------- */
.formula { margin-top: 30px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.formula-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.formula-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.total { margin-top: 14px; }
.total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 14px; }
.total-row strong { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.total-row.off strong { color: var(--warn); }
.total-bar { display: flex; height: 8px; border-radius: 5px; overflow: hidden; background: #ececf0; margin-top: 8px; }
.total-bar span { display: block; height: 100%; }
.table-wrap { margin-top: 14px; overflow-x: auto; }
.formula-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.formula-table th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--line-2); }
.formula-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.formula-table .num { text-align: right; white-space: nowrap; }
.formula-table tr.tier-row td { font-weight: 600; padding-top: 12px; border-bottom-color: var(--line-2); }
.formula-table tr.foot td { font-weight: 600; border-bottom: 0; }
.formula-table .flag { color: var(--warn); font-size: 12px; font-weight: 500; }

/* compliance status */
.status { margin-top: 14px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); }
.status h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.status p { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.status ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.status li { margin: 2px 0; }
.status.review { border-color: #e7d2ad; background: var(--warn-soft); }
.status.review h3 { color: var(--warn); }
.status.ok h3 { color: var(--ok); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.badge.review { background: var(--warn-soft); color: var(--warn); border: 1px solid #e7d2ad; }
.badge.ok { background: #eef4ef; color: var(--ok); border: 1px solid #cfe0d2; }

/* ---------- result ---------- */
.result-grid { display: flex; flex-direction: column; gap: 16px; }
.result-grid > .stack { display: contents; }
.o-1 { order: 1; } .o-2 { order: 2; } .o-3 { order: 3; } .o-4 { order: 4; } .o-5 { order: 5; }
.o-4 .status { margin-top: 0; }
@media (min-width: 900px) {
  .result-grid { display: grid; grid-template-columns: 5fr 6fr; align-items: start; }
  .result-grid > .stack { display: grid; }
}
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--bg); min-width: 0; }
.panel + .panel { margin-top: 0; }
.stack { display: grid; gap: 16px; min-width: 0; }
.formula-card { background: linear-gradient(180deg, #fff, var(--paper)); }
.fc-top { display: flex; gap: 14px; align-items: center; }
.swatch-bottle { width: 44px; height: 58px; flex: none; }
.fc-type { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.fc-name { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; }
.fc-oil { font-size: 13px; color: var(--ink-2); }
.fc-tier { margin-top: 16px; }
.fc-tier h3 { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); display: flex; justify-content: space-between; }
.fc-tier ul { list-style: none; margin: 6px 0 0; padding: 0; }
.fc-tier li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 15px; font-variant-numeric: tabular-nums; }
.fc-tier li span:last-child { color: var(--ink-2); white-space: nowrap; }
.fc-foot { margin-top: 14px; font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.score { border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.score .k { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.score .v { font-size: 38px; font-weight: 300; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.score .v small { font-size: 14px; color: var(--ink-3); letter-spacing: 0; }
.score .s { font-size: 12px; color: var(--ink-2); }
.verdict { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.verdict.unique { color: var(--accent); }
.verdict-sub { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; }
.neighbours { list-style: none; margin: 12px 0 0; padding: 0; counter-reset: n; }
.neighbours li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: baseline; }
.neighbours li::before { counter-increment: n; content: counter(n); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.neighbours .nb-name { min-width: 0; overflow-wrap: anywhere; }
.neighbours .nb-brand { color: var(--ink-2); }
.neighbours .nb-sim { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.fade { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.fade strong { font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.fade .modelled { font-size: 12px; color: var(--ink-3); }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--line); stroke-width: 0.6; }
.chart-svg .tick { fill: var(--ink-3); font: 9px var(--sans); }
.chart-svg .threshold { stroke: var(--ink-3); stroke-dasharray: 3 3; stroke-width: 0.8; }
.chart-svg .fade-line { stroke: var(--accent); stroke-width: 0.9; stroke-dasharray: 2 3; }
.chart-svg .fade-dot { fill: var(--accent); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0; margin: 8px 0 0; font-size: 12px; color: var(--ink-2); }
.legend .swatch { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.tweaks { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.tweak { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; }
.tweak p { margin: 0; font-size: 14px; }
.tweak .gain { font-size: 12px; color: var(--ink-2); }
.note { margin: 10px 0 0; font-size: 13px; color: var(--ink-2); }
.disclaimer { margin: 26px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.disclaimer strong { color: var(--ink); font-weight: 600; }
.loading { color: var(--ink-2); padding: 30px 0; }
.restart-row { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- navbar ---------- */
.navbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(255,255,255,0.9); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.navbar-inner { max-width: 1120px; margin: 0 auto; padding: 12px var(--gutter); display: flex; align-items: center; gap: 10px; }
.nav-status { flex: 1; margin: 0; font-size: 12px; line-height: 1.3; color: var(--ink-2); text-align: center; min-width: 0; }
.navbar .primary { min-width: 108px; }

@media (max-width: 360px) {
  :root { --gutter: 14px; }
  .primary, .secondary { padding: 0 16px; }
  .navbar .primary { min-width: 92px; }
  .scores { grid-template-columns: 1fr; }
  .pyr-row b { width: 48px; }
  .progress ol { grid-template-columns: 0.9fr 1fr 1.45fr 1fr; gap: 2px; }
  .progress li { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.carousel, .formula, .panel, .status { scroll-margin-top: 112px; }

@media (min-width: 1000px) {
  .p3-grid { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 32px; align-items: start; }
  .p3-grid .formula { margin-top: 26px; position: sticky; top: 112px; max-height: calc(100vh - 112px - var(--nav-h) - 16px); overflow-y: auto; }
  #shares .track { margin-right: 0; padding-right: 0; }
}
.arrows[hidden] { display: none !important; }

/* ---------- header links ---------- */
.brand-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 0.3em; min-height: 44px; }
.top-links { display: flex; gap: 6px; }
.top-links a[aria-current="page"] { color: var(--ink); font-weight: 600; }
body.no-nav main { padding-bottom: 48px; }
.btn-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.primary.danger { background: #8a2f22; }
.primary.danger:hover { background: #74261b; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.field small { font-weight: 400; color: var(--ink-3); }
.field input, .field select { min-height: 44px; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 14px; font-size: 16px; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field input[aria-invalid="true"] { border-color: var(--warn); }
.name-form { display: grid; gap: 14px; margin-top: 14px; }
.name-form .primary { justify-self: start; }
.field-msg { margin: 0; min-height: 1em; font-size: 13px; color: var(--warn); }
.card-actions + .field-msg, [data-role="msg"] { color: var(--ink-2); margin-top: 8px; }
.review-list { margin: 10px 0 0; padding-left: 18px; font-size: 14px; }
.review-list li { margin: 3px 0; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; border: 1px solid #e7d2ad; background: var(--warn-soft); border-radius: 14px; }
.confirm p { margin: 0 0 4px; flex-basis: 100%; font-size: 14px; }

/* ---------- directory (card styles live in card.css) ---------- */
.dir-tools { display: grid; grid-template-columns: 1fr; gap: 12px; max-width: 640px; }
@media (min-width: 560px) { .dir-tools { grid-template-columns: 2fr 1fr; } }
.dir-foot { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dir-more { margin: 20px 0 0; display: flex; justify-content: center; }
.dir-grid[aria-busy="true"] { opacity: .6; transition: opacity .2s; }
@media (prefers-reduced-motion: reduce) { .dir-grid[aria-busy="true"] { transition: none; } }
.crumbs { margin: 16px 0 0; }
.crumbs a { color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.crumbs a:hover { color: var(--ink); }

.count-field { position: relative; }
.count-field input { padding-right: 64px; }
.counter { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; pointer-events: none; }
.counter.over { color: var(--warn); font-weight: 600; }

.brand, .top-links a { white-space: nowrap; }
.field select { -webkit-appearance: none; appearance: none; height: 44px; padding-right: 36px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236e6e73' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center / 12px 8px; }
@media (max-width: 360px) { .brand-sub { display: none; } .top-links { gap: 0; } }

/* ---------- IFRA pre-check (Result step; the compliance gate) ---------- */
:root { --fail: #a1261b; --fail-soft: #fbeceb; }
.badge.fail { background: var(--fail-soft); color: var(--fail); border: 1px solid #efc6c1; }
.ifra { border-left: 4px solid var(--line-2); }
.ifra.ifra-ok { border-left-color: var(--ok); }
.ifra.ifra-fail { border-left-color: var(--fail); }
.ifra.ifra-review { border-left-color: var(--warn); }
.ifra-status { font-size: 16px; line-height: 1.35; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; }
.ifra-k { font-weight: 600; }
.ifra-status .badge { font-size: 12px; }
.ifra-sum { margin: 8px 0 0; font-size: 14px; color: var(--ink); }
.ifra-lines { margin-top: 10px; }
.ifra-lines > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink); list-style: none; }
.ifra-lines > summary::-webkit-details-marker { display: none; }
.ifra-lines > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .15s; flex: none; margin-left: 2px; }
.ifra-lines[open] > summary::before { transform: rotate(45deg); }
.ifra-lines > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.ifra-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; min-width: 0; }
.ifra-table caption { caption-side: bottom; text-align: left; padding-top: 8px; }
.ifra-table th, .ifra-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ifra-table thead th { font-weight: 500; color: var(--ink-2); font-size: 12px; border-bottom-color: var(--line-2); }
.ifra-table .num { text-align: right; white-space: nowrap; }
.ifra-table tbody th { font-weight: 500; }
.il-name { display: block; }
.il-from { display: block; font-size: 12px; color: var(--ink-2); font-weight: 400; overflow-wrap: anywhere; }
.il-st { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.il-st.pass { color: var(--ok); }
.il-st.fail { color: var(--fail); }
.il-st.review { color: var(--warn); }
.il-st.note { color: var(--ink-2); }
.ifra-table tr.st-fail th .il-name { color: var(--fail); font-weight: 600; }
.ifra-disc { margin: 10px 0 0; }
.status.guide h3 { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.il-st-inline { display: none; }
@media (max-width: 480px) {
  .ifra-table thead th:nth-child(4), .ifra-table td:nth-child(4),
  .ifra-table thead th:nth-child(5), .ifra-table td:nth-child(5) { display: none; }
  .il-st-inline { display: inline-block; margin-top: 2px; }
  .ifra-table { font-size: 12px; table-layout: fixed; }
  .ifra-table thead th:nth-child(1) { width: 50%; }
  .ifra-table thead th:nth-child(2), .ifra-table thead th:nth-child(3) { width: 25%; white-space: normal; }
  .ifra-table th, .ifra-table td { padding: 7px 3px; overflow-wrap: anywhere; }
}

/* ---------- Step 4: verdict first, blockers next, the rest folded ---------- */
#step-4 .step-head.compact { padding: 14px 0 8px; }
#step-4 .step-head.compact h1 { font-size: clamp(22px, 4.5vw, 30px); }
.verdict-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, #fff, var(--paper)); }
.vh-main { min-width: 0; }
.vh-type { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.vh-name { margin: 2px 0 0; font-size: clamp(22px, 5vw, 30px); letter-spacing: -0.025em; line-height: 1.15; overflow-wrap: anywhere; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.pill { display: inline-flex; align-items: baseline; gap: 6px; min-height: 36px; padding: 7px 14px; border-radius: 999px; font-size: 16px; font-weight: 600; border: 1px solid var(--line-2); background: #fff; }
.pill small { font-weight: 500; font-size: 13px; opacity: .8; font-variant-numeric: tabular-nums; }
.pill-k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; opacity: .75; }
.pill.ok { background: #eef4ef; color: var(--ok); border-color: #cfe0d2; }
.pill.fail { background: var(--fail-soft); color: var(--fail); border-color: #efc6c1; }
.pill.review, .pill.no { background: var(--warn-soft); color: var(--warn); border-color: #e7d2ad; }
.vh-act { flex: none; }
@media (max-width: 899px) { .vh-act { display: none; } }

.r-grid { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.r-grid .panel { padding: 16px 18px; }
@media (min-width: 900px) {
  .r-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .r-formula { grid-column: 1; grid-row: 1; }
  .r-next { grid-column: 2; grid-row: 1; }
}
.r-next:focus { outline: none; }
.r-h { margin: 0; font-size: 17px; letter-spacing: -0.015em; display: flex; align-items: center; gap: 8px; }
.r-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.r-table th, .r-table td { padding: 4px 2px; text-align: left; font-weight: 400; border-bottom: 1px solid var(--line); }
.r-table thead th { font-size: 11px; color: var(--ink-3); font-weight: 500; }
.r-table .num { text-align: right; white-space: nowrap; }
.r-table tr.tier-row th, .r-table tr.tier-row td { font-weight: 600; font-size: 12px; padding-top: 8px; border-bottom-color: var(--line-2); }
.r-dd { margin-top: 10px; }
.r-spark { display: block; width: 100%; height: 34px; }
.r-dd p { margin: 4px 0 0; display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); }
.r-dd .modelled { color: var(--ink-3); }

.np-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fix-list { list-style: none; margin: 10px 0 0; padding: 0; }
.fix { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fix-text { min-width: 0; }
.fix-name { margin: 0; font-size: 14px; font-weight: 600; }
.fix-amt { margin: 1px 0 0; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.fix-btn { flex: none; white-space: nowrap; }
.fix-log { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; margin-bottom: 12px; border-radius: 12px; background: #eef4ef; border: 1px solid #cfe0d2; }
.fix-log p { margin: 0; font-size: 12px; color: var(--ink); }

.r-more { margin-top: 14px; border-top: 1px solid var(--line); }
.acc { border-bottom: 1px solid var(--line); }
.acc > summary { list-style: none; cursor: pointer; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 15px; padding: 0 2px; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after { content: ""; width: 8px; height: 8px; border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2); transform: rotate(45deg); margin: 0 6px 4px 0; flex: none; transition: transform .2s; }
.acc[open] > summary::after { transform: rotate(-135deg); margin-bottom: -4px; }
.acc-meta { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--ink-2); text-align: right; }
.acc-body { padding: 4px 2px 18px; }
.ifra-foot { margin-top: 14px; font-size: 12px; color: var(--ink-2); }
.ifra-foot p { margin: 6px 0 0; }
.ifra-foot ul { margin: 4px 0 0; padding-left: 18px; }
.linkish { background: none; border: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 0 6px; font-size: 13px; }
#step-4 .disclaimer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; margin-top: 14px; padding-top: 10px; }

/* Step 3: live IFRA maximum on each slider */
.range-wrap { position: relative; }
.ifra-mark { position: absolute; top: 8px; bottom: 8px; width: 2px; margin-left: -1px; background: var(--fail); border-radius: 1px; pointer-events: none;
  left: calc(10px + (100% - 20px) * var(--p, 1)); }
.ifra-mark::after { content: "IFRA"; position: absolute; top: -6px; left: 4px; font-size: 9px; font-weight: 700; letter-spacing: .06em; color: var(--fail); }
.ifra-max { margin: -4px 0 0; font-size: 12px; color: var(--ink-3); }
.ifra-max.over { color: var(--fail); font-weight: 600; }
.share-card.ifra-over { border-color: #efc6c1; background: var(--fail-soft); }
.r-h:focus, .r-h:focus-visible { outline: none; }
@media (max-width: 360px) { .pill { font-size: 14px; padding: 6px 10px; gap: 4px; } .verdict-head { padding: 14px; } }

/* ---------- Why it's not unique yet: closest perfumes and note overlap ---------- */
.why { margin: 10px 0 14px; }
.why-h { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--ink-2); }
.nb-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.nb-card { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: #fff; }
.nb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.nb-title { margin: 0; font-size: 14px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.nb-pct { margin: 0; flex: none; font-size: 13px; font-weight: 600; color: var(--warn); font-variant-numeric: tabular-nums; }
.nb-meta { margin: 1px 0 0; font-size: 12px; color: var(--ink-2); }
.ov { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.ov-bar { flex: 1; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.ov-bar span { display: block; height: 100%; background: var(--accent); }
.ov-label { flex: none; font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.why-line { margin: 6px 0 0; font-size: 13px; color: var(--ink); }
.chip-row { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; }
.chip-k { flex: none; width: 70px; font-size: 11px; color: var(--ink-3); padding-top: 3px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; line-height: 18px; border: 1px solid transparent; }
.chip .illo { width: 18px; height: 18px; margin-left: -4px; }
.chip.shared { background: var(--accent-soft); border-color: rgba(168,135,79,.55); color: #6f5428; font-weight: 600; }
.chip.mine { background: #fff; border-color: var(--line-2); color: var(--ink); }
.chip.theirs { background: #f3f3f5; color: var(--ink-3); }
.chip.more { color: var(--ink-3); }
@media (max-width: 360px) { .chip-k { width: 56px; } }
.pill.profile { background: #fff; color: var(--ink); border-color: var(--line-2); }
.pill.profile.b-signature { background: var(--accent-soft); color: #6f5428; border-color: rgba(168,135,79,.55); }
.pill.profile.b-classic { background: #f3f3f5; color: var(--ink-2); }
.why-h small { font-weight: 400; color: var(--ink-3); }
.profile-acc { margin-top: 12px; border-top: 1px solid var(--line); }

/* ---------- Step 1 bottles ---------- */
.type { grid-template-columns: minmax(0, 1fr) 76px; column-gap: 12px; }
.type > span:not(.type-bottle):not(.tick) { grid-column: 1; }
.type-bottle { grid-column: 2; grid-row: 1 / span 6; align-self: center; display: grid; justify-items: center; gap: 4px; }
.type .tick { right: auto; left: auto; position: absolute; top: 14px; right: 14px; }
.bt-fig { display: block; width: 64px; height: 96px; }
.bottle { display: block; width: 100%; height: 100%; }
.bt-label { font-size: 10px; line-height: 1.25; color: var(--ink-2); text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bottle .bt-oil { transform-box: fill-box; transform-origin: 50% 100%; }
.bottle.rise .bt-oil { animation: bt-rise .38s cubic-bezier(.2,.7,.2,1) both; }
@keyframes bt-rise { from { transform: scaleY(.04); } to { transform: none; } }
@media (min-width: 720px) {
  .type { grid-template-columns: minmax(0, 1fr); }
  .type-bottle { grid-column: 1; grid-row: auto; justify-self: start; grid-auto-flow: column; align-items: end; gap: 10px; margin-top: 4px; }
}
.bt-label { white-space: normal; }
.bt-label span { display: block; white-space: nowrap; }
@media (min-width: 720px) { .bt-label span { display: inline; } }

/* ---------- Accounts: sign-in sheet, likes, creator page ---------- */
.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 440px; border-radius: 20px 20px 0 0; background: #fff; color: var(--ink); box-shadow: 0 -20px 60px -20px rgba(0,0,0,.35); }
@media (min-width: 600px) { .sheet { margin: auto; border-radius: 20px; } }
.sheet::backdrop { background: rgba(29,29,31,.35); }
.sheet[open] { animation: sheet-in .28s cubic-bezier(.2,.7,.2,1); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-x { display: flex; justify-content: flex-end; padding: 10px 10px 0; }
#si-body { padding: 4px 22px 22px; }
#si-body h2 { font-size: 22px; letter-spacing: -0.02em; margin: 0; }
.si-form { display: grid; gap: 12px; margin-top: 14px; }
.si-form .primary { justify-self: start; }
.si-alt { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
#si-otp { letter-spacing: .3em; font-variant-numeric: tabular-nums; font-size: 20px; }
.tile { display: grid; gap: 6px; }
.like-btn { justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.like-btn .heart { font-size: 15px; color: var(--ink-3); }
.like-btn[aria-pressed="true"] { border-color: rgba(168,135,79,.6); background: var(--accent-soft); color: #6f5428; }
.like-btn[aria-pressed="true"] .heart { color: var(--accent); }
.like-row { text-align: center; margin: 12px 0 0; }
.me-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.me-name { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; flex: 1 1 260px; }
.me-name .field { flex: 1 1 180px; }
.me-name .field-msg { flex-basis: 100%; margin: 0; }
.me-email { margin: 0; color: var(--ink-2); font-size: 14px; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.me-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.me-grid { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; }
.me-tile { display: grid; gap: 8px; }
.me-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 0; }
.me-stats div { text-align: center; padding: 6px 2px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-width: 0; }
.me-stats dt { font-size: 9.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.me-stats dd { margin: 2px 0 0; font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }
.me-trend { margin: 0; display: grid; gap: 2px; font-size: 11px; color: var(--ink-3); }
.me-spark { width: 100%; height: 28px; display: block; }
