/* ============================================================
   CafeDaily — "Brew Lab" design system
   A precision-instrument visual language for specialty coffee.
   ============================================================ */

/* ---- Self-hosted type ------------------------------------- */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/fraunces-400.ttf') format('truetype');
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/fraunces-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/fraunces-600.ttf') format('truetype');
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('/fonts/fraunces-900.ttf') format('truetype');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/spacemono-400.ttf') format('truetype');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/spacemono-700.ttf') format('truetype');
}

/* ---- Tokens ----------------------------------------------- */
:root {
  /* Extraction palette */
  --espresso: #1a120b;
  --paper: #f1ebdf;
  --crema: #d2914a; /* honey-amber readout glow */
  --crema-deep: #b8752f;
  --sage: #6f7d53; /* fresh / under */
  --garnet: #9e3b2a; /* stale / over / danger */

  /* Light theme (default) */
  --bg: #f1ebdf;
  --bg-grain: #ece4d4;
  --surface: #faf6ee;
  --surface-2: #f4eee1;
  --ink: #1a120b;
  --ink-2: #4b3f33;
  --ink-dim: #8a7d6c;
  --line: #ddd1bd;
  --line-strong: #c9bba2;
  --accent: var(--crema-deep);
  --accent-ink: #fdf8ef;
  --ring-track: #e3d9c6;

  /* Type */
  --display: 'Fraunces', 'Songti SC', Georgia, serif;
  --data: 'Space Mono', ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
  --body: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans SC',
    'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;

  /* Rhythm */
  --step--1: clamp(0.78rem, 0.75rem + 0.15vw, 0.86rem);
  --step-0: clamp(0.95rem, 0.92rem + 0.2vw, 1.02rem);
  --step-1: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
  --step-2: clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --step-3: clamp(2rem, 1.6rem + 2vw, 3.1rem);
  --step-4: clamp(2.8rem, 2rem + 4vw, 5.2rem);
  --step-5: clamp(3.6rem, 2.2rem + 6vw, 7rem);

  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(26, 18, 11, 0.06),
    0 8px 30px -12px rgba(26, 18, 11, 0.18);
  --shadow-lift: 0 2px 6px rgba(26, 18, 11, 0.08),
    0 24px 60px -24px rgba(26, 18, 11, 0.32);
  --maxw: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.dark {
  --bg: #140d08;
  --bg-grain: #1a120b;
  --surface: #241913;
  --surface-2: #2c1f16;
  --ink: #f3ecdd;
  --ink-2: #cdbfa9;
  --ink-dim: #94836d;
  --line: #3a2b1f;
  --line-strong: #4d3a29;
  --accent: var(--crema);
  --accent-ink: #1a120b;
  --ring-track: #33251a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 34px -14px rgba(0, 0, 0, 0.7);
  --shadow-lift: 0 2px 8px rgba(0, 0, 0, 0.5),
    0 30px 70px -28px rgba(0, 0, 0, 0.85);
}

/* ---- Reset / base ----------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
body {
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(
      1px 1px at 20% 30%,
      rgba(26, 18, 11, 0.03) 1px,
      transparent 0
    ),
    radial-gradient(1px 1px at 70% 60%, rgba(26, 18, 11, 0.025) 1px, transparent 0);
  background-size: 140px 140px, 200px 200px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
  overflow-x: hidden;
}
img,
svg {
  display: block;
  max-width: 100%;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Type primitives -------------------------------------- */
.display {
  font-family: var(--display);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.02em;
  font-variation-settings: 'SOFT' 30, 'WONK' 1, 'opsz' 120;
}
.data {
  font-family: var(--data);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.eyebrow {
  font-family: var(--data);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--ink-dim);
  font-weight: 700;
}
.eyebrow .tick {
  color: var(--accent);
}

/* ---- Layout ----------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4vw, 2.5rem);
}
section {
  position: relative;
  padding-block: clamp(3.5rem, 8vw, 7rem);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
  margin-bottom: 2.5rem;
}
.section-head h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: var(--step-2);
  letter-spacing: -0.02em;
}
.section-index {
  font-family: var(--data);
  font-size: var(--step--1);
  color: var(--accent);
  font-weight: 700;
}

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
}
.brand svg {
  color: var(--accent);
}
.topbar nav {
  display: flex;
  gap: 1.6rem;
  align-items: center;
}
.topbar nav a {
  font-family: var(--data);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  transition: color 0.2s;
}
.topbar nav a:hover {
  color: var(--ink);
}
.nav-links {
  display: none;
}
@media (min-width: 820px) {
  .nav-links {
    display: flex;
  }
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font-family: var(--data);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--ink);
}

/* ============================================================
   Hero — the thesis
   ============================================================ */
.hero {
  padding-top: clamp(2.5rem, 6vw, 4.5rem);
  padding-bottom: clamp(2.5rem, 6vw, 4rem);
}
.hero-grid {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
}
@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: 1.05fr 0.95fr;
  }
}
.hero-kicker {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.6rem;
}
.hero-kicker .rule {
  height: 1px;
  width: 46px;
  background: var(--line-strong);
}
.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--step-5);
  line-height: 0.92;
  letter-spacing: -0.03em;
  font-variation-settings: 'SOFT' 40, 'WONK' 1, 'opsz' 144;
}
.hero h1 em {
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
  font-variation-settings: 'SOFT' 60, 'WONK' 1;
}
.hero p.lede {
  margin-top: 1.5rem;
  max-width: 44ch;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-2);
}
.hero-meta {
  margin-top: 2.2rem;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.hero-meta .cell .n {
  font-family: var(--data);
  font-weight: 700;
  font-size: var(--step-1);
  color: var(--ink);
}
.hero-meta .cell .k {
  font-family: var(--data);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-dim);
}

/* ---- The Pour Dial (signature) ---------------------------- */
.dial-stage {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: min(100%, 460px);
  margin-inline: auto;
}
.dial-stage::before {
  content: '';
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 42%,
    color-mix(in oklab, var(--crema) 26%, transparent),
    transparent 62%
  );
  filter: blur(24px);
  opacity: 0.75;
}
.dial-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.dial-track {
  fill: none;
  stroke: var(--ring-track);
  stroke-width: 5;
}
.dial-sweep {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px color-mix(in oklab, var(--crema) 55%, transparent));
}
.dial-seg {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
  opacity: 0.9;
}
.dial-tick {
  stroke: var(--line-strong);
  stroke-width: 2;
}
.dial-center {
  text-align: center;
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.15rem;
}
.dial-phase {
  font-family: var(--data);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}
