/*
 * Miirae Core — inference_web stylesheet
 *
 * Design language: "first light" — a warm porcelain field (human experience)
 * holding near-black ink (introspection, depth), crossed by two signals:
 *   --iris   #4f46e5  intelligence · future · structure
 *   --aurora #0e9888  emergence · discovery · live signal
 * Everything else stays neutral so the two accents read as meaning,
 * not decoration.
 */

/* ─── Design tokens ─────────────────────────────────────────────── */
:root {
  color-scheme: light;

  --canvas: #f7f7f3;
  --canvas-deep: #f0f0ea;
  --surface: #ffffff;
  --surface-soft: #fbfbf9;
  --surface-2: #f3f4f1;

  --ink: #15171e;
  --ink-soft: #404859;
  --muted: #6e7787;
  --faint: #9aa1b0;
  --line: #e4e6ec;
  --line-strong: #cfd3dd;

  --iris: #4f46e5;
  --iris-deep: #3a32c8;
  --iris-ink: #322db3;
  --iris-wash: #eeedfc;
  --iris-soft: rgba(79, 70, 229, 0.10);
  --iris-faint: rgba(79, 70, 229, 0.05);

  --aurora: #0e9888;
  --aurora-ink: #0b7a6e;
  --aurora-wash: #e9f6f3;
  --aurora-soft: rgba(14, 152, 136, 0.12);

  --amber-ink: #8a6a1f;
  --amber-wash: #faf5e7;
  --amber-line: #e8dcba;

  --err: #c2362f;
  --err-wash: #fbeeed;

  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;

  --shadow-card: 0 1px 2px rgba(21, 23, 30, 0.04), 0 8px 28px rgba(21, 23, 30, 0.05);
  --shadow-raise: 0 2px 6px rgba(21, 23, 30, 0.06), 0 16px 40px rgba(21, 23, 30, 0.08);

  --font-display: "Outfit", system-ui, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;

  --container-max: 1400px;
  --container-px: clamp(1rem, 3.5vw, 2.75rem);
  --flow-gutter: 96px;
  --aside-top: 1rem;
}

/* ─── Reset & base ──────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
}

img, picture, svg { display: block; max-width: 100%; }

a { color: var(--iris-ink); }

/* ─── Accessibility helpers ─────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.75rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--iris);
  color: #ffffff;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
}
.skip-link:focus {
  left: 0.75rem;
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Emergent layer: quiet field with two faint halos ──────────── */
.abstraction-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 58% 40% at 50% -8%, rgba(79, 70, 229, 0.06), transparent 62%),
    radial-gradient(ellipse 44% 32% at 92% 108%, rgba(14, 152, 136, 0.05), transparent 58%),
    radial-gradient(circle at 1px 1px, rgba(21, 23, 30, 0.040) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 26px 26px;
  background-color: var(--canvas);
}

/* ─── App shell ─────────────────────────────────────────────────── */
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-px);
}

/* ─── Signal hairline (replaces the CMYK strip) ─────────────────── */
.cmyk-bar {
  display: block;
  width: 100%;
  height: 3px;
  flex-shrink: 0;
  background: linear-gradient(90deg,
    var(--iris) 0%,
    #6d66ec 34%,
    var(--aurora) 72%,
    rgba(14, 152, 136, 0) 100%);
}
.cmyk-bar--subtle { height: 3px; opacity: 1; }
.cmyk-swatch { display: none; }

/* ─── Header ────────────────────────────────────────────────────── */
.site-header {
  flex-shrink: 0;
  padding-block: 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.site-header--compact {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.site-header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-mark {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border-radius: var(--radius-xs);
  background: #ffffff;
  border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color 0.15s ease;
}
.brand-mark:hover { border-color: var(--line-strong); }
.brand-mark:focus-visible {
  outline: 2px solid var(--iris);
  outline-offset: 3px;
}
.brand-mark picture { display: block; line-height: 0; }
.brand-mark__img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
}

.brand-mark--compact {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0;
  border: 0;
  background: transparent;
  text-decoration: none;
}
.brand-mark--compact .brand-mark__img {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
/* Wordmark: dark, crisp, unmistakably the product name. */
.brand-mark__word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.site-nav {
  display: flex;
  gap: 1.4rem;
  margin-inline: auto;
}
.site-nav__link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.site-nav__link:hover { color: var(--ink); }
.site-nav__link.is-active {
  color: var(--ink);
  border-bottom-color: var(--iris);
}

.language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}
.language-toggle select,
.language-toggle--compact select {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
}

.site-header__copy { min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.brand-stratum {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--iris-ink);
}
.tagline {
  margin: 0;
  max-width: 58ch;
  font-size: 0.96rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

@media (max-width: 640px) {
  .brand-mark__img { width: 48px; height: 48px; }
  .site-nav { gap: 1rem; }
}

/* ─── Error banner ──────────────────────────────────────────────── */
.banner-error {
  margin: 1rem 0 0;
  padding: 0.7rem 1rem;
  background: var(--err-wash);
  color: var(--err);
  border-left: 3px solid var(--err);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  font-size: 0.95rem;
}
.banner-error--info {
  background: var(--iris-soft, rgba(79,70,229,0.08));
  color: var(--iris-ink, #322db3);
  border-left-color: var(--iris, #4f46e5);
}
.error { color: var(--err); }
.meta  { color: var(--muted); font-size: 0.88rem; margin: 0; }

/* ─── Main layout ───────────────────────────────────────────────── */
.page-main {
  flex: 1;
  padding-block: 1.75rem 2.5rem;
  isolation: isolate;
}
.page-main:focus { outline: none; }

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.4rem;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease, transform 0.1s ease, box-shadow 0.13s ease;
}

.btn-primary {
  background: var(--iris);
  color: #ffffff;
  border: 1px solid var(--iris-deep);
  box-shadow: 0 1px 2px rgba(58, 50, 200, 0.25), 0 6px 18px rgba(79, 70, 229, 0.22);
}
.btn-primary:hover { background: var(--iris-deep); }
.btn-primary:active { transform: translateY(1px); box-shadow: 0 2px 8px rgba(58, 50, 200, 0.25); }
.btn-primary:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.btn-primary.is-loading { opacity: 0.72; pointer-events: auto; }

.btn-secondary {
  background: var(--surface);
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  box-shadow: 0 1px 2px rgba(21, 23, 30, 0.04);
}
.btn-secondary:hover {
  color: var(--ink);
  border-color: var(--iris);
  background: var(--iris-faint);
}
.btn-secondary:active { transform: translateY(1px); }
.btn-secondary:focus-visible { outline: 2px solid var(--iris); outline-offset: 3px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.95rem;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.btn-ghost:hover {
  color: var(--ink);
  border-color: var(--iris);
  background: var(--iris-faint);
}
.btn-ghost:active { transform: translateY(1px); }
.btn-ghost:focus-visible { outline: 2px solid var(--iris); outline-offset: 2px; }
.btn-ghost:disabled {
  opacity: 0.55;
  color: var(--faint);
  cursor: not-allowed;
}
.btn-ghost--quiet {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
}
.btn-ghost--quiet:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface);
}

#chat-start {
  background: var(--iris-wash);
  border: 1px solid rgba(79, 70, 229, 0.40);
  color: var(--iris-ink);
}
#chat-start:hover {
  background: #e3e1fb;
  border-color: var(--iris);
}

