:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-strong: #eef5f2;
  --ink: #17201b;
  --muted: #64706b;
  --border: #d9e0dd;
  --accent: #0f766e;
  --accent-dark: #0b5d57;
  --warn: #925f12;
  --danger: #ad3131;
  --ok: #267348;
  --focus: #d99f24;
  --shadow: 0 10px 24px rgba(24, 36, 32, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 18px;
  height: 48px;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  color: var(--ink);
  font-weight: 750;
  letter-spacing: 0;
}

.navlinks {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.logout-form {
  display: inline;
  margin: 0;
}

.page {
  margin: 0 auto;
  max-width: 1180px;
  padding: 30px 24px 48px;
}

.workspace-page {
  height: calc(100vh - 48px);
  overflow: hidden;
  padding: 0;
}

.page-header,
.workspace-header {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-header h1,
.workspace-header h1 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 4px;
}

.page-header p,
.workspace-header p,
.text-block-header p,
.form-title p {
  color: var(--muted);
  margin: 0;
}

.content-band,
.auth-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  padding: 22px;
}

.content-band h2 {
  font-size: 18px;
  margin: 0 0 16px;
}

.narrow,
.auth-panel {
  max-width: 820px;
}

.auth-panel {
  margin: 80px auto 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.compact-button {
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  line-height: 1.2;
  min-height: 36px;
  padding: 9px 13px;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease;
}

.primary-button {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

.secondary-button,
.compact-button {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--ink);
}

.secondary-button:hover,
.compact-button:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.compact-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.compact-button {
  min-height: 30px;
  padding: 6px 10px;
}

.compact-link,
.link-button {
  background: transparent;
  border: 0;
  color: var(--accent-dark);
  cursor: pointer;
  padding: 0;
}

.full-width {
  width: 100%;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.empty-state {
  color: var(--muted);
  margin: 0;
}

.muted-note {
  color: var(--muted);
  font-size: 13px;
}

.export-waiting {
  align-items: center;
  display: inline-flex;
  min-height: 36px;
}

.staff-user-list {
  display: grid;
  gap: 16px;
}

.staff-user-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.staff-user-summary {
  align-items: center;
  background: #f7faf8;
  cursor: pointer;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(160px, 1fr) auto;
  justify-content: space-between;
  list-style: revert;
  padding: 12px 14px;
}

.staff-user-panel[open] .staff-user-summary {
  border-bottom: 1px solid var(--border);
}

.staff-user-name {
  font-size: 16px;
  font-weight: 750;
}

.staff-user-progress {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.staff-export-details {
  border-top: 1px solid var(--border);
  margin-top: 18px;
  padding-top: 14px;
}

.staff-export-details summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 650;
  margin-bottom: 12px;
}

.messages {
  margin-bottom: 18px;
}

.message {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 10px;
  padding: 10px 12px;
}

.message-success {
  background: #eef8f1;
  border-color: #c9e8d2;
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

.field-label {
  color: var(--ink);
  font-weight: 650;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  padding: 10px 11px;
  width: 100%;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.annotation-form textarea:focus {
  border-color: var(--focus);
  outline: 2px solid rgba(217, 159, 36, 0.24);
}

.mono-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.help-text {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.errorlist {
  color: var(--danger);
  font-weight: 500;
  margin: 0;
  padding-left: 20px;
}

.checklist-field > div,
.checklist-field ul {
  border: 1px solid var(--border);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  list-style: none;
  margin: 0;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
}

.checklist-field > div > div label,
.checklist-field li label {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  font-weight: 500;
  gap: 8px;
  min-height: 36px;
  padding: 6px 8px;
}

.checklist-field > div > div label:has(input:checked),
.checklist-field li label:has(input:checked) {
  background: #eef8f7;
  border-color: var(--accent);
}

.checklist-field input {
  margin: 0;
  width: auto;
}

.workspace-shell {
  height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  min-height: 620px;
}

.workspace-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin: 0;
  min-height: 58px;
  padding: 6px 14px;
  flex: 0 0 auto;
}

.workspace-header h1 {
  font-size: 18px;
  margin: 0 0 2px;
}

.workspace-header p {
  font-size: 12.5px;
  line-height: 1.25;
}

.workspace-title {
  flex: 0 1 320px;
  min-width: 190px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.workspace-actions {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.workspace-nav-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.workspace-nav-actions .primary-button,
.workspace-nav-actions .secondary-button {
  min-height: 32px;
  padding: 7px 11px;
}

.save-status {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  padding: 6px 10px;
}

.save-status[data-tone="busy"] {
  background: #fff8e8;
  border-color: #efd899;
  color: var(--warn);
}

.save-status[data-tone="ok"] {
  background: #eef8f1;
  border-color: #c9e8d2;
  color: var(--ok);
}

.save-status[data-tone="readonly"] {
  background: #f1f4f3;
  border-color: var(--border);
  color: var(--muted);
}

.save-status[data-tone="error"] {
  background: #fff0ef;
  border-color: #f3c7c3;
  color: var(--danger);
}

.workspace-grid {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(280px, 1fr) 6px minmax(360px, 430px);
  height: auto;
  min-height: 0;
  overflow: hidden;
  user-select: auto;
}

.workspace-grid.is-resizing {
  cursor: col-resize;
  user-select: none;
}

.review-pane,
.label-pane {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 9px;
}

.review-pane {
  display: block;
}

.label-pane {
  background: #f9faf9;
}

.pane-resizer {
  align-items: center;
  background: #edf1ef;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  cursor: col-resize;
  display: flex;
  justify-content: center;
  min-height: 0;
  position: relative;
}

.pane-resizer::after {
  background: #a7b4af;
  border-radius: 999px;
  content: "";
  height: 44px;
  width: 2px;
}

.pane-resizer:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.pane-resizer:hover,
.workspace-grid.is-resizing .pane-resizer {
  background: #dfe8e5;
}

.text-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(24, 36, 32, 0.035);
  overflow: hidden;
}

.text-block + .text-block {
  margin-top: 7px;
}

.text-block-header {
  align-items: flex-start;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
}

.text-block-header h2 {
  font-size: 14px;
  margin: 0;
}

.text-block-body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  margin: 0;
  max-height: none;
  overflow: auto;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.text-block.is-long:not(.expanded) .text-block-body {
  max-height: 220px;
}

.text-block.is-long:not(.expanded) {
  position: relative;
}

.text-block.is-long:not(.expanded):not(.has-reference-sources):not(.has-answer-parts)::after {
  background: linear-gradient(rgba(255, 255, 255, 0), #ffffff);
  bottom: 34px;
  content: "";
  height: 54px;
  left: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
}

.answer-block-body {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
}

.answer-part + .answer-part {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.answer-part-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 5px;
}

.answer-part-header h3 {
  font-size: 13px;
  font-weight: 750;
  line-height: 1.25;
  margin: 0;
}

.answer-search-tools {
  align-items: center;
  display: flex;
  flex: 1 1 280px;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
  min-width: 240px;
}

.answer-search-input {
  flex-basis: 150px;
}

.answer-part-body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.48;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.answer-markdown-body {
  white-space: normal;
}

.answer-part.is-scrollable .answer-part-body {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: min(520px, 56vh);
  min-height: min(260px, 34vh);
  overflow: auto;
  padding: 7px 9px;
}

.answer-part.has-answer-search-results .answer-search-count {
  display: inline-block;
}

.answer-part.has-answer-search-results .answer-search-nav {
  display: inline-flex;
}

.reference-source-list {
  display: grid;
  gap: 7px;
  padding: 7px;
}

.reference-source-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: 0 2px 8px rgba(24, 36, 32, 0.04);
  min-height: 0;
  overflow: hidden;
}

.reference-source-card:first-child {
  border-top: 1px solid var(--border);
}

.reference-source-header {
  align-items: flex-start;
  background: #f8fbfa;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: space-between;
  padding: 6px 8px;
}

.reference-source-header h3 {
  flex: 1 1 260px;
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
  min-width: 0;
}

.reference-source-tools {
  align-items: center;
  display: flex;
  flex: 1 1 300px;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
  min-width: 220px;
}

.source-search-input {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  flex: 0 1 138px;
  font: inherit;
  max-width: 190px;
  min-height: 28px;
  min-width: 118px;
  padding: 4px 8px;
}

.source-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 126, 111, 0.12);
  outline: none;
}

.source-search-count {
  color: var(--muted);
  display: none;
  font-size: 12px;
  min-width: 34px;
  text-align: center;
}

.source-search-nav {
  display: none;
  min-width: 28px;
  padding-left: 8px;
  padding-right: 8px;
}

.reference-source-card.has-source-search-results .source-search-count {
  display: inline-block;
}

.reference-source-card.has-source-search-results .source-search-nav {
  display: inline-flex;
}

.source-preview-body,
.source-full-body {
  line-height: 1.48;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  padding: 8px 10px;
  white-space: pre-wrap;
}

.source-preview-body {
  max-height: calc(6 * 1.48em + 16px);
  overflow: hidden;
  position: relative;
  white-space: normal;
}

.source-truncation-note {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin: 0;
  padding: 6px 10px 7px;
}

.source-truncation-toggle {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  padding: 0;
  text-decoration: none;
}

.source-truncation-toggle:hover {
  text-decoration: underline;
}

.source-truncation-toggle:focus-visible {
  border-radius: 3px;
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.source-full-body {
  max-height: min(500px, 52vh);
}

.source-markdown {
  white-space: normal;
}

.source-markdown p {
  margin: 0 0 8px;
}

.source-markdown p:last-child,
.source-markdown .markdown-table-wrap:last-child,
.source-markdown .markdown-list:last-child {
  margin-bottom: 0;
}

.source-markdown .source-markdown-heading {
  color: var(--ink);
  font-weight: 750;
  line-height: 1.3;
  margin: 12px 0 6px;
}

.source-markdown h1.source-markdown-heading {
  font-size: 18px;
}

.source-markdown h2.source-markdown-heading {
  font-size: 16px;
}

.source-markdown h3.source-markdown-heading,
.source-markdown h4.source-markdown-heading,
.source-markdown h5.source-markdown-heading,
.source-markdown h6.source-markdown-heading {
  font-size: 15px;
}

.source-markdown .source-markdown-heading:first-child {
  margin-top: 0;
}

.markdown-table-wrap {
  margin: 8px 0;
  max-width: 100%;
  overflow-x: auto;
}

.markdown-table {
  border-collapse: collapse;
  font-size: 12.5px;
  line-height: 1.36;
  min-width: 520px;
  width: 100%;
}

.markdown-table th,
.markdown-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  vertical-align: top;
}

.markdown-table th {
  background: #f3f7f5;
  color: var(--ink);
  font-weight: 750;
}

.markdown-list {
  display: grid;
  gap: 4px;
  margin: 0 0 8px;
}

.markdown-list-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  line-height: 1.42;
  margin: 0;
  padding-left: calc(var(--list-depth, 0) * 18px);
}

.markdown-list-marker {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 14px;
  text-align: right;
}

.markdown-list-text {
  min-width: 0;
}

.source-full-body {
  display: none;
}

.reference-source-card.expanded .source-preview-body {
  display: none;
}

.reference-source-card.expanded .source-truncation-note {
  display: none;
}

.reference-source-card.expanded .source-full-body {
  display: block;
}

.gold-source-highlight {
  background: #fff0a8;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  color: var(--ink);
  font-weight: 750;
  padding: 0 2px;
}

.source-search-hit {
  background: #bdeee5;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  color: var(--ink);
  padding: 0 2px;
}

.source-search-hit.is-current {
  background: #0f766e;
  color: #ffffff;
}

.user-highlight {
  background: linear-gradient(
    180deg,
    transparent 18%,
    rgba(62, 180, 86, 0.32) 18%,
    rgba(62, 180, 86, 0.32) 92%,
    transparent 92%
  );
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  color: inherit;
  cursor: pointer;
  padding: 0 0.1em;
}

.user-highlight:hover {
  background: linear-gradient(
    180deg,
    transparent 14%,
    rgba(62, 180, 86, 0.46) 14%,
    rgba(62, 180, 86, 0.46) 94%,
    transparent 94%
  );
  box-shadow: inset 0 -1px 0 rgba(38, 115, 72, 0.7);
}

.user-highlight:focus-visible {
  outline: 2px solid var(--ok);
  outline-offset: 2px;
}

.highlight-prompt {
  background: var(--ok);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(24, 36, 32, 0.18);
  color: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  min-height: 28px;
  padding: 7px 11px;
  position: fixed;
  transform: translate(-50%, calc(-100% - 8px));
  white-space: nowrap;
  z-index: 60;
}

.highlight-prompt[hidden] {
  display: none;
}

.highlight-prompt[data-highlight-prompt-mode="clear"] {
  background: #ffffff;
  border-color: rgba(38, 115, 72, 0.45);
  color: var(--ok);
}

.highlight-prompt:hover {
  box-shadow: 0 10px 22px rgba(24, 36, 32, 0.22);
}

.highlight-prompt:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.annotation-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 7px;
  padding: 9px;
}

.read-only-form {
  background: #fbfcfb;
}

.form-title {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
}

.form-title > div {
  flex: 1 1 230px;
  min-width: 0;
}

.form-title h2 {
  font-size: 16px;
  margin: 0 0 2px;
}

.review-subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
  margin: 0;
}