.dial-time {
  font-family: var(--data);
  font-weight: 700;
  font-size: clamp(2.6rem, 9vw, 3.6rem);
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.dial-target {
  font-family: var(--data);
  font-size: 0.8rem;
  color: var(--ink-dim);
}
.dial-target b {
  color: var(--ink-2);
  font-weight: 700;
}
.dial-controls {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  margin-top: 1.4rem;
}

/* ---- Buttons ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.7rem 1.3rem;
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  transition: transform 0.15s var(--ease), background-color 0.2s,
    border-color 0.2s, color 0.2s;
}
.btn:active {
  transform: scale(0.96);
}
.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 18px -8px color-mix(in oklab, var(--accent) 70%, transparent);
}
.btn-accent:hover {
  background: color-mix(in oklab, var(--accent) 88%, #000);
}
.btn-ghost {
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-icon {
  width: 52px;
  height: 52px;
  padding: 0;
  justify-content: center;
}

/* ============================================================
   Palette
   ============================================================ */
.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
}
.swatch {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.swatch .chip {
  height: 92px;
  display: flex;
  align-items: flex-end;
  padding: 0.6rem;
}
.swatch .chip .role {
  font-family: var(--data);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(4px);
}
.swatch .meta {
  padding: 0.6rem 0.7rem 0.75rem;
}
.swatch .meta .name {
  font-weight: 600;
  font-size: 0.9rem;
}
.swatch .meta .hex {
  font-family: var(--data);
  font-size: 0.74rem;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* ---- Type specimen ---------------------------------------- */
.specimen {
  display: grid;
  gap: 1.2rem;
}
@media (min-width: 760px) {
  .specimen {
    grid-template-columns: repeat(3, 1fr);
  }
}
.spec-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  background: var(--surface);
}
.spec-card .label {
  font-family: var(--data);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 0.9rem;
}
.spec-card .big {
  font-size: 3.4rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}
.spec-card .big.serif {
  font-family: var(--display);
  font-weight: 500;
  font-variation-settings: 'SOFT' 40, 'WONK' 1;
}
.spec-card .big.mono {
  font-family: var(--data);
  font-weight: 700;
}
.spec-card .note {
  font-size: 0.86rem;
  color: var(--ink-2);
}
.spec-card .row {
  font-size: 0.8rem;
  color: var(--ink-dim);
  border-top: 1px dashed var(--line);
  margin-top: 0.9rem;
  padding-top: 0.7rem;
}

/* ============================================================
   Phone frames + screens
   ============================================================ */
.screens {
  display: grid;
  gap: clamp(2rem, 5vw, 3rem) clamp(1.5rem, 3vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: start;
}
.screen-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.screen-cap {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.screen-cap .num {
  font-family: var(--data);
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
}
.screen-cap .ttl {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.12rem;
}
.screen-cap .sub {
  font-size: 0.8rem;
  color: var(--ink-dim);
  margin-left: auto;
}
.phone {
  --pad: 12px;
  position: relative;
  margin-inline: auto;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 320 / 660;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 38px;
  box-shadow: var(--shadow-lift);
  padding: var(--pad);
  overflow: hidden;
}
.phone::before {
  /* notch */
  content: '';
  position: absolute;
  top: calc(var(--pad) + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 92px;
  height: 22px;
  background: var(--ink);
  border-radius: 999px;
  z-index: 5;
  opacity: 0.9;
}
.screen {
  position: relative;
  height: 100%;
  border-radius: 27px;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--ink);
}
.screen-scroll {
  flex: 1;
  overflow: hidden;
  padding: 46px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.s-eyebrow {
  font-family: var(--data);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.s-h {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.s-sub {
  font-size: 0.74rem;
  color: var(--ink-dim);
  line-height: 1.4;
}

/* bottom tab bar inside phone */
.tabbar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0.5rem 0.4rem calc(0.5rem + 6px);
  border-top: 1px solid var(--line);
  background: color-mix(in oklab, var(--surface) 70%, var(--bg));
}
.tabbar .tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: var(--data);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.tabbar .tab svg {
  width: 20px;
  height: 20px;
}
.tabbar .tab.on {
  color: var(--accent);
}
.tabbar .tab.on::after {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* cards inside screens */
.mini-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem 0.8rem;
}
.mini-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.badge {
  font-family: var(--data);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.42rem;
  border-radius: 6px;
  font-weight: 700;
}
.badge.fresh {
  color: var(--sage);
  background: color-mix(in oklab, var(--sage) 16%, transparent);
}
.badge.peak {
  color: var(--accent);
  background: color-mix(in oklab, var(--crema) 18%, transparent);
}
.badge.stale {
  color: var(--garnet);
  background: color-mix(in oklab, var(--garnet) 14%, transparent);
}
.data-sm {
  font-family: var(--data);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
.k-label {
  font-family: var(--data);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* freshness meter */
.meter {
  height: 5px;
  border-radius: 999px;
  background: var(--ring-track);
  overflow: hidden;
  margin-top: 0.4rem;
}
.meter > i {
  display: block;
  height: 100%;
  border-radius: 999px;
}

/* mini pour dial for the timer screen */
.mini-dial {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 0.4rem auto 0.2rem;
}
.mini-dial .c {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.mini-dial .c .t {
  font-family: var(--data);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
}
.mini-dial .c .p {
  font-family: var(--data);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

/* stage list */
.stage {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--line);
}
.stage:last-child {
  border-bottom: none;
}
.stage .no {
  font-family: var(--data);
  font-size: 0.62rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  display: grid;
  place-content: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--ink-dim);
}
.stage.done .no {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.stage.now .no {
  border-color: var(--accent);
  color: var(--accent);
}
.stage .nm {
  font-size: 0.76rem;
  flex: 1;
}
.stage .vv {
  font-family: var(--data);
  font-size: 0.7rem;
  color: var(--ink-dim);
}

/* flavor radar wrap */
.radar {
  display: grid;
  place-items: center;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.chip-tag {
  font-size: 0.66rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
}
.chip-tag.on {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* stat tiles */
.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
}
.tile .n {
  font-family: var(--data);
  font-weight: 700;
  font-size: 1.25rem;
}
.tile .n small {
  font-size: 0.7rem;
  color: var(--ink-dim);
}

/* login screen */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.field label {
  font-size: 0.66rem;
  color: var(--ink-2);
  font-weight: 600;
}
.field .box {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-size: 0.74rem;
  color: var(--ink-dim);
  background: var(--surface);
}
.full-btn {
  width: 100%;
  justify-content: center;
  margin-top: 0.2rem;
}

/* bars chart */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 60px;
}
.bars > i {
  flex: 1;
  background: color-mix(in oklab, var(--accent) 55%, var(--ring-track));
  border-radius: 3px 3px 0 0;
}
.bars > i.hi {
  background: var(--accent);
}

/* ============================================================
   Principles / closing
   ============================================================ */
.principles {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (min-width: 720px) {
  .principles {
    grid-template-columns: repeat(2, 1fr);
  }
}
.principle {
  background: var(--surface);
  padding: 1.6rem;
}
.principle .no {
  font-family: var(--data);
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
}
.principle h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0.5rem 0 0.4rem;
}
.principle p {
  font-size: 0.88rem;
  color: var(--ink-2);
  line-height: 1.55;
}

footer {
  border-top: 1px solid var(--line);
  padding-block: 2.5rem 3.5rem;
  color: var(--ink-dim);
}
footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
footer .data {
  font-size: 0.74rem;
}

.note-banner {
  background: color-mix(in oklab, var(--crema) 12%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--crema) 30%, var(--line));
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  font-size: 0.86rem;
  color: var(--ink-2);
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}
.note-banner b {
  color: var(--ink);
}

/* reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ============================================================
   SHARED KIT — cross-page nav + doc/diagram/timeline primitives
   (added for TRD / architecture / roadmap pages)
   ============================================================ */

/* --- cross-page pill nav (sits under topbar on doc pages) --- */
.subnav {
  position: sticky;
  top: 60px;
  z-index: 40;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.subnav .wrap {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  height: 52px;
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav .wrap::-webkit-scrollbar {
  display: none;
}
.subnav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  font-family: var(--data);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 0.34rem 0.75rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.subnav a:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.subnav a.active {
  color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 45%, var(--line));
  background: color-mix(in oklab, var(--crema) 10%, transparent);
}
.subnav a .n {
  font-weight: 700;
  opacity: 0.7;
}

/* --- doc page header --- */
.doc-head {
  padding-block: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 3vw, 2.5rem);
}
.doc-head .eyebrow {
  margin-bottom: 1.1rem;
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
}
.doc-head h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--step-4);
  line-height: 0.96;
  letter-spacing: -0.03em;
  font-variation-settings: 'SOFT' 40, 'WONK' 1, 'opsz' 144;
}
.doc-head h1 em {
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
}
.doc-head .lede {
  margin-top: 1.2rem;
  max-width: 62ch;
  font-size: var(--step-1);
  color: var(--ink-2);
  line-height: 1.5;
}
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  margin-top: 1.8rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}
.doc-meta .cell .k {
  font-family: var(--data);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.doc-meta .cell .v {
  font-family: var(--data);
  font-weight: 700;
  font-size: 0.92rem;
  margin-top: 0.15rem;
}
.doc-meta .cell .v.ok {
  color: var(--sage);
}
.doc-meta .cell .v.warn {
  color: var(--accent);
}

/* --- two column doc layout with sticky TOC --- */
.doc-layout {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
}
@media (min-width: 940px) {
  .doc-layout {
    grid-template-columns: 200px 1fr;
    align-items: start;
  }
}
.toc {
  position: sticky;
  top: 130px;
  display: none;
  flex-direction: column;
  gap: 0.1rem;
  border-left: 1px solid var(--line);
  padding-left: 1rem;
}
@media (min-width: 940px) {
  .toc {
    display: flex;
  }
}
.toc a {
  font-size: 0.8rem;
  color: var(--ink-dim);
  padding: 0.28rem 0;
  transition: color 0.2s;
  border-left: 2px solid transparent;
  margin-left: -1rem;
  padding-left: 1rem;
}
.toc a:hover {
  color: var(--ink);
}
.toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}
.toc .grp {
  font-family: var(--data);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-top: 1rem;
  opacity: 0.6;
}

/* --- doc article typography --- */
.doc-body {
  max-width: 74ch;
}
.doc-body h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: var(--step-2);
  letter-spacing: -0.02em;
  margin: 2.6rem 0 0.4rem;
  scroll-margin-top: 140px;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}
.doc-body h2 .rq {
  font-family: var(--data);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.doc-body h3 {
  font-family: var(--body);
  font-weight: 700;
  font-size: 1.06rem;
  margin: 1.8rem 0 0.4rem;
  scroll-margin-top: 140px;
}
.doc-body p {
  color: var(--ink-2);
  margin: 0.7rem 0;
  line-height: 1.68;
}
.doc-body ul,
.doc-body ol {
  color: var(--ink-2);
  margin: 0.7rem 0;
  padding-left: 1.2rem;
  line-height: 1.66;
}
.doc-body li {
  margin: 0.35rem 0;
}
.doc-body li::marker {
  color: var(--accent);
}
.doc-body strong {
  color: var(--ink);
  font-weight: 700;
}
.doc-body code,
.inline-code {
  font-family: var(--data);
  font-size: 0.84em;
  background: color-mix(in oklab, var(--ink) 8%, var(--surface));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.08em 0.4em;
  color: var(--ink);
}
.doc-body a.link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* --- requirement rows --- */
.req {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: start;
  padding: 0.85rem 0;
  border-bottom: 1px dashed var(--line);
}
.req .id {
  font-family: var(--data);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.req .txt {
  font-size: 0.92rem;
  color: var(--ink-2);
  line-height: 1.5;
}
.req .txt b {
  color: var(--ink);
}
.pill {
  font-family: var(--data);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  height: fit-content;
}
.pill.must {
  color: var(--garnet);
  background: color-mix(in oklab, var(--garnet) 14%, transparent);
}
.pill.should {
  color: var(--accent);
  background: color-mix(in oklab, var(--crema) 16%, transparent);
}
.pill.could {
  color: var(--sage);
  background: color-mix(in oklab, var(--sage) 16%, transparent);
}
.pill.done {
  color: var(--sage);
  background: color-mix(in oklab, var(--sage) 16%, transparent);
}
.pill.wip {
  color: var(--accent);
  background: color-mix(in oklab, var(--crema) 16%, transparent);
}
.pill.gap {
  color: var(--garnet);
  background: color-mix(in oklab, var(--garnet) 14%, transparent);
}

/* --- callout --- */
.callout {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.1rem 1.3rem;
  margin: 1.4rem 0;
}
.callout .lbl {
  font-family: var(--data);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.callout.gap {
  border-left-color: var(--garnet);
}
.callout.gap .lbl {
  color: var(--garnet);
}
.callout p {
  margin: 0.3rem 0;
  font-size: 0.9rem;
}

/* --- spec table --- */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.86rem;
}
.spec-table th {
  text-align: left;
  font-family: var(--data);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line-strong);
}
.spec-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: top;
}
.spec-table td:first-child {
  font-family: var(--data);
  color: var(--ink);
  white-space: nowrap;
}
.spec-table tr:hover td {
  background: color-mix(in oklab, var(--crema) 5%, transparent);
}
.method-tag {
  font-family: var(--data);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
}
.method-tag.get {
  color: var(--sage);
  background: color-mix(in oklab, var(--sage) 14%, transparent);
}
.method-tag.post {
  color: var(--accent);
  background: color-mix(in oklab, var(--crema) 16%, transparent);
}
.method-tag.put {
  color: #7d6f9e;
  background: color-mix(in oklab, #7d6f9e 16%, transparent);
}
.method-tag.del {
  color: var(--garnet);
  background: color-mix(in oklab, var(--garnet) 14%, transparent);
}

/* ============================================================
   ARCHITECTURE diagram
   ============================================================ */
.arch-stage {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    180deg,
    var(--surface),
    color-mix(in oklab, var(--surface-2) 60%, var(--bg))
  );
  padding: clamp(1rem, 3vw, 2rem);
  overflow: hidden;
}
.arch-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}
.arch-node rect,
.arch-node circle {
  transition: stroke 0.3s, filter 0.3s;
}
.arch-lane-label {
  font-family: var(--data);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  fill: var(--ink-dim);
}
.arch-node-title {
  font-family: var(--body);
  font-weight: 700;
  fill: var(--ink);
}
.arch-node-sub {
  font-family: var(--data);
  fill: var(--ink-dim);
}
.arch-flow {
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
  opacity: 0.55;
}
.arch-packet {
  fill: var(--accent);
  filter: drop-shadow(0 0 5px color-mix(in oklab, var(--crema) 70%, transparent));
}
.arch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.6rem;
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}
.arch-legend .item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-2);
}
.arch-legend .sw {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
}

