:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-subtle: #f7f9f9;
  --surface-sunken: #eef2f3;
  --ink: #15191b;
  --muted: #59616a;
  --faint: #6a727b;
  --border: #e4e8ea;
  --border-strong: #c9cfd4;
  --accent: #0a757d;
  --accent-hover: #085f66;
  --accent-bright: #12a2ab;
  --accent-soft: #e8f5f5;
  --accent-line: #b0dade;
  --warning: #9a6400;
  --warning-soft: #fff8e6;
  --warning-line: #ecd7a4;
  --danger: #b23a34;
  --danger-soft: #fff2f0;
  --danger-line: #ecc2be;
  --success: #1f7a4d;
  --success-soft: #ecf8f1;
  --sidebar-width: 304px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(17, 24, 28, 0.05);
  --shadow-sm: 0 1px 3px rgba(17, 24, 28, 0.06), 0 1px 2px rgba(17, 24, 28, 0.04);
  --shadow-md: 0 6px 16px rgba(17, 24, 28, 0.07), 0 2px 5px rgba(17, 24, 28, 0.04);
  --shadow-lg: 0 26px 64px rgba(17, 24, 28, 0.16), 0 6px 16px rgba(17, 24, 28, 0.06);
  --ring: 0 0 0 3px rgba(10, 117, 125, 0.28);
  --font-ui: "Geist", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-prose: "Geist", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Google Sans Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-code: var(--font-mono);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

:where(a, button, input, textarea, select, summary, dialog, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.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;
}

.noscript-banner {
  padding: 14px 18px;
  color: #fff;
  background: var(--danger);
  font-size: 14px;
  text-align: center;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  max-width: 1920px;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 15px 18px;
  background: var(--surface);
  color: var(--ink);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 4px;
  margin: -4px;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}

.brand-lockup > span:last-child {
  display: grid;
  line-height: 1.25;
}

