/* ========== 123AHP - modernized styles ========== */

:root {
  /* Brand */
  --brand-blue-50:  #eaf6fb;
  --brand-blue-100: #d6ecf5;
  --brand-blue-200: #b7dfee;
  --brand-blue-300: #85c9e1;
  --brand-blue-400: #5bb3d2;
  --brand-blue-500: #3a9bc1;
  --brand-blue-600: #247ea3;
  --brand-blue-700: #1a5f7d;

  --brand-red-400: #d04545;
  --brand-red-500: #b82a2a;
  --brand-red-600: #9a1f1f;

  --accent-orange: #e68246;

  /* Surfaces (light) */
  --bg-page: #dcf0f8;
  --bg-card: #ffffff;
  --bg-header: #eaf6fb;
  --bg-nav: #7cbfd9;
  --bg-subtle: #f5fafd;
  --border-soft: #dbe9f0;
  --border-strong: #b7d4e0;

  /* Text */
  --ink-900: #102a37;
  --ink-700: #345667;
  /* The muted stop for hints, bylines and footers. Was #607b89, which measured
     4.48 on white and only 3.81 on the tinted --bg-page - under AA wherever it
     carried small text. This clears 4.5 on every surface it actually lands on
     (5.52 on white, 5.05 worst case on --bg-page) and stays clearly lighter than
     --ink-700. Dark redefines it below and already passed, so this is light only. */
  --ink-500: #506775;
  --ink-400: #8aa2ae;
  --ink-inverse: #ffffff;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(16, 42, 55, 0.06), 0 1px 3px rgba(16, 42, 55, 0.04);
  --shadow-md: 0 4px 14px rgba(16, 42, 55, 0.08), 0 2px 6px rgba(16, 42, 55, 0.05);
  --shadow-lg: 0 12px 36px rgba(16, 42, 55, 0.12), 0 4px 12px rgba(16, 42, 55, 0.06);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Type */
  --font-sans: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-logo: 'Caveat', 'Segoe Script', 'Bradley Hand', cursive;

  /* Layout */
  --shell-max: 1280px;
  --gutter: 28px;
}

[data-theme="dark"] {
  --bg-page: #071319;
  --bg-card: #0f2029;
  --bg-header: #102936;
  --bg-nav: #164059;
  --bg-subtle: #0a1b24;
  --border-soft: #1d3648;
  --border-strong: #3a6582;

  --ink-900: #f2f8fb;
  --ink-700: #c9dae4;
  --ink-500: #8fa6b3;
  --ink-400: #6a8594;
  --ink-inverse: #071319;

  --brand-blue-50:  #0f2836;
  --brand-blue-100: #143449;
  --brand-blue-200: #1b4a66;
  --brand-blue-300: #2e7699;
  --brand-red-400: #ff6a6a;
  --brand-red-500: #ff4e4e;
  --brand-red-600: #e03535;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.7);
}

/* Corner radius tweak - higher-specificity so it beats :root */
html[data-radius="sharp"],
html[data-radius="sharp"]:root {
  --r-sm: 0px !important;
  --r-md: 0px !important;
  --r-lg: 0px !important;
  --r-xl: 0px !important;
  --r-pill: 0px !important;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--ink-900);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s ease, color .3s ease;
}

a { color: var(--brand-red-500); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

/* ---------- Top bar ---------- */
.topbar {
  background: transparent;
  padding: 14px 0 6px;
}
.topbar-inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.lang-flags {
  display: flex;
  gap: 6px;
}
.lang-flags button {
  width: 28px;
  height: 21px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,.18);
  padding: 0;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  opacity: .78;
  transition: opacity .15s, transform .15s;
}
.lang-flags button:hover { opacity: 1; transform: translateY(-1px); }
.lang-flags button[aria-current="true"] { opacity: 1; outline: 2px solid var(--brand-blue-500); outline-offset: 1px; }
[data-theme="dark"] .lang-flags button { border-color: rgba(255,255,255,.22); }

/* Flag images: flag-icons (MIT) 4x3 SVGs; eo.svg is hand-drawn (Esperanto) */
.flag-hr { background-image: url('/img/flags/hr.svg'); }
.flag-en { background-image: url('/img/flags/gb.svg'); }
.flag-de { background-image: url('/img/flags/de.svg'); }
.flag-pt { background-image: url('/img/flags/pt.svg'); }
.flag-cz { background-image: url('/img/flags/cz.svg'); }
.flag-ep { background-image: url('/img/flags/eo.svg'); }
.flag-pl { background-image: url('/img/flags/pl.svg'); }
.flag-es { background-image: url('/img/flags/es.svg'); }
.flag-xx { background: var(--ink-400); }

.topbar-spacer { flex: 1; }
.topbar-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--brand-blue-600);
}
.topbar-meta .user { color: var(--ink-500); }
.topbar-meta a { font-weight: 600; }
.topbar-beta {
  font-size: 12px;
  color: var(--brand-blue-500);
  letter-spacing: .04em;
}

/* ---------- Shell / card ---------- */
.shell {
  max-width: var(--shell-max);
  margin: 8px auto 4px;
  padding: 0 var(--gutter);
  /* Card shadow - lifts the whole wrapper off the page */
  filter: drop-shadow(0 2px 2px rgba(16,42,55,0.10))
          drop-shadow(0 8px 28px rgba(16,42,55,0.14));
}

.hero {
  background: linear-gradient(180deg, #e7f5fb 0%, #dcf0f8 100%);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 12px 36px 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  position: relative;
  overflow: visible;
  min-height: 184px;
}
[data-theme="dark"] .hero {
  background: linear-gradient(180deg, #16313e 0%, #0f2531 100%);
}

.wordmark {
  font-family: var(--font-logo);
  font-weight: 700;
  font-size: 72px;
  line-height: 1;
  letter-spacing: -.01em;
  color: var(--brand-blue-500);
  display: flex;
  align-items: baseline;
  gap: 4px;
  user-select: none;
}
.wordmark .w-123 { color: #ffffff; text-shadow: 0 2px 0 rgba(0,0,0,.04); -webkit-text-stroke: 1px var(--brand-blue-300); }
[data-theme="dark"] .wordmark .w-123 { color: #1f3d52; -webkit-text-stroke: 1px var(--brand-blue-400); }
.wordmark .w-ahp { color: var(--brand-blue-500); }
.tagline {
  margin-top: 6px;
  color: var(--brand-blue-500);
  font-weight: 600;
  font-size: 18px;
}

/* ---------- Hero illustration: one self-contained unit ---------- */
.hero-illustration {
  /* Enlarged ~1.3x to match the old header. Woman png is 192x163 native,
     so this is a mild, client-approved upscale. */
  --woman-w: 250px;
  --woman-h: 212px;
  width: calc(var(--woman-w) + 180px);
  max-width: 52vw;
  height: var(--woman-h);
  position: relative;
  align-self: end;
  /* Pull up so the woman's head peeks above the header, but not into topbar */
  margin-top: -26px;
  /* Let her forearms rest on the blue nav band edge with a small clean overlap */
  margin-bottom: -22px;
  /* Push hard to the right */
  margin-right: -31px;
  /* No z-index here: the woman and bubble are layered individually around the
     nav (bubble behind nav, woman in front) - see their z-index values. */
}
/* The woman, anchored bottom-right */
.hero-woman {
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--woman-w);
  height: var(--woman-h);
  z-index: 6; /* in front of the bubble (z2) and the nav (z4) */
  pointer-events: none;
  user-select: none;
  display: block;
}
/* Thought bubble - big oval, ends just before her face */
.hero-bubble {
  position: absolute;
  /* Measured from the old header.jpg and scaled 1.305x (new hero 184px vs old
     141px): oval 159x114 -> 208x149, right edge tucked 25px behind the woman
     (she is z6), bottom sitting right at the menu line (2px under). */
  right: calc(var(--woman-w) - 39px);
  bottom: 12px;
  width: 208px;
  height: 149px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid var(--brand-blue-400);
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  z-index: 2; /* behind the nav (z4) and the woman (z6) */
}
.hero-bubble .hero-bubble-glyph {
  font-size: 64px;
  line-height: 1;
}
/* Rotating legacy motif images inside the oval bubble. Stacked, cross-fade. */
.hero-bubble-img {
  position: absolute;
  inset: 0;
  margin: auto;
  /* Old header: the 145x109 motif filled 91% of the oval's width. Explicit
     width (not max-width) so it upscales with the bigger oval. */
  width: 91%;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 2s ease;
  pointer-events: none;
  user-select: none;
}
.hero-bubble-img.is-on { opacity: 1; }
/* Tail dots: 3 dots walking up-right from the oval toward her head.
   Biggest closest to the bubble, smallest closest to her forehead. */
.hero-bubble::before,
.hero-bubble::after { content: none; }
.hero-bubble-dot {
  position: absolute;
  background: #fff;
  border: 1.5px solid var(--brand-blue-400);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  z-index: 8; /* in FRONT of the woman - old header paints the dots over her hair */
}
/* Three thought dots along the header's top edge, measured from the old
   header.jpg and scaled 1.305x. They shrink hard left-to-right (cloud ->
   tiny) and run INTO her hair, reading as "the lady is thinking". */
.hero-bubble-dot-1 { /* CLOUD - wide ellipse above the oval's right end */
  width: 46px; height: 35px;
  top: 14px;
  right: calc(var(--woman-w) - 27px);
}
.hero-bubble-dot-2 { /* mid ellipse, at her hairline */
  width: 20px; height: 14px;
  top: 11px;
  right: calc(var(--woman-w) - 56px);
}
.hero-bubble-dot-3 { /* TINY, over her hair, close to her face */
  width: 7px; height: 6px;
  top: 15px;
  right: calc(var(--woman-w) - 77px);
  border-width: 1px;
}
[data-theme="dark"] .hero-bubble-dot {
  background: #1a3345;
  border-color: var(--brand-blue-300);
}

[data-theme="dark"] .hero-bubble,
[data-theme="dark"] .hero-bubble::before,
[data-theme="dark"] .hero-bubble::after {
  background: #1a3345;
  border-color: var(--brand-blue-300);
}

.thought-bubble, .thought-content, .character, .character-img { display: none !important; }

/* ---------- Nav ---------- */
.nav {
  background: var(--bg-nav);
  /* Above the bubble bottom (z2) so the oval tucks under the menu, but below the
     woman (z6) whose forearms rest in front of the bar. */
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  flex-wrap: wrap;
  /* Full-width breakout - extends edge to edge of viewport */
  position: relative;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  /* Align nav items with the shell content */
  padding-left: max(calc(var(--gutter) + 36px), calc((100vw - var(--shell-max)) / 2 + var(--gutter) + 36px));
  padding-right: max(calc(var(--gutter) + 36px), calc((100vw - var(--shell-max)) / 2 + var(--gutter) + 36px));
}
.nav a {
  color: rgba(255,255,255,.88);
  font-weight: 600;
  font-size: 14px;
  padding: 14px 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  border-radius: var(--r-sm);
  transition: background .15s;
}
/* Separator between links - the first one has nothing to its left to divide. */
.nav a:not(:first-of-type)::before {
  content: '';
  position: absolute;
  left: -3px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 14px;
  background: rgba(255,255,255,.5);
  border-radius: var(--r-sm);
}
.nav a:hover { background: rgba(255,255,255,.14); text-decoration: none; }
.nav a[aria-current="page"] { background: none; color: #fff; }

/* Menu toggle - only ever shown in the compact bar (see the 780px block). */
.nav-toggle {
  display: none;
  margin-left: auto;
  padding: 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: rgba(255,255,255,.88);
  cursor: pointer;
  position: relative;
  flex: none;
}
.nav-toggle:hover { background: rgba(255,255,255,.14); }
.nav-toggle .nt-close { display: none; }
.nav.is-open .nav-toggle .nt-open { display: none; }
.nav.is-open .nav-toggle .nt-close { display: block; }
/* Active page folded away behind the toggle - keep the orange "you are here" cue. */
.nav--current-folded .nav-toggle::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 2px;
  height: 3px;
  background: var(--accent-orange);
  border-radius: 3px 3px 0 0;
}
.nav.is-open .nav-toggle::after { display: none; }
.nav a[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 3px;
  background: var(--accent-orange);
  border-radius: 3px 3px 0 0;
}

/* ---------- Page body ---------- */
.page-body {
  background: var(--bg-card);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  padding: 28px 36px 36px;
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 36px;
  min-height: 560px;
  box-shadow: var(--shadow-md);
}
.page-body.no-sidebar { grid-template-columns: 1fr; }

.main-col { min-width: 0; }

.crumbs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--brand-blue-600);
  flex-wrap: wrap;
  gap: 10px;
}
.crumbs .crumb-path { font-weight: 600; }
.crumbs .crumb-path .sep { color: var(--ink-400); margin: 0 6px; }
.crumbs .crumb-step { color: var(--ink-500); font-size: 13px; }
.pair-progress {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  font-size: 12px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  color: var(--brand-blue-600);
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--brand-red-500);
  margin: 0 0 8px;
  letter-spacing: -.01em;
}
.page-subtitle {
  color: var(--ink-500);
  margin: 0 0 20px;
  font-size: 14px;
}