/* layer cards (mobile-friendly fallback / detail) */
.layers {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.5rem;
}
.layer {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.2rem;
}
.layer .tier {
  font-family: var(--data);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.layer h4 {
  font-family: var(--body);
  font-weight: 700;
  font-size: 0.98rem;
}
.layer p {
  font-size: 0.84rem;
  color: var(--ink-2);
  margin-top: 0.2rem;
  line-height: 1.5;
}
.layer .stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}
.tech {
  font-family: var(--data);
  font-size: 0.64rem;
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
}

/* ============================================================
   ROADMAP timeline
   ============================================================ */
.timeline {
  position: relative;
  margin-top: 1.5rem;
  padding-left: 2rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(
    180deg,
    var(--sage),
    var(--accent) 55%,
    var(--garnet)
  );
  opacity: 0.5;
}
.phase {
  position: relative;
  padding: 0 0 2rem;
}
.phase::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  transform: translateX(-1px);
}
.phase.done::before {
  background: var(--accent);
}
.phase .when {
  font-family: var(--data);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.phase h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.28rem;
  margin: 0.2rem 0 0.5rem;
  letter-spacing: -0.01em;
}
.phase h3 .no {
  font-family: var(--data);
  color: var(--accent);
  font-size: 0.9rem;
}
.phase .card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.2rem;
}
.phase .card ul {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
}
.phase .card li {
  font-size: 0.88rem;
  color: var(--ink-2);
  margin: 0.3rem 0;
  line-height: 1.5;
}
.phase .card li::marker {
  color: var(--accent);
}
.phase .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