.btn-primary--large {
  padding: 0.85rem 2rem;
  font-size: 1rem;
  min-width: 12rem;
}
.btn-primary--send { padding: 0.45rem 1.1rem; font-size: 0.9rem; }
.btn-secondary--block,
.btn-ghost--block {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
}

/* ─── Form fields ───────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.field__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.field__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

textarea,
input[type="url"],
input[type="text"],
input[type="email"],
input[type="number"],
select {
  width: 100%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  padding: 0.68rem 0.85rem;
  font: inherit;
}
textarea:focus,
input[type="url"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--iris);
  box-shadow: 0 0 0 3px var(--iris-soft);
}
textarea {
  resize: vertical;
  min-height: 200px;
  max-height: 60vh;
  font-family: var(--font-body);
  line-height: 1.55;
}

.field-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  margin: 0 0 1rem;
  padding: 1rem 1.1rem 1.1rem;
  background: var(--surface-soft);
}
.field-group legend {
  padding: 0 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.field-group__intro {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.field-group--flat { border: none; margin: 0; padding-top: 0.75rem; background: transparent; }

.checkbox-grid { display: grid; gap: 0.65rem 1rem; }
@media (min-width: 560px) { .checkbox-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 780px) { .checkbox-grid--model-groups { grid-template-columns: repeat(3, 1fr); } }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.checkbox input[type="checkbox"] {
  accent-color: var(--iris);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}
.checkbox--block { display: flex; }

.checkbox--model-group {
  align-items: flex-start;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  transition: border-color 0.12s ease;
}
.checkbox--model-group:hover { border-color: var(--line-strong); }
.checkbox--model-group:has(input:checked) { border-color: rgba(79, 70, 229, 0.45); }
.checkbox--model-group strong,
.checkbox--model-group small { display: block; }
.checkbox--model-group strong { color: var(--ink); }
.checkbox--model-group small {
  margin-top: 0.22rem;
  color: var(--muted);
  line-height: 1.35;
}

.options-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.9rem;
  align-items: end;
}
@media (min-width: 640px) {
  .options-row {
    grid-template-columns: minmax(9rem, auto) minmax(9rem, auto) minmax(0, 1fr);
  }
}
.options-row--compact { display: flex; flex-wrap: wrap; gap: 0.65rem 1rem; }

.field--inline { gap: 0.3rem; margin-bottom: 0; min-width: 0; }
.field--inline select,
.field--inline input[type="text"] { padding-block: 0.5rem; width: 100%; }
.options-row .checkbox--block { justify-self: start; padding-top: 0.25rem; }

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.checkbox-row__label {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-right: 0.25rem;
}

.form-actions {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.submit-status {
  margin: 0.45rem 0 0;
  min-height: 1.25rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-style: italic;
}
.submit-hint {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ─── Landing ───────────────────────────────────────────────────── */
.page-main--landing,
.page-body--landing .page-main { max-width: none; padding: 0; }

.landing-hero {
  min-height: calc(100vh - 9rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 6vw, 4rem) var(--container-px);
}
.landing-hero__inner {
  max-width: 44rem;
  text-align: center;
}
.landing-eyebrow {
  margin: 0 0 0.9rem;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--iris-ink);
}
.landing-title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.landing-lead {
  margin: 0 auto 1.6rem;
  max-width: 38rem;
  color: var(--ink-soft);
  font-size: 1.08rem;
  line-height: 1.65;
}
.landing-points {
  margin: 0 0 2.1rem;
  padding: 0;
  list-style: none;
  text-align: left;
  display: inline-block;
  color: var(--muted);
  font-size: 0.94rem;
}
.landing-points li {
  padding: 0.35rem 0 0.35rem 1.2rem;
  position: relative;
}
.landing-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.78rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--aurora);
}
.landing-actions { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; }
.landing-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ─── Chat stage ────────────────────────────────────────────────── */
.page-main--chat {
  max-width: 44rem;
  margin-inline: auto;
  padding: clamp(1.25rem, 3vw, 2rem) var(--container-px) 3rem;
}
.chat-stage__form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.chat-stage__head {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.chat-stage__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.chat-stage__sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.5;
}
.chat-stage__hint {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}
.btn-secondary--large { padding: 0.75rem 1.5rem; font-size: 1rem; }
.chat-stage__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}
.sim-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.sim-toggle input { accent-color: var(--iris); }
.chat-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.chat-control input[type="number"] {
  width: 3.8rem;
  padding: 0.28rem 0.45rem;
  border-radius: 7px;
}

/* Progress drawer */
.chat-progress-drawer {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.chat-progress-drawer__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  font-size: 0.84rem;
  color: var(--muted);
}
.chat-progress-drawer__summary::-webkit-details-marker { display: none; }
.chat-progress-drawer__summary strong {
  margin-left: auto;
  color: var(--ink);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}
.chat-progress-drawer__summary em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.4rem;
  padding: 0.14rem 0.5rem;
  border: 1px solid var(--amber-line);
  border-radius: 999px;
  color: var(--amber-ink);
  background: var(--amber-wash);
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.chat-progress-drawer__summary em[data-level="moderate"] {
  border-color: rgba(79, 70, 229, 0.32);
  color: var(--iris-ink);
  background: var(--iris-wash);
}
.chat-progress-drawer__summary em[data-level="conclusive"] {
  border-color: rgba(14, 152, 136, 0.36);
  color: var(--aurora-ink);
  background: var(--aurora-wash);
}

.chat-progress {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
}
.chat-progress--compact {
  padding: 0 0.9rem 0.9rem;
  display: grid;
  gap: 0.55rem;
  border: none;
  background: transparent;
}
.chat-progress__item {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}
.chat-progress__summary {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.1rem 0 0.35rem;
  border-bottom: 1px solid var(--line);
}
.chat-progress__summary span,
.chat-progress__item span {
  color: var(--muted);
  font-size: 0.74rem;
}
.chat-progress__summary strong,
.chat-progress__item strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.chat-progress__row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}
.progress-bar {
  height: 0.4rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--canvas-deep);
}
.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--iris), var(--aurora));
  transition: width 0.35s ease;
}

.persona-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem 0.85rem 0.85rem;
  border-left: 3px solid rgba(79, 70, 229, 0.45);
  background: var(--iris-faint);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}
.persona-field[hidden] { display: none; }
.persona-field textarea { resize: vertical; min-height: 70px; }

