:root {
  --bg: #f8f7f4;
  --bg-subtle: #f2f0eb;
  --surface: #ffffff;
  --surface-muted: #faf9f6;
  --ink: #111318;
  --ink-secondary: #4e5563;
  --ink-muted: #7c8391;
  --border: rgba(17, 19, 24, 0.09);
  --border-strong: rgba(17, 19, 24, 0.16);
  --brand: #e63b14;
  --brand-hover: #cc310e;
  --brand-soft: rgba(230, 59, 20, 0.08);
  --brand-border: rgba(230, 59, 20, 0.22);
  --emerald: #0d8a5e;
  --emerald-soft: rgba(13, 138, 94, 0.09);
  --emerald-border: rgba(13, 138, 94, 0.22);
  --amber: #b45b09;
  --amber-soft: rgba(180, 91, 9, 0.09);
  --amber-border: rgba(180, 91, 9, 0.24);
  --indigo: #3049c9;
  --indigo-soft: rgba(48, 73, 201, 0.08);
  --indigo-border: rgba(48, 73, 201, 0.22);
  --danger: #c42b1c;
  --danger-soft: rgba(196, 43, 28, 0.08);
  --danger-border: rgba(196, 43, 28, 0.22);
  --slate-soft: rgba(78, 85, 99, 0.1);
  --shadow-xs: 0 1px 2px rgba(17, 19, 24, 0.04);
  --shadow-md: 0 1px 2px rgba(17, 19, 24, 0.04), 0 12px 32px -12px rgba(17, 19, 24, 0.09);
  --shadow-lg: 0 2px 4px rgba(17, 19, 24, 0.04), 0 20px 48px -18px rgba(17, 19, 24, 0.12);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image:
    radial-gradient(920px 420px at 85% -80px, rgba(230, 59, 20, 0.055), transparent 68%),
    radial-gradient(720px 380px at 10% -60px, rgba(17, 19, 24, 0.03), transparent 70%);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
}

body.modal-open {
  overflow: hidden;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(248, 247, 244, 0.84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  display: block;
  height: 25px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-divider {
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  flex-shrink: 0;
}

.brand-product {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.topbar-pill svg {
  width: 13px;
  height: 13px;
  color: var(--ink-muted);
}

/* ---------- Main Layout ---------- */
.page-main {
  flex: 1;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: clamp(28px, 5.5vh, 60px) clamp(16px, 4vw, 32px) 64px;
}

/* ---------- Loading Boot State ---------- */
.boot-state {
  max-width: 440px;
  margin: 12vh auto;
  padding: 28px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.boot-spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 2.5px solid var(--bg-subtle);
  border-top-color: var(--brand);
  animation: spin 0.75s linear infinite;
}

.boot-state p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-secondary);
}

/* ---------- Screen 1: Unlock Hero ---------- */
.unlock-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
  padding-top: clamp(8px, 2vh, 24px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
}

.eyebrow-mark {
  width: 0;
  height: 0;
  border-left: 4.5px solid transparent;
  border-right: 4.5px solid transparent;
  border-top: 7px solid var(--brand);
  display: inline-block;
}

.hero-title {
  margin: 0 0 18px;
  font-size: clamp(30px, 3.8vw, 44px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.hero-title .accent {
  color: var(--brand);
}

.hero-lead {
  margin: 0 0 32px;
  max-width: 48ch;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink-secondary);
}

.pillar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.pillar-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

.pillar-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  padding-top: 3px;
}

.pillar-title {
  margin: 0 0 3px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.pillar-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-secondary);
}