/* page-level footer nav between docs */
.doc-nav {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: 1fr 1fr;
  margin-top: 3rem;
}
.doc-nav a {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  background: var(--surface);
  transition: border-color 0.2s, transform 0.15s var(--ease);
}
.doc-nav a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.doc-nav a .k {
  font-family: var(--data);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.doc-nav a .t {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  margin-top: 0.2rem;
}
.doc-nav a.next {
  text-align: right;
}

/* ============================================================
   Hero dial — ambient motion enrichments
   ============================================================ */
.dial-shimmer {
  transform-origin: 170px 170px;
  animation: dial-rotate 14s linear infinite;
}
@keyframes dial-rotate {
  to {
    transform: rotate(360deg);
  }
}
#sweepHead {
  transition: transform 0.08s linear;
}
.dial-drip {
  transform-origin: 170px 214px;
  animation: dial-drip 3.2s var(--ease) infinite;
  opacity: 0;
}
@keyframes dial-drip {
  0%,
  62% {
    transform: translateY(0) scaleY(0.6);
    opacity: 0;
  }
  70% {
    opacity: 0.9;
  }
  100% {
    transform: translateY(46px) scaleY(1.25);
    opacity: 0;
  }
}
/* steam floating above the dial */
.dial-steam {
  position: absolute;
  top: -6%;
  left: 50%;
  width: 32%;
  height: 26%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 2;
  opacity: 0.5;
}
.dial-steam .wisp {
  fill: none;
  stroke: var(--crema);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
  animation: steam-rise 4.5s var(--ease) infinite;
}
.dial-steam .w2 {
  animation-duration: 5.4s;
  animation-delay: -1.2s;
  opacity: 0.85;
}
.dial-steam .w3 {
  animation-duration: 4.9s;
  animation-delay: -2.4s;
}
@keyframes steam-rise {
  0% {
    stroke-dashoffset: 120;
    opacity: 0;
    transform: translateY(6px);
  }
  30% {
    opacity: 0.9;
  }
  70% {
    opacity: 0.5;
  }
  100% {
    stroke-dashoffset: -40;
    opacity: 0;
    transform: translateY(-8px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .dial-shimmer,
  .dial-drip,
  .dial-steam .wisp {
    animation: none;
  }
  .dial-steam {
    opacity: 0.28;
  }
  .dial-steam .wisp {
    stroke-dashoffset: 0;
  }
}

/* ============================================================
   DATAVIZ — validated categorical palette + chart primitives
   Palette validated with dataviz/validate_palette.js (light+dark):
   all 6 checks PASS, worst adjacent CVD ΔE > 12. Coffee-anchored:
   slot 1 amber(crema) · 3 garnet · 5 green(sage) carry brand meaning.
   ============================================================ */
:root {
  --cat-1: #c67b32; /* amber / crema */
  --cat-2: #4a3aa7; /* indigo */
  --cat-3: #b0432f; /* garnet */
  --cat-4: #1f9b8e; /* teal */
  --cat-5: #5f8a2f; /* sage green */
  --cat-6: #9a4f8f; /* plum */
  --cat-7: #a07d1a; /* gold */
  --cat-8: #8a4a22; /* sienna */
  /* sequential ramp (single hue = crema/amber), light→dark */
  --seq-1: #f0dcc0;
  --seq-2: #e3bd8c;
  --seq-3: #d59a56;
  --seq-4: #bd7c31;
  --seq-5: #935e1f;
  /* status (reserved; icon+label always) */
  --ok: #5f8a2f;
  --warn: #a07d1a;
  --danger: #b0432f;
  --grid: var(--line);
}
.dark {
  --cat-1: #c2833c;
  --cat-2: #8073d0;
  --cat-3: #d3634a;
  --cat-4: #2ba899;
  --cat-5: #79a147;
  --cat-6: #b869aa;
  --cat-7: #b28c28;
  --cat-8: #bf7440;
  --seq-1: #4a3016;
  --seq-2: #6d4a1f;
  --seq-3: #96692b;
  --seq-4: #c08f45;
  --seq-5: #e0b371;
  --ok: #79a147;
  --warn: #c8a13a;
  --danger: #d3634a;
  --grid: var(--line);
}

/* --- chart shell --- */
.chart-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.1rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}
.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.chart-title {
  font-family: var(--body);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink);
}
.chart-sub {
  font-family: var(--data);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.chart-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart-grid line {
  stroke: var(--grid);
  stroke-width: 1;
}
.chart-axis {
  font-family: var(--data);
  font-size: 10px;
  fill: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.chart-baseline {
  stroke: var(--line-strong);
  stroke-width: 1;
}

/* legend (always present for >=2 series) */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
.legend .key {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--ink-2);
}
.legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}
.legend .dot.line {
  height: 3px;
  width: 16px;
  border-radius: 2px;
}