/* ─── Chat window ───────────────────────────────────────────────── */
.chat-window {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: 1rem;
  min-height: 250px;
  max-height: clamp(250px, 45vh, 500px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}
.page-main--chat .chat-window {
  min-height: 22rem;
  max-height: min(52vh, 32rem);
}
.chat-window[data-empty="true"] {
  justify-content: center;
  align-items: center;
  text-align: center;
}
.chat-empty {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  max-width: 36ch;
}
.chat-empty em { color: var(--ink); font-style: normal; font-weight: 600; }

.chat-bubble {
  max-width: min(94%, 56ch);
  padding: 0.58rem 0.8rem 0.62rem;
  border-radius: 12px;
  font-size: 0.93rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-bubble--you {
  align-self: flex-end;
  background: var(--iris);
  border: 1px solid var(--iris-deep);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.chat-bubble--ai {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.chat-bubble--synthetic {
  box-shadow: inset 3px 0 0 var(--amber-line);
}
.chat-bubble--system {
  max-width: min(96%, 68ch);
  color: var(--muted);
  font-size: 0.86rem;
}

/* Belief note — quiet, warm, human */
.chat-bubble--belief {
  align-self: flex-start;
  max-width: min(92%, 62ch);
  padding-block: 0.45rem;
  color: var(--amber-ink);
  font-size: 0.83rem;
  font-style: italic;
  background: var(--amber-wash);
  border: 1px solid var(--amber-line);
  border-left: 3px solid #d9bf76;
}

/* System context note — "How I'm reading this" */
.chat-bubble--context {
  align-self: flex-start;
  max-width: min(94%, 68ch);
  padding: 0.6rem 0.75rem 0.7rem;
  color: var(--ink-soft);
  font-size: 0.84rem;
  background: var(--aurora-wash);
  border: 1px solid rgba(14, 152, 136, 0.22);
  border-left: 3px solid var(--aurora);
}
.chat-bubble__context-label {
  font-family: var(--font-display);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--aurora-ink);
  margin-bottom: 0.35rem;
}
.chat-bubble__context-body {
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--ink-soft);
}

/* Thought (debug) bubbles */
.chat-bubble--thought {
  align-self: flex-start;
  max-width: min(94%, 68ch);
  color: var(--ink-soft);
  font-size: 0.84rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
}
.chat-bubble--thought-nested {
  padding: 0.65rem 0.75rem 0.75rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.chat-bubble__meta-shell {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.chat-bubble__meta-label {
  font-family: var(--font-display);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.15rem 0.2rem 0;
}
.chat-bubble__meta-inner-wrap {
  padding: 0.35rem 0.4rem 0.45rem;
  border-radius: 10px;
  background: var(--canvas);
  border: 1px dashed var(--line-strong);
}
.chat-bubble__meta-inner {
  margin: 0;
  padding: 0.5rem 0.65rem 0.55rem;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-context-note {
  align-self: flex-start;
  max-width: min(92%, 62ch);
  color: var(--muted);
  font-size: 0.82rem;
}
.chat-context-note summary {
  display: inline-flex;
  width: 1.35rem;
  height: 1.35rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(14, 152, 136, 0.40);
  border-radius: 999px;
  color: var(--aurora-ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-style: italic;
  list-style: none;
  background: var(--aurora-wash);
}
.chat-context-note summary::-webkit-details-marker { display: none; }
.chat-context-note__body {
  margin-top: 0.35rem;
  padding: 0.45rem 0.65rem;
  border-left: 2px solid rgba(14, 152, 136, 0.35);
  color: var(--muted);
  font-style: italic;
  background: var(--surface-soft);
  border-radius: var(--radius-xs);
}

.chat-bubble--thinking {
  align-self: flex-start;
  color: var(--muted);
  font-style: italic;
  border: 1px dotted var(--line-strong);
  background: var(--surface-soft);
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
}
.chat-bubble--thinking::after {
  content: "...";
  display: inline-block;
  width: 0ch;
  margin-left: 0.2rem;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  animation: chat-dots-reveal 1.1s steps(4, end) infinite;
}
@keyframes chat-dots-reveal {
  0%, 20%   { width: 0ch; }
  40%       { width: 1ch; }
  60%       { width: 2ch; }
  80%, 100% { width: 3ch; }
}

/* Composer */
.chat-composer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.chat-composer__guidance {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}
.chat-composer textarea,
.page-main--chat .chat-composer textarea {
  resize: vertical;
  min-height: 60px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 0.75rem 0.85rem;
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
}
.chat-composer textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--surface-soft);
}
.chat-composer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}
.chat-meta {
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.chat-meta__turns {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chat-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.chat-runtime-hint {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.chat-error {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(194, 54, 47, 0.30);
  background: var(--err-wash);
  color: var(--err);
  font-size: 0.85rem;
}

/* Context drawer + analysis settings */
.context-drawer--chat,
.analysis-settings {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.context-drawer--chat > summary,
.analysis-settings > summary {
  padding: 0.72rem 0.9rem;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.context-drawer--chat > summary::-webkit-details-marker,
.analysis-settings > summary::-webkit-details-marker { display: none; }
.context-drawer--chat > summary::before,
.analysis-settings > summary::before {
  content: "▸";
  color: var(--iris);
  font-size: 0.8em;
  transition: transform 0.15s ease;
}
.context-drawer--chat[open] > summary::before,
.analysis-settings[open] > summary::before { transform: rotate(90deg); }
.context-drawer--chat[open] > summary,
.analysis-settings[open] > summary { border-bottom: 1px solid var(--line); }
.context-drawer--chat .context-block,
.analysis-settings .field-group { padding: 0 0.9rem 0.9rem; }

.context-drawer__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--iris-wash);
  color: var(--iris-ink);
  font-size: 0.72rem;
  font-weight: 700;
}
.context-drawer__intro {
  margin: 0.85rem 0.9rem 0.6rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.context-block {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.context-block:last-child { padding-bottom: 1.15rem; }
.context-file-input { font-size: 0.88rem; }
.context-file-list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.context-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  font-size: 0.84rem;
}
.context-upload-error {
  margin: 0;
  color: var(--err);
  font-size: 0.84rem;
}

.chat-stage__footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
.chat-stage__footer .btn-primary { align-self: flex-start; }

@media (min-width: 1280px) {
  .chat-window {
    min-height: 340px;
    max-height: clamp(340px, 52vh, 620px);
  }
  .chat-bubble {
    width: auto;
    max-width: min(62vw, calc(100% - 0.4rem));
  }
}
@media (max-width: 639.98px) {
  .chat-window {
    padding: 0.65rem 0.6rem;
    min-height: 235px;
    max-height: clamp(235px, 44vh, 360px);
    gap: 0.45rem;
  }
  .chat-bubble {
    max-width: 100%;
    font-size: 0.89rem;
    line-height: 1.46;
  }
  .chat-composer textarea { min-height: 54px; }
}

/* ─── Panels (shared card language) ─────────────────────────────── */
.panel {
  position: relative;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.45rem;
  box-shadow: var(--shadow-card);
}
@media (min-width: 640px) {
  .panel { padding: 1.6rem 1.75rem; }
}
.panel__header { margin-bottom: 1rem; }
.panel__header--tight { margin-bottom: 0.75rem; }
.panel-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.panel__header--tight .panel-title { font-size: 1.02rem; margin: 0; }
.panel-intro {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
}

/* All results-page panels resolve to the same clean card. */
.panel--clean {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-card);
}
.panel--form { border-top: 3px solid var(--iris); }
.panel--results { border-top: 3px solid var(--iris); }
.panel--highlights { border-top: 3px solid var(--aurora); }
.panel--snapshot { border-top: 3px solid var(--line-strong); }

/* ─── Results layout ────────────────────────────────────────────── */
.page-main--results {
  max-width: var(--container-max);
  padding: clamp(1rem, 3vw, 2rem) var(--container-px) 3rem;
}
.results-layout {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 1024px) {
  .results-layout {
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
    column-gap: clamp(2rem, 4vw, 4.5rem);
    /* aside must stretch so the sticky summary has travel room */
    align-items: stretch;
  }
  .results-layout__primary { align-self: start; }
}
.results-layout__primary { min-width: 0; }
.results-layout__aside { min-width: 0; }

/* Connector overlay: drawn by results_flow.js (desktop only). */
.results-flow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}
.results-layout__primary,
.results-layout__aside { position: relative; z-index: 1; }
@media (max-width: 1023.98px) {
  .results-flow { display: none; }
}

/* Sticky summary — capped to the viewport, internal scroll on body. */
@media (min-width: 1024px) {
  .results-layout__aside .panel--summary {
    position: sticky;
    top: calc(var(--aside-top) + 3.4rem); /* clear the sticky header */
    max-height: calc(100vh - var(--aside-top) * 2 - 3.4rem);
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .results-layout__aside .panel--summary .panel__header { flex-shrink: 0; }
  .results-layout__aside .panel--summary .summary-placeholder,
  .results-layout__aside .panel--summary .summary-body {
    overflow-y: auto;
    min-height: 0;
    padding-right: 0.35rem;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
  }
  .results-layout__aside .panel--summary .summary-body { flex: 1 1 auto; }
  .results-layout__aside .panel--summary .report-actions { flex-shrink: 0; }
}

.panel--summary {
  border-top: 3px solid var(--iris);
}

/* ─── Highlights (at a glance) ──────────────────────────────────── */
.highlights {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.highlights--compact { display: grid; gap: 1rem; }
@media (min-width: 640px) { .highlights--compact { grid-template-columns: 1fr 1fr; } }

.highlight-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem 1rem;
  background: var(--surface-soft);
}
.highlight-card--skills { border-top: 3px solid var(--iris); }
.highlight-card--nature { border-top: 3px solid var(--aurora); }

.highlight-card__title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
}
.highlight-card__sub {
  margin: 0.2rem 0 0.7rem;
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.highlight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.88rem;
}
.highlight-list--tight { gap: 0.3rem; }
.highlight-list--compact { font-size: 0.88rem; }
.highlight-list li {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0.45rem;
  align-items: baseline;
  padding: 0.42rem 0.6rem;
  border-left: 2px solid var(--line-strong);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
}
.highlight-card--skills .highlight-list li { border-left: 2px solid rgba(79, 70, 229, 0.55); }
.highlight-card--nature .highlight-list li { border-left: 2px solid rgba(14, 152, 136, 0.55); }
.highlight-list li .chip-desc {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}
.highlight-list--tight li {
  grid-template-columns: auto 1fr;
  padding: 0.3rem 0.5rem;
}

.chip-id {
  font-family: ui-monospace, monospace;
  font-size: 0.74rem;
  color: var(--faint);
}
.chip-meta {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.74rem;
}
.chip-label { color: var(--ink-soft); font-weight: 600; }

.nature-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 460px) { .nature-split { grid-template-columns: 1fr 1fr; } }
.nature-split__title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.4rem;
}
.highlight-card__empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}
.highlight-card__empty--inline { margin: 0.25rem 0 0; }
.cmyk-tick {
  display: inline-block;
  width: 14px;
  height: 3px;
  background: var(--iris);
  border-radius: 1px;
}
.cmyk-tick--m { background: var(--aurora); }

/* ─── Model blocks (evidence) ───────────────────────────────────── */
.panel--results .model-block + .model-block { margin-top: 1rem; }

.model-block {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1.05rem 1.15rem 1.15rem;
  background: var(--surface);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.model-block--clean { margin-bottom: 1rem; }
.model-block--clean .model-block__title { font-size: 0.95rem; margin-bottom: 0.5rem; }

/* Viewport link state — set by results_flow.js while the summary
   connector points at this block. */
.model-block.is-linked {
  border-color: rgba(79, 70, 229, 0.55);
  background: linear-gradient(180deg, var(--surface) 0%, #fbfaff 100%);
  box-shadow: 0 0 0 3px var(--iris-soft), var(--shadow-card);
}

.model-block__accent {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
  pointer-events: none;
}
.model-block--c1 { border-left: 3px solid rgba(79, 70, 229, 0.55); }
.model-block--c2 { border-left: 3px solid rgba(14, 152, 136, 0.55); }
.model-block--c3 { border-left: 3px solid rgba(138, 106, 31, 0.50); }
.model-block--c4 { border-left: 3px solid var(--line-strong); }
.model-block--c1 .model-block__accent { background: rgba(79, 70, 229, 0.35); }
.model-block--c2 .model-block__accent { background: rgba(14, 152, 136, 0.35); }
.model-block--c3 .model-block__accent { background: rgba(138, 106, 31, 0.30); }
.model-block--c4 .model-block__accent { background: var(--line); }

.model-block__title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.model-block__description,
.model-block__note {
  margin: 0.25rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.row-tag {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--iris-faint);
  color: var(--iris-ink);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.model-block__subtitle {
  font-size: 0.76rem;
  color: var(--muted);
  margin: 1rem 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.source-detail {
  margin-top: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  overflow: hidden;
}
.source-detail summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.72rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-soft);
}
.source-detail summary:hover { color: var(--ink); }
.source-detail summary::after {
  content: "Expand";
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.source-detail[open] summary::after { content: "Collapse"; }
.source-detail summary small {
  color: var(--muted);
  font-weight: 500;
}
.source-detail[open] { padding: 0 0.9rem 0.9rem; }
.source-detail[open] summary {
  margin-inline: -0.9rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.source-detail--nested {
  margin-top: 1rem;
}

/* Tables — light header, dark text (fixes the dark-on-dark header) */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
  color: var(--ink-soft);
}
th, td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-2);
}

.mono { font-family: ui-monospace, monospace; font-size: 0.82rem; }
.num  { font-variant-numeric: tabular-nums; white-space: nowrap; }
.desc { color: var(--ink-soft); font-size: 0.84rem; }
.evidence-absent { color: var(--muted); font-style: italic; font-size: 0.82rem; opacity: 0.75; }
.spikes { font-size: 0.84rem; color: var(--muted); padding-left: 1.1rem; margin: 0.25rem 0 0; }
.spikes li { margin: 0.25rem 0; }
.reliability-box {
  display: grid;
  gap: 0.3rem;
  margin: 0.6rem 0 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
}
.reliability-box strong { color: var(--ink); }
.reliability-box span,
.reliability-box small { color: var(--muted); }
.reliability-box--warning {
  border-color: rgba(178, 67, 67, 0.32);
  background: rgba(178, 67, 67, 0.06);
}
.reliability-box--ok {
  border-color: rgba(14, 152, 136, 0.25);
  background: rgba(14, 152, 136, 0.06);
}

.diagnostics-grid,
.object-domain-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 720px) {
  /* Auto-fit keeps a minimum readable card width: cards drop to a single column
     rather than being squeezed so narrow that inner content needs horizontal scroll. */
  .diagnostics-grid,
  .object-domain-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  }
}
.diagnostic-card,
.object-domain-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  padding: 0.9rem 1rem;
}
.diagnostic-card__title {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  color: var(--ink);
}
.diagnostic-flag {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  line-height: 1.5;
}
.diagnostic-flag--warning { color: var(--err); }
.diagnostic-flag--ok { color: var(--aurora-ink); }
.diagnostic-flag--neutral { color: var(--ink-soft); }
.diagnostic-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}
.diagnostic-list {
  margin: 0.7rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.diagnostic-list li { margin: 0.3rem 0; }

/* ─── Summary panel ─────────────────────────────────────────────── */
.summary-lead {
  font-size: 0.94rem;
  color: var(--ink-soft);
  margin: 0.45rem 0 0;
  line-height: 1.55;
}
.summary-placeholder { margin-top: 0.5rem; }
.summary-muted { color: var(--muted); font-size: 0.92rem; margin: 0; line-height: 1.55; }

.summary-body .summary-headline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  margin: 0 0 1rem;
  line-height: 1.45;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.summary-sub {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--iris-ink);
  margin: 1rem 0 0.4rem;
}
.summary-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.summary-list li { margin: 0.4rem 0; }
.summary-list li::marker { color: var(--iris); }
.summary-list--muted li { color: var(--muted); }
.summary-list--muted li::marker { color: var(--faint); }
.summary-paragraph {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.6;
}
.summary-caveat {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 1rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
  font-style: italic;
}
.summary-error { color: var(--err); margin: 0 0 0.5rem; }