/* ---------- Elevated Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.unlock-card {
  padding: clamp(24px, 4vw, 36px);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.unlock-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink) 74%, var(--brand) 74%, var(--brand) 100%);
}

.card-kicker {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.card-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.card-subtitle {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-secondary);
}

.cross-portal-link {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-secondary);
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.cross-portal-link strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.cross-portal-link svg {
  width: 15px;
  height: 15px;
  color: var(--ink-muted);
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.cross-portal-link:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
  color: var(--ink);
}

.cross-portal-link:hover svg {
  color: var(--brand);
  transform: translateX(2px);
}

/* ---------- Form Controls ---------- */
.field {
  margin-bottom: 20px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.tag-req {
  color: var(--brand);
  font-weight: 700;
}

.tag-opt {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--bg-subtle);
  padding: 1px 7px;
  border-radius: 999px;
}

.dirty-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  padding: 1px 7px;
  border-radius: 999px;
}

.field-meta {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

.field-meta.is-error {
  color: var(--danger);
  font-weight: 600;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input, .textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 12px 14px;
  line-height: 1.55;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.input:hover, .textarea:hover {
  border-color: rgba(17, 19, 24, 0.28);
}

.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3.5px rgba(17, 19, 24, 0.08);
}

.input-code {
  font-family: var(--font-mono);
  font-size: 14.5px;
  letter-spacing: 0.04em;
  padding-right: 76px;
  height: 48px;
}

.input::placeholder, .textarea::placeholder {
  color: #9ba1ad;
  font-family: var(--font-sans);
  letter-spacing: normal;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.textarea-compact {
  min-height: 82px;
}

.textarea-profile {
  min-height: 210px;
  line-height: 1.75;
}

.input-action {
  position: absolute;
  right: 8px;
  padding: 6px 11px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.input-action:hover {
  background: var(--bg-subtle);
  color: var(--ink);
  border-color: var(--border-strong);
}

.field-help {
  margin: 7px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-muted);
}

/* Direction Mode Compact Pills */
.dir-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dir-option {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.dir-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.dir-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.2;
  user-select: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.dir-option:hover .dir-pill {
  border-color: rgba(17, 19, 24, 0.34);
  background: var(--surface-muted);
  color: var(--ink);
}

.dir-option input:focus-visible + .dir-pill {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.dir-option input:checked + .dir-pill {
  border-color: var(--ink);
  background: linear-gradient(180deg, #ffffff 0%, #faf9f6 100%);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 0 0 2.5px rgba(17, 19, 24, 0.06);
}

.dir-check {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1.5px solid rgba(17, 19, 24, 0.22);
  background: var(--surface);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.dir-check svg {
  width: 10px;
  height: 10px;
}

.dir-option input:checked + .dir-pill .dir-check {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.dir-custom-wrap {
  margin-top: 10px;
}

.input-dir-custom {
  padding-right: 64px;
}

.input-counter {
  position: absolute;
  right: 12px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  pointer-events: none;
}

.meta-item-highlight {
  color: var(--indigo);
  font-weight: 600;
}

.meta-item-highlight svg {
  color: var(--indigo);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 11px;
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1;
  padding: 13px 20px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(17, 19, 24, 0.14);
}

.btn-primary:hover:not(:disabled) {
  background: #232732;
  box-shadow: 0 6px 16px -4px rgba(17, 19, 24, 0.24);
}

.btn-brand {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(230, 59, 20, 0.24);
}

.btn-brand:hover:not(:disabled) {
  background: var(--brand-hover);
  box-shadow: 0 8px 18px -5px rgba(230, 59, 20, 0.34);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: rgba(17, 19, 24, 0.28);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-secondary);
  border-color: var(--border);
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 9px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-full {
  width: 100%;
  height: 48px;
}

.btn-spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #ffffff;
  animation: spin 0.7s linear infinite;
}

.btn-ghost .btn-spinner,
.btn-secondary .btn-spinner {
  border-color: rgba(17, 19, 24, 0.18);
  border-top-color: var(--ink);
}

/* ---------- Inline Alerts ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.55;
  margin-bottom: 18px;
  border: 1px solid transparent;
}

.alert svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-error {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

.alert-info {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: var(--amber);
}

.trust-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-muted);
}

.trust-note svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--ink-muted);
}

/* ---------- Narrow Form Screens (#unused & #review) ---------- */
.narrow-shell {
  max-width: 740px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 24px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 14px;
}

.status-chip-emerald {
  background: var(--emerald-soft);
  border: 1px solid var(--emerald-border);
  color: var(--emerald);
}

.status-chip-brand {
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  color: var(--brand);
}

.status-chip-indigo {
  background: var(--indigo-soft);
  border: 1px solid var(--indigo-border);
  color: var(--indigo);
}

.status-chip-amber {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber);
}

.status-chip-slate {
  background: var(--slate-soft);
  border: 1px solid var(--border-strong);
  color: var(--ink-secondary);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.dot-pulse {
  position: relative;
}

.dot-pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: pulse-ring 1.8s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

.page-title {
  margin: 0 0 8px;
  font-size: clamp(24px, 3.2vw, 31px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.page-lead {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-secondary);
  line-height: 1.7;
}

.context-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.context-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.context-pill-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-muted);
}

.form-card {
  padding: clamp(22px, 4vw, 34px);
}

.form-section + .form-section {
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

.section-heading {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-head-row .section-heading {
  margin-bottom: 0;
}

.section-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
}

/* ---------- Screen 3: Question Selection Cards ---------- */
.choice-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.choice-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.choice-card {
  display: grid;
  grid-template-columns: 18px 26px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.choice-option:hover .choice-card {
  border-color: rgba(17, 19, 24, 0.34);
  background: var(--surface-muted);
}

.choice-option input:focus-visible + .choice-card {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.choice-option input:checked + .choice-card {
  border-color: var(--ink);
  background: linear-gradient(180deg, #ffffff 0%, #faf9f6 100%);
  box-shadow: 0 0 0 3px rgba(17, 19, 24, 0.06);
}

.choice-radio {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  transition: border-color 0.15s ease;
}

.choice-radio::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
  transform: scale(0);
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.choice-option input:checked + .choice-card .choice-radio {
  border-color: var(--ink);
}

.choice-option input:checked + .choice-card .choice-radio::after {
  transform: scale(1);
}

.choice-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  margin-top: 1px;
}

.choice-option input:checked + .choice-card .choice-num {
  background: var(--brand-soft);
  color: var(--brand);
}

.choice-text {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--ink);
  word-break: break-word;
}

.choice-option input:checked + .choice-card .choice-text {
  font-weight: 600;
}

/* Repick Box */
.repick-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.repick-copy {
  flex: 1;
  min-width: 220px;
}

.repick-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.repick-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-muted);
}

.repick-box .btn-secondary {
  padding: 9px 14px;
  font-size: 13px;
}

.lock-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 18px;
}

.lock-notice svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Spec Strip */
.spec-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  margin-bottom: 22px;
}

.spec-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.spec-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--ink);
}

.spec-icon svg {
  width: 15px;
  height: 15px;
}

.spec-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.spec-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-muted);
}