/* stat tiles / hero figure */
.stat-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
  overflow: hidden;
}
.stat .label {
  font-size: 0.72rem;
  color: var(--ink-dim);
}
.stat .value {
  font-family: var(--data);
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1;
  color: var(--ink);
}
.stat .value small {
  font-size: 0.8rem;
  color: var(--ink-dim);
  font-weight: 400;
}
.stat .delta {
  font-family: var(--data);
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.stat .delta.up {
  color: var(--ok);
}
.stat .delta.down {
  color: var(--danger);
}
.stat .spark {
  position: absolute;
  right: 0.6rem;
  bottom: 0.5rem;
  width: 64px;
  height: 24px;
  opacity: 0.9;
}
.hero-figure {
  font-family: var(--data);
  font-weight: 700;
  font-size: clamp(2.6rem, 8vw, 4rem);
  line-height: 0.95;
  color: var(--ink);
  letter-spacing: -0.02em;
}

/* meter */
.meter-lg {
  height: 8px;
  border-radius: 999px;
  background: var(--ring-track);
  overflow: hidden;
}
.meter-lg > i {
  display: block;
  height: 100%;
  border-radius: 999px;
}

/* dashboard grid */
.dash-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 680px) {
  .dash-grid.two {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 900px) {
  .dash-grid.three {
    grid-template-columns: 2fr 1fr;
  }
}
.dash-grid .span-2 {
  grid-column: 1 / -1;
}

/* calendar heatmap */
.heat {
  display: grid;
  grid-template-columns: repeat(26, 1fr);
  gap: 3px;
}
.heat i {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--seq-1);
}
.heat i[data-l='0'] {
  background: var(--ring-track);
}
.heat i[data-l='1'] {
  background: var(--seq-1);
}
.heat i[data-l='2'] {
  background: var(--seq-2);
}
.heat i[data-l='3'] {
  background: var(--seq-3);
}
.heat i[data-l='4'] {
  background: var(--seq-4);
}
.heat i[data-l='5'] {
  background: var(--seq-5);
}

/* segmented toggle (chart / table view) */
.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.seg button {
  font-family: var(--data);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  color: var(--ink-dim);
}
.seg button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
}

/* tooltip */
.viz-tip {
  position: fixed;
  pointer-events: none;
  z-index: 80;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 0.74rem;
  line-height: 1.35;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  transition: opacity 0.12s;
  max-width: 220px;
}
.viz-tip.on {
  opacity: 1;
}
.viz-tip .t-k {
  font-family: var(--data);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
}
.viz-tip .t-v {
  font-family: var(--data);
  font-weight: 700;
}