#summary-narrative.is-loading .summary-placeholder { display: block; }

.summary-loader {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.55rem;
  border-left: 2px solid var(--iris);
  background: var(--iris-faint);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.3;
}
.summary-loader__label { font-weight: 500; }
.summary-loader__dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.summary-loader__dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--iris);
  opacity: 0.35;
  animation: inference-consolidate 1.1s ease-in-out infinite;
}
.summary-loader__dots span:nth-child(2) {
  background: var(--aurora);
  animation-delay: 0.18s;
}
.summary-loader__dots span:nth-child(3) {
  background: var(--line-strong);
  animation-delay: 0.36s;
}
@keyframes inference-consolidate {
  0%, 100% { transform: scale(0.85); opacity: 0.35; }
  40%      { transform: scale(1.25); opacity: 1; }
}

.summary-retry-row { margin: 0.9rem 0 0; }
.summary-retry { font-size: 0.88rem; padding: 0.45rem 1rem; }

.summary-body.is-revealing {
  position: relative;
  caret-color: var(--iris);
}
.summary-body.is-revealing::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  top: 0.4rem;
  width: 2px;
  height: 1rem;
  background: var(--iris);
  animation: summary-caret 0.65s steps(2, start) infinite;
  pointer-events: none;
}
@keyframes summary-caret { to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .summary-loader__dots span { animation: none; opacity: 0.85; }
  .summary-body.is-revealing::after { animation: none; opacity: 0.35; }
}