.brand-lockup strong {
  font-size: 17px;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.brand-lockup small {
  margin-top: 2px;
  color: var(--faint);
  font-family: var(--font-prose);
  font-size: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 10px;
  font-size: 19px;
  font-weight: 700;
}

.prototype-tag {
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  margin: 20px 0 22px;
  padding: 5px 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.prototype-tag span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(18, 162, 171, 0.18);
}

.section-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.section-nav-button {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.section-nav-button:hover {
  color: var(--ink);
  background: var(--surface-sunken);
}

.section-nav-button[aria-current="step"] {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.section-nav-code {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 12px;
}

.section-nav-button[aria-current="step"] .section-nav-code {
  color: var(--accent);
}

.section-nav-label {
  overflow: hidden;
  font-family: var(--font-prose);
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-nav-button[aria-current="step"] .section-nav-label {
  font-weight: 600;
}

.section-nav-state {
  color: var(--muted);
  font-size: 13px;
}

.section-nav-button.is-complete .section-nav-state {
  color: var(--success);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 22px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.55;
}

.sidebar-footer p {
  margin: 0;
}

.sidebar-footer .muted {
  color: var(--faint);
}

.mobile-header {
  display: none;
}

.main-column {
  min-width: 0;
  min-height: 100vh;
  padding: 34px clamp(24px, 3vw, 52px) 72px;
  background: var(--surface);
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow,
.rail-label {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 6px 0 0;
  font-family: var(--font-prose);
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 620;
  letter-spacing: -0.028em;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.save-status {
  color: var(--faint);
  font-size: 13px;
  white-space: nowrap;
}

.progress-track {
  width: 100%;
  height: 6px;
  margin: 26px 0 24px;
  background: var(--surface-sunken);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 260ms ease;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 26px;
  padding: 15px 17px;
  border: 1px solid;
  border-radius: var(--radius);
  font-family: var(--font-prose);
  font-size: 14px;
}

.notice strong {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 620;
  letter-spacing: -0.005em;
}

.notice p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.text-button {
  margin: 9px 0 0;
  padding: 0;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.text-button:hover {
  color: var(--accent-hover);
}

.notice-test {
  color: var(--ink);
  background: var(--surface-subtle);
  border-color: var(--border);
}

.notice-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
}

.section-intro {
  margin-bottom: 26px;
  padding: 24px 26px;
  background: var(--accent-soft);
  color: var(--ink);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
}

.section-intro h2 {
  margin: 0 0 9px;
  font-family: var(--font-prose);
  font-size: 21px;
  font-weight: 620;
  letter-spacing: -0.02em;
}

.section-intro p {
  max-width: 740px;
  margin: 0;
  color: #2c4548;
  font-family: var(--font-prose);
  font-size: 15px;
  line-height: 1.65;
}

.section-intro ul {
  margin: 14px 0 0;
  padding-left: 20px;
  color: #2c4548;
  font-family: var(--font-prose);
  font-size: 14px;
}

.question-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.question-card {
  position: relative;
  min-width: 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  scroll-margin-top: 20px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.question-card:focus-within {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-sm);
}

.question-card.has-error {
  border-color: var(--danger-line);
  background: var(--danger-soft);
}

.question-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.question-code {
  flex: 0 0 auto;
  min-width: 42px;
  padding: 4px 9px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-pill);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.question-title-wrap {
  min-width: 0;
  flex: 1;
}

.question-title {
  margin: 0;
  font-family: var(--font-prose);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.45;
}

.required-mark {
  color: var(--danger);
  font-family: var(--font-ui);
  font-size: 14px;
  vertical-align: top;
}

.question-help {
  max-width: 790px;
  margin: 8px 0 0;
  color: var(--muted);
  font-family: var(--font-prose);
  font-size: 14px;
  line-height: 1.6;
}

.question-example {
  margin: 13px 0 0;
  padding: 12px 15px;
  color: var(--muted);
  background: var(--surface-subtle);
  border-left: 3px solid var(--accent-line);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-prose);
  font-size: 14px;
}

/* Verification write-ups run from a paragraph to several pages, so the long
   ones scroll inside the card rather than burying the question below it. */
.info-scroll {
  max-height: 340px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.info-card {
  padding: 22px 24px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-prose);
}

.info-card.info-accent {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.info-card h3 {
  margin: 0 0 9px;
  font-size: 16px;
  font-weight: 620;
  letter-spacing: -0.012em;
}

.info-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.info-card p + p,
.info-card ul + p {
  margin-top: 11px;
}

.info-card ul {
  margin: 11px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14px;
}

.study-catalog {
  display: grid;
  gap: 26px;
}

.study-catalog-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.study-catalog-summary h3 {
  margin: 5px 0 0;
  font-family: var(--font-prose);
  font-size: 20px;
  font-weight: 630;
  letter-spacing: -0.02em;
}

.study-catalog-summary > strong {
  min-width: 48px;
  color: var(--accent);
  font-size: 30px;
  font-weight: 650;
  text-align: right;
}

.study-catalog-group {
  display: grid;
  gap: 10px;
}

.study-catalog-group-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px;
}

.study-catalog-group-heading h3 {
  margin: 0;
  font-family: var(--font-prose);
  font-size: 17px;
  font-weight: 630;
  text-transform: capitalize;
}

.study-catalog-group-heading span {
  color: var(--faint);
  font-size: 12px;
}

.study-catalog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.study-catalog-task {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: start;
  gap: 14px;
  padding: 18px 20px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.study-catalog-task:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.study-catalog-task.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.study-catalog-task-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.study-catalog-task-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.study-catalog-task-title strong {
  font-family: var(--font-prose);
  font-size: 17px;
  font-weight: 640;
  letter-spacing: -0.015em;
}

.study-catalog-task-title code {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.study-catalog-taxonomy {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.study-catalog-description {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-prose);
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.study-catalog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.study-catalog-tags > span {
  padding: 2px 8px;
  color: var(--muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 11px;
}

.study-catalog-task.is-complete {
  border-color: var(--success);
  background: var(--success-soft);
}

.study-task-done,
.study-task-progress {
  justify-self: start;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.study-task-done {
  color: var(--success);
  background: var(--surface);
  border: 1px solid var(--success);
}

.study-task-progress {
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid var(--warning-line);
}

.study-catalog-task-action {
  align-self: end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

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

.review-choice {
  position: relative;
  display: grid;
  grid-template-columns: 18px 40px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-height: 48px;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease;
}

.review-choice:hover {
  background: var(--surface-subtle);
  border-color: var(--border-strong);
}

.review-choice:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  box-shadow: inset 3px 0 var(--accent);
}

.review-choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.review-choice input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.review-choice-mark {
  min-width: 36px;
  padding: 3px 6px;
  color: var(--muted);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
}

.review-choice:has(input:checked) .review-choice-mark {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.review-choice-copy {
  display: grid;
  gap: 4px;
  font-family: var(--font-prose);
}

.review-choice-copy strong {
  font-size: 15px;
  font-weight: 620;
}

.review-choice-copy small {
  max-width: 760px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.review-open-response {
  display: grid;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.review-open-response > label {
  color: var(--ink);
  font-family: var(--font-prose);
  font-size: 14px;
  font-weight: 600;
}

.review-open-response .text-area {
  min-height: 92px;
}

.review-basis {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  margin-top: 16px;
  padding: 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}

.review-basis > label {
  color: var(--ink);
  font-family: var(--font-prose);
  font-size: 14px;
  font-weight: 600;
}

.review-basis > span {
  color: var(--faint);
  font-size: 12px;
}

.review-basis .text-area {
  grid-column: 1 / -1;
  min-height: 105px;
  background: var(--surface);
}

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

.choice-row {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-height: 46px;
  padding: 12px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: default;
  transition: background 130ms ease, border-color 130ms ease;
}

.choice-row:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}

.choice-row:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.choice-row:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.choice-row > input[type="radio"],
.choice-row > input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.choice-label {
  cursor: pointer;
  font-family: var(--font-prose);
  font-size: 15px;
  line-height: 1.5;
}

.inline-other {
  grid-column: 2;
  width: 100%;
  margin-top: 6px;
}

.text-list {
  display: grid;
  gap: 8px;
}

.text-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.text-list-remove {
  width: 44px;
  min-width: 44px;
  padding: 0;
  font-size: 18px;
}

.text-list-actions {
  margin-top: 2px;
}

.text-list-add {
  width: auto;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-group.span-2 {
  grid-column: 1 / -1;
}

.field-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.text-input,
.text-area,
.select-input,
.number-input {
  width: 100%;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 130ms ease, box-shadow 130ms ease;
}

.text-input,
.select-input,
.number-input {
  min-height: 46px;
  padding: 11px 13px;
}

.text-area {
  min-height: 118px;
  padding: 12px 14px;
  resize: vertical;
  font-family: var(--font-prose);
  line-height: 1.6;
}

.text-input:focus,
.text-area:focus,
.select-input:focus,
.number-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.text-input::placeholder,
.text-area::placeholder {
  color: #949ba2;
}

.char-count {
  color: var(--faint);
  font-size: 12px;
  text-align: right;
}

.field-error {
  min-height: 0;
  margin: 8px 0 0;
  color: var(--danger);
  font-family: var(--font-prose);
  font-size: 13px;
  font-weight: 500;
}

.scale-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.scale-option {
  position: relative;
  min-height: 84px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 10px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: background 130ms ease, border-color 130ms ease;
}

.scale-option:hover {
  background: var(--surface-subtle);
  border-color: var(--border-strong);
}

.scale-option:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.scale-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.scale-option input {
  position: absolute;
  opacity: 0;
}

.scale-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 620;
}

.scale-option:has(input:checked) .scale-number {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.scale-label {
  color: var(--muted);
  font-family: var(--font-prose);
  font-size: 12px;
  line-height: 1.3;
}

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

.constant-sum-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  align-items: center;
  gap: 16px;
  padding: 12px 15px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.constant-sum-row label {
  font-family: var(--font-prose);
  font-size: 14px;
}

.number-wrap {
  position: relative;
}

.number-wrap .number-input {
  padding-right: 32px;
  text-align: right;
}

.number-wrap span {
  position: absolute;
  right: 12px;
  top: 50%;
  color: var(--faint);
  font-size: 14px;
  transform: translateY(-50%);
}

.sum-total {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 11px;
  font-size: 14px;
}

.sum-total strong {
  min-width: 62px;
  color: var(--accent);
  text-align: right;
}

.sum-total.is-invalid strong {
  color: var(--danger);
}

.matrix-scroll {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.matrix-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  table-layout: fixed;
}

.matrix-table th,
.matrix-table td {
  padding: 11px 9px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
}

.matrix-table th:last-child,
.matrix-table td:last-child {
  border-right: 0;
}

.matrix-table tr:last-child td {
  border-bottom: 0;
}

.matrix-table thead th {
  color: var(--muted);
  background: var(--surface-subtle);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-transform: none;
}

.matrix-table .matrix-row-label {
  width: 35%;
  min-width: 210px;
  padding-left: 14px;
  font-family: var(--font-prose);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.matrix-cell label {
  width: 100%;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.matrix-cell input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.matrix-cell:has(input:checked) {
  background: var(--accent-soft);
}

.matrix-cell:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.repeater-list {
  display: grid;
  gap: 14px;
}

.repeater-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
}

.repeater-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 15px;
  color: var(--ink);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 620;
  letter-spacing: 0;
}

.repeater-card-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.mini-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mini-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-prose);
  font-size: 13px;
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease;
}

.mini-check:hover {
  background: var(--surface-subtle);
  border-color: var(--border-strong);
}

.mini-check:has(input:checked) {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.mini-check:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mini-check input {
  accent-color: var(--accent);
}

.repeater-actions {
  margin-top: 12px;
}

.workflow-builder {
  display: grid;
  gap: 12px;
}

.workflow-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-subtle);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.workflow-toolbar-copy {
  display: grid;
  gap: 3px;
}

.workflow-toolbar-copy strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 620;
  letter-spacing: 0;
}

.workflow-toolbar-copy span {
  color: var(--muted);
  font-size: 13px;
}

.workflow-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workflow-toolbar .button {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--border-strong);
}

.workflow-toolbar .button:hover {
  color: var(--accent);
  background: var(--surface);
  border-color: var(--accent-line);
}

.workflow-toolbar .workflow-add-block {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.workflow-toolbar .workflow-add-block:hover {
  color: #fff;
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.workflow-modebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.workflow-modebar button {
  min-height: 38px;
  padding: 0 13px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  font: 600 13px/1 var(--font-ui);
  cursor: pointer;
}

.workflow-modebar button:hover {
  color: var(--ink);
  border-color: var(--border-strong);
}

.workflow-modebar button[aria-pressed="true"] {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.workflow-modebar button[data-workflow-tool="loop"][aria-pressed="true"] {
  color: #fff;
  background: #b07800;
  border-color: #b07800;
}

.workflow-mode-hint {
  flex: 1 1 240px;
  margin-left: 6px;
  color: var(--muted);
  font-family: var(--font-prose);
  font-size: 13px;
}

.workflow-canvas-scroll {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.workflow-canvas-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.workflow-canvas {
  position: relative;
  width: max(100%, 720px);
  height: 520px;
  overflow: hidden;
  background-color: var(--surface-subtle);
  background-image: radial-gradient(circle, rgba(24, 42, 34, 0.09) 1.2px, transparent 1.2px);
  background-position: 0 0;
  background-size: 20px 20px;
  touch-action: pan-x pan-y;
}

.workflow-canvas::after {
  content: "";
  position: absolute;
  inset: 12px;
  pointer-events: none;
  border: 1px dashed rgba(66, 82, 74, 0.16);
  border-radius: var(--radius-sm);
}

.workflow-canvas-label {
  position: absolute;
  z-index: 1;
  top: 18px;
  left: 21px;
  padding: 4px 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.86);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.workflow-edge-layer {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.workflow-edge {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.6;
  vector-effect: non-scaling-stroke;
}

.workflow-edge.flow {
  stroke: #45525c;
}

.workflow-edge.branch {
  stroke: var(--accent);
  stroke-dasharray: 7 5;
}

.workflow-edge.loop {
  stroke: #b07800;
  stroke-width: 3;
}

.workflow-edge-layer marker[id$="-flow"] path {
  fill: #45525c;
}

.workflow-edge-layer marker[id$="-branch"] path {
  fill: var(--accent);
}

.workflow-edge-layer marker[id$="-loop"] path {
  fill: #b07800;
}

.workflow-node {
  position: absolute;
  z-index: 3;
  width: 178px;
  min-height: 108px;
  padding: 0 10px 11px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  transform: translate(-50%, -50%);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.workflow-node:hover,
.workflow-node.is-selected {
  border-color: var(--accent);
  box-shadow: var(--shadow-md), 0 0 0 3px rgba(10, 117, 125, 0.14);
}

.workflow-node.is-connection-source {
  border-color: #b07800;
  box-shadow: var(--shadow-md), 0 0 0 3px rgba(176, 120, 0, 0.22);
}

.workflow-node.is-dragging {
  z-index: 5;
  box-shadow: var(--shadow-lg);
  transition: none;
}

.workflow-studs {
  position: absolute;
  top: -7px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.workflow-studs i {
  width: 22px;
  height: 7px;
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.workflow-node:hover .workflow-studs i,
.workflow-node.is-selected .workflow-studs i {
  border-color: var(--accent);
}

.workflow-node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 0 -10px 9px;
  padding: 7px 7px 7px 11px;
  color: var(--muted);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.workflow-drag-handle {
  min-width: 0;
  padding: 3px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  font: 700 12px/1 var(--font-ui);
  letter-spacing: 0.06em;
  cursor: grab;
  touch-action: none;
}

.workflow-drag-handle:active {
  cursor: grabbing;
}

.workflow-drag-handle:focus-visible,
.workflow-node-remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.workflow-node-remove {
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.workflow-node-remove:hover:not(:disabled) {
  color: var(--danger);
  border-color: var(--danger-line);
}

.workflow-node-remove:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.workflow-node-name,
.workflow-node-detail {
  width: 100%;
  min-width: 0;
  padding: 5px 5px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  font-family: var(--font-prose);
  outline: 0;
}

.workflow-node-name {
  font-size: 14px;
  font-weight: 620;
}

.workflow-node-detail {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.workflow-node-name:focus,
.workflow-node-detail:focus {
  border-bottom-color: var(--accent);
  box-shadow: 0 2px 0 -1px var(--accent);
}

.workflow-node-name::placeholder,
.workflow-node-detail::placeholder {
  color: #949ba2;
}

.workflow-port {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 14px;
  height: 14px;
  padding: 0;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  transform: translateY(-50%);
  cursor: crosshair;
}

.workflow-port-in {
  left: -8px;
}

.workflow-port-out {
  right: -8px;
}

.workflow-node.is-connection-source .workflow-port {
  background: #f4bb3f;
  border-color: #8b5d00;
}

.workflow-port:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.workflow-connections-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.workflow-connections-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
}

.workflow-connections-header > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workflow-connections-header strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 620;
}

.workflow-connection-list {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.workflow-connection-row {
  display: grid;
  grid-template-columns: 84px minmax(190px, 1.2fr) minmax(150px, 1fr) 28px;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

.workflow-connection-row.loop {
  background: var(--warning-soft);
  border-color: var(--warning-line);
}

.workflow-connection-row.branch {
  border-left: 3px solid var(--accent);
}

.workflow-connection-type {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.workflow-connection-row.loop .workflow-connection-type {
  color: var(--warning);
}

.workflow-connection-route {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-family: var(--font-prose);
  font-size: 13px;
}

.workflow-connection-route strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-connection-route > span {
  color: var(--accent);
}

.workflow-connection-condition {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  font: 13px/1.3 var(--font-prose);
}

.workflow-connection-note {
  color: var(--faint);
  font-family: var(--font-prose);
  font-size: 13px;
}

.workflow-connection-remove {
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.workflow-connection-remove:hover {
  color: var(--danger);
  border-color: var(--danger-line);
}

.workflow-empty-connections {
  margin: 0;
  padding: 10px;
  color: var(--muted);
  font-family: var(--font-prose);
  font-size: 13px;
}

.workflow-preview {
  padding: 16px;
  color: var(--ink);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
}

.workflow-preview h4 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.workflow-preview-connections {
  display: grid;
  gap: 6px;
  color: #2c4548;
  font-size: 13px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease, box-shadow 130ms ease;
}

.button {
  min-height: 44px;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-xs);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button-secondary {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.button-secondary:hover:not(:disabled) {
  color: var(--accent-hover);
  background: #dcefef;
}

.button-ghost {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--border-strong);
}

.button-ghost:hover:not(:disabled) {
  color: var(--ink);
  background: var(--surface-subtle);
  border-color: var(--faint);
}

.button-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

.button-small {
  min-height: 36px;
  padding: 6px 12px;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--border-strong);
  font-size: 13px;
}

.button-full {
  width: 100%;
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 1px solid var(--border-strong);
  font-size: 18px;
}

.icon-button:hover {
  background: var(--surface-subtle);
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.form-footer-right {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.sidebar-status {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.rail-card {
  padding: 13px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.rail-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.rail-card-header strong {
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}

.sidebar-progress-body {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.completion-ring-wrap {
  position: relative;
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  margin: 0;
}

.completion-ring {
  width: 76px;
  height: 76px;
  transform: rotate(-90deg);
}

.completion-ring circle {
  fill: none;
  stroke-width: 9;
}

.ring-track {
  stroke: var(--surface-sunken);
}

.ring-value {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 301.59;
  stroke-dashoffset: 301.59;
  transition: stroke-dashoffset 250ms ease;
}

.completion-center {
  position: absolute;
  display: grid;
  text-align: center;
}

.completion-center strong {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.completion-center span {
  color: var(--muted);
  font-family: var(--font-prose);
  font-size: 9px;
}

.status-grid {
  display: grid;
  gap: 2px;
  margin: 0;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.status-grid div {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 1px 0;
}

.status-grid dt {
  color: var(--faint);
  font-size: 9px;
  text-transform: none;
  letter-spacing: 0;
}

.status-grid dd {
  margin: 0;
  overflow: hidden;
  font-size: 10px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-card h2 {
  margin: 5px 0;
  font-family: var(--font-prose);
  font-size: 13px;
  font-weight: 620;
  letter-spacing: -0.015em;
}

.rail-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: var(--font-prose);
  font-size: 10px;
  line-height: 1.45;
}

.rail-card .rail-label {
  font-size: 9px;
}

.rail-card .button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 10px;
}

.rail-new-response {
  display: block;
  margin: 12px auto 0;
}

.rail-card-compact a {
  display: block;
  margin-top: 10px;
  padding: 2px 0;
  color: var(--accent);
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.rail-card-compact a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.modal {
  width: min(560px, calc(100vw - 28px));
  padding: 0;
  background: transparent;
  border: 0;
}

.modal::backdrop {
  background: rgba(15, 22, 26, 0.55);
  backdrop-filter: blur(3px);
}

.modal-card {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.modal-card > p {
  color: var(--muted);
  font-family: var(--font-prose);
  font-size: 14px;
  line-height: 1.6;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-header h2,
.success-card h2 {
  margin: 6px 0 0;
  font-family: var(--font-prose);
  font-size: 23px;
  font-weight: 620;
  letter-spacing: -0.025em;
}

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

.modal-actions-spread {
  justify-content: space-between;
}

.recovery-input {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.key-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
  padding: 15px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
}

.key-display code {
  min-width: 0;
  color: #0b3d41;
  font-family: var(--font-mono);
  font-size: clamp(13px, 2.3vw, 15px);
  font-weight: 600;
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
}

.success-card {
  text-align: center;
}

.success-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin: 0 auto 15px;
  color: #fff;
  background: var(--success);
  border-radius: 50%;
  font-size: 26px;
}

.success-card .eyebrow {
  color: var(--success);
}

.success-card > p {
  margin: 12px auto;
}

.fine-print {
  font-size: 13px !important;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 13px 16px;
  color: #f2f6f7;
  background: #1d2528;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-prose);
  font-size: 14px;
  animation: toast-in 160ms ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1220px) {
  :root {
    --sidebar-width: 278px;
  }

  .main-column {
    padding-inline: 26px;
  }
}

@media (max-width: 1040px) {
  :root {
    --sidebar-width: 250px;
  }

  .sidebar-progress-body {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .completion-ring-wrap,
  .completion-ring {
    width: 66px;
    height: 66px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    box-shadow: none;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    color: var(--ink);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .mobile-header .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 17px;
  }

  .sidebar {
    position: fixed;
    inset: 59px 0 auto 0;
    z-index: 40;
    width: 100%;
    height: calc(100vh - 59px);
    display: none;
    padding: 18px;
    border-right: 0;
  }

  .sidebar.is-open {
    display: flex;
  }

  .sidebar-top .brand-lockup,
  .sidebar-top .prototype-tag {
    display: none;
  }

  .sidebar-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-footer {
    margin-top: 18px;
  }

  .main-column {
    min-height: calc(100vh - 59px);
    padding: 24px 16px 56px;
  }

  .topbar {
    display: block;
  }

  .topbar-actions {
    justify-content: space-between;
    margin-top: 16px;
  }

  .section-intro,
  .question-card {
    padding: 20px 18px;
  }

  .question-header {
    gap: 10px;
  }

  .question-code {
    min-width: 38px;
  }

  .study-catalog-summary,
  .study-catalog-task {
    padding: 17px;
  }

  .study-catalog-task-title {
    display: grid;
    gap: 2px;
  }

  .review-choice {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .review-choice-mark {
    display: none;
  }

  .review-basis {
    grid-template-columns: 1fr;
  }

  .review-basis .text-area {
    grid-column: 1;
  }

  .field-grid,
  .repeater-card-body {
    grid-template-columns: 1fr;
  }

  .scale-grid {
    grid-template-columns: 1fr;
  }

  .scale-option {
    min-height: 48px;
    grid-template-columns: 34px minmax(0, 1fr);
    justify-items: start;
    text-align: left;
  }

  .constant-sum-row {
    grid-template-columns: 1fr 90px;
  }

  .workflow-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .workflow-toolbar-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workflow-toolbar-actions .button {
    min-width: 0;
    padding-inline: 8px;
  }

  .workflow-modebar button {
    flex: 1 1 calc(50% - 6px);
  }

  .workflow-mode-hint {
    flex-basis: 100%;
    margin: 4px 2px 0;
  }

  .workflow-connection-row {
    grid-template-columns: 74px minmax(0, 1fr) 28px;
  }

  .workflow-connection-condition,
  .workflow-connection-note {
    grid-column: 1 / -1;
  }

  .workflow-connection-remove {
    grid-column: 3;
    grid-row: 1;
  }

  .form-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .form-footer > .button,
  .form-footer-right,
  .form-footer-right .button {
    width: 100%;
  }

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

  .modal-actions-spread .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.study-catalog-source {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 5px;
  margin-top: 4px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 650;
}

.task-source-browser {
  overflow: clip;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.task-source-summary {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 18px;
  cursor: pointer;
  list-style: none;
  background: var(--surface-subtle);
}

.task-source-summary::-webkit-details-marker {
  display: none;
}

.task-source-summary > span:first-child {
  display: grid;
  gap: 1px;
}

.task-source-summary strong {
  color: var(--ink);
  font-size: 14px;
  letter-spacing: -0.01em;
}

.task-source-summary small {
  color: var(--muted);
  font-size: 12px;
}

.task-source-summary > span:last-child {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-pill);
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 650;
}

.task-source-layout {
  display: grid;
  min-height: 480px;
  grid-template-columns: minmax(230px, 30%) minmax(0, 1fr);
  border-top: 1px solid var(--border);
}

.task-source-tree {
  max-height: 620px;
  overflow: auto;
  padding: 10px 8px 18px;
  border-right: 1px solid var(--border);
  background: #fbfcfc;
}

.task-source-folder {
  margin: 0;
}

.task-source-folder > summary {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  list-style: none;
  color: #384247;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 650;
}

.task-source-folder > summary::-webkit-details-marker {
  display: none;
}

.task-source-folder > summary:hover {
  background: var(--surface-sunken);
}

.task-source-folder-icon {
  color: var(--faint);
  font-size: 10px;
  transition: transform 140ms ease;
}

.task-source-folder[open] > summary .task-source-folder-icon {
  transform: rotate(90deg);
}

.task-source-folder-children {
  padding-left: 13px;
  border-left: 1px solid var(--border);
  margin-left: 13px;
}

.task-source-file {
  display: grid;
  width: 100%;
  min-height: 34px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 0;
  border-radius: var(--radius-xs);
  cursor: pointer;
  color: #3f494f;
  background: transparent;
  text-align: left;
}

.task-source-file:hover {
  background: var(--surface-sunken);
}

.task-source-file[aria-current] {
  color: var(--accent-hover);
  background: var(--accent-soft);
}

.task-source-file-icon {
  display: inline-grid;
  width: 25px;
  height: 20px;
  place-items: center;
  border: 1px solid #d9e0e2;
  border-radius: 5px;
  color: #647079;
  background: #f1f4f5;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.task-source-file-icon[data-file-kind="dockerfile"],
.task-source-heading-icon[data-file-kind="dockerfile"] {
  color: #1769aa;
  background: #e7f3fb;
  border-color: #b9d9ec;
}

.task-source-file-icon[data-file-kind="python"],
.task-source-heading-icon[data-file-kind="python"] {
  color: #7b5a08;
  background: #fff7d8;
  border-color: #eadb9a;
}

.task-source-file-icon[data-file-kind="r"],
.task-source-heading-icon[data-file-kind="r"] {
  color: #315ca8;
  background: #ebf1fc;
  border-color: #c6d6f3;
}

.task-source-file-icon[data-file-kind="json"],
.task-source-file-icon[data-file-kind="toml"],
.task-source-file-icon[data-file-kind="yaml"],
.task-source-heading-icon[data-file-kind="json"],
.task-source-heading-icon[data-file-kind="toml"],
.task-source-heading-icon[data-file-kind="yaml"] {
  color: #8b5a15;
  background: #fff4df;
  border-color: #ecd2a4;
}

.task-source-file-icon[data-file-kind="lean"],
.task-source-file-icon[data-file-kind="rust"],
.task-source-file-icon[data-file-kind="c"],
.task-source-file-icon[data-file-kind="cpp"],
.task-source-heading-icon[data-file-kind="lean"],
.task-source-heading-icon[data-file-kind="rust"],
.task-source-heading-icon[data-file-kind="c"],
.task-source-heading-icon[data-file-kind="cpp"] {
  color: #8a4730;
  background: #faeee9;
  border-color: #e7c5b9;
}

.task-source-file > span:nth-child(2) {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-source-file small {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  white-space: nowrap;
}

.task-source-viewer {
  min-width: 0;
  min-height: 480px;
  overflow: hidden;
  background: #fff;
}

.task-source-viewer-header {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid #d0d7de;
  color: #24292f;
  background: #f6f8fa;
}

.task-source-file-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.task-source-heading-icon {
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  color: #57606a;
  background: #ffffff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
}

.task-source-file-heading > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.task-source-viewer-header strong {
  overflow: hidden;
  color: #24292f;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 590;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-source-viewer-header strong span {
  color: #6e7781;
  font-weight: 450;
}

.task-source-viewer-header small {
  overflow: hidden;
  color: #6e7781;
  font-family: var(--font-mono);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-source-viewer-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}

.task-source-footer a,
.task-source-error a {
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}

.task-source-footer a:hover,
.task-source-error a:hover {
  text-decoration: underline;
}

.task-source-tool {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  cursor: pointer;
  color: #24292f;
  background: #f6f8fa;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 620;
  line-height: 1;
  text-decoration: none;
  transition:
    color 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.task-source-tool:hover {
  border-color: #afb8c1;
  color: #24292f;
  background: #eef1f4;
  text-decoration: none;
}

.task-source-tool:focus-visible {
  outline-color: #0969da;
}

.task-source-tool[aria-pressed="true"] {
  border-color: #54aeff;
  color: #0550ae;
  background: #ddf4ff;
}

.task-source-empty,
.task-source-binary,
.task-source-error,
.task-source-loading {
  display: grid;
  min-height: 420px;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.task-source-empty > span,
.task-source-binary > span {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 750;
}

.task-source-empty strong,
.task-source-binary strong,
.task-source-error strong {
  color: var(--ink);
}

.task-source-empty p,
.task-source-binary p,
.task-source-error p {
  max-width: 480px;
  margin: 0;
  font-size: 13px;
}

.task-code-workspace {
  min-height: 420px;
  color: #24292f;
  background: #ffffff;
}

.task-code-scroll {
  min-height: 390px;
  max-height: 640px;
  overflow: auto;
  scrollbar-color: #afb8c1 #f6f8fa;
  scrollbar-width: thin;
}

.task-code-scroll:focus-visible {
  outline: 2px solid #0969da;
  outline-offset: -2px;
}

.task-code-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.task-code-scroll::-webkit-scrollbar-track {
  background: #f6f8fa;
}

.task-code-scroll::-webkit-scrollbar-thumb {
  border: 2px solid #f6f8fa;
  border-radius: 8px;
  background: #afb8c1;
}

.task-source-code {
  width: 100%;
  min-width: max-content;
  min-height: 390px;
  margin: 0;
  padding: 12px 0 18px;
  color: #24292f;
  background:
    linear-gradient(90deg, #f6f8fa 0, #f6f8fa 52px, #ffffff 52px, #ffffff 100%);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.7;
  tab-size: 2;
  white-space: pre;
}

.task-source-code code {
  display: table;
  width: 100%;
  min-width: max-content;
}

.task-code-line {
  display: table-row;
}

.task-code-line:hover {
  background: #f6f8fa;
}

.task-code-line-number,
.task-code-line-content {
  display: table-cell;
  min-height: 20px;
}

.task-code-line-number {
  position: sticky;
  z-index: 1;
  left: 0;
  width: 52px;
  min-width: 52px;
  padding: 0 13px 0 8px;
  border-right: 1px solid #d8dee4;
  color: #8c959f;
  background: #f6f8fa;
  text-align: right;
  user-select: none;
}

.task-code-line-content {
  padding: 0 18px;
}

.task-code-scroll.is-wrapped .task-source-code,
.task-code-scroll.is-wrapped .task-source-code code {
  min-width: 0;
}

.task-code-scroll.is-wrapped .task-source-code code {
  display: block;
}

.task-code-scroll.is-wrapped .task-code-line {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
}

.task-code-scroll.is-wrapped .task-code-line-number,
.task-code-scroll.is-wrapped .task-code-line-content {
  display: block;
}

.task-code-scroll.is-wrapped .task-code-line-content {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tok-comment {
  color: #6e7781;
  font-style: italic;
}

.tok-keyword {
  color: #cf222e;
  font-weight: 620;
}

.tok-string {
  color: #0a3069;
}

.tok-number {
  color: #0550ae;
}

.tok-literal {
  color: #0550ae;
  font-weight: 590;
}

.tok-function {
  color: #8250df;
}

.tok-property {
  color: #953800;
}

.tok-operator,
.tok-meta {
  color: #24292f;
}

.tok-section,
.tok-heading {
  color: #8250df;
  font-weight: 620;
}

.tok-link {
  color: #0969da;
  text-decoration: underline;
  text-decoration-color: rgba(9, 105, 218, 0.4);
  text-underline-offset: 2px;
}

.task-code-statusbar {
  display: flex;
  min-height: 31px;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
  padding: 5px 12px;
  border-top: 1px solid #d8dee4;
  color: #6e7781;
  background: #f6f8fa;
  font-family: var(--font-mono);
  font-size: 9px;
}

.task-code-statusbar span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  color: #57606a;
}

.task-code-statusbar i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2da44e;
  box-shadow: 0 0 0 3px rgba(45, 164, 78, 0.1);
}

.task-code-truncated {
  margin: 0;
  padding: 9px 12px;
  border-top: 1px solid #d4a72c;
  color: #7d4e00;
  background: #fff8c5;
  font-size: 10px;
  text-align: center;
}

.task-source-image-wrap {
  display: grid;
  min-height: 420px;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(45deg, #f0f3f3 25%, transparent 25%),
    linear-gradient(-45deg, #f0f3f3 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f0f3f3 75%),
    linear-gradient(-45deg, transparent 75%, #f0f3f3 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.task-source-image-wrap img {
  max-width: 100%;
  max-height: 720px;
  border: 1px solid var(--border);
  background: #fff;
  object-fit: contain;
}

.task-pdf-viewer {
  min-height: 620px;
  color: #24292f;
  background: #ffffff;
}

.task-pdf-toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid #d0d7de;
  background: #f6f8fa;
}

.task-pdf-toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-pdf-toolbar button {
  display: inline-grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  padding: 4px 8px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  cursor: pointer;
  color: #24292f;
  background: #ffffff;
  font-size: 12px;
  font-weight: 650;
}

.task-pdf-toolbar button:hover:not(:disabled) {
  border-color: #afb8c1;
  background: #eef1f4;
}

.task-pdf-toolbar button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.task-pdf-toolbar .task-pdf-fit {
  min-width: 68px;
  font-size: 10px;
}

.task-pdf-page-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #57606a;
  font-size: 10px;
}

.task-pdf-page-control input {
  width: 44px;
  height: 30px;
  padding: 3px 5px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  color: #24292f;
  background: #ffffff;
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: center;
}

.task-pdf-page-control strong {
  color: #24292f;
}

.task-pdf-scale {
  min-width: 62px;
  color: #57606a;
  font-family: var(--font-mono);
  font-size: 9px;
  text-align: center;
}

.task-pdf-stage {
  position: relative;
  min-height: 540px;
  max-height: 760px;
  overflow: auto;
  padding: 24px;
  background:
    linear-gradient(rgba(208, 215, 222, 0.6) 1px, transparent 1px),
    #eaeef2;
  background-size: 100% 32px;
  scrollbar-color: #afb8c1 #eaeef2;
  scrollbar-width: thin;
}

.task-pdf-stage:focus-visible {
  outline: 2px solid #0969da;
  outline-offset: -2px;
}

.task-pdf-canvas {
  display: block;
  max-width: none;
  margin: 0 auto;
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(31, 35, 40, 0.12),
    0 10px 30px rgba(31, 35, 40, 0.15);
}

.task-pdf-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  color: #57606a;
  background: rgba(234, 238, 242, 0.94);
  text-align: center;
}

.task-pdf-loading strong {
  color: #24292f;
  font-size: 13px;
}

.task-pdf-loading span:last-child {
  font-size: 10px;
}

.task-pdf-statusbar {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 12px;
  border-top: 1px solid #d0d7de;
  color: #6e7781;
  background: #f6f8fa;
  font-family: var(--font-mono);
  font-size: 9px;
}

.task-source-footer {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface-subtle);
  font-size: 11px;
}

.task-source-footer code {
  color: var(--ink);
  font-family: var(--font-mono);
}

@media (max-width: 900px) {
  .task-source-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-source-layout {
    grid-template-columns: 1fr;
  }

  .task-source-tree {
    max-height: 330px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .task-source-viewer-header,
  .task-source-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-source-viewer-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .task-source-tool {
    flex: 1 1 auto;
  }

  .task-source-code {
    font-size: 10.5px;
  }

  .task-pdf-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-pdf-toolbar-group {
    width: 100%;
    justify-content: center;
  }

  .task-pdf-stage {
    min-height: 480px;
    max-height: 640px;
    padding: 14px;
  }
}