/* data table view */
.viz-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.viz-table th,
.viz-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-family: var(--data);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.viz-table th:first-child,
.viz-table td:first-child {
  text-align: left;
}
.viz-table th {
  color: var(--ink-dim);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.viz-hidden {
  display: none;
}

/* ============================================================
   Records module — richer note cards + imagery
   ============================================================ */
/* CSS-drawn "photo" placeholder — a cup of coffee seen top-down */
.brew-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, #3a2416 0 22%, #24160d 23% 34%, transparent 35%),
    radial-gradient(circle at 50% 42%, #6f4a2b 0 20%, transparent 21%),
    linear-gradient(135deg, #b8823f, #8a5a2b 55%, #5f3d1f);
}
.brew-photo::after {
  /* crema swirl */
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
      ellipse 40% 26% at 48% 40%,
      rgba(245, 225, 190, 0.5),
      transparent 60%
    ),
    radial-gradient(ellipse 12% 8% at 58% 46%, rgba(255, 248, 235, 0.4), transparent 70%);
  mix-blend-mode: screen;
}
.brew-photo .ph-tag {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  font-family: var(--data);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fdf8ef;
  background: rgba(26, 18, 11, 0.5);
  backdrop-filter: blur(4px);
  padding: 0.14rem 0.44rem;
  border-radius: 6px;
}
.brew-photo.beans {
  background:
    radial-gradient(circle at 30% 40%, #4a2f1a 0 6%, transparent 7%),
    radial-gradient(circle at 62% 30%, #3a2414 0 5%, transparent 6%),
    radial-gradient(circle at 50% 62%, #5a3a22 0 6%, transparent 7%),
    radial-gradient(circle at 74% 66%, #43291800 0 5%, transparent 6%),
    linear-gradient(135deg, #7a5230, #4a2f1a);
}

/* param grid inside a record card */
.param-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.param-grid .p {
  background: var(--surface);
  padding: 0.4rem 0.5rem;
}
.param-grid .p .k {
  font-family: var(--data);
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.param-grid .p .v {
  font-family: var(--data);
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--ink);
  margin-top: 0.1rem;
}
.param-grid .p .v.accent {
  color: var(--accent);
}

/* rating stars */
.stars {
  display: inline-flex;
  gap: 1px;
  color: var(--accent);
  font-size: 0.7rem;
}
.stars .off {
  color: var(--line-strong);
}

/* record list card (feed style) */
.rec-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.rec-card .body {
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.taste-bars {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}
.taste-bars .tb {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 0.5rem;
}
.taste-bars .tb .k {
  font-size: 0.62rem;
  color: var(--ink-dim);
}
.taste-bars .tb .track {
  height: 4px;
  border-radius: 999px;
  background: var(--ring-track);
  overflow: hidden;
}
.taste-bars .tb .track > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

/* ============================================================
   AI-NATIVE + tools + persona + RBAC components (phase 3)
   ============================================================ */

/* --- AI assistant / conversational entry --- */
.ai-hero {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 100% at 100% 0%, color-mix(in oklab, var(--crema) 14%, transparent), transparent 60%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
  padding: clamp(1.1rem, 3vw, 1.8rem);
  position: relative;
  overflow: hidden;
}
.ai-orb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: none;
  background: radial-gradient(circle at 35% 30%, var(--crema), var(--crema-deep) 70%);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--crema) 22%, transparent),
    0 0 22px -4px var(--crema);
  position: relative;
}
.ai-orb::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--crema) 40%, transparent);
  animation: ai-pulse 3s var(--ease) infinite;
}
@keyframes ai-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  70% { transform: scale(1.45); opacity: 0; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ai-orb::after { animation: none; }
}
.ai-bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  border-top-left-radius: 4px;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.5;
  max-width: 90%;
}
.ai-bubble.me {
  border-top-left-radius: 14px;
  border-top-right-radius: 4px;
  margin-left: auto;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.ai-typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-dim);
  margin-right: 3px;
  animation: ai-blink 1.2s infinite both;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.chips-scroll {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.suggest-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  color: var(--ink-2);
  background: var(--surface);
  transition: border-color 0.2s, color 0.2s, transform 0.15s var(--ease);
  cursor: pointer;
}
.suggest-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.suggest-chip .ic { color: var(--accent); }

/* --- daily bean-card recommendation (hero card) --- */
.beancard {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}
.beancard .thumb {
  border-radius: 14px;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 34% 38%, #4a2f1a 0 10%, transparent 11%),
    radial-gradient(circle at 64% 34%, #3a2414 0 8%, transparent 9%),
    radial-gradient(circle at 52% 66%, #5a3a22 0 9%, transparent 10%),
    linear-gradient(135deg, #7a5230, #4a2f1a);
}
.beancard .why {
  font-size: 0.82rem;
  color: var(--ink-2);
  border-left: 2px solid var(--accent);
  padding-left: 0.6rem;
  line-height: 1.5;
}
.beancard .why b { color: var(--accent); }
.match-ring {
  --p: 86;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--ring-track) 0);
  display: grid;
  place-items: center;
  flex: none;
}
.match-ring::after {
  content: attr(data-p) '%';
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-family: var(--data);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--ink);
}

/* --- persona / mood --- */
.persona-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.1rem 1.2rem;
}
.mbti-tag {
  font-family: var(--data);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  padding: 0.24rem 0.6rem;
  border-radius: 8px;
  color: var(--accent-ink);
  background: var(--accent);
}
.mbti-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.mood-scale {
  display: flex;
  gap: 0.3rem;
}
.mood-scale button,
.mood-scale span {
  font-size: 1.3rem;
  opacity: 0.4;
  transition: opacity 0.2s, transform 0.15s var(--ease);
  cursor: pointer;
  background: none;
  border: none;
}
.mood-scale .on,
.mood-scale button:hover {
  opacity: 1;
  transform: scale(1.15);
}
.trait-bar {
  display: grid;
  grid-template-columns: 68px 1fr 68px;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  color: var(--ink-dim);
  margin: 0.5rem 0;
}
.trait-bar .track {
  height: 6px;
  border-radius: 999px;
  background: var(--ring-track);
  position: relative;
}
.trait-bar .track > i {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}
.trait-bar .lft { text-align: right; color: var(--ink-2); }
.trait-bar .rgt { text-align: left; color: var(--ink-2); }

/* --- share card preview --- */
.share-card {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--espresso), #2c1c10 60%, #3a2414);
  color: #f3ecdd;
  padding: 1.3rem;
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}
.share-card .brand-mini {
  font-family: var(--display);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--crema);
}
.share-card .big-score {
  font-family: var(--data);
  font-weight: 700;
  font-size: 3rem;
  line-height: 1;
  color: #f3ecdd;
}
.share-card .flav {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}
.share-card .flav span {
  font-size: 0.66rem;
  border: 1px solid rgba(210, 145, 74, 0.4);
  color: var(--crema);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
.share-targets {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  font-size: 0.82rem;
  color: var(--ink);
  transition: border-color 0.2s, transform 0.15s var(--ease);
  cursor: pointer;
}
.share-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.share-btn .dot { width: 18px; height: 18px; border-radius: 5px; }

/* --- RBAC role matrix --- */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--data);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid;
}
.role-badge.hobby { color: var(--sage); border-color: color-mix(in oklab, var(--sage) 50%, transparent); background: color-mix(in oklab, var(--sage) 12%, transparent); }
.role-badge.barista { color: var(--accent); border-color: color-mix(in oklab, var(--crema) 50%, transparent); background: color-mix(in oklab, var(--crema) 12%, transparent); }
.role-badge.admin { color: var(--cat-2); border-color: color-mix(in oklab, var(--cat-2) 50%, transparent); background: color-mix(in oklab, var(--cat-2) 12%, transparent); }
.rbac-matrix { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.rbac-matrix th, .rbac-matrix td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); text-align: center; }
.rbac-matrix th:first-child, .rbac-matrix td:first-child { text-align: left; color: var(--ink-2); }
.rbac-matrix th { font-family: var(--data); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); }
.rbac-matrix .yes { color: var(--ok); font-weight: 700; }
.rbac-matrix .no { color: var(--ink-dim); opacity: 0.5; }