.guide-button {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent-dark);
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 650;
  min-height: 28px;
  padding: 4px 9px;
}

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

.task-progress {
  align-items: center;
  background: #fbfcfb;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  flex: 1 1 520px;
  gap: 7px;
  grid-template-columns: max-content minmax(0, 1fr);
  margin: 0;
  min-width: 0;
  overflow: hidden;
  padding: 5px 8px;
}

.task-progress-header {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 650;
  justify-content: flex-start;
  line-height: 1.2;
  white-space: nowrap;
}

.task-progress-track {
  align-items: center;
  contain: paint;
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 1px 3px;
  scrollbar-width: thin;
}

.task-progress-cell {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 26px;
  font-size: 11.5px;
  font-weight: 750;
  height: 26px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  text-decoration: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
  width: 26px;
}

.task-progress-cell.is-pending {
  background: #ffe6a6;
  border-color: #efc45a;
}

.task-progress-cell.is-complete {
  background: #bfe8c8;
  border-color: #6fbd82;
}

.task-progress-cell.is-current {
  box-shadow: inset 0 0 0 2px #ffffff, 0 0 0 2px var(--accent);
}

.task-progress-cell:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.task-progress-cell:focus-visible {
  box-shadow: 0 0 0 3px rgba(18, 126, 111, 0.12);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.question-field {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 7px 9px 9px;
  position: relative;
}

.question-field:focus {
  outline: none;
}

.question-field.is-jump-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 126, 111, 0.12);
}

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