.section-title {
  color: var(--brand-red-500);
  font-weight: 700;
  font-size: 20px;
  text-align: center;
  margin: 8px 0 20px;
}

/* ---------- Step strip (wizard jump navigation) ---------- */
.step-strip { margin: 16px 0 26px; }
.step-track { display: flex; align-items: flex-start; }
.step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 86px;
  flex-shrink: 0;
  text-decoration: none;
  position: relative;
  z-index: 1;
}
.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-strong);
  color: var(--ink-500);
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.step-dot.done { background: var(--brand-blue-500); border-color: var(--brand-blue-500); color: #fff; }
a.step-node:hover .step-dot { border-color: var(--brand-blue-500); color: var(--brand-blue-600); }
a.step-node:hover .step-dot.done { background: var(--brand-blue-600); border-color: var(--brand-blue-600); color: #fff; }
.step-node[aria-current="step"] .step-dot {
  background: var(--brand-red-500);
  border-color: var(--brand-red-500);
  color: #fff;
  box-shadow: 0 2px 10px rgba(184, 42, 42, .28);
}
.step-name {
  font-size: 12px;
  line-height: 1.25;
  margin-top: 6px;
  text-align: center;
  color: var(--ink-700);
  max-width: 82px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.step-node[aria-disabled="true"] .step-name { color: var(--ink-500); }
.step-node[aria-current="step"] .step-name { color: var(--brand-red-500); font-weight: 600; }
.step-seg {
  height: 2.5px;
  flex: 1 1 12px;
  min-width: 10px;
  border-radius: 2px;
  margin: 15px -22px 0;
  background: var(--border-strong);
}
.step-seg.done { background: var(--brand-blue-500); }
.step-caption {
  display: none;
  text-align: center;
  font-size: 13px;
  color: var(--ink-500);
  margin-top: 8px;
}
.step-caption-num { color: var(--brand-red-500); font-weight: 600; }
.step-caption-name { color: var(--ink-700); font-weight: 600; }
.step-strip.compact .step-name { display: none; }
.step-strip.compact .step-caption { display: block; }
.step-strip.compact .step-node { width: 44px; }
.step-strip.compact .step-dot { width: 28px; height: 28px; font-size: 12px; }
.step-strip.compact .step-seg { margin: 13px -6px 0; }
@media (max-width: 620px) {
  .step-track {
    overflow-x: auto;
    gap: 5px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .step-track::-webkit-scrollbar { display: none; }
  .step-track > :first-child { margin-left: auto; }
  .step-track > :last-child { margin-right: auto; }
  .step-seg { display: none; }
  .step-node, .step-strip.compact .step-node { width: 26px; }
  .step-dot, .step-strip.compact .step-dot { width: 26px; height: 26px; font-size: 11px; }
  .step-dot svg { width: 13px; height: 13px; }
  .step-name { display: none; }
  .step-caption { display: block; }
}
.step-nav-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 36px 0 12px;
  padding-top: 22px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}

@media (max-width: 500px) {
  .step-nav-bottom {
    flex-wrap: nowrap;
    gap: 8px;
    margin: 12px 0 20px;
    padding-top: 14px;
  }
  .step-nav-bottom .btn {
    position: relative;
    min-width: 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    display: inline-flex;
  }
  /* Icon-only buttons: the label stays in the DOM but out of sight, so the
     button keeps an accessible name. display:none would strip that name and
     leave a nameless circle for screen readers. */
  .step-nav-bottom .btn .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .step-nav-bottom .btn svg {
    flex-shrink: 0;
  }
}
.step-nav-bottom .btn { min-height: 44px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  background: transparent;
  color: var(--ink-900);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--brand-red-500);
  color: #fff;
  box-shadow: 0 2px 10px rgba(184, 42, 42, .22);
}
/* The dark block swaps --brand-red-500 from #b82a2a to a much brighter #ff4e4e,
   which white text only reaches 3.25 against. Dark ink on the bright fill gets
   5.81, and it is the convention this codebase already picked for filled buttons
   in dark - see [data-theme="dark"] .adm-btn in admin.css. */
[data-theme="dark"] .btn-primary { color: #1a0d0d; }
.btn-primary:hover { background: var(--brand-red-600); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(184, 42, 42, .3); }

/* Disabled state - visually obvious so users know the button isn't clickable yet */
.btn:disabled,
.btn.is-disabled,
.btn[aria-disabled="true"] {
  background: var(--neutral-100, #eef0f3) !important;
  color: var(--neutral-500, #8a93a0) !important;
  border-color: var(--border-strong, #d8dde4) !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  opacity: .75;
  transform: none !important;
  filter: grayscale(.2);
}
.btn:disabled:hover,
.btn.is-disabled:hover,
.btn[aria-disabled="true"]:hover {
  background: var(--neutral-100, #eef0f3) !important;
  color: var(--neutral-500, #8a93a0) !important;
  transform: none !important;
  box-shadow: none !important;
}
.btn-primary:disabled,
.btn-primary.is-disabled,
.btn-primary[aria-disabled="true"] {
  background: #e7e9ee !important;
  color: #9aa1ad !important;
  border-color: #d8dde4 !important;
}
.btn-ghost {
  background: transparent;
  color: var(--brand-red-500);
  border-color: transparent;
}
.btn-ghost:hover { background: rgba(184, 42, 42, .07); }
.btn-outline {
  background: transparent;
  color: var(--brand-red-500);
  border-color: var(--brand-red-500);
}
.btn-outline:hover { background: var(--brand-red-500); color: #fff; }
.btn-secondary {
  background: var(--brand-blue-50);
  color: var(--brand-blue-700);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--brand-blue-100); }
.btn-icon-only {
  padding: 10px;
  border-radius: 50%;
}

.arrow { width: 14px; height: 14px; }

.footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.footer-actions .center { display: flex; gap: 12px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  /* Site-wide vars, not the --text/--surface aliases: those live in auth.css,
     which _AdminLayout does not load, so admin flashes rendered unstyled. */
  background: var(--ink-900);
  color: var(--bg-card);
  border-radius: var(--r-md);
  box-shadow: 0 16px 40px -12px rgba(0,0,0,0.4);
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  animation: toast-in 220ms ease-out;
}
.toast svg { width: 16px; height: 16px; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Results: winner card + action bar ---------- */
.winner-card {
  --gold-500: #d4a017;
  --gold-300: #f5c84b;
  --gold-100: #fff4d1;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 24px;
  margin: 8px 0 28px;
  border-radius: var(--r-lg);
  background: linear-gradient(100deg,
    color-mix(in oklch, var(--gold-300) 22%, var(--surface)) 0%,
    color-mix(in oklch, var(--gold-100) 55%, var(--surface)) 100%);
  border: 1px solid color-mix(in oklch, var(--gold-500) 35%, transparent);
  box-shadow: 0 10px 30px -18px color-mix(in oklch, var(--gold-500) 70%, transparent);
}
.winner-card-badge {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold-500);
  color: #fff;
}
.winner-card-badge svg { width: 30px; height: 30px; stroke-width: 2.2; }
.winner-card-body { min-width: 0; }
.winner-card-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.winner-card-name {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 6px;
  word-break: break-word;
}
.winner-card-sub {
  font-size: 14px;
  color: var(--text-muted);
}
.winner-card-sub strong { color: var(--text); }

/* Proposer description on Browse/View (legacy "opis") (N9). */
.view-desc {
  max-width: 720px;
  margin: 14px auto;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.view-desc-label { font-weight: 700; margin-right: 4px; }

/* Average rating + vote count next to the rate widget (N28). */
.rating-summary {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.rating-summary .muted { font-weight: 400; }

/* Structure lists shown when the result is hidden by the admin (N26). */
.struct-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.results-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.results-actions-right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}
@media (max-width: 640px) {
  .winner-card { flex-direction: column; align-items: flex-start; padding: 18px; }
  .winner-card-badge { width: 48px; height: 48px; }
  .winner-card-badge svg { width: 22px; height: 22px; }
  .results-actions, .results-actions-right { width: 100%; }
  .results-actions-right { justify-content: stretch; }
  .results-actions-right .btn { flex: 1 1 auto; }
}

/* ---------- Sidebar ---------- */
.sidebar {
  border-left: 1px dashed var(--border-strong);
  padding-left: 28px;
  min-width: 0;
}
.sidebar-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  text-decoration: none !important;
  transition: transform .15s, box-shadow .15s;
}
.sidebar-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.sidebar-card .sc-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, #e54141, #f08080);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-card .sc-title {
  color: var(--brand-red-500);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
}
.sidebar-card .sc-sub {
  color: var(--ink-500);
  font-size: 12px;
}

.sidebar h3 {
  color: var(--brand-red-500);
  font-size: 18px;
  margin: 0 0 10px;
  font-weight: 700;
}
.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar ul li {
  padding: 6px 0;
  border-bottom: 1px dotted var(--border-soft);
}
.sidebar ul li a {
  color: var(--brand-red-500);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar ul li a::before {
  content: '›';
  color: var(--brand-blue-500);
  font-weight: 700;
}

/* ---------- Site footer ---------- */
.site-footer {
  max-width: var(--shell-max);
  margin: 10px auto 18px;
  padding: 0 var(--gutter);
  text-align: center;
  color: var(--brand-blue-600);
  font-size: 13px;
}
.site-footer .links { margin-bottom: 8px; }
.site-footer .links a {
  color: var(--brand-blue-600);
  margin: 0 10px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
}
.site-footer .company {
  margin-top: 8px;
  color: var(--brand-blue-400);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
}

/* ---------- Forms ---------- */
.field-label {
  display: block;
  /* 700, not 600: #247ea3 measured 4.04 on white - under AA in light mode too,
     not just dark. 700 (#1a5f7d) is the same hue one stop deeper and reaches 7.14.
     Visible change: labels read slightly darker across every form on the site. */
  color: var(--brand-blue-700);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}
/* The dark block redefines the 50..300 brand stops but leaves 400+ alone, so both
   600 and 700 keep their light-mode values and go too dark on a dark card. 400
   stays light by design and lands at ~7.6. */
[data-theme="dark"] .field-label { color: var(--brand-blue-400); }
.input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg-card);
  color: var(--ink-900);
  font-size: 15px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none;
  border-color: var(--brand-blue-500);
  box-shadow: 0 0 0 3px rgba(58, 155, 193, .15);
}

.row-gap { display: grid; gap: 10px; }

.inline-add {
  display: inline-flex;
  gap: 8px;
  margin-top: 12px;
}
.inline-add button {
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--brand-blue-500);
  background: var(--brand-blue-500);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  box-shadow: 0 2px 8px rgba(58, 155, 193, .25);
}
.inline-add button svg { display: block; }
.inline-add button:hover {
  background: var(--brand-blue-600);
  border-color: var(--brand-blue-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(58, 155, 193, .4);
}
.inline-add button.danger {
  background: var(--bg-card);
  color: var(--brand-red-500);
  border-color: var(--brand-red-500);
  box-shadow: 0 2px 8px rgba(184, 42, 42, .12);
}
.inline-add button.danger:hover {
  background: var(--brand-red-500);
  color: #fff;
  box-shadow: 0 4px 14px rgba(184, 42, 42, .35);
}

/* ---------- Model type pills ---------- */
.model-type {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.model-type label {
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 16px 20px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 110px;
  transition: all .15s;
  background: var(--bg-card);
}
.model-type label:hover { border-color: var(--brand-blue-500); transform: translateY(-1px); }
.model-type input { display: none; }
.model-type input:checked + .mt-content {
  color: var(--brand-red-500);
}
.model-type label:has(input:checked) {
  border-color: var(--brand-red-500);
  box-shadow: 0 0 0 3px rgba(184, 42, 42, .12);
}
.mt-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 18px;
}
.mt-single { background: linear-gradient(135deg, #8a1f4a, #c23a6b); }
.mt-team   { background: linear-gradient(135deg, #e54141, #f08080); }
.mt-group  { background: linear-gradient(135deg, #46b86e, #f0a030 50%, #e54141); }
.mt-content { font-weight: 600; font-size: 14px; color: var(--ink-700); }

/* ---------- Comparison scale ---------- */
.compare-row {
  margin: 24px 0;
  text-align: center;
}
.compare-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 620px;
  margin: 0 auto 10px;
  padding: 0 6px;
}
.compare-label {
  color: var(--brand-blue-500);
  font-weight: 600;
  font-size: 16px;
  max-width: 40%;
  text-align: center;
}
.compare-label.is-preferred {
  color: var(--brand-red-500);
}
.compare-ratio {
  color: var(--ink-500);
  font-size: 12px;
  font-family: ui-monospace, monospace;
  border-top: 1px dashed var(--ink-400);
  border-bottom: 1px dashed var(--ink-400);
  padding: 2px 10px;
  min-width: 50px;
  text-align: center;
}
.compare-ratio.is-prompt {
  font-family: inherit;
  font-style: italic;
  font-size: 12px;
  color: var(--brand-red-600, #B82A2A);
  white-space: nowrap;
  border-top-color: transparent;
  border-bottom-color: transparent;
  padding: 2px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: promptPulse 1.6s ease-in-out infinite;
}
.compare-ratio.is-prompt .prompt-caret {
  font-style: normal;
  font-size: 14px;
  line-height: 1;
  animation: promptBounce 1.2s ease-in-out infinite;
}
@keyframes promptPulse {
  0%, 100% { opacity: .75; }
  50%      { opacity: 1; }
}
@keyframes promptBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(2px); }
}

.scale {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  max-width: 760px;
  margin: 0 auto;
}

/* Flat slider variant */
.scale.flat {
  position: relative;
  padding: 22px 14px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  max-width: 760px;
  gap: 6px;
}
.scale.flat::before { display: none; }
.scale.flat .scale-btn {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-700);
  background: var(--bg-card);
  cursor: pointer;
  transition: all .12s;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.scale.flat .scale-btn.size-sm { width: 30px; height: 30px; font-size: 13px; }
.scale.flat .scale-btn.size-xs { width: 26px; height: 26px; font-size: 12px; }
.scale.flat .scale-btn:hover {
  border-color: var(--brand-blue-500);
  color: var(--brand-blue-700);
  background: var(--brand-blue-50);
}
.scale.flat .scale-btn.selected {
  background: var(--accent-orange);
  color: #fff;
  border-color: var(--accent-orange);
  box-shadow: 0 4px 12px rgba(230, 130, 70, .35);
  transform: translateY(-4px) scale(1.15);
  border-radius: 4px;
}

/* ---------- Result bars ---------- */
/* Every list in the views is "result-list v2", so the .v2 rule below overrides
   both of these. Kept because the token is what .result-list.v2 hangs off. */
.result-list {
  max-width: 640px;
  margin: 0 auto;
}

/* ---------- Result bars v2 - the "real" one ---------- */
.result-list.v2 {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.result-row-v2 {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: stretch;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg, 14px);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.result-row-v2:hover {
  border-color: var(--border-strong);
}
.result-row-v2.is-winner {
  background: linear-gradient(180deg,
    color-mix(in oklch, #f2c25a 18%, var(--bg-card)) 0%,
    color-mix(in oklch, #f2c25a 4%, var(--bg-card)) 65%,
    var(--bg-card) 100%);
  border-color: color-mix(in oklch, #d4a53a 55%, var(--border-soft));
  box-shadow:
    0 1px 0 rgba(212, 165, 58, .08),
    0 10px 24px -16px rgba(180, 135, 30, .35);
}
/* Rank badge */
.rv-rank {
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 2px;
}
.rv-rank-num {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-subtle);
  color: var(--ink-500);
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border-soft);
  letter-spacing: -0.02em;
}
.result-row-v2.is-winner .rv-rank-num {
  background: linear-gradient(180deg, #f4ce6a 0%, #d4a53a 100%);
  color: #3a2a00;
  border-color: #b88a1f;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55),
    inset 0 -1px 0 rgba(120, 80, 0, .15),
    0 2px 8px rgba(180, 135, 30, .35);
  font-size: 16px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .4);
}
/* Body: name row + track + sub */
.rv-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rv-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; min-width: 0;
}
.rv-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-900);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.result-row-v2.is-winner .rv-name {
  color: #8a6515;
  font-weight: 700;
}
.rv-share {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink-500);
  flex-shrink: 0;
  display: inline-flex; align-items: baseline; gap: 2px;
}
.rv-share strong {
  font-size: 17px;
  color: var(--ink-700);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.rv-share .rv-unit { font-size: 12px; color: var(--ink-400, #9aa1ad); }
.result-row-v2.is-winner .rv-share strong { color: #8a6515; }

/* Track + fill - flat, no gradient, confident */
.rv-track {
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.rv-fill {
  height: 100%;
  background: var(--ink-300, #bfc6d1);
  border-radius: 999px;
  transition: width .55s cubic-bezier(.2, .8, .2, 1);
}
.rv-fill.blue    { background: var(--brand-blue-400, #6fb1cf); }
.rv-fill.is-winner {
  background: linear-gradient(90deg, #f4ce6a 0%, #d4a53a 100%);
}
/* Segmented version for StructuredResultList */
.rv-stack {
  height: 100%;
  display: flex;
  border-radius: 999px;
  overflow: hidden;
  transition: width .55s cubic-bezier(.2, .8, .2, 1);
}
.rv-seg {
  height: 100%;
  position: relative;
  cursor: help;
  transition: filter .15s ease;
}
.rv-seg:hover { filter: brightness(1.12); }
/* Thicker track for structured (multi-segment) rows */
.rv-track-thick { height: 16px; border-radius: 999px; }
.v2-structured .rv-track { height: 16px; }

.rv-sub {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px;
  color: var(--ink-400, #9aa1ad);
  margin-top: 1px;
}
.rv-sub code {
  font-family: ui-monospace, monospace;
  background: transparent;
  color: var(--ink-500);
  padding: 0;
}

/* Criterion colour legend under the structured list */
.rv-legend {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 16px;
  max-width: 680px;
  margin: 14px auto 0;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink-500);
  border-top: 1px dashed var(--border-soft);
}
/* Prominent version at the top of the structured list */
.rv-legend.rv-legend-top {
  margin: 0 auto 12px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md, 10px);
  font-size: 12.5px;
  color: var(--ink-700);
}
.rv-legend-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-500);
  margin-right: 4px;
}
.rv-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.rv-legend-chip {
  width: 12px; height: 12px; border-radius: 3px;
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(0,0,0,.06) inset;
}
.rv-legend-name { font-weight: 500; }

@media (max-width: 560px) {
  .result-row-v2 { grid-template-columns: 36px 1fr; padding: 12px 12px; gap: 10px; }
  .rv-rank-num { width: 30px; height: 30px; font-size: 13px; border-radius: 8px; }
  .rv-name { font-size: 14px; }
  .rv-share strong { font-size: 15px; }
}

/* ---------- Intermediate steps (redesigned) ---------- */

.imd-header { margin-bottom: 28px; }
.imd-title {
  font-size: 26px; font-weight: 800; color: var(--ink-900);
  margin: 0 0 6px; letter-spacing: -.02em;
}
.imd-subtitle { color: var(--ink-500); font-size: 14px; margin: 0; }

.imd-flow { display: flex; flex-direction: column; gap: 20px; }

.imd-card {
  border-radius: var(--r-lg);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.imd-card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; flex-wrap: wrap; row-gap: 8px;
}
.imd-card-head.accent-blue    { background: var(--brand-blue-100); border-bottom: 1px solid var(--brand-blue-200); }
.imd-card-head.accent-red     { background: color-mix(in oklch, var(--brand-red-500) 9%, var(--bg-card)); border-bottom: 1px solid color-mix(in oklch, var(--brand-red-400) 25%, transparent); }
.imd-card-head.accent-gold    { background: color-mix(in oklch, #d4a017 12%, var(--bg-card)); border-bottom: 1px solid color-mix(in oklch, #d4a017 30%, transparent); }
.imd-card-head.accent-neutral { background: var(--bg-subtle); border-bottom: 1px solid var(--border-soft); }

[data-theme="dark"] .imd-card-head.accent-blue    { background: var(--brand-blue-200); border-bottom-color: var(--brand-blue-300); }
[data-theme="dark"] .imd-card-head.accent-red     { background: color-mix(in oklch, var(--brand-red-500) 18%, var(--bg-card)); }
[data-theme="dark"] .imd-card-head.accent-gold    { background: color-mix(in oklch, #d4a017 20%, var(--bg-card)); }
[data-theme="dark"] .imd-card-head.accent-neutral { background: var(--bg-header); }

.imd-step-badge {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-blue-500); color: #fff;
  font-size: 12px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.accent-red  .imd-step-badge { background: var(--brand-red-500); }
.accent-gold .imd-step-badge { background: #c59215; }

.imd-card-title { font-size: 14px; font-weight: 700; color: var(--ink-900); flex: 1; letter-spacing: -.01em; }
.imd-crit-tag   { font-style: normal; color: var(--brand-red-500); font-weight: 700; }

.imd-meta-row {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto; flex-shrink: 0;
}
.imd-meta-stat {
  display: inline-flex; align-items: baseline; gap: 5px;
  font-size: 14px; font-family: ui-monospace, monospace;
  color: var(--ink-700);
}
.imd-meta-stat + .imd-meta-stat {
  margin-left: 0;
}
.imd-meta-stat + .imd-meta-stat::before { content: none; }
.imd-meta-sep {
  color: var(--ink-400);
  font-size: 16px;
  line-height: 1;
  user-select: none;
}
.imd-meta-key {
  font-size: 13px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-700); margin-right: 2px;
}
.imd-meta-dot { display: none; }

.imd-card-body { background: var(--bg-card); padding: 16px 18px 18px; }
.imd-table-wrap { overflow-x: auto; }

.imd-table { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.imd-table th,
.imd-table td { padding: 9px 14px; text-align: center; border: 1px solid var(--border-soft); }
.imd-table tbody th {
  text-align: left; font-weight: 600; color: var(--ink-900);
  background: var(--bg-subtle); white-space: nowrap;
}
.imd-table thead th {
  font-weight: 700; font-size: 12px; letter-spacing: .01em;
  color: var(--brand-blue-700); background: var(--brand-blue-50); white-space: nowrap;
}
.imd-table thead th.imd-th-result { color: #7a5500; background: color-mix(in oklch, #d4a017 14%, var(--bg-card)); }
.imd-table .imd-th-corner         { background: var(--bg-subtle); }
.imd-table td.imd-diag    { background: var(--brand-blue-50); color: var(--brand-blue-700); font-weight: 600; }
.imd-table td.imd-td-result { background: color-mix(in oklch, #d4a017 10%, var(--bg-card)); color: #7a5500; font-weight: 700; }
.imd-table tbody td { color: var(--ink-700); }
.imd-table tbody tr:nth-child(even) td,
.imd-table tbody tr:nth-child(even) th { background: color-mix(in oklch, var(--bg-subtle) 60%, var(--bg-card)); }
.imd-table tbody tr:nth-child(even) td.imd-diag      { background: color-mix(in oklch, var(--brand-blue-100) 70%, var(--bg-card)); }
.imd-table tbody tr:nth-child(even) td.imd-td-result { background: color-mix(in oklch, #d4a017 14%, var(--bg-card)); }

.imd-summary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Mobile summary styles */
.imd-mobile-note {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--brand-blue-50); border: 1px solid var(--brand-blue-200);
  border-radius: var(--r-md); padding: 10px 14px;
  font-size: 13px; color: var(--brand-blue-700);
  margin-bottom: 20px;
}
.imd-mobile-note svg { flex-shrink: 0; margin-top: 1px; }
.imd-mobile-section {
  font-size: 14px; font-weight: 700; color: var(--ink-700);
  margin: 20px 0 8px; letter-spacing: -0.01em;
}
@media (max-width: 700px) {
  .imd-summary-row { grid-template-columns: 1fr; }
  .imd-meta-row    { margin-left: 0; width: 100%; }
}

/* ---------- Benefit-to-cost table ---------- */
.bc-table {
  margin: 0 auto;
  border-collapse: collapse;
  max-width: 520px;
  width: 100%;
}
.bc-table th {
  text-align: center;
  color: var(--brand-blue-600);
  font-weight: 600;
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-soft);
}
.bc-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.bc-table td.label {
  color: var(--brand-blue-600);
  font-weight: 600;
  text-align: right;
  width: 50%;
}
.bc-table .input { max-width: 160px; }

/* ---------- CR pill ---------- */
.cr-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--bg-subtle);
  color: var(--ink-700);
  font-size: 13px;
  font-family: ui-monospace, monospace;
  margin: 24px auto;
}
.cr-pill .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #46b86e;
}
.cr-pill .dot.warn { background: #e68246; }
.cr-pill .dot.bad  { background: #e24545; }

/* Step CR pill: reuses .cr-pill; sits left of the step buttons in .step-nav-bottom
   while it fits there, and drops onto its own row when it does not.
   flex-basis must stay auto: with basis 0 the pill reports zero width to the
   line-breaking step, so it never wraps and instead absorbs whatever the buttons
   leave over - on a narrow row that crushed it below its min-content width and
   spilled the red recommendation across the buttons. */
/* margin-left overrides the auto that .cr-pill uses to centre itself on the
   results pages: here the pill lines up with the left edge of the step row. */
.step-cr { flex: 0 1 auto; flex-wrap: wrap; min-width: 0; max-width: fit-content; margin-left: 0; margin-right: auto; }
.step-cr[hidden] { display: none; }
.step-cr .cr-msg { font-size: 12px; color: var(--brand-red-500); }
/* The step buttons wrap as one unit, so a pill that drops to its own row can
   never split them across two rows. */
.step-nav-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; }
@media (max-width: 500px) {
  .step-nav-bottom:has(.step-cr) { flex-wrap: wrap; }
  .step-cr { flex-basis: 100%; margin: 0 0 10px; justify-content: center; }
  .step-nav-actions { flex: 1 1 100%; justify-content: space-between; gap: 8px; margin-left: 0; }
}

/* ---------- Public library: compact horizontal rows (.pc-) ---------- */
/* Single-column list; each row is a 4-track grid that collapses to stacked
   grid areas under 700px. The popup anchors live on .pc-struct-line /
   .pc-star-wrap, not on the ellipsis-clipped text, so overflow:hidden on the
   text never eats the popup. */
.pc-list { display: flex; flex-direction: column; gap: 8px; }
.pc-row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.65fr) 150px;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--brand-blue-500);
  border-radius: 0 10px 10px 0;
}
.pc-icon {
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; overflow: hidden;
  background: var(--brand-blue-50); border: 1px solid var(--border-soft);
}
.pc-icon img { width: 100%; height: 100%; object-fit: contain; }
.pc-title-block { min-width: 0; }
.pc-title {
  display: block; font-size: 12.5px; font-weight: 700; color: #185BAA;
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-title:hover { text-decoration: underline; }
.pc-meta {
  margin-top: 2px; font-size: 11px; color: var(--ink-500);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-struct { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-struct-line { position: relative; display: flex; align-items: baseline; font-size: 11.5px; min-width: 0; }
.pc-struct-text {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-700);
}
.pc-struct-label { font-weight: 700; margin-right: 4px; }
.pc-more {
  flex-shrink: 0; margin-left: 4px; padding: 0 6px;
  font-size: 10.5px; font-weight: 700; line-height: 1.6;
  border-radius: var(--r-pill); cursor: pointer;
  background: var(--brand-blue-50); border: 1px solid var(--border-strong); color: var(--brand-blue-700);
}
.pc-pop {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 4px;
  max-width: 300px; width: max-content; padding: 10px 12px; z-index: 20;
  /* Literal, not var(--ink-900): that flips to near-white in dark mode and put
     white text on a white tooltip. A tooltip stays dark in both themes. */
  background: #102a37; color: #fff; font-size: 11.5px; line-height: 1.4;
  border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.pc-pop.is-open { display: block; }
@media (hover: hover) { .pc-struct-line:hover .pc-pop { display: block; } }
.pc-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 0; }
.pc-star-wrap { position: relative; min-width: 0; }
.pc-star {
  display: flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: #e7f5ec; border: 1px solid #bfe3cd; color: #256c43;
  font-size: 11.5px; font-weight: 700; cursor: default;
}
.pc-star svg { flex-shrink: 0; }
.pc-star-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Rows whose result is hidden or missing say so instead of a winner pill. */
.pc-nores {
  display: flex; align-items: center; justify-content: center;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--bg-subtle); border: 1px dashed var(--border-strong);
  color: var(--ink-500); font-size: 11px; font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-btn { justify-content: center; text-align: center; }

/* Dark theme for the row. The block above was authored against a white card, so
   its blues and greens are light-ramp literals; once .pc-row follows --bg-card
   they all land on a dark surface and need answering. The 400/500 brand stops are
   the ones that stay light in dark mode - 50..300 invert. */
[data-theme="dark"] .pc-title {
  /* !important is deliberate: it beats the per-calculation LibraryHeaderFontColor
     inline style. That colour is picked against a white card - one real row ships
     #0E099E, a near-black blue - so on a dark card it is unreadable rather than
     decorative. Light mode still honours it. */
  color: var(--brand-blue-400) !important;
}
[data-theme="dark"] .pc-more {
  background: var(--brand-blue-50);
  border-color: var(--border-strong);
  color: var(--brand-blue-400);
}
[data-theme="dark"] .pc-star {
  background: rgba(124, 201, 124, .12);
  border-color: rgba(124, 201, 124, .3);
  color: #7cc97c;
}
/* The tooltip is dark on a dark card, so it needs an edge to sit apart. */
[data-theme="dark"] .pc-pop { border: 1px solid var(--border-strong); }
/* Toolbar: one horizontal line of labeled filters (wraps on narrow screens).
   The doubled selector outranks .mm-toolbar's space-between from
   my-models.css, which loads later. */
.mm-toolbar.pc-toolbar { justify-content: flex-start; align-items: flex-start; }

/* ---------- Pager (shared by the admin lists and the public library) ---------- */
/* Moved here from admin.css: only _AdminLayout loads that file, so the rules
   could never reach Browse/Public once it started sharing the _Pager partial.
   Radius stays a literal 8px rather than --r-sm so the "sharp corners" theme does
   not silently restyle a control that never followed it. */
.pager {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
/* Numbers are plain text. The boxes they used to carry were chrome doing no work,
   and eleven of them read as a wall; without them the filled current page is the
   only thing the eye has to find.
   button belongs here too: the jump's submit is a <button>, and leaving it out
   left it a raw browser control - 23px tall against the 32px input, square, 2px
   border, sitting 4px low - wearing only .pg-arrow's colours. */
.pager a,
.pager span,
.pager button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-700);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}
.pager button { cursor: pointer; }
.pager a:hover { background: var(--bg-subtle); }
/* Literal #fff, not --ink-inverse: that flips to near-black in dark mode and
   would put dark text on the dark-blue pill. */
.pager a.is-on {
  background: var(--brand-blue-700);
  border-color: var(--brand-blue-700);
  border-radius: var(--r-pill);
  color: #fff;
}
/* Inherits --ink-700 from the base rule. It used --ink-500 to recede, but that
   measured 3.95 on white - the same muted stop that fails for .hint and
   .mm-meta-date in light. The gap either side already separates it. */

/* Arrows keep a box - stepping is the common move, so it gets the target. The box
   is what sets them apart from the numbers, so the glyph can share --ink-700;
   --ink-500 looked right but measured 4.48 on white, a hair under AA. */
.pager .pg-arrow {
  border-color: var(--border-soft);
  background: var(--bg-card);
  color: var(--ink-700);
}
.pager .pg-arrow:hover { background: var(--bg-subtle); border-color: var(--border-strong); }
/* First/last page: the arrow stays in place so the row does not reflow. */
.pager .pg-arrow.is-off { opacity: .4; }

/* Jump box, shown whenever the pager shows. The rule splits the two jobs:
   browse nearby on the left, travel on the right. */
/* border:0 matters - .pager span hands every chip a 1px transparent border, and
   under border-box those two borders alone would make this rule 2px wide. */
.pager .pg-sep {
  min-width: 1px;
  width: 1px;
  padding: 0;
  border: 0;
  height: 22px;
  background: var(--border-soft);
  margin: 0 6px;
}
.pager .pg-jump-form { display: flex; align-items: center; gap: 6px; }
/* --ink-700, not --ink-500: "Go to" is real UI text, and --ink-500 measured 3.95
   on white. The lighter weight is what keeps it from competing with the numbers. */
.pager .pg-jump-label { font-size: 12.5px; font-weight: 400; color: var(--ink-700); white-space: nowrap; }
.pager input.pg-jump {
  width: 64px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--ink-700);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
}
.pager input.pg-jump:focus-visible { outline: 2px solid var(--brand-blue-500); outline-offset: 1px; }
/* Spinners are unreadable at 64px and the arrows next to them mean something
   else entirely. */
.pager input.pg-jump { -moz-appearance: textfield; appearance: textfield; }
.pager input.pg-jump::-webkit-outer-spin-button,
.pager input.pg-jump::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pager .pg-go { flex: none; }
.pc-toolbar .mm-search { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.pc-toolbar input[name="q"] { width: 200px; }
.pc-label { font-size: 11px; font-weight: 700; color: var(--ink-500); line-height: 1.3; }
/* The checkbox slot matches the 43px inputs so every label sits on one line. */
.pc-check { display: flex; align-items: center; min-height: 43px; }
.pc-check input { width: 16px; height: 16px; cursor: pointer; }
@media (max-width: 700px) {
  .pc-row {
    grid-template-columns: auto 1fr;
    grid-template-areas: "icon title" "struct struct" "actions actions";
    gap: 8px 10px;
  }
  .pc-icon { grid-area: icon; }
  .pc-title-block { grid-area: title; }
  .pc-struct { grid-area: struct; }
  .pc-actions { grid-area: actions; flex-direction: row; align-items: center; justify-content: space-between; }
  .pc-star-wrap { flex: 0 1 auto; }
  .pc-btn { flex: 0 0 auto; }
}

/* ---------- Home: hero method + grid ---------- */
/* minmax(0, ...) keeps the examples strip's intrinsic width from inflating
   the column (grid items default to min-width auto). */
.home-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 28px;
}
@media (max-width: 900px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
}
.method-pane {
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 22px;
  align-self: start; /* hug the text - no empty stretch beside taller cards */
}
.method-pane h2 {
  color: var(--brand-red-500);
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 12px;
}
.method-pane p {
  color: var(--ink-700);
  font-size: 14px;
  margin: 0 0 12px;
}
.method-pane .more {
  color: var(--brand-red-500);
  font-weight: 700;
  font-size: 13px;
}

/* Example bodies are legacy HTML with layout tables sized to content,
   which squeezes the text cell next to a wide image. Stretch them. */
.example-body table { width: 100%; }
.example-body td { word-break: normal; }
.example-body img { max-width: 100%; height: auto; }

/* Topbar light/dark toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-700);
  margin-right: 10px;
}
.theme-toggle:hover { border-color: var(--border-strong); }
.theme-toggle .tt-moon { display: none; }
[data-theme="dark"] .theme-toggle .tt-moon { display: block; }
[data-theme="dark"] .theme-toggle .tt-sun { display: none; }

/* Legacy article content (method/guide/about/terms) - text migrated from
   123ahp.com with presentation stripped; typography supplied here. */
.legacy-content { line-height: 1.65; }
.legacy-content p { font-size: 14.5px; }
.legacy-content h1,
.legacy-content h2,
.legacy-content h3,
.legacy-content h4 {
  color: var(--brand-red-500);
  font-weight: 700;
  margin: 22px 0 10px;
}
.legacy-content h1 { font-size: 24px; }
.legacy-content h2 { font-size: 20px; }
.legacy-content h3 { font-size: 17px; }
.legacy-content h4 { font-size: 15px; }
.legacy-content strong, .legacy-content b { color: var(--ink-900); }
.legacy-content em { color: inherit; }
.legacy-content ul, .legacy-content ol {
  margin: 0 0 14px;
  padding-left: 24px;
  color: var(--ink-700);
  font-size: 14.5px;
}
.legacy-content li { margin-bottom: 6px; }
.legacy-content a { color: var(--brand-red-500); font-weight: 600; }
.legacy-content a:hover { text-decoration: underline; }
.legacy-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-md);
  margin: 10px 0;
}
.legacy-content table {
  border-collapse: collapse;
  margin: 14px 0;
  max-width: 100%;
  font-size: 13.5px;
}
.legacy-content table td,
.legacy-content table th {
  border: 1px solid var(--border-soft);
  padding: 6px 10px;
  color: var(--ink-700);
}
.legacy-content hr {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 18px 0;
}
.legacy-content .legacy-cta {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Single column so the model card's hierarchy illustration renders wide
   enough to read (item 19); the calculator card stacks below it. minmax(0,)
   so the examples strip's intrinsic width cannot widen the column. */
.home-illos {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}
.illo-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 20px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.illo-card h3 {
  color: var(--brand-red-500);
  font-size: 17px;
  margin: 0;
  font-weight: 700;
}
.illo-card .illo {
  aspect-ratio: 16/10;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--brand-blue-50), var(--brand-blue-100));
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-blue-600);
  text-align: center;
  padding: 14px;
  position: relative;
  overflow: hidden;
}
.illo-card .illo svg { max-width: 100%; height: auto; }

/* Home examples rotator: a clipped strip of example thumbnails flanked by
   round arrow buttons, mirroring the legacy welcome-page rotator. */
.home-ex-strip-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.home-ex-arrow {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--brand-red-500);
  background: #fff;
  color: var(--brand-red-500);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.home-ex-arrow:hover {
  background: var(--brand-red-500);
  color: #fff;
}
.home-ex-clip {
  flex: 1;
  overflow: hidden;
}
.home-ex-strip {
  display: flex;
  gap: 10px;
  transition: transform .35s ease;
}
/* Two thumbnails fill the clip (one on narrow phones); 5/3 is the legacy
   250x150 thumbnail ratio. */
.home-ex-thumb {
  flex: 0 0 calc(50% - 5px);
  display: block;
}
@media (max-width: 480px) {
  .home-ex-thumb { flex-basis: 100%; }
}
.home-ex-thumb img {
  width: 100%;
  aspect-ratio: 5 / 3;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  display: block;
}

/* Mini demo sliders on home (abacus-style) */
.abacus {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 4px;
}
.abacus-row {
  position: relative;
  height: 22px;
}
.abacus-row .track {
  position: absolute;
  top: 50%;
  left: 8px;
  right: 8px;
  height: 3px;
  background: var(--brand-blue-300);
  border-radius: var(--r-sm);
  transform: translateY(-50%);
  opacity: .6;
}
.abacus-row .bead {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff, rgba(255,255,255,0) 50%), linear-gradient(180deg, #cfeaf4, #7cc0d8);
  box-shadow: 0 2px 4px rgba(36, 126, 163, .3);
  transform: translate(-50%, -50%);
  cursor: grab;
  transition: background .15s, transform .2s cubic-bezier(.2, .8, .2, 1);
}
.abacus-row .bead.active {
  background: radial-gradient(circle at 35% 28%, #ffd0d0, rgba(255,208,208,0) 50%), linear-gradient(180deg, #e04a4a, #9a1f1f);
}
.abacus-row .bead:hover { transform: translate(-50%, -50%) scale(1.15); }
.abacus-label {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: var(--brand-blue-600);
  text-align: right;
  padding-right: 10px;
}

/* Home layout B: hero (method pitch + CTA beside the large hierarchy
   illustration), then calculator + examples slider in one row. */
.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 30px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 34px 38px;
}
.home-hero h1 {
  color: var(--brand-red-500);
  font-size: 30px;
  margin: 0 0 12px;
  font-weight: 700;
}
.home-hero p { color: var(--ink-700); font-size: 15px; margin: 0 0 10px; }
.home-hero-quote { color: var(--ink-500); font-size: 13.5px; font-style: italic; }
.home-hero-cta {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
  flex-wrap: wrap;
}
.home-hero img { max-width: 100%; height: auto; display: block; }

.home-duo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 26px;
  margin-top: 26px;
  align-items: stretch;
}
/* A language with no featured entries leaves the calculator card alone in the
   grid - give it the whole row instead of a third of it. */
.home-duo-solo { grid-template-columns: minmax(0, 1fr); }
.home-ex-list-card { margin-top: 26px; }
/* Example links in their own full-width card below the duo - the sidebar list
   restyled into columns (styling mirrors .sidebar ul). */
.home-ex-list {
  list-style: none;
  padding: 10px 0 0;
  margin: 0;
  columns: 4;
  column-gap: 28px;
}
.home-ex-list li {
  padding: 5px 0;
  border-bottom: 1px dotted var(--border-soft);
  break-inside: avoid;
}
.home-ex-list li a {
  color: var(--brand-red-500);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.home-ex-list li a::before {
  content: '\203A';
  color: var(--brand-blue-500);
  font-weight: 700;
}
/* Ahead of the 480px rule on purpose: both match on a narrow screen and they
   carry the same specificity, so the last one in source order has to be the
   1-column step. */
@media (max-width: 900px) { .home-ex-list { columns: 2; } }
@media (max-width: 480px) { .home-ex-list { columns: 1; } }
@media (max-width: 900px) {
  .home-hero { grid-template-columns: minmax(0, 1fr); padding: 26px; }
  .home-duo { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Utility ---------- */
.muted { color: var(--ink-500); }
.center { text-align: center; }
.hint { color: var(--ink-500); font-size: 13px; text-align: center; margin: 0 0 16px; }
.divider { height: 1px; background: var(--border-soft); margin: 22px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .page-body { grid-template-columns: 1fr; padding: 24px 20px; }
  .sidebar { border-left: none; border-top: 1px dashed var(--border-strong); padding-left: 0; padding-top: 24px; }
  /* Illustration scaled 0.8x from the desktop base (woman 250 -> 200). */
  .hero { padding: 10px 24px 6px; min-height: 148px; }
  .hero-illustration { --woman-w: 200px; --woman-h: 170px; width: calc(var(--woman-w) + 144px); height: var(--woman-h); margin-top: -21px; margin-bottom: -18px; }
  .hero-bubble { width: 166px; height: 119px; right: calc(var(--woman-w) - 31px); bottom: 10px; }
  .hero-bubble .hero-bubble-glyph { font-size: 51px; }
  .hero-bubble-dot-1 { width: 37px; height: 28px; top: 11px; right: calc(var(--woman-w) - 22px); }
  .hero-bubble-dot-2 { width: 16px; height: 11px; top: 9px; right: calc(var(--woman-w) - 45px); }
  .hero-bubble-dot-3 { width: 6px; height: 5px; top: 12px; right: calc(var(--woman-w) - 62px); }
  .wordmark { font-size: 54px; }
  /* Drop the full-bleed breakout. Edge-to-edge reads as deliberate on a wide
     window, but down here the bar only overhangs the hero card by the shell
     gutter (12-28px), which just looks misaligned. Joining the card keeps
     hero + nav + page-body reading as the single block they are. */
  .nav {
    width: auto;
    left: auto;
    transform: none;
    padding: 0 8px;
  }
  .nav a { padding: 12px 10px; font-size: 13px; }
  .topbar-meta { font-size: 12px; gap: 12px; }
  .scale { gap: 4px; max-width: 100%; overflow-x: auto; padding-bottom: 6px; }
  .scale.flat { padding: 18px 10px 12px; gap: 4px; }
  .scale.flat .scale-btn { width: 32px; height: 32px; font-size: 13px; }
  .scale.flat .scale-btn.size-sm { width: 28px; height: 28px; font-size: 12px; }
  .scale.flat .scale-btn.size-xs { width: 24px; height: 24px; font-size: 11px; }
}

/* Hero illustration fine-tuning for small tablets/phones. MUST come after the
   900px block so its smaller sizes win when both media queries match. */
@media (max-width: 760px) {
  /* Illustration scaled 0.72x from the desktop base (woman 250 -> 180). */
  .hero { min-height: 134px; }
  .hero-illustration { --woman-w: 180px; --woman-h: 153px; width: calc(var(--woman-w) + 130px); height: var(--woman-h); margin-top: -19px; margin-bottom: -16px; }
  .hero-bubble { width: 150px; height: 107px; right: calc(var(--woman-w) - 28px); bottom: 9px; }
  .hero-bubble .hero-bubble-glyph { font-size: 46px; }
  .hero-bubble-dot-1 { width: 33px; height: 25px; top: 10px; right: calc(var(--woman-w) - 19px); }
  .hero-bubble-dot-2 { width: 14px; height: 10px; top: 8px; right: calc(var(--woman-w) - 40px); }
  .hero-bubble-dot-3 { width: 5px;  height: 4px;  top: 11px; right: calc(var(--woman-w) - 55px); }
}

/* ---------- Compact nav (≤600px) ----------
   Re-measured after "javni izračuni" joined the bar, at the ≤900px link sizing:
   the six Croatian links need 471px (English 457px - its longer public label is
   offset by shorter labels elsewhere). The bar keeps a constant 72px of chrome,
   so it offers 528px at 600px wide and the links stop fitting near 543px. 600
   keeps ~57px of slack. Note this only holds while nav.* is hr/en; a language
   with longer labels (German) would need the breakpoint raised with it.
   Only the first two links stay in the bar; the rest fold behind the toggle and
   reappear as full-width rows when it is open. */
@media (max-width: 600px) {
  .nav { flex-wrap: wrap; }
  .nav-toggle { display: inline-flex; }
  .nav a:nth-of-type(n+3) { display: none; }
  /* order keeps the button on the top row: the unfolded links follow it in flex
     order, so they wrap below instead of shoving it down to the last row. */
  .nav.is-open a:nth-of-type(n+3) { display: flex; flex: 0 0 100%; order: 1; }
  /* The "|" tick reads as a separator between inline links, not stacked rows. */
  .nav.is-open a:nth-of-type(n+3)::before { display: none; }
}

/* ---------- Mobile slider (≤500px) ---------- */
.scale-mobile { display: none; }
.scale-desktop { display: flex; }

@media (max-width: 500px) {
  .scale-desktop { display: none !important; }
  .scale-mobile { display: block; padding: 4px 0 8px; }

  /* Hide woman + bubbles on mobile, compact header */
  .hero-illustration { display: none !important; }
  .hero { min-height: unset !important; padding: 16px 20px 12px !important; }

  /* Allow page-level horizontal scroll for wide tables */
  body { overflow-x: auto; }
  .shell { overflow-x: visible; }
  .page-body { overflow-x: visible; }
  .main-col { overflow-x: visible; }
  .imd-table-wrap { overflow-x: visible; }
  .imd-card { overflow: visible; }
  .imd-card-body { overflow: visible; padding: 12px 10px; }

  /* Labels: single line, truncate with ellipsis */
  .compare-labels { flex-wrap: nowrap; gap: 4px; }
  .compare-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 38%;
    flex-shrink: 1;
  }
  /* Hide the hint text on mobile */
  .prompt-text { display: none; }
  .compare-ratio.is-prompt .prompt-caret { font-size: 18px; }

  /* Compact mobile scale buttons */
  .mobile-scale-row {
    display: flex;
    width: 100%;
    gap: 3px;
    padding: 2px 0;
    align-items: flex-end;
  }
  .ms-btn {
    flex: 1;
    border: none;
    background: var(--bg-subtle);
    font-weight: 700;
    font-size: 11px;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    transition: background 0.12s, color 0.12s, transform 0.08s;
    font-family: inherit;
    color: var(--ink-400);
    position: relative;
  }
  .ms-btn.ms-right { color: var(--brand-blue-500); background: oklch(96% 0.02 240); }
  .ms-btn.ms-left  { color: var(--accent-orange); background: oklch(96% 0.02 55); }
  .ms-btn.ms-center { color: var(--ink-500); font-size: 12px; background: var(--bg-subtle); }

  .ms-btn:hover { filter: brightness(0.95); transform: translateY(-1px); }

  .ms-btn.active.ms-right {
    background: var(--brand-blue-500);
    color: #fff;
  }
  .ms-btn.active.ms-left {
    background: var(--accent-orange);
    color: #fff;
  }
  .ms-btn.active.ms-center {
    background: var(--ink-500);
    color: #fff;
  }
}

@media (max-width: 560px) {
  .shell { padding: 0 12px; }
  /* Logo and illustration STAY side by side (like the old header), just
     smaller - illustration scaled 0.6x from the desktop base (woman 250 -> 150). */
  .hero { border-radius: var(--r-lg) var(--r-lg) 0 0; min-height: 110px; }
  .hero-illustration { --woman-w: 150px; --woman-h: 127px; width: calc(var(--woman-w) + 108px); height: var(--woman-h); margin-top: -16px; margin-bottom: -13px; }
  .hero-bubble { width: 125px; height: 89px; right: calc(var(--woman-w) - 23px); bottom: 7px; }
  .hero-bubble .hero-bubble-glyph { font-size: 38px; }
  .hero-bubble-dot-1 { width: 28px; height: 21px; top: 8px; right: calc(var(--woman-w) - 16px); }
  .hero-bubble-dot-2 { width: 12px; height: 8px; top: 7px; right: calc(var(--woman-w) - 34px); }
  .hero-bubble-dot-3 { width: 4px; height: 4px; top: 9px; right: calc(var(--woman-w) - 46px); }
  .page-body { border-radius: 0 0 var(--r-lg) var(--r-lg); padding: 20px 16px; }
  .wordmark { font-size: 42px; }
  .tagline { font-size: 14px; }
}


/* ============================================================
   TEAM/GROUP FLOW + MODAL STYLES
   ============================================================ */

/* ----- Choose Team (step 2 of 5, mode=team) ----- */
.team-choose {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 18px 20px 20px;
  margin-top: 8px;
}
.team-choose-head {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr 60px 2fr;
  gap: 14px;
  padding: 4px 4px 10px;
  border-bottom: 1px dashed var(--border-strong);
  color: var(--brand-blue-600);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.team-choose-head span:nth-child(3) { text-align: center; }
.team-choose-row {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr 60px 2fr;
  gap: 14px;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px dotted var(--border-soft);
  transition: opacity .15s;
}
.team-choose-row:last-of-type { border-bottom: 0; }
.team-choose-row.is-off { opacity: .5; }
.team-choose-row.is-off .tc-crit { text-decoration: line-through; }
.tc-crit {
  color: var(--brand-red-500);
  font-weight: 600;
  font-size: 15px;
}
.tc-crit-cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tc-teamname { font-size: 12px; padding: 6px 10px; }
.tc-teamname::placeholder { font-style: italic; }

/* Owner-facing invitation link shown once a code exists (legacy ltlCode). */
.tc-invite-link {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 2px 4px 12px;
  border-bottom: 1px dotted var(--border-soft);
  margin-bottom: 4px;
}
.tc-invite-label { font-size: 12px; color: var(--ink-500); font-weight: 600; white-space: nowrap; }
.tc-invite-url { flex: 1; min-width: 200px; font-size: 12px; padding: 6px 10px; color: var(--brand-blue-700); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Narrow screens: the 4-column ChooseTeam row stacks - criterion + checkbox
   on top, then full-width e-mail and comment inputs. */
@media (max-width: 700px) {
  .team-choose-head { display: none; }
  .team-choose-row {
    grid-template-columns: 1fr 44px;
    grid-auto-rows: auto;
    gap: 8px;
    align-items: start;
    padding: 14px 4px;
  }
  .team-choose-row .tc-crit-cell { grid-column: 1; grid-row: 1; }
  .team-choose-row .tc-check { grid-column: 2; grid-row: 1; justify-self: end; margin-top: 2px; }
  .team-choose-row > input[type="email"] { grid-column: 1 / -1; grid-row: 2; }
  .team-choose-row > input:not([type="email"]) { grid-column: 1 / -1; grid-row: 3; }
}
.tc-check {
  display: inline-flex;
  justify-content: center;
  cursor: pointer;
  position: relative;
}
.tc-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.tc-check-box {
  width: 22px; height: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-card);
  display: inline-block;
  transition: all .15s;
}
.tc-check:hover .tc-check-box { border-color: var(--brand-red-400); }
/* "~" not "+": the checkbox tag helper renders a hidden false-input between
   the checkbox and the styled box, so the adjacent-sibling selector never
   matched and the checkmark stayed invisible. */
.tc-check input:checked ~ .tc-check-box {
  background: var(--brand-red-500);
  border-color: var(--brand-red-500);
  box-shadow: 0 2px 8px rgba(184, 42, 42, .25);
}
.tc-check input:checked ~ .tc-check-box::after {
  content: '';
  display: block;
  width: 6px; height: 11px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  margin: 2px auto 0;
}
.team-choose-confirm {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-strong);
  gap: 12px;
  flex-wrap: wrap;
}
.tc-count {
  color: var(--ink-500);
  font-size: 13px;
  font-family: ui-monospace, monospace;
}

/* ----- Choose Group (step 2 of 5, mode=group) ----- */
.group-choose {
  display: grid;
  gap: 20px;
}
.gc-title-row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}
.gc-title-row > .field-label { min-width: 100px; }
.gc-title-field {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 260px;
}
.gc-title-field .input { flex: 1; }

.gc-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 600px) { .gc-summary { grid-template-columns: 1fr; } }
.gc-summary > div {
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.gc-summary-head {
  color: var(--brand-blue-600);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}

/* .mm-col-list may already exist; define if not */
.mm-col-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mm-col-list li {
  color: var(--brand-red-500);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 0;
  border-bottom: 1px dotted var(--border-soft);
}
.mm-col-list li:last-child { border-bottom: 0; }

.gc-parts {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 16px 18px 18px;
}
.gc-parts-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-strong);
  gap: 12px;
  flex-wrap: wrap;
}
.gc-parts-head > span:first-child {
  color: var(--brand-blue-600);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.gc-part-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-bottom: 8px;
}
@media (max-width: 600px) { .gc-part-row { grid-template-columns: 1fr; } }
.gc-parts-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-strong);
  gap: 12px;
  flex-wrap: wrap;
}

/* ----- Group results: participant weights table ----- */
.gw-table { display: flex; flex-direction: column; }
.gw-row {
  display: grid;
  grid-template-columns: 1fr 140px 110px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dotted var(--border-soft);
}
.gw-row:last-child { border-bottom: 0; }
.gw-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; flex-wrap: wrap; }
.gw-name a { color: var(--brand-red-500); text-decoration: none; }
.gw-name a:hover { text-decoration: underline; }
.gw-weight { max-width: 140px; text-align: right; }
.gw-norm { font-size: 12px; }
@media (max-width: 600px) { .gw-row { grid-template-columns: 1fr; } .gw-weight { max-width: none; } }

/* Group comparisons: cells where participants point in opposite directions */
.imd-table td.gcmp-disagree {
  background: color-mix(in oklch, var(--brand-orange, #e68246) 16%, transparent);
  font-weight: 600;
}

/* ChooseGroup: optional weight column next to name + email */
.gc-part-row.has-weight { grid-template-columns: 1fr 1.4fr 110px; }
.gc-part-row.has-weight.has-revoke { grid-template-columns: 1fr 1.4fr 110px 36px; }
@media (max-width: 600px) { .gc-part-row.has-weight, .gc-part-row.has-weight.has-revoke { grid-template-columns: 1fr; } }
.gc-part-revoke {
  border: 1px solid var(--brand-red-500, #c0392b);
  background: transparent;
  color: var(--brand-red-500, #c0392b);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.gc-part-revoke:hover { background: var(--brand-red-500, #c0392b); color: #fff; }

/* Styled message popup (window.ahpPopup - replacement for alert()) */
.ahp-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 25, 40, 0.45);
  animation: ahpPopupFade 0.15s ease-out;
}
.ahp-popup {
  max-width: 440px;
  width: calc(100% - 48px);
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d5dbe3);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
  padding: 22px 24px 18px;
}
.ahp-popup-text { font-size: 14px; line-height: 1.55; color: var(--ink-700, #243447); }
.ahp-popup-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
@keyframes ahpPopupFade { from { opacity: 0; } to { opacity: 1; } }

/* Contextual help (legacy RadToolTip "?" icons) */
.help-tip { display: inline-block; position: relative; vertical-align: middle; margin-left: 8px; }
.help-tip > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--brand-blue-600, #2c6e9e);
  color: var(--brand-blue-600, #2c6e9e);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.help-tip > summary::-webkit-details-marker { display: none; }
.help-tip[open] > summary { background: var(--brand-blue-600, #2c6e9e); color: #fff; }
.help-tip-body {
  position: absolute;
  z-index: 60;
  top: 26px;
  left: 0;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid var(--border, #d5dbe3);
  border-radius: 8px;
  background: var(--surface, #fff);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
}
@media (max-width: 600px) { .help-tip-body { min-width: 220px; max-width: 80vw; } }

/* ----- Load-from-Participant link (appears above scale for team mode) ----- */
.load-from-part {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 4px 0 14px;
  background: color-mix(in oklch, var(--brand-blue-50) 70%, transparent);
  border: 1px dashed var(--brand-blue-300);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--ink-700);
  flex-wrap: wrap;
}
.load-from-part svg { color: var(--brand-blue-600); flex-shrink: 0; }
.link-inline {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--brand-red-500);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-inline:hover { color: var(--brand-red-600); }
.link-inline strong { font-weight: 700; }
.link-inline .muted { color: var(--ink-500); font-weight: 400; margin-left: 4px; font-style: italic; }

/* ----- Modal ----- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 42, 55, .55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: modal-in .16s ease-out;
}
[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, .7); }
@keyframes modal-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 22px 24px 20px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modal-pop .18s ease-out;
}
.modal.is-wide { max-width: 720px; }
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.modal-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--ink-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.modal-close:hover { background: var(--bg-subtle); color: var(--brand-red-500); }
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.modal-head svg { color: var(--brand-red-500); flex-shrink: 0; }
.modal-head h3 {
  color: var(--brand-red-500);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}
.modal p { color: var(--ink-700); font-size: 14px; margin: 0 0 14px; }
.modal p .muted { color: var(--ink-500); font-size: 13px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-soft);
  flex-wrap: wrap;
}

/* ----- Participant preview grid (inside modal) ----- */
.part-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
  max-height: 50vh;
  overflow-y: auto;
}
.pp-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}
.pp-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
}
.pp-left { text-align: right; }
.pp-right { text-align: left; }
.pp-marker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--bg-card);
  border: 1.5px solid var(--border-strong);
  font-family: ui-monospace, monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-700);
  white-space: nowrap;
  min-width: 64px;
  justify-content: center;
}
.pp-marker.side-left {
  color: var(--brand-red-500);
  border-color: var(--brand-red-400);
  background: color-mix(in oklch, var(--brand-red-500) 10%, var(--bg-card));
}
.pp-marker.side-right {
  color: var(--brand-blue-600);
  border-color: var(--brand-blue-300);
  background: color-mix(in oklch, var(--brand-blue-300) 14%, var(--bg-card));
}
.pp-intensity {
  font-size: 12px;
  opacity: .8;
  font-weight: 600;
}

/* ----- Compare layout: Your current | → | New (from participant) ----- */
.pp-legend {
  display: grid;
  grid-template-columns: 1fr 120px 28px 140px 1fr;
  gap: 12px;
  align-items: center;
  padding: 6px 12px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-500, #6b7280);
}
.pp-legend-left  { text-align: right; }
.pp-legend-right { text-align: left; }
.pp-legend-yours, .pp-legend-theirs {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
.pp-legend-arrow { text-align: center; color: var(--ink-400, #9aa1ad); font-weight: 600; }
.pp-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.pp-dot.tone-mine { background: var(--ink-400, #9aa1ad); }
.pp-dot.tone-new  { background: var(--brand-red-500); }

.pp-row-compare {
  grid-template-columns: 1fr 120px 28px 140px 1fr;
}
.pp-row-compare.is-changed {
  background: color-mix(in oklch, #f2c25a 8%, var(--bg-subtle));
  border-color: color-mix(in oklch, #e6c987 55%, var(--border-soft));
}
.pp-row-compare.is-same {
  opacity: .65;
}
.pp-arrow-sep {
  text-align: center;
  color: var(--ink-400, #9aa1ad);
  font-weight: 700;
}
.pp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--bg-card);
  border: 1.5px solid var(--border-strong);
  font-family: ui-monospace, monospace;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  min-width: 64px;
  justify-content: center;
}
.pp-pill .pp-arrow { font-size: 14px; line-height: 1; }
.pp-pill .pp-val   { font-size: 13px; }
.pp-pill.is-neutral .pp-arrow {
  font-size: 13px;
  color: var(--ink-400, #9aa1ad);
  font-weight: 800;
}

/* ---- "Yours" pill - always neutral grey so it reads as a baseline ---- */
.pp-pill.tone-mine {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--ink-700);
}

/* ---- "New" pill - colour encodes comparison to YOUR value ---- */
/* Same as yours → calm blue (no alarm, nothing to read into) */
.pp-pill.tone-new.dir-same {
  color: var(--brand-blue-700, #1e4a7b);
  border-color: var(--brand-blue-300);
  background: color-mix(in oklch, var(--brand-blue-300) 14%, var(--bg-card));
}
/* Higher than yours → green (will strengthen your direction) */
.pp-pill.tone-new.dir-higher {
  color: #1f7a3a;
  border-color: #7ec896;
  background: color-mix(in oklch, #2fa85c 14%, var(--bg-card));
}
/* Lower than yours → red (will weaken / disagree) */
.pp-pill.tone-new.dir-lower {
  color: var(--brand-red-600);
  border-color: var(--brand-red-400);
  background: color-mix(in oklch, var(--brand-red-500) 10%, var(--bg-card));
}
/* No baseline (you haven't answered) → neutral amber */
.pp-pill.tone-new.dir-new {
  color: #8a5a10;
  border-color: #e6c987;
  background: color-mix(in oklch, #f2c25a 16%, var(--bg-card));
}

.pp-pill.pp-empty {
  color: var(--ink-400, #9aa1ad);
  font-style: italic;
  font-weight: 500;
  border-style: dashed;
}

/* ---- Colour key row under the legend ---- */
.pp-colorkey {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  padding: 6px 12px 10px;
  font-size: 11.5px;
  color: var(--ink-500, #6b7280);
}
.pp-key-item { display: inline-flex; align-items: center; gap: 6px; }
.pp-key-chip {
  width: 12px; height: 12px; border-radius: 3px;
  display: inline-block; border: 1.5px solid transparent;
}
.pp-key-chip.dir-same   { background: color-mix(in oklch, var(--brand-blue-300) 35%, #fff); border-color: var(--brand-blue-300); }
.pp-key-chip.dir-higher { background: color-mix(in oklch, #2fa85c 35%, #fff); border-color: #7ec896; }
.pp-key-chip.dir-lower  { background: color-mix(in oklch, var(--brand-red-500) 30%, #fff); border-color: var(--brand-red-400); }
.pp-key-chip.dir-new    { background: color-mix(in oklch, #f2c25a 40%, #fff); border-color: #e6c987; }
.pp-footnote {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 10px 0 0; font-size: 12px;
}

@media (max-width: 720px) {
  .pp-legend, .pp-row-compare {
    grid-template-columns: 1fr 90px 20px 110px 1fr;
    gap: 8px;
  }
  .pp-pill { min-width: 54px; padding: 4px 8px; }
}


/* ----- Team step mini progress (3-step sequence inside Choose Team) ----- */
.team-steps-mini {
  list-style: none;
  margin: 0 0 18px;
  padding: 12px 14px;
  background: color-mix(in oklch, var(--brand-blue-50) 45%, transparent);
  border: 1px dashed var(--brand-blue-300);
  border-radius: var(--r-md);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  counter-reset: ts;
}
.team-steps-mini li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-pill);
  font-size: 13px;
  color: var(--ink-500);
  font-weight: 500;
  transition: all .2s;
}
.team-steps-mini .ts-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid var(--border-strong);
}
.team-steps-mini li.is-active {
  color: var(--brand-red-500);
  border-color: var(--brand-red-400);
  background: color-mix(in oklch, var(--brand-red-500) 7%, var(--bg-card));
  font-weight: 600;
}
.team-steps-mini li.is-active .ts-num {
  background: var(--brand-red-500);
  color: #fff;
  border-color: var(--brand-red-500);
  box-shadow: 0 2px 8px rgba(184, 42, 42, .25);
}
.team-steps-mini li.is-done { color: var(--ink-700); }
.team-steps-mini li.is-done .ts-num {
  background: #35a36b;
  color: #fff;
  border-color: #35a36b;
}
.team-steps-mini li.is-done .ts-num::after {
  content: '';
  display: block;
  position: absolute;
  width: 6px; height: 10px;
  border: solid #fff;
  border-width: 0 2.2px 2.2px 0;
  transform: rotate(45deg);
  margin-top: -10px;
}
.team-steps-mini li.is-done .ts-num { position: relative; color: transparent; }

/* ----- Confirmed pill replaces Confirm button after action ----- */
.tc-confirmed-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: color-mix(in oklch, #35a36b 14%, var(--bg-card));
  border: 1.5px solid #35a36b;
  color: #1e7b4b;
  font-weight: 700;
  font-size: 14px;
}
[data-theme="dark"] .tc-confirmed-pill {
  background: color-mix(in oklch, #35a36b 25%, var(--bg-card));
  color: #7dd6a6;
}
.tc-confirmed-pill svg { color: currentColor; }

/* ----- Inline hint under the disabled Continue ----- */
.continue-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 9px 14px;
  background: color-mix(in oklch, var(--accent-orange, #e68246) 12%, transparent);
  border: 1px dashed color-mix(in oklch, var(--accent-orange, #e68246) 55%, transparent);
  border-radius: var(--r-md);
  color: var(--ink-700);
  font-size: 13px;
  max-width: max-content;
}
.continue-hint svg { color: var(--accent-orange, #e68246); flex-shrink: 0; }

/* ------- Team / Group choose screens ------- */
.team-steps-mini { list-style: none; padding: 0; margin: 0 0 20px; display:flex; gap: 20px; }
.team-steps-mini li { display:flex; align-items:center; gap:8px; font-size:13px; color: var(--ink-500); }
.team-steps-mini li.is-active { color: var(--brand-red-500); font-weight: 600; }
.team-steps-mini li.is-done { color: var(--brand-blue-700); }
.team-steps-mini li.is-done .ts-num { background: var(--brand-blue-500); color: #fff; }
.team-steps-mini li.is-active .ts-num { background: var(--brand-red-500); color: #fff; }

/* Team participant: locked answers */
.locked-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 6px 0 18px;
  background: var(--brand-blue-50);
  border: 1px solid var(--brand-blue-200);
  border-radius: var(--r-md);
  color: var(--ink-700);
  font-size: 14px;
}
.locked-banner svg { color: var(--brand-blue-500); flex: none; }
.compare-locked {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  opacity: .65;
}
.compare-locked .scale-btn,
.compare-locked .ms-btn { pointer-events: none; cursor: default; }

/* Star rating */
.star-row { display:flex; gap:4px; justify-content:center; }
.star-btn {
    font-size: 28px;
    background: none;
    border: 0;
    cursor: pointer;
    color: var(--border-strong);
    transition: color .15s;
    padding: 0 2px;
    line-height: 1;
}
.star-btn:hover, .star-btn.filled { color: #e6b000; }

/* Language flags are now POST forms (CSRF-safe); keep the row layout flat. */
.lang-flags .lang-flag-form { display: inline-flex; margin: 0; padding: 0; }

/* 3D viewer - launch button + modal */
.viewer3d-launch { display: flex; justify-content: center; margin: 18px 0; }
.viewer3d-open {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 12px 22px; border-radius: 999px; cursor: pointer;
    font: inherit; font-size: 15px; font-weight: 500; letter-spacing: .01em;
    color: #fff; background: var(--brand-blue-600, #247ea3);
    border: 1px solid var(--brand-blue-600, #247ea3);
    box-shadow: 0 2px 10px rgba(36, 126, 163, .25);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.viewer3d-open:hover { background: #1f6c8c; box-shadow: 0 4px 16px rgba(36, 126, 163, .32); }
.viewer3d-open:active { transform: scale(.98); }
.viewer3d-open-icon { font-size: 13px; opacity: .9; }

.ahp3d-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 2vh 2vw; }
.ahp3d-modal[hidden] { display: none !important; }
.ahp3d-modal [hidden] { display: none !important; }
.ahp3d-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 36, .5); }
.ahp3d-dialog {
    position: relative; display: flex; flex-direction: column;
    width: min(1180px, 96vw); height: min(880px, 92vh);
    background: #fff; border-radius: 14px; overflow: hidden;
    box-shadow: 0 24px 70px rgba(15, 23, 36, .35);
}
.ahp3d-header { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border, #e3e6ec); }
.ahp3d-title { font-weight: 500; font-size: 16px; color: var(--brand-blue-600, #247ea3); }
.ahp3d-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.ahp3d-tabs { display: inline-flex; gap: 6px; }
.ahp3d-tab { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border, #d9dbe1); background: none; cursor: pointer; font: inherit; font-size: 13px; color: #4a5160; }
.ahp3d-tab.is-active { border-color: var(--brand-blue-600, #247ea3); color: var(--brand-blue-600, #247ea3); background: rgba(36, 126, 163, .08); }
.ahp3d-axes { display: inline-flex; gap: 12px; align-items: center; }
.ahp3d-axis { font-size: 12px; display: inline-flex; gap: 6px; align-items: center; color: #4a5160; }
.ahp3d-axis-across { color: #177a5b; }
.ahp3d-axis-depth { color: #5044b0; }
.ahp3d-axis select { font: inherit; font-size: 12px; padding: 4px 7px; border-radius: 7px; border: 1px solid var(--border, #d9dbe1); color: #2b3240; background: #fff; max-width: 150px; }
.ahp3d-chip { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border, #d9dbe1); background: none; cursor: pointer; font: inherit; font-size: 13px; color: #4a5160; }
.ahp3d-chip:hover { border-color: #b7bdc9; }
.ahp3d-spin.is-active { border-color: var(--brand-red-500, #b82a2a); color: var(--brand-red-500, #b82a2a); }
.ahp3d-close { margin-left: 4px; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border, #d9dbe1); background: none; cursor: pointer; font-size: 22px; line-height: 1; color: #6b6f76; }
.ahp3d-close:hover { color: #b82a2a; border-color: #e6b6b6; }
.viewer3d-open:focus-visible, .ahp3d-tab:focus-visible, .ahp3d-chip:focus-visible, .ahp3d-close:focus-visible, .ahp3d-axis select:focus-visible { outline: 2px solid var(--brand-blue-600, #247ea3); outline-offset: 2px; }
.ahp3d-canvas-wrap { position: relative; flex: 1; min-height: 0; background: #f7f9fc; overflow: hidden; }
.ahp3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ahp3d-hud { position: absolute; left: 14px; top: 12px; pointer-events: none; font-family: var(--font-sans); font-size: 12px; color: #8a93a5; letter-spacing: .01em; }
.ahp3d-hud b { color: #3a4151; font-weight: 500; }
.ahp3d-legend { position: absolute; left: 14px; bottom: 12px; display: flex; gap: 14px; font-size: 12px; font-family: var(--font-sans); }
.ahp3d-nowebgl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; color: #6b6f76; }
.ahp3d-hint { position: absolute; right: 14px; bottom: 12px; font-size: 12px; color: #9aa1ad; pointer-events: none; }

/* sensitivity (what-if) panel - below the canvas, two columns */
.ahp3d-sens { border-top: 1px solid var(--border, #e3e6ec); background: #fff; flex: 0 0 auto; }
.ahp3d-sens[hidden] { display: none !important; }
.ahp3d-sens-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px; }
.ahp3d-sens-toggle { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; font: inherit; padding: 4px 0; }
.ahp3d-sens-toggle::before { content: "\25BE"; color: #9aa1ad; }
.ahp3d-sens:not(.is-open) .ahp3d-sens-toggle::before { content: "\25B8"; }
.ahp3d-sens-title { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #6b7280; font-weight: 500; }
.ahp3d-sens-sub { font-size: 11px; color: #9aa1ad; }
.ahp3d-sens-badge { font-size: 11px; font-family: ui-monospace, Consolas, monospace; padding: 2px 9px; border-radius: 999px; background: rgba(217,164,65,.16); color: #8a5e10; border: 1px solid rgba(217,164,65,.5); }
.ahp3d-sens-badge[hidden] { display: none; }
.ahp3d-sens-body { display: none; padding: 0 14px 14px; gap: 0 40px; max-height: 230px; overflow: auto; }
.ahp3d-sens.is-open .ahp3d-sens-body { display: grid; grid-template-columns: 1fr 1fr; }
.ahp3d-sens-colh { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: #6b7280; font-weight: 500; margin-bottom: 8px; }
.ahp3d-sens-note { font-size: 12px; color: #6b7280; margin-bottom: 10px; }
.ahp3d-sens-reset { margin-top: 6px; font: inherit; font-size: 12.5px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--gold, #d9a441); background: rgba(217,164,65,.12); color: #8a5e10; cursor: pointer; }
.ahp3d-srow { margin-bottom: 11px; }
.ahp3d-stop { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 2px; }
.ahp3d-sname { font-weight: 500; display: flex; align-items: center; gap: 7px; min-width: 0; }
.ahp3d-sswatch { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.ahp3d-snm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahp3d-svals { font-family: ui-monospace, Consolas, monospace; text-align: right; flex: 0 0 auto; line-height: 1.2; }
.ahp3d-sadj { font-weight: 600; }
.ahp3d-sder { display: block; font-size: 11px; color: #9aa1ad; }
.ahp3d-srange { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: #e6e9ef; outline: none; margin: 5px 0 2px; cursor: pointer; }
.ahp3d-srange::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--c, #888); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(20,30,50,.18); cursor: pointer; }
.ahp3d-srange::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--c, #888); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(20,30,50,.18); cursor: pointer; }
.ahp3d-srange:focus-visible { outline: 2px solid var(--brand-blue-600, #247ea3); outline-offset: 3px; }
.ahp3d-orow { margin-bottom: 9px; }
.ahp3d-otop { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 2px; }
.ahp3d-oname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahp3d-opct { font-family: ui-monospace, Consolas, monospace; font-weight: 600; flex: 0 0 auto; }
.ahp3d-otrack { height: 10px; border-radius: 6px; background: #eef1f6; overflow: hidden; }
.ahp3d-ofill { height: 100%; border-radius: 6px; }
.ahp3d-credit { flex: 0 0 auto; padding: 6px 14px; border-top: 1px solid var(--border, #e3e6ec); font-size: 11px; color: #9aa1ad; text-align: right; }
@media (max-width: 760px) { .ahp3d-header { gap: 8px; } .ahp3d-axes { width: 100%; } .ahp3d-sens.is-open .ahp3d-sens-body { grid-template-columns: 1fr; } }

/* Impersonation banner - full-width bar shown across the top while an admin is
   viewing the site as another user (see ImpersonationBannerViewComponent). The
   solid amber reads clearly in both light and dark themes. */
.impersonation-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 8px 16px;
    background: #b45309;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}
.impersonation-bar__text { line-height: 1.4; }
.impersonation-bar__text strong { font-weight: 800; }
.impersonation-bar__form { margin: 0; display: inline; }
.impersonation-bar__btn {
    border: 1px solid rgba(255, 255, 255, .7);
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font: inherit;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
}
.impersonation-bar__btn:hover { background: rgba(255, 255, 255, .26); }