/* Report actions */
.report-actions {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.report-actions__row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.report-actions__row .btn-secondary { flex: 1 1 auto; font-size: 0.85rem; padding: 0.5rem 0.9rem; }
.report-actions__row input[type="email"] {
  flex: 1 1 10rem;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  font-size: 0.88rem;
}

/* Conversation snapshot */
.chat-snapshot {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 20rem;
  overflow-y: auto;
  font-size: 0.88rem;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}
.chat-snapshot--plain {
  white-space: pre-wrap;
  color: var(--ink-soft);
  line-height: 1.5;
}
.chat-snapshot__bubble {
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  line-height: 1.45;
  max-width: 92%;
  color: var(--ink-soft);
}
.chat-snapshot__bubble--user,
.chat-snapshot__bubble--you {
  align-self: flex-end;
  background: var(--iris-wash);
  border: 1px solid rgba(79, 70, 229, 0.22);
}
.chat-snapshot__bubble--assistant,
.chat-snapshot__bubble--ai {
  align-self: flex-start;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.results-rerun {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ─── Footer ────────────────────────────────────────────────────── */
.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding-block: 1.5rem 1.75rem;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  justify-content: space-between;
}
.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.site-footer__brand picture { display: block; line-height: 0; }
.site-footer__mark {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: var(--radius-xs);
  background: #ffffff;
  padding: 4px;
  border: 1px solid var(--line);
}
.site-footer__lead {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 44ch;
}
.site-footer__cta {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  color: var(--iris-ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  text-decoration: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.site-footer__cta:hover { border-color: var(--iris); background: var(--iris-faint); }
.site-footer__cta:focus-visible { outline: 2px solid var(--iris); outline-offset: 2px; }

.site-footer--compact {
  margin-top: auto;
  padding: 1.25rem 0 1.75rem;
  border-top: 1px solid var(--line);
}
.site-footer--compact .site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer--compact .site-footer__lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ─── Demo report: single-screen pitch snapshot ─────────────────── */
.page-main--demo-report {
  max-width: 1500px;
  padding: 0.9rem var(--container-px) 1.1rem;
}

.page-body--demo-report .site-footer--compact {
  padding: 0.7rem 0 1rem;
}

.cci-report {
  display: grid;
  gap: 0.75rem;
}

.cci-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.9fr);
  gap: 1rem;
  align-items: stretch;
}

.cci-kicker {
  margin: 0 0 0.25rem;
  color: var(--iris-ink);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cci-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3vw, 2.7rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.cci-lead {
  margin: 0.55rem 0 0;
  max-width: 66ch;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.5;
}

.cci-hero__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.cci-stat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.3rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  min-height: 124px;
}

.cci-stat--accent {
  background: linear-gradient(180deg, var(--iris-faint), rgba(255,255,255,0.98));
  border-color: rgba(79, 70, 229, 0.18);
}

.cci-stat__label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cci-stat__value {
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.cci-stat__sub {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.cci-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 0.75rem;
}

.cci-panel {
  min-width: 0;
}

.cci-panel--distribution,
.cci-panel--actions {
  grid-column: span 1;
}

.cci-panel--atoms {
  grid-column: span 2;
}

.cci-panel--actions {
  grid-column: span 2;
}

.cci-bars {
  display: grid;
  gap: 0.42rem;
}

.cci-bar-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 26px;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.85rem;
}

.cci-bar-row__label,
.cci-bar-row__count {
  font-weight: 600;
  color: var(--ink-soft);
}

.cci-bar {
  height: 0.72rem;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--line);
}

.cci-bar-svg,
.ce-meter-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.cci-bar-track,
.ce-meter-track {
  fill: var(--surface-2);
}

.cci-bar-fill {
  fill: var(--iris);
}

.cci-bar-row--hybrid .cci-bar-fill,
.cci-bar-row--core .cci-bar-fill { fill: var(--aurora); }
.cci-bar-row--stretch .cci-bar-fill { fill: #5d86d7; }
.cci-bar-row--watch .cci-bar-fill { fill: #c8a73f; }
.cci-bar-row--risk .cci-bar-fill,
.cci-bar-row--critical .cci-bar-fill { fill: #c2362f; }

.cci-caption {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.ce-profile {
  display: grid;
  gap: 0.7rem;
}

.ce-row__head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.ce-meter {
  height: 0.58rem;
  margin-top: 0.22rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}

.ce-meter-fill { fill: var(--iris); }

.ce-row__note {
  margin: 0.32rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.cci-insight {
  margin: 0.7rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.42;
}

.atom-cloud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.atom-chip {
  display: grid;
  gap: 0.18rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.atom-chip--ls { background: var(--iris-faint); }
.atom-chip--pt { background: rgba(14, 152, 136, 0.09); }
.atom-chip--sm { background: rgba(200, 167, 63, 0.12); }

.atom-chip__id,
.atom-chip__share {
  font-size: 0.73rem;
  color: var(--muted);
}

.atom-chip strong {
  font-size: 0.88rem;
  line-height: 1.2;
}

.discovery-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.cci-subtitle {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
}

.cci-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.34;
}

.cci-list--tight {
  gap: 0.28rem;
}

.dept-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.38rem;
}

.dept-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.38rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
}

.dept-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.decision-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.decision-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 0.85rem 0.9rem;
}

.decision-inline {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.4;
}

.decision-inline span {
  font-weight: 700;
}

.decision-note,
.cci-summary {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.42;
}

.decision-meta {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-size: 0.79rem;
  line-height: 1.34;
}

.cci-footer-note {
  padding-top: 0.95rem;
  padding-bottom: 0.95rem;
}

@media (max-width: 1360px) {
  .cci-grid {
    grid-template-columns: 1.2fr 1fr;
  }
  .cci-panel--atoms,
  .cci-panel--actions {
    grid-column: span 2;
  }
  .atom-cloud {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1023.98px) {
  .page-main--demo-report {
    padding-bottom: 2rem;
  }
  .cci-hero,
  .cci-grid,
  .decision-grid,
  .discovery-columns,
  .atom-cloud,
  .cci-hero__meta {
    grid-template-columns: 1fr;
  }
  .cci-panel--atoms,
  .cci-panel--actions {
    grid-column: span 1;
  }
}

/* ─── Ontology report ────────────────────────────────────────────── */
.page-main--ontology-report {
  max-width: 1500px;
  padding: 0.9rem var(--container-px) 1.2rem;
}

.ontology-report {
  display: grid;
  gap: 0.8rem;
}

.ontology-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 1rem;
  align-items: stretch;
}

.ontology-meta {
  display: grid;
  gap: 0.75rem;
}

.ontology-stat {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.ontology-stat--accent {
  background: rgba(14, 152, 136, 0.08);
  border-color: rgba(14, 152, 136, 0.2);
}

.ontology-map {
  display: grid;
  gap: 0.8rem;
}

.ontology-svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at top left, rgba(79, 70, 229, 0.05), transparent 46%),
    radial-gradient(ellipse at bottom right, rgba(14, 152, 136, 0.05), transparent 44%),
    var(--surface-soft);
  border: 1px solid var(--line);
}

.ontology-links line {
  stroke: rgba(64, 72, 89, 0.34);
  stroke-width: 2;
}

.ontology-node rect {
  stroke: var(--line-strong);
  stroke-width: 1.2;
}

.ontology-node--root rect {
  fill: rgba(79, 70, 229, 0.12);
  stroke: rgba(79, 70, 229, 0.28);
}

.ontology-node--dept rect {
  fill: rgba(79, 70, 229, 0.06);
}

.ontology-node--cap rect {
  fill: rgba(14, 152, 136, 0.08);
  stroke: rgba(14, 152, 136, 0.22);
}

.ontology-node--artifact rect {
  fill: rgba(200, 167, 63, 0.10);
  stroke: rgba(200, 167, 63, 0.26);
}

.ontology-node--action rect {
  fill: rgba(21, 23, 30, 0.05);
}

.ontology-node--risk rect {
  fill: rgba(194, 54, 47, 0.10);
  stroke: rgba(194, 54, 47, 0.24);
}

.ontology-node--good rect {
  fill: rgba(14, 152, 136, 0.11);
}

.ontology-node__kicker {
  font-size: 14px;
  font-weight: 700;
  fill: var(--iris-ink);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ontology-node__title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  fill: var(--ink);
}

.ontology-node__title--sm {
  font-size: 18px;
  font-weight: 600;
}

.ontology-node__body {
  font-size: 14px;
  fill: var(--ink-soft);
}

.ontology-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.ontology-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.ontology-dot {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 999px;
  display: inline-block;
}

.ontology-dot--root { background: rgba(79, 70, 229, 0.55); }
.ontology-dot--dept { background: rgba(79, 70, 229, 0.24); }
.ontology-dot--cap { background: rgba(14, 152, 136, 0.42); }
.ontology-dot--artifact { background: rgba(200, 167, 63, 0.54); }
.ontology-dot--action { background: rgba(21, 23, 30, 0.35); }

.ontology-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.95fr;
  gap: 0.8rem;
}

.ontology-nodes-list {
  display: grid;
  gap: 0.8rem;
}

@media (max-width: 1100px) {
  .ontology-hero,
  .ontology-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Inline code ───────────────────────────────────────────────── */
code {
  font-size: 0.85em;
  background: var(--iris-faint);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  border: 1px solid rgba(79, 70, 229, 0.18);
  color: var(--iris-ink);
}

/* ═══ Legacy surfaces (/legacy form page) — same palette, simplified ═══ */
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.site-header__top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 0.65rem;
}

.layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}
@media (min-width: 1100px) {
  .layout--with-results {
    grid-template-columns: minmax(0, 1.25fr) var(--flow-gutter) minmax(360px, 1fr);
    column-gap: 0;
    row-gap: 1.25rem;
  }
  .layout--with-results .layout__primary { grid-column: 1; align-self: start; }
  .layout--with-results .layout__aside   { grid-column: 3; }
}
.layout__primary { min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.layout__aside   { min-width: 0; }

.flow-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}
.layout--with-results > .layout__primary,
.layout--with-results > .layout__aside { position: relative; z-index: 1; }
@media (max-width: 1099.98px) {
  .flow-overlay { display: none; }
  .layout--with-results { grid-template-columns: minmax(0, 1fr); }
  .layout--with-results .layout__primary,
  .layout--with-results .layout__aside { grid-column: auto; }
}
@media (min-width: 1100px) {
  .layout--with-results .panel--summary {
    position: sticky;
    top: var(--aside-top);
    max-height: calc(100vh - var(--aside-top) * 2);
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .layout--with-results .panel--summary .panel__header { flex-shrink: 0; }
  .layout--with-results .panel--summary .summary-placeholder,
  .layout--with-results .panel--summary .summary-body {
    overflow-y: auto;
    min-height: 0;
    padding-right: 0.25rem;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
  }
  .layout--with-results .panel--summary .summary-body { flex: 1 1 auto; }
}

.input-surface {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
@media (min-width: 960px) {
  .input-surface {
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
    align-items: start;
  }
}
.input-primary {
  padding: 1.35rem 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 960px) {
  .input-primary {
    border-bottom: none;
    border-right: 1px solid var(--line);
  }
}
.context-panel { padding: 0; }
.context-drawer { padding: 0; }
.context-drawer > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 1rem 1.15rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}
.context-drawer > summary::-webkit-details-marker { display: none; }
.context-drawer > summary::before {
  content: "▸";
  color: var(--iris);
  transition: transform 0.15s ease;
}
.context-drawer[open] > summary::before { transform: rotate(90deg); }
.context-drawer__intro,
.context-drawer .context-block { padding: 0 1.15rem; }

.input-modes {
  margin-bottom: 1.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.onboarding-note {
  padding: 1rem 1.15rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.onboarding-note p { margin: 0; color: var(--muted); }
.onboarding-note .eyebrow {
  margin-bottom: 0.25rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.input-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: transparent;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 720px) { .input-tabs { grid-template-columns: repeat(3, 1fr); } }
.input-tab {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-display);
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
  position: relative;
}
.input-tab:hover {
  background: var(--iris-faint);
  color: var(--ink);
  border-color: var(--line-strong);
}
.input-tab:focus-visible {
  outline: 2px solid var(--iris);
  outline-offset: -3px;
  z-index: 1;
}
.input-tab[aria-selected="true"] {
  background: var(--iris-wash);
  color: var(--ink);
  border-color: rgba(79, 70, 229, 0.45);
}
.input-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--iris);
}
.input-tab__label { font-size: 0.98rem; font-weight: 600; letter-spacing: 0.01em; }
.input-tab__sub {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--muted);
}
.input-tab[aria-selected="true"] .input-tab__sub { color: var(--ink-soft); }