.question-heading {
  align-items: flex-start;
  display: flex;
  gap: 6px;
  justify-content: space-between;
  position: relative;
}

.question-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  min-width: 0;
  padding-right: 4px;
}

.question-info {
  flex: 0 0 auto;
  line-height: 1;
  position: static;
}

.question-info-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent-dark);
  cursor: help;
  display: inline-flex;
  font-size: 12px;
  font-weight: 750;
  height: 22px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 22px;
}

.question-info-button:hover,
.question-info-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 126, 111, 0.12);
  outline: none;
}

.question-info-tooltip {
  background: #16231f;
  border-radius: 7px;
  box-sizing: border-box;
  box-shadow: 0 12px 28px rgba(24, 36, 32, 0.22);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.38;
  max-width: min(420px, 100%);
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 9px 10px;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  transform: translateY(-2px);
  transition: transform 120ms ease;
  visibility: hidden;
  white-space: normal;
  width: max-content;
  z-index: 20;
}

.question-info-tooltip p,
.question-info-tooltip .markdown-list {
  margin-bottom: 7px;
}

.question-info-tooltip p:last-child,
.question-info-tooltip .markdown-list:last-child {
  margin-bottom: 0;
}

.question-info-tooltip .markdown-list-item {
  margin: 0;
}