/* --- onboarding stepper --- */
.stepper {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.stepper .st {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--data);
  font-size: 0.7rem;
  color: var(--ink-dim);
}
.stepper .st .n {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-content: center;
  border: 1px solid var(--line-strong);
  font-weight: 700; font-size: 0.66rem;
}
.stepper .st.done .n { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.stepper .st.now .n { border-color: var(--accent); color: var(--accent); }
.onb-step {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.3rem;
  margin-bottom: 1rem;
}
@media (min-width: 720px) { .onb-step { grid-template-columns: 1.3fr 1fr; align-items: center; } }
.onb-step .visual {
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  min-height: 150px;
  display: grid;
  place-items: center;
  padding: 1rem;
}

/* --- tool cards + scan frame --- */
.tool-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.tool-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: border-color 0.2s, transform 0.15s var(--ease);
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card .tico {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-content: center;
  background: color-mix(in oklab, var(--crema) 14%, var(--surface-2));
  color: var(--accent);
  border: 1px solid var(--line);
}
.tool-card h4 { font-weight: 700; font-size: 1rem; }
.tool-card p { font-size: 0.85rem; color: var(--ink-2); line-height: 1.5; }
.tool-card .how {
  font-family: var(--data);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border-top: 1px dashed var(--line);
  padding-top: 0.6rem;
  margin-top: auto;
}
/* camera scan frame */
.scan-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #2a1d12, #17100a);
}
.scan-frame .corner {
  position: absolute;
  width: 22px; height: 22px;
  border: 2px solid var(--crema);
}
.scan-frame .corner.tl { top: 12px; left: 12px; border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
.scan-frame .corner.tr { top: 12px; right: 12px; border-left: none; border-bottom: none; border-radius: 0 4px 0 0; }
.scan-frame .corner.bl { bottom: 12px; left: 12px; border-right: none; border-top: none; border-radius: 0 0 0 4px; }
.scan-frame .corner.br { bottom: 12px; right: 12px; border-left: none; border-top: none; border-radius: 0 0 4px 0; }
.scan-frame .scanline {
  position: absolute;
  left: 8%; right: 8%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--crema), transparent);
  box-shadow: 0 0 10px var(--crema);
  animation: scanmove 2.6s var(--ease) infinite;
}
@keyframes scanmove { 0%, 100% { top: 16%; } 50% { top: 84%; } }
@media (prefers-reduced-motion: reduce) { .scan-frame .scanline { animation: none; top: 50%; } }
.scan-frame .particles i {
  position: absolute;
  border-radius: 50%;
  background: rgba(210, 145, 74, 0.55);
  border: 1px solid rgba(245, 225, 190, 0.5);
}

/* generic feature-hero split */
.feat-hero {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 820px) { .feat-hero { grid-template-columns: 1fr 1fr; } }

/* ============================================================
   Daily caffeine tracker (phase 4)
   ============================================================ */
.caf-gauge-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: center;
}
@media (min-width: 640px) { .caf-gauge-wrap { grid-template-columns: auto 1fr; } }
.caf-gauge {
  position: relative;
  width: 180px;
  height: 180px;
  margin-inline: auto;
  flex: none;
}
.caf-gauge .c {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.caf-gauge .mg {
  font-family: var(--data);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
  color: var(--ink);
}
.caf-gauge .mg small { font-size: 0.9rem; color: var(--ink-dim); font-weight: 400; }
.caf-gauge .lim {
  font-family: var(--data);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-top: 0.2rem;
}
.caf-state {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--data);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  margin-top: 0.4rem;
}
.caf-state.ok { color: var(--ok); background: color-mix(in oklab, var(--sage) 14%, transparent); }
.caf-state.warn { color: var(--warn); background: color-mix(in oklab, var(--crema) 16%, transparent); }
.caf-state.danger { color: var(--danger); background: color-mix(in oklab, var(--garnet) 14%, transparent); }