.submit-caption {
  margin: 12px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* ---------- Screen 4: Progress, Optimizing & Delivery ---------- */
.result-shell {
  max-width: 820px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.result-hero {
  padding: clamp(22px, 4vw, 32px);
}

.result-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.badge-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-group .status-chip {
  margin-bottom: 0;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.sync-pill.is-live {
  color: var(--emerald);
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
}

.sync-pill.is-reconnecting {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber-border);
}

.refresh-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.updated-label {
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.btn-refresh {
  padding: 6px 12px;
  font-size: 12.5px;
  gap: 6px;
}

.btn-refresh.is-spinning svg {
  animation: spin 0.7s linear infinite;
}

.subject-heading {
  margin: 0 0 8px;
  font-size: clamp(23px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
  word-break: break-word;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 8px 0 18px;
  font-size: 13px;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-item svg {
  width: 14px;
  height: 14px;
  color: var(--ink-muted);
}

/* Locked Question Highlight Callout */
.question-callout {
  margin: 14px 0 18px;
  padding: 15px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-left: 3.5px solid var(--ink);
}

.question-callout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.question-kicker {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.btn-inline-toggle {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
}

.btn-inline-toggle:hover {
  text-decoration: underline;
}

.question-text {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--ink);
  word-break: break-word;
}

.locked-profile-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.locked-profile-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 5px;
}

.locked-profile-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Status Banner */
.status-banner {
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.status-banner.tone-active {
  background: linear-gradient(180deg, rgba(230, 59, 20, 0.035) 0%, #faf9f6 100%);
  border-color: var(--brand-border);
}

.status-banner.tone-optimizing {
  background: linear-gradient(180deg, rgba(48, 73, 201, 0.045) 0%, #faf9fc 100%);
  border-color: var(--indigo-border);
}

.status-banner.tone-completed {
  background: linear-gradient(180deg, rgba(13, 138, 94, 0.06) 0%, #fafdf9 100%);
  border-color: var(--emerald-border);
}

.status-banner.tone-attention {
  background: linear-gradient(180deg, rgba(180, 91, 9, 0.06) 0%, #fdfaf5 100%);
  border-color: var(--amber-border);
}

.status-banner.tone-historical {
  background: linear-gradient(180deg, rgba(78, 85, 99, 0.06) 0%, #faf9f6 100%);
  border-color: var(--border-strong);
}

.banner-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.banner-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.banner-pct {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.status-banner.tone-optimizing .banner-pct {
  color: var(--indigo);
}

.status-banner.tone-completed .banner-pct {
  color: var(--emerald);
}

.status-banner.tone-attention .banner-pct {
  color: var(--amber);
}

.status-banner.tone-historical .banner-pct {
  color: var(--ink-secondary);
}

.banner-desc {
  margin: 0;
  font-size: 13.8px;
  line-height: 1.65;
  color: var(--ink-secondary);
}

/* Native CSP-Safe Progress Bar */
.progress-wrap {
  margin-top: 16px;
}

.progress-native {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 7px;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 19, 24, 0.08);
  overflow: hidden;
  display: block;
}

.progress-native::-webkit-progress-bar {
  background: rgba(17, 19, 24, 0.08);
  border-radius: 999px;
}

.progress-native::-webkit-progress-value {
  background: linear-gradient(90deg, #111318 0%, #e63b14 100%);
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-native::-moz-progress-bar {
  background: linear-gradient(90deg, #111318 0%, #e63b14 100%);
  border-radius: 999px;
}

.progress-native.is-optimizing::-webkit-progress-value {
  background: linear-gradient(90deg, #111318 0%, #3049c9 100%);
}

.progress-native.is-optimizing::-moz-progress-bar {
  background: linear-gradient(90deg, #111318 0%, #3049c9 100%);
}

.progress-native.is-completed::-webkit-progress-value {
  background: var(--emerald);
}

.progress-native.is-completed::-moz-progress-bar {
  background: var(--emerald);
}

.progress-native.is-attention::-webkit-progress-value {
  background: var(--amber);
}

.progress-native.is-attention::-moz-progress-bar {
  background: var(--amber);
}

/* Report Actions Deck */
.report-deck {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.report-note {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* Inline Report Preview Reader */
.preview-card {
  overflow: hidden;
}

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.preview-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-frame {
  display: block;
  width: 100%;
  height: 76vh;
  min-height: 540px;
  border: 0;
  background: #ffffff;
}

/* ---------- 4-Stage Pipeline Card ---------- */
.pipeline-card {
  padding: clamp(20px, 3.5vw, 28px);
}

.pipeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.pipeline-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.pipeline-hint {
  font-size: 12.5px;
  color: var(--ink-muted);
}

.stepper {
  list-style: none;
  margin: 0;
  padding: 0;
}

.step-item {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 0 0 22px;
  align-items: start;
}

.step-item:last-child {
  padding-bottom: 0;
}

.step-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 30px;
  bottom: 4px;
  width: 1.5px;
  background: var(--border-strong);
}

.step-item.is-done:not(:last-child)::before {
  background: var(--emerald-border);
}

.step-item.is-active:not(:last-child)::before {
  background: linear-gradient(180deg, var(--brand-border) 0%, var(--border) 100%);
}

.step-node {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-muted);
  position: relative;
  z-index: 1;
}

.step-node svg {
  width: 14px;
  height: 14px;
}

.step-item.is-done .step-node {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #ffffff;
}

.step-item.is-active .step-node {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  box-shadow: 0 0 0 5px var(--brand-soft);
}

.step-item.is-optimizing .step-node {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #ffffff;
  box-shadow: 0 0 0 5px var(--indigo-soft);
}

.step-item.is-attention .step-node {
  background: var(--amber);
  border-color: var(--amber);
  color: #ffffff;
  box-shadow: 0 0 0 5px var(--amber-soft);
}

.step-item.is-cancelled .step-node {
  background: var(--ink-muted);
  border-color: var(--ink-muted);
  color: #ffffff;
}

.step-body {
  padding-top: 3px;
}

.step-name {
  margin: 0 0 3px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-muted);
}

.step-item.is-done .step-name,
.step-item.is-active .step-name,
.step-item.is-optimizing .step-name,
.step-item.is-attention .step-name {
  color: var(--ink);
}

.step-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-muted);
}

.step-item.is-active .step-desc,
.step-item.is-optimizing .step-desc,
.step-item.is-attention .step-desc {
  color: var(--ink-secondary);
}

.step-state {
  padding-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
}

.step-item.is-done .step-state {
  color: var(--emerald);
}

.step-item.is-active .step-state {
  color: var(--brand);
}

.step-item.is-optimizing .step-state {
  color: var(--indigo);
}

.step-item.is-attention .step-state {
  color: var(--amber);
}

/* Reassurance Footnote Box */
.keep-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.keep-card svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--ink-muted);
}

/* ---------- In-Page Confirmation Dialog ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(17, 19, 24, 0.44);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px -12px rgba(17, 19, 24, 0.28);
  padding: 26px 26px 22px;
}

.modal-head {
  margin-bottom: 10px;
}

.modal-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 10px;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}

.modal-desc {
  margin: 0 0 16px;
  font-size: 13.8px;
  line-height: 1.65;
  color: var(--ink-secondary);
}

.modal-quote {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  margin-bottom: 18px;
}

.modal-quote-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.modal-quote-text {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* ---------- Footer ---------- */
.page-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
}

.footer-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.footer-brand {
  font-weight: 600;
  color: var(--ink-secondary);
}

/* ---------- Animations ---------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.9);
    opacity: 0.5;
  }
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot-spinner,
  .btn-spinner,
  .btn-refresh.is-spinning svg,
  .dot-pulse::after {
    animation: none;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .unlock-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 4px;
  }

  .unlock-card-col {
    order: -1;
  }

  .hero-lead {
    margin-bottom: 22px;
  }

  .spec-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar-inner {
    height: 60px;
  }

  .brand-logo {
    height: 22px;
  }

  .brand-divider,
  .brand-product {
    display: none;
  }

  .topbar-pill {
    padding: 5px 10px;
    font-size: 11.5px;
  }

  .topbar-pill-full {
    display: none;
  }

  .choice-card {
    grid-template-columns: 18px 24px minmax(0, 1fr);
    gap: 9px;
    padding: 12px 13px;
  }

  .repick-box {
    flex-direction: column;
    align-items: stretch;
  }

  .repick-box .btn-secondary {
    width: 100%;
  }

  .pipeline-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 18px;
  }

  .step-item {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 12px;
  }

  .step-item:not(:last-child)::before {
    left: 13px;
  }

  .step-node {
    width: 28px;
    height: 28px;
  }

  .step-state {
    grid-column: 2;
    padding-top: 0;
    margin-top: -8px;
  }

  .report-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .report-actions .btn {
    width: 100%;
  }

  .refresh-group {
    width: 100%;
    justify-content: space-between;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
  }
}