.question-info-tooltip .markdown-list-marker {
  color: rgba(255, 255, 255, 0.72);
}

.question-info:hover .question-info-tooltip,
.question-info:focus-within .question-info-tooltip,
.question-info-button:focus + .question-info-tooltip,
.question-info-button:focus-visible + .question-info-tooltip {
  transform: translateY(0);
  visibility: visible;
}

.question-definition {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
  margin: -2px 0 0;
}

.required-marker {
  color: var(--warn);
  font-size: 12px;
  font-weight: 650;
  margin-left: 6px;
}

.option-stack {
  align-items: stretch;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(auto-fit, minmax(min(138px, 100%), 1fr));
}

.option-row {
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  font-size: 14px;
  gap: 6px;
  min-height: 31px;
  min-width: 0;
  padding: 4px 8px;
}

.option-row input {
  flex: 0 0 auto;
}

.option-row span {
  flex: 1 1 auto;
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
}

.option-row:has(input:checked),
.segmented label:has(input:checked) {
  background: #eef8f7;
  border-color: var(--accent);
}

.annotation-form:not(.read-only-form) .option-row:has(input:disabled),
.annotation-form:not(.read-only-form) .segmented label:has(input:disabled) {
  background: #f3f5f4;
  border-color: #d7dedb;
  color: #89958f;
  cursor: not-allowed;
}