/* today's cup log timeline */
.cup-log { display: flex; flex-direction: column; gap: 0.5rem; }
.cup-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.7rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 0.6rem 0.8rem;
}
.cup-row .logo {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: grid; place-content: center; font-weight: 800;
  font-family: var(--data); font-size: 0.7rem; color: #fff;
  letter-spacing: -0.02em;
}
.cup-row .name { font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.cup-row .meta { font-family: var(--data); font-size: 0.68rem; color: var(--ink-dim); margin-top: 0.1rem; }
.cup-row .mg {
  font-family: var(--data); font-weight: 700; font-size: 0.95rem; color: var(--accent);
  text-align: right; white-space: nowrap;
}
.cup-row .mood { font-size: 1.1rem; }

/* brand logo tints (recognizable placeholder chips, not real logos) */
.brand-sbux { background: #00704a; }
.brand-luckin { background: #002d64; }
.brand-mstand { background: #1a1a1a; }
.brand-nowwa { background: #2f7d4f; }
.brand-manner { background: #3a3a3a; }
.brand-peets { background: #6b2c2c; }
.brand-other { background: var(--crema-deep); }

/* capture card */
.caf-capture {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .caf-capture { grid-template-columns: 200px 1fr; align-items: center; } }
.brand-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.brand-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 0.3rem 0.7rem; font-size: 0.78rem; color: var(--ink-2);
}
.brand-chip .sw { width: 12px; height: 12px; border-radius: 4px; flex: none; }

/* late-night care banner */
.care-banner {
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.3rem;
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  background:
    radial-gradient(120% 120% at 100% 0%, color-mix(in oklab, #4a3aa7 22%, transparent), transparent 55%),
    linear-gradient(160deg, #1c1636, #241913);
  border: 1px solid color-mix(in oklab, #4a3aa7 30%, var(--line));
  color: #ece4f0;
}
.care-banner .moon {
  font-size: 1.8rem; flex: none; filter: drop-shadow(0 0 8px rgba(160,140,220,0.5));
}
.care-banner h4 { font-family: var(--display); font-weight: 600; font-size: 1.1rem; color: #f3ecdd; }
.care-banner p { font-size: 0.86rem; color: #cabfe0; line-height: 1.55; margin-top: 0.3rem; }
.care-banner .tip { color: #b9a6e6; }

/* sleep window pill */
.sleep-hint {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--data); font-size: 0.72rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 0.3rem 0.7rem; color: var(--ink-2); margin-top: 0.6rem;
}
.sleep-hint b { color: var(--accent); }

/* ============================================================
   Interactive app shell (app.html) — phase 5
   A device-framed, tabbed single-page prototype.
   ============================================================ */
.app-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(0.5rem, 3vw, 2rem);
}
.device {
  width: 100%;
  max-width: 440px;
  height: min(920px, calc(100vh - 2rem));
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 30px;
  box-shadow: var(--shadow-lift);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
@media (min-width: 480px) { .device { border-radius: 38px; } }

.app-top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem 0.7rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--surface) 60%, var(--bg));
}
.app-top .brand { font-size: 1rem; }
.app-top .tools { display: flex; gap: 0.4rem; align-items: center; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-content: center;
  color: var(--ink-2); border: 1px solid transparent;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.icon-btn:hover { color: var(--accent); background: color-mix(in oklab, var(--crema) 10%, transparent); }

.app-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.app-view {
  padding: 1.1rem 1.1rem 2rem;
  display: none;
  animation: view-in 0.4s var(--ease);
}
.app-view.active { display: block; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .app-view.active { animation: none; } }

.app-tabbar {
  flex: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
  background: color-mix(in oklab, var(--surface) 70%, var(--bg));
  padding-bottom: env(safe-area-inset-bottom);
}
.app-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0.55rem 0.2rem 0.6rem;
  font-family: var(--data);
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  position: relative;
  transition: color 0.2s;
}
.app-tab svg { width: 21px; height: 21px; }
.app-tab.on { color: var(--accent); }
.app-tab.on::before {
  content: '';
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 2px; border-radius: 0 0 3px 3px;
  background: var(--accent);
}

/* app-scoped headings */
.v-head { margin-bottom: 1rem; }
.v-head .eyebrow { display: block; margin-bottom: 0.35rem; }
.v-head h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.v-head p { font-size: 0.84rem; color: var(--ink-dim); margin-top: 0.3rem; line-height: 1.5; }
.v-sec { margin-top: 1.5rem; }
.v-sec-h {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 0.7rem;
}
.v-sec-h .t { font-weight: 700; font-size: 0.98rem; }
.v-sec-h .x { font-family: var(--data); font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }

/* icon + text list rows (replaces emoji lists) */
.ic-row { display: flex; align-items: flex-start; gap: 0.6rem; }
.ic-badge {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-content: center; color: var(--accent);
  background: color-mix(in oklab, var(--crema) 12%, var(--surface-2));
  border: 1px solid var(--line);
}

/* ============================================================
   Persona quiz
   ============================================================ */
.axis-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.9rem 1rem;
  margin-bottom: 0.7rem;
}
.axis-card .hd { display: flex; align-items: center; gap: 0.5rem; }
.axis-card .hd .ic-badge { width: 30px; height: 30px; }
.axis-card .poles {
  display: flex; justify-content: space-between;
  font-family: var(--data); font-size: 0.72rem; color: var(--ink-2);
  margin-top: 0.6rem;
}
.axis-card .poles b { color: var(--ink); }
.axis-card .track {
  height: 6px; border-radius: 999px; background: var(--ring-track);
  margin: 0.4rem 0; position: relative;
}
.axis-card .blurb { font-size: 0.78rem; color: var(--ink-dim); line-height: 1.5; }

.arch-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem;
}
.arch-mini {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); padding: 0.6rem 0.7rem;
  display: flex; align-items: center; gap: 0.45rem;
}
.arch-mini .ic-badge { width: 26px; height: 26px; border-radius: 8px; }
.arch-mini .nm { font-size: 0.72rem; font-weight: 600; line-height: 1.15; }
.arch-mini .cd { font-family: var(--data); font-size: 0.54rem; color: var(--ink-dim); }

/* quiz runner */
.quiz-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); padding: 1.2rem 1.2rem 1.4rem;
}
.quiz-prog { height: 5px; border-radius: 999px; background: var(--ring-track); overflow: hidden; margin-bottom: 1.1rem; }
.quiz-prog > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.4s var(--ease); }
.quiz-count { font-family: var(--data); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 0.5rem; }
.quiz-q { font-family: var(--display); font-weight: 600; font-size: 1.2rem; line-height: 1.3; margin-bottom: 1rem; }
.quiz-opts { display: flex; flex-direction: column; gap: 0.6rem; }
.quiz-opt {
  text-align: left; border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 0.85rem 1rem; font-size: 0.92rem; color: var(--ink);
  background: var(--surface); transition: border-color 0.2s, background-color 0.2s, transform 0.12s var(--ease);
  display: flex; align-items: center; gap: 0.6rem;
}
.quiz-opt:hover { border-color: var(--accent); transform: translateY(-1px); }
.quiz-opt .dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; }
.quiz-opt.sel { border-color: var(--accent); background: color-mix(in oklab, var(--crema) 10%, var(--surface)); }
.quiz-opt.sel .dot { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2px var(--surface); }
.quiz-nav { display: flex; justify-content: space-between; margin-top: 1.2rem; gap: 0.6rem; }

/* result reveal */
.result-hero {
  text-align: center; padding: 1.4rem 1rem;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in oklab, var(--crema) 16%, transparent), transparent 60%),
    var(--surface);
}
.result-hero .rico {
  width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 0.7rem;
  display: grid; place-content: center; color: var(--accent-ink);
  background: radial-gradient(circle at 36% 32%, var(--crema), var(--crema-deep) 78%);
  box-shadow: 0 10px 26px -10px color-mix(in oklab, var(--crema) 70%, transparent);
}
.result-hero .rcode { font-family: var(--data); font-weight: 700; letter-spacing: 0.2em; color: var(--accent); font-size: 0.8rem; }
.result-hero .rname { font-family: var(--display); font-weight: 600; font-size: 1.7rem; margin: 0.2rem 0; }
.result-hero .rtag { font-size: 0.86rem; color: var(--ink-2); font-style: italic; }