.input-panel {
  padding: 1.35rem 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.input-panel[hidden] { display: none; }
.input-panel.is-muted { opacity: 0.58; }
.input-panel.is-muted textarea,
.input-panel.is-muted input { cursor: not-allowed; }
.input-panel__header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--ink);
}
.input-panel__header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.chat-partner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}
@media (min-width: 640px) { .chat-partner { grid-template-columns: 1fr 1fr; } }
.partner-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.85rem 0.8rem 2.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.partner-card input[type="radio"] {
  position: absolute;
  left: 0.85rem;
  top: 0.9rem;
  width: 14px;
  height: 14px;
  accent-color: var(--iris);
}
.partner-card:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.partner-card:has(input:checked) {
  border-color: rgba(79, 70, 229, 0.55);
  background: var(--iris-wash);
  color: var(--ink);
}
.partner-card__title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
}
.partner-card__sub {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}
.partner-card:has(input:checked) .partner-card__sub { color: var(--ink-soft); }

.interview-length { max-width: 18rem; }

/* CE x TE alignment chart */
.cete-chart { margin: 1rem 0 1.25rem; }
.cete-grid { width: 100%; border-collapse: collapse; margin-top: 0.6rem; font-size: 0.8rem; }
.cete-grid th, .cete-grid td { border: 1px solid var(--line, #d9d9e0); padding: 0.5rem 0.6rem; text-align: center; vertical-align: middle; }
.cete-grid thead th, .cete-grid tbody th { background: rgba(0,0,0,0.03); font-weight: 600; }
.cete-corner { text-align: left; color: var(--muted); }
.cete-mode { color: var(--muted); font-size: 0.72rem; }
.cete-cell.cete-strong_match { background: rgba(46,160,67,0.16); }
.cete-cell.cete-match { background: rgba(46,160,67,0.08); }
.cete-cell.cete-stretch { background: rgba(210,153,34,0.14); }
.cete-cell.cete-mismatch { background: rgba(210,80,34,0.10); }
.cete-cell.cete-strong_mismatch { background: rgba(210,40,40,0.16); }
.cete-userrow th { outline: 2px solid var(--accent, #5b6cff); }
.cete-usercell { outline: 3px solid var(--accent, #5b6cff); font-weight: 700; }
.cete-you { color: var(--accent, #5b6cff); font-weight: 700; font-size: 0.72rem; }
.object-domain-card--wide { grid-column: 1 / -1; }

/* ─── Resume-session banner (connection-loss recovery) ──────────── */
.resume-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--aurora, #0e9888);
  border-radius: 12px;
  background: var(--aurora-wash, #e9f6f3);
  color: var(--ink, #15171e);
  font-size: 0.9rem;
}
.resume-banner__text { flex: 1 1 240px; }
.resume-banner__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ─── Auth + account ────────────────────────────────────────────── */
.auth-card {
  max-width: 420px;
  margin: 2.5rem auto;
  padding: 2rem;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e4e6ec);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(21, 23, 30, 0.06);
}
.auth-card__title { margin: 0 0 0.35rem; font-size: 1.5rem; }
.auth-card__lead { margin: 0 0 1.25rem; color: var(--muted, #6e7787); font-size: 0.95rem; }
.auth-card__notice { margin: 0 0 1rem; color: var(--aurora-ink, #0b7a6e); }
.auth-form { display: flex; flex-direction: column; gap: 0.9rem; }
.auth-form .field { display: flex; flex-direction: column; gap: 0.3rem; }
.auth-form input {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-strong, #cfd3dd);
  border-radius: 10px;
  font: inherit;
}
.auth-form__submit { margin-top: 0.4rem; }
.auth-card__fineprint { margin: 0.2rem 0 0; font-size: 0.78rem; color: var(--muted, #6e7787); }
.auth-card__foot { margin: 1.25rem 0 0; font-size: 0.88rem; color: var(--muted, #6e7787); }

.site-nav__logout { display: inline; margin: 0; }
.site-nav__link--button {
  background: none; border: none; cursor: pointer; font: inherit; padding: 0;
  color: inherit;
}

.account { max-width: 780px; margin: 2rem auto; }
.account__header { margin-bottom: 1.5rem; }
.account__title { margin: 0 0 0.2rem; }
.account__email { margin: 0; color: var(--muted, #6e7787); }
.account__section { margin-bottom: 2rem; }
.account__section--muted { padding-top: 1rem; border-top: 1px solid var(--line, #e4e6ec); }
.account__subtitle { font-size: 1.1rem; margin: 0 0 0.75rem; }
.account__reports, .account__teams { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.account__report, .account__team {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.75rem 1rem; border: 1px solid var(--line, #e4e6ec); border-radius: 12px;
  background: var(--surface-soft, #fbfbf9); flex-wrap: wrap;
}
.account__report-main { display: flex; flex-direction: column; gap: 0.15rem; }
.account__report-date { font-size: 0.8rem; color: var(--muted, #6e7787); }
.account__report-actions, .account__data-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.account__team-role {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--iris-soft, rgba(79,70,229,0.1)); color: var(--iris-ink, #322db3);
  padding: 0.15rem 0.5rem; border-radius: 999px;
}
.account__team-alias { font-size: 0.8rem; color: var(--muted, #6e7787); }
.account__empty { color: var(--muted, #6e7787); }
.btn-secondary--small { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.btn-ghost--danger { color: #b42318; }

/* Team dashboard (Phase 5) */
.team-dashboard { display: flex; flex-direction: column; gap: 1.25rem; max-width: 980px; margin: 0 auto; }
.team-dashboard__actions { margin-top: 0.75rem; }
.team-stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1rem; }
.team-stat {
  padding: 1rem; border: 1px solid var(--line, #e4e6ec); border-radius: 14px;
  background: var(--surface-soft, #fbfbf9); text-align: center;
}
.team-stat__value { display: block; font-size: 1.6rem; font-weight: 700; color: var(--iris-ink, #322db3); }
.team-stat__label { display: block; font-size: 0.8rem; color: var(--muted, #6e7787); margin-top: 0.25rem; }
.team-locked { font-size: 0.82rem; color: var(--muted, #6e7787); font-style: italic; }
.account__section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.account__consent { margin: 0; }

/* Legal pages + cookie notice (Phase 6) */
.legal { max-width: 760px; margin: 2rem auto; line-height: 1.6; }
.legal__title { margin: 0.5rem 0 0.25rem; }
.legal__meta { color: var(--muted, #6e7787); font-size: 0.9rem; margin: 0 0 1.5rem; }
.legal__review {
  background: #fff4e5; color: #8a5300; border: 1px solid #f0c987;
  padding: 0.6rem 0.9rem; border-radius: 10px; font-size: 0.85rem; font-weight: 600;
}
.legal h2 { margin-top: 1.6rem; font-size: 1.15rem; }
.legal__list { padding-left: 1.2rem; }
.legal__links { margin-top: 2rem; color: var(--muted, #6e7787); }
.site-footer__links { display: flex; gap: 1rem; font-size: 0.85rem; }
.site-footer__links a { color: var(--muted, #6e7787); text-decoration: none; }
.site-footer__links a:hover { text-decoration: underline; }
.cookie-notice {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 60;
  max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 1.1rem; border-radius: 14px;
  background: var(--ink, #1a1a24); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.cookie-notice[hidden] { display: none; }
.cookie-notice__text { margin: 0; font-size: 0.86rem; }
.cookie-notice__text a { color: #cdd3ff; }

/* Plain-language executive layer (Phase 7) */
.cci-plain {
  margin: 0.5rem 0 1.25rem; padding: 1.1rem 1.25rem; border-radius: 14px;
  background: var(--iris-soft, rgba(79,70,229,0.07)); border: 1px solid var(--line, #e4e6ec);
}
.cci-plain__headline { margin: 0 0 0.5rem; font-size: 1.15rem; color: var(--iris-ink, #322db3); }
.cci-plain__lead { margin: 0 0 0.4rem; font-weight: 600; }
.cci-plain__list { margin: 0 0 0.6rem; padding-left: 1.2rem; line-height: 1.65; }
.cci-plain__list .chip-label { margin: 0 0.15rem; }
.cci-plain__muted { color: var(--muted, #6e7787); }
.cci-plain__caveat { margin: 0; font-size: 0.85rem; color: var(--muted, #6e7787); font-style: italic; }

/* Truly-disabled Analyze button (Phase 4 button/flow cleanup) */
.btn-primary.is-disabled,
.btn-primary:disabled,
.btn-primary[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.btn-primary--block,
.btn-secondary--block { display: block; width: 100%; text-align: center; }

/* Demo persona library (Phase 4) */
.demo-grid {
  display: grid; gap: 1rem; margin-top: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.demo-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.2rem; border: 1px solid var(--line, #e4e6ec); border-radius: 16px;
  background: var(--surface-soft, #fbfbf9); text-decoration: none; color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.demo-card:hover {
  transform: translateY(-2px); border-color: var(--iris, #4f46e5);
  box-shadow: 0 8px 24px rgba(58, 50, 200, 0.12);
}
.demo-card__name { margin: 0 0 0.2rem; font-size: 1.1rem; }
.demo-card__role { margin: 0 0 0.4rem; font-weight: 600; color: var(--iris-ink, #322db3); }
.demo-card__goal { margin: 0 0 0.5rem; }
.demo-card__blurb { margin: 0; color: var(--muted, #6e7787); font-size: 0.9rem; }
.demo-card__foot { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.demo-card__cta { margin-left: auto; font-weight: 600; color: var(--iris, #4f46e5); }

.demo-personas__actions { margin-top: 1rem; }
.demo-persona__facts { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.demo-persona__facts li { font-size: 0.9rem; }
.demo-persona__fact-key { display: inline-block; min-width: 6.5rem; color: var(--muted, #6e7787); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.demo-persona { display: flex; flex-direction: column; gap: 1.25rem; max-width: 820px; margin: 0 auto; }
.demo-persona__eyebrow {
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem;
  color: var(--muted, #6e7787); margin: 0 0 0.3rem;
}
.demo-persona__context { color: var(--muted, #6e7787); }
.demo-persona__proceed {
  margin-top: 1rem; padding: 1.2rem; border-radius: 16px;
  background: var(--iris-soft, rgba(79,70,229,0.08)); border: 1px solid var(--line, #e4e6ec);
}
.demo-persona__proceed-copy { margin: 0 0 1rem; }
.demo-persona__analysis-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}
.demo-persona__analysis-actions form,
.demo-persona__analysis-actions > div {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.demo-persona__analysis-actions span {
  color: var(--muted, #6e7787);
  font-size: 0.8rem;
  line-height: 1.35;
}
.demo-persona__pending { margin: 0; color: var(--muted, #6e7787); font-style: italic; }
.demo-artifact { margin-top: 1rem; }
.demo-artifact__head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.demo-artifact__text {
  width: 100%; margin-top: 0.5rem; padding: 0.75rem; border-radius: 12px;
  border: 1px solid var(--line, #e4e6ec); background: #fff; font: inherit; resize: vertical;
}

/* ─── CCI report additions (def_en + anchors, CE block, logit table) ── */
.chip-anchor {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted, #6e7787);
}
.diagnostic-meta--anchor {
  display: block;
  margin-top: 0.15rem;
  font-style: italic;
  color: var(--ink-soft, #454b57);
}

.ce-block {
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line, #e4e6ec);
  border-left: 3px solid var(--iris, #4f46e5);
  border-radius: var(--radius-xs, 10px);
  background: var(--surface-soft, #fbfbf9);
}
.ce-block__preface { margin: 0.35rem 0 0.6rem; color: var(--ink, #15171e); font-size: 0.95rem; line-height: 1.5; }
.ce-block__evidence-label { margin: 0.75rem 0 0.2rem; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft, #454b57); }
.ce-block__fam { color: var(--iris-ink, #322db3); font-weight: 600; }

.logit-table { width: 100%; }
.logit-table th.num, .logit-table td.num { text-align: right; white-space: nowrap; }

/* ─── Desktop: fit landing & chat to the viewport ───────────────── */
@media (min-width: 1024px) {
  /* Landing hero fills the space between header and footer exactly. */
  .page-body--landing .page-main { flex: 1 1 auto; min-height: 0; display: flex; }
  .page-body--landing .landing-hero { min-height: 0; flex: 1 1 auto; }

  /* Interview workspace: conversation owns the canvas; secondary inputs live in
     a conventional fixed-width utility rail. Only the two work areas scroll. */
  .page-body--chat {
    height: 100dvh;
    overflow: hidden;
  }
  .page-body--chat .app-shell {
    height: 100dvh;
    min-height: 0;
  }
  .page-body--chat .site-footer {
    display: none;
  }
  .page-body--chat .page-main--chat {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    width: 100%;
    max-width: 1500px;
    padding: 0.85rem clamp(1rem, 2vw, 2rem);
    overflow: hidden;
  }
  .page-body--chat .chat-stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    width: 100%;
  }
  .page-body--chat .chat-stage__form {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.75rem;
    width: 100%;
  }
  .page-body--chat .chat-stage__head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding-inline: 0.15rem;
  }
  .page-body--chat .chat-stage__sub,
  .page-body--chat .chat-stage__hint {
    display: inline;
    margin-right: 0.75rem;
  }
  .page-body--chat .chat-stage__controls {
    flex: 0 0 auto;
    justify-content: flex-end;
  }
  .chat-workspace {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    gap: 0.9rem;
  }
  .chat-workspace__conversation {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0.65rem;
  }
  .chat-workspace__sidebar {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    scrollbar-width: thin;
  }
  .chat-workspace__sidebar-title {
    margin: 0;
    padding: 0 0.1rem 0.15rem;
    color: var(--muted);
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .page-body--chat .page-main--chat .chat-window {
    min-height: 0;
    max-height: none;
    padding: clamp(1rem, 1.8vw, 1.5rem);
    border-radius: 14px;
  }
  .page-body--chat .chat-bubble {
    max-width: min(78%, 72ch);
  }
  .page-body--chat .chat-composer {
    gap: 0.35rem;
    padding: 0.7rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-card);
  }
  .page-body--chat .chat-composer textarea {
    min-height: 68px;
    max-height: 22vh;
    resize: vertical;
    border: 0;
    padding: 0.2rem 0.25rem;
    outline: none;
    box-shadow: none;
  }
  .page-body--chat .chat-composer__guidance {
    padding-inline: 0.25rem;
    font-size: 0.78rem;
  }
  .page-body--chat .chat-composer__row,
  .page-body--chat .chat-runtime-hint,
  .page-body--chat .chat-error {
    margin-inline: 0.25rem;
  }
  .page-body--chat .chat-progress-drawer {
    box-shadow: none;
  }
  .page-body--chat .context-drawer--chat,
  .page-body--chat .analysis-settings {
    flex: 0 0 auto;
    background: var(--surface);
  }
  .page-body--chat .chat-stage__footer {
    margin-top: auto;
    padding-top: 0.75rem;
  }
  .page-body--chat .chat-stage__footer .btn-primary {
    align-self: stretch;
  }
}