.annotation-form:not(.read-only-form) .option-row:has(input:disabled) span,
.annotation-form:not(.read-only-form) .segmented label:has(input:disabled) span {
  color: #89958f;
}

.annotation-form:not(.read-only-form) .option-row input:disabled,
.annotation-form:not(.read-only-form) .segmented input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.read-only-form .option-row,
.read-only-form .segmented label {
  cursor: default;
}

.read-only-form input:disabled {
  cursor: default;
}

.annotation-form textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 30px;
  padding: 5px 8px;
  resize: vertical;
  width: 100%;
}

.annotation-form textarea[readonly] {
  background: #f7faf8;
  color: var(--ink);
  cursor: text;
}

.annotation-form textarea[data-question-id$="_notes"],
.annotation-form textarea[data-question-id="comments"],
.annotation-form textarea[data-question-id="notes"] {
  height: 42px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.segmented label {
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  min-height: 31px;
  padding: 4px 8px;
  text-align: center;
}

.segmented input {
  margin-right: 6px;
}

.form-errors {
  background: #fff0ef;
  border: 1px solid #f3c7c3;
  border-radius: 6px;
  color: var(--danger);
  padding: 10px;
}

.status-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  padding: 4px 8px;
}

.status-completed {
  background: #eef8f1;
  border-color: #c9e8d2;
  color: var(--ok);
}

.status-draft {
  background: #fff8e8;
  border-color: #efd899;
  color: var(--warn);
}

.status-read-only {
  background: #f1f4f3;
  border-color: var(--border);
  color: var(--muted);
}

.guide-modal[hidden] {
  display: none;
}

.guide-modal {
  inset: 0;
  position: fixed;
  z-index: 80;
}

.guide-backdrop {
  background: rgba(20, 30, 27, 0.32);
  inset: 0;
  position: absolute;
}

.guide-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(24, 36, 32, 0.22);
  container-type: inline-size;
  left: 50%;
  max-height: min(960px, calc(100vh - 24px));
  max-width: 860px;
  min-height: 320px;
  min-width: 360px;
  overflow: auto;
  padding: 18px 20px;
  position: absolute;
  resize: both;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(860px, calc(100vw - 32px));
}

.guide-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding-bottom: 12px;
}

.guide-header h2 {
  font-size: 20px;
  margin: 0 0 4px;
}

.guide-header p {
  color: var(--muted);
  margin: 0;
}

.guide-body {
  display: grid;
  gap: 0;
  grid-template-columns: 1fr;
  padding-top: 12px;
}

.guide-body article {
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 3px;
  padding: 8px 0;
}

.guide-body article:first-child {
  padding-top: 0;
}

.guide-body article:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.guide-body h3 {
  font-size: 15px;
  margin: 0;
}

.guide-section-body {
  color: var(--muted);
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.guide-section-body p,
.guide-section-body .markdown-list {
  margin: 0;
}

.guide-section-body p + p,
.guide-section-body p + .markdown-list,
.guide-section-body .markdown-list + p,
.guide-section-body .markdown-list + .markdown-list {
  margin-top: 7px;
}

@container (max-width: 520px) {
  .guide-header {
    flex-direction: column;
  }

  .guide-body {
    grid-template-columns: 1fr;
  }

  .guide-header h2 {
    font-size: 18px;
  }

  .guide-header p,
  .guide-body p {
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    height: auto;
    padding: 14px 16px;
  }

  .navlinks {
    justify-content: flex-end;
  }

  .workspace-grid {
    grid-template-columns: minmax(240px, 1fr) 10px minmax(280px, 360px);
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-actions {
    align-items: flex-start;
    flex-direction: column;
    width: 100%;
  }

  .task-progress {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .task-progress-header {
    justify-content: space-between;
  }

  .guide-dialog {
    max-height: calc(100vh - 32px);
    min-height: 280px;
    min-width: calc(100vw - 32px);
    width: calc(100vw - 32px);
  }
}
