:root {
  --bg: #f4f5f2;
  --panel: #ffffff;
  --text: #1f2528;
  --muted: #647076;
  --line: #d9dfdc;
  --blue: #536f99;
  --blue-soft: #eef3f8;
  --teal: #276b66;
  --teal-soft: #e5f3f1;
  --amber: #8a5b00;
  --amber-soft: #fff1c7;
  --red: #9c3e3a;
  --red-soft: #f9e5e2;
  --green: #3f6f45;
  --green-soft: #e7f1e6;
  --taxonomy-protected-color: var(--amber);
  --taxonomy-protected-soft: var(--amber-soft);
  --taxonomy-negotiable-color: var(--teal);
  --taxonomy-negotiable-soft: var(--teal-soft);
  --taxonomy-delegatable-color: var(--green);
  --taxonomy-delegatable-soft: var(--green-soft);
  --taxonomy-accountability-color: var(--red);
  --taxonomy-accountability-soft: var(--red-soft);
  --shadow: 0 8px 24px rgba(31, 37, 40, 0.06);
  --control-height: 40px;
  --icon-control-size: 40px;
  --formal-control-font-size: 12px;
  --formal-subsection-title-font-size: 13px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  overflow: hidden;
}

body:has(.friction-review-workspace:not([hidden])) {
  overflow: auto;
}

.application-surface[hidden] {
  display: none !important;
}

body[data-application-phase="writing_experience_survey"] .system-bar,
body[data-application-phase="friction_review"] .system-bar,
body[data-application-phase="complete"] .system-bar {
  display: none;
}

body[data-application-phase="writing_experience_survey"] .app-shell,
body[data-application-phase="friction_review"] .app-shell,
body[data-application-phase="complete"] .app-shell {
  min-height: 100dvh;
  padding: 0;
}

.friction-review-workspace {
  background: var(--bg);
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: clamp(24px, 5vw, 64px) clamp(16px, 7vw, 112px) 48px;
}

.friction-review-header,
.friction-review-list,
.friction-review-footer {
  margin: 0 auto;
  max-width: 1120px;
}

.post-writing-survey-form {
  display: grid;
  gap: 24px;
  margin: 0 auto;
  max-width: 840px;
}

.survey-progress {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  margin: 18px auto 22px;
  max-width: 840px;
}

.submitted-draft-review-button {
  margin-top: 10px;
  width: fit-content;
}

.survey-section {
  display: grid;
  gap: 16px;
  margin: 0;
}

.survey-section h2 {
  font-size: 20px;
  margin: 0;
}

.survey-section-hint {
  color: var(--muted);
  line-height: 1.6;
  margin: -4px 0 0;
}

.survey-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin: 20px auto 0;
  max-width: 840px;
}

.survey-question {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0;
  padding: 20px 22px 16px;
}

.survey-question legend {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.55;
  max-width: 100%;
  padding: 0 6px;
}

.likert-options {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(var(--likert-option-count, 7), minmax(0, 1fr));
  margin-top: 18px;
}

.likert-option {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-weight: 700;
  gap: 6px;
  justify-content: center;
  min-height: 54px;
  padding: 7px 4px;
}

.likert-option:has(input:checked) {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 0 0 2px rgba(83, 111, 153, 0.12);
}

.likert-option input {
  accent-color: var(--blue);
  margin: 0;
}

.likert-anchors {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  grid-template-columns: 1fr 1fr 1fr;
  margin-top: 8px;
}

.likert-anchors span:nth-child(2) { text-align: center; }
.likert-anchors span:last-child { text-align: right; }

.task-complete-workspace {
  align-content: center;
  text-align: center;
}

@media (max-width: 640px) {
  .survey-question { padding-inline: 14px; }
  .survey-question legend { font-size: 15px; }
  .likert-options { gap: 4px; }
  .likert-option { min-height: 48px; }
  .survey-navigation { justify-content: stretch; }
  .survey-navigation button { flex: 1 1 30%; }
}

.friction-review-header {
  padding-bottom: 26px;
}

.friction-review-header h1 {
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.03em;
  margin: 6px 0 12px;
}

.friction-review-header > p:not(.eyebrow):not(.friction-review-progress) {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
  max-width: 680px;
}

.friction-review-progress {
  color: var(--teal);
  font-size: 14px;
  font-weight: 700;
  margin: 18px 0 0;
}

.friction-review-list {
  display: grid;
  gap: 20px;
}

.friction-review-question {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(31, 37, 40, 0.05);
  overflow: hidden;
}

.friction-review-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.friction-review-texts {
  border-right: 1px solid var(--line);
  display: grid;
  gap: 18px;
  padding: 22px;
}

.friction-review-texts section + section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.friction-review-comparison > .friction-review-prompt {
  padding: 22px;
}

.friction-review-question h2 {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  margin: 0 0 9px;
  text-transform: uppercase;
}

.friction-review-text,
.friction-review-prompt-content {
  background: #f7f8f6;
  border: 1px solid #e3e7e4;
  border-radius: 10px;
  line-height: 1.7;
  min-height: 72px;
  padding: 13px 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.friction-review-prompt-candidate {
  border-top: 1px solid rgba(138, 91, 0, 0.2);
  margin-top: 12px;
  padding-top: 12px;
  white-space: pre-wrap;
}

.friction-review-text.is-deleted {
  color: var(--red);
  font-style: italic;
}

.friction-review-prompt-content {
  background: var(--amber-soft);
  border-color: #f0d898;
}

.friction-review-response {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 20px 22px 22px;
}

.friction-review-response legend {
  font-size: 16px;
  font-weight: 700;
  padding: 0;
}

.friction-review-options {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.friction-review-option {
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  line-height: 1.5;
  padding: 11px 12px;
  transition: background 120ms ease, border-color 120ms ease;
}

.friction-review-option:hover,
.friction-review-option:has(input:checked) {
  background: var(--teal-soft);
  border-color: #91c9c2;
}

.friction-review-option input {
  flex: 0 0 auto;
  margin-top: 4px;
}

.friction-review-footer {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: flex-end;
  padding-top: 24px;
}

.friction-review-error {
  color: var(--red);
  font-size: 14px;
  margin: 0 auto 0 0;
}

.friction-review-empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
}

.friction-review-empty p {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

@media (max-width: 760px) {
  .friction-review-workspace {
    padding: 28px 14px 36px;
  }

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

  .friction-review-texts {
    border-bottom: 1px solid var(--line);
    border-right: 0;
  }

  .friction-review-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .friction-review-error {
    margin: 0;
  }

  .friction-review-footer button {
    width: 100%;
  }
}

body.auth-pending .app-shell {
  visibility: hidden;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
}

.system-bar {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  min-height: 56px;
  padding: 10px 12px;
  position: relative;
  z-index: 40;
}

.system-brand {
  min-width: 0;
  position: relative;
}

.system-title-line {
  align-items: center;
  display: flex;
  gap: 9px;
}

.task-prompt-button {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #42484c;
  font-size: 13px;
  font-weight: 500;
  padding: 2px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.task-prompt-button:hover,
.task-prompt-button:focus-visible,
.task-prompt-button.active {
  background: transparent;
  color: #111;
}

.task-prompt-button:focus-visible {
  outline: 2px solid #7890b2;
  outline-offset: 3px;
}

.task-prompt-popover {
  background: #fff;
  border: 1px solid #d8dcde;
  border-radius: 0;
  box-shadow: none;
  left: 0;
  max-height: calc(100vh - 104px);
  overflow: auto;
  padding: 20px;
  position: absolute;
  top: calc(100% + 12px);
  width: min(760px, calc(100vw - 48px));
  z-index: 100;
}

.profile-settings-popover {
  width: min(820px, calc(100vw - 48px));
}

.profile-settings-fields {
  max-height: min(62vh, 620px);
  overflow: auto;
  padding-right: 6px;
}

.profile-question-field select {
  min-height: 42px;
}

.profile-summary-section {
  background: #f7f5fb;
  border: 1px solid #ddd5ed;
  border-radius: 10px;
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
}

.profile-summary-heading {
  display: grid;
  gap: 3px;
}

.profile-summary-heading span,
.profile-summary-section.empty span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.profile-summary-entry {
  background: #fff;
  border: 1px solid #e4deef;
  border-radius: 8px;
  padding: 9px 10px;
}

.profile-summary-entry p {
  line-height: 1.5;
  margin: 0 0 7px;
}

.profile-summary-entry div {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 11px;
  gap: 8px;
}

.profile-summary-entry button {
  margin-left: auto;
  min-height: 28px;
  padding: 4px 8px;
}

.task-prompt-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.task-prompt-heading h2 {
  font-size: 24px;
}

.task-prompt-close-button {
  background: transparent;
  border: 0;
  color: #555;
  cursor: pointer;
  font: inherit;
  padding: 4px;
}

.task-prompt-close-button:hover,
.task-prompt-close-button:focus-visible {
  color: #111;
  text-decoration: underline;
}

.task-prompt-content {
  color: #202124;
  font-size: 16px;
  line-height: 1.75;
}

.task-prompt-content p {
  margin: 0 0 12px;
}

.task-prompt-content p:last-child {
  margin-bottom: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: 18px;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 14px;
}

.task-prompt-inline {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin: 4px 0 0;
}

.system-actions,
.button-row,
.section-title-row,
.panel-header {
  align-items: center;
  display: flex;
}

.system-actions {
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.submission-validation-message {
  color: #9c3e3a;
  flex: 1 0 100%;
  font-size: 12px;
  margin: 0;
  text-align: right;
}

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

.button-row {
  gap: 8px;
}

.section-title-row,
.panel-header {
  justify-content: space-between;
}

.segmented {
  background: #edf0ef;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  padding: 3px;
}

body[data-study-mode="woz"] .demo-only {
  display: none !important;
}

/* The formal entry is participant-only even if an old or malformed URL still
   contains Wizard-oriented markup in the shared template. */
body[data-study-mode="automatic"] .wizard-only {
  display: none !important;
}

/* Formal participants use the editor's native Cmd/Ctrl+Z history. The frozen
   WoZ interface keeps its existing explicit recovery controls. */
body[data-study-mode="automatic"] #undoLastAiButton,
body[data-study-mode="automatic"] #undoPendingTextButton {
  display: none !important;
}

.mode-button,
.quiet-button,
.danger-button,
.primary-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 7px;
  min-height: var(--control-height);
  padding: 6px 9px;
}

.mode-button {
  background: transparent;
  color: var(--muted);
}

.mode-button.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(31, 37, 40, 0.08);
}

.quiet-button,
.icon-button {
  background: #f7f8f6;
  border-color: var(--line);
  color: var(--text);
}

.log-viewer-link {
  align-items: center;
  display: inline-flex;
  font-size: 13px;
  text-decoration: none;
}

.danger-button {
  background: var(--red-soft);
  border-color: #edc3be;
  color: var(--red);
}

.primary-button {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.icon-button {
  align-items: center;
  display: inline-flex;
  height: var(--icon-control-size);
  justify-content: center;
  min-height: var(--icon-control-size);
  padding: 0;
  width: var(--icon-control-size);
}

button:disabled { cursor: not-allowed; }
button[data-busy="true"] { cursor: wait; }

#toolbar.ql-toolbar button,
#toolbar.ql-toolbar select {
  min-height: 32px;
  min-width: 32px;
}

.workspace {
  --editor-column: 1.38fr;
  --friction-column: 0.86fr;
  --chat-column: 0.86fr;
  display: grid;
  flex: 1 1 auto;
  gap: 0;
  grid-template-columns:
    minmax(360px, var(--editor-column)) 12px
    minmax(280px, var(--friction-column)) 12px
    minmax(280px, var(--chat-column));
  min-height: 0;
  overflow: hidden;
}

body[data-stage="1"] .workspace,
body[data-stage="2"] .workspace {
  gap: 14px;
  grid-template-columns: minmax(520px, 1.15fr) minmax(340px, 0.85fr);
}

/* The formal profile belongs to the participant across writing tasks. Keep the
   current DOM for now, but present Stage 1 as a dedicated settings surface. */
body[data-study-mode="automatic"][data-stage="1"] .workspace {
  display: block;
  overflow-y: auto;
}

body[data-study-mode="automatic"][data-stage="1"] .editor-panel {
  margin: 0 auto;
  max-width: 980px;
  min-height: 100%;
}

body[data-study-mode="automatic"][data-stage="1"] .editor-panel > .panel-header,
body[data-study-mode="automatic"][data-stage="1"] .toolbar,
body[data-study-mode="automatic"][data-stage="1"] .editor,
body[data-study-mode="automatic"][data-stage="1"] .selection-action-bar,
body[data-study-mode="automatic"][data-stage="1"] .ideas-notes-card,
body[data-study-mode="automatic"][data-stage="1"] .chat-panel,
body[data-study-mode="automatic"][data-stage="1"] #taskPromptButton {
  display: none !important;
}

body[data-study-mode="automatic"][data-stage="1"] .locked-workspace-message {
  background: #f8f9f7;
  border-top: 1px solid var(--line);
  display: flex;
  font-size: 13px;
  justify-content: flex-start;
  line-height: 1.35;
  min-height: 0;
  padding: 6px 14px;
  text-align: left;
}

body[data-study-mode="automatic"][data-stage="1"] .system-brand > .eyebrow,
body[data-study-mode="automatic"][data-stage="1"] #taskPromptPopover {
  display: none !important;
}

body[data-stage="1"] .friction-panel,
body[data-stage="2"] .friction-panel {
  display: none;
}

body[data-stage="1"] .column-resizer,
body[data-stage="2"] .column-resizer {
  display: none;
}

/* The formal participant view is a writing tool, not a stack of dashboard
   cards. Keep the study surface flat and let the column separators provide the
   hierarchy. Wizard and WoZ surfaces keep the original card treatment. */
body[data-study-mode="automatic"][data-role="user"] .app-shell {
  padding: 0;
}

body[data-study-mode="automatic"][data-role="user"] #roleEyebrow {
  display: none;
}

body[data-study-mode="automatic"][data-role="user"] .system-bar {
  background: #eef0ee;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  margin-bottom: 0;
  height: 52px;
  min-height: 52px;
  padding: 0 16px;
}

body[data-study-mode="automatic"][data-role="user"] .workspace {
  border-top: 0;
}

body[data-study-mode="automatic"][data-role="user"] .editor-panel,
body[data-study-mode="automatic"][data-role="user"] .friction-panel,
body[data-study-mode="automatic"][data-role="user"] .chat-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

body[data-study-mode="automatic"][data-role="user"] .panel-header {
  background: #eef0ee;
  border-bottom: 1px solid var(--line);
  margin: 0;
  height: 52px;
  min-height: 52px;
  padding: 0 16px;
}

body[data-study-mode="automatic"][data-role="user"] .panel-header .eyebrow,
body[data-study-mode="automatic"][data-role="user"] .task-prompt-inline {
  display: none;
}

body[data-study-mode="automatic"][data-role="user"] .chat-messages,
body[data-study-mode="automatic"][data-role="user"] .chat-form {
  margin-inline: clamp(18px, 2vw, 36px);
}

body[data-study-mode="automatic"][data-role="user"] .chat-messages {
  padding-right: 0;
}

body[data-study-mode="automatic"][data-role="user"] #structureWorkspace {
  display: none !important;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 14px 18px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .notes-section {
  border: 0;
  border-radius: 0;
  padding: 14px 18px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .note-card {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--note-taxonomy-color, var(--blue));
  border-radius: 0;
  box-shadow: none;
  padding: 12px 0 12px 14px;
}

/* The baseline condition shares the same editor and AI collaboration core but
   has no friction surface. The condition is set from the authenticated account
   (or the formal experiment URL in local testing), not by a participant toggle. */
body[data-study-mode="automatic"][data-condition="baseline"] .friction-panel,
body[data-study-mode="automatic"][data-condition="baseline"] .column-resizer,
body[data-study-mode="automatic"][data-condition="baseline"] #selectionActionBar,
body[data-study-mode="automatic"][data-condition="baseline"] #revisionCheckPopover,
body[data-study-mode="automatic"][data-condition="baseline"] #frictionPresentationModal {
  display: none !important;
}

/* Stage 3 is the formal participant's writing workspace. Its fixed column
   hierarchy is intentionally independent from the legacy draggable layout so
   frozen WoZ and Wizard surfaces retain their original geometry. */
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .workspace {
  display: grid;
  gap: 0;
  grid-template-columns: 300px minmax(0, 1fr) 340px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .friction-panel {
  grid-column: 1;
  grid-row: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .editor-panel {
  grid-column: 2;
  grid-row: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .chat-panel {
  grid-column: 3;
  grid-row: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .column-resizer {
  display: none !important;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="baseline"][data-stage="3"] .workspace {
  grid-template-columns: minmax(0, 1fr) 340px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="baseline"][data-stage="3"] .editor-panel {
  grid-column: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="baseline"][data-stage="3"] .chat-panel {
  grid-column: 2;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-friction-panel-collapsed {
  grid-template-columns: 52px minmax(0, 1fr) 340px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-chat-panel-collapsed {
  grid-template-columns: 300px minmax(0, 1fr) 52px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-friction-panel-collapsed.formal-chat-panel-collapsed {
  grid-template-columns: 52px minmax(0, 1fr) 52px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="baseline"][data-stage="3"] .workspace.formal-chat-panel-collapsed {
  grid-template-columns: minmax(0, 1fr) 52px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .formal-panel-header-actions,
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .chat-header-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .formal-panel-toggle {
  flex: 0 0 auto;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-friction-panel-collapsed .friction-panel,
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-chat-panel-collapsed .chat-panel {
  overflow: hidden;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-friction-panel-collapsed .friction-panel > :not(.panel-header),
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .workspace.formal-chat-panel-collapsed .chat-panel > :not(.panel-header) {
  display: none;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-friction-panel-collapsed .friction-panel .panel-header > :first-child,
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .workspace.formal-chat-panel-collapsed .chat-panel .panel-header > :first-child,
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .workspace.formal-chat-panel-collapsed .chat-panel .chat-header-actions > :not(.formal-panel-toggle) {
  display: none;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-friction-panel-collapsed .friction-panel .panel-header,
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .workspace.formal-chat-panel-collapsed .chat-panel .panel-header {
  justify-content: center;
  padding-inline: 8px;
}

.column-resizer {
  align-items: center;
  cursor: col-resize;
  display: flex;
  justify-content: center;
  min-height: 0;
  outline: none;
  position: relative;
  touch-action: none;
  user-select: none;
}

.column-resizer::before {
  background: #c9cfcc;
  border-radius: 999px;
  content: "";
  height: 44px;
  transition: background 120ms ease, height 120ms ease, width 120ms ease;
  width: 2px;
}

.column-resizer:hover::before,
.column-resizer:focus-visible::before,
.column-resizer.dragging::before {
  background: var(--blue);
  height: 64px;
  width: 4px;
}

body.resizing-columns {
  cursor: col-resize;
  user-select: none;
}

.editor-panel,
.friction-panel,
.chat-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-height: 0;
  overflow: hidden;
}

.editor-panel {
  display: flex;
  flex-direction: column;
}

.friction-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 14px;
}

.chat-panel {
  display: grid;
  gap: 12px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  padding: 14px;
}

/* The middle column can contain a long intention and a long structure check.
   Keep one column-level scrollbar so resizing its width (and therefore wrapping
   more text) never hides the lower cards behind a clipped flex container. */
.friction-panel {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.friction-panel > * {
  flex: 0 0 auto;
}

/* Participant reminders must stay in the first visible section of stage 3.
   Wizard controls keep their existing order. */
body[data-role="user"][data-stage="3"] .friction-panel > .panel-header {
  order: -2;
}

body[data-role="user"][data-stage="3"] .friction-panel > .notes-section {
  order: -1;
}

.chat-panel {
  overflow: hidden;
}

.panel-header {
  border-bottom: 1px solid var(--line);
  gap: 12px;
  min-height: 70px;
  padding: 14px;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="3"] .panel-header {
  justify-content: flex-start;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="3"] .panel-header .eyebrow {
  display: none;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="3"] .editor {
  flex: 1 1 auto;
  min-height: 180px;
  position: relative;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="3"] .editor .ql-container,
body[data-study-mode="automatic"][data-condition="friction"][data-stage="3"] .editor .ql-editor {
  pointer-events: auto;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="3"] .ideas-notes-card {
  background: #fff;
  border: 0;
  border-radius: 0;
  border-top: 1px solid #e2e6e4;
  box-shadow: none;
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 14px 12px;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="3"] .ideas-notes-card textarea {
  background: #fff;
  border-color: #e0e4e2;
  box-shadow: none;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="3"] .panel-header > :last-child {
  margin-left: auto;
}

.friction-panel .panel-header,
.chat-panel .panel-header {
  border-bottom: 1px solid var(--line);
  margin: -14px -14px 0;
  padding: 14px;
}

.chat-header-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="2"] #formalChatPanelToggle {
  font-size: 24px;
  height: 38px;
  line-height: 1;
  min-height: 38px;
  width: 38px;
}

#newChatButton {
  white-space: nowrap;
}

.chat-conversation-select {
  max-width: 210px;
  min-height: 36px;
  padding: 6px 28px 6px 9px;
}

.outline-card {
  background: #fbfcff;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  overflow: auto;
  padding: 14px;
}

body[data-outline="locked"] .outline-card {
  flex: 1 1 auto;
  min-height: 0;
}

body[data-stage="2"] .outline-card {
  flex: 1 1 auto;
  min-height: 0;
}

body[data-outline="ready"] .outline-card {
  max-height: 160px;
}

body[data-stage="3"] .outline-card {
  display: none;
}

.outline-instruction {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 10px 0;
}

.outline-fields {
  display: grid;
  gap: 10px;
}

.outline-fields textarea {
  min-height: 56px;
}

.outline-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.outline-summary {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.outline-summary-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
}

.outline-summary-item span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 3px;
}

.outline-summary-item p {
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
  overflow-wrap: anywhere;
}

.formal-planning-item textarea {
  min-height: 44px;
  width: 100%;
}

.formal-planning-field {
  border: 0;
  border-top: 1px solid rgba(93, 84, 73, 0.2);
  display: block;
  padding: 8px 0;
}

.formal-planning-field:first-child {
  border-top: 0;
}

.formal-planning-field-heading,
.custom-planning-heading {
  display: block;
  position: relative;
}

.planning-dimension {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  margin-bottom: 3px;
}

.planning-field-question {
  color: var(--text);
  display: flex;
  gap: 0.42em;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.planning-question-number {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.formal-planning-field textarea,
.formal-planning-field input {
  box-sizing: border-box;
  margin-top: 7px;
  width: 100%;
}

.formal-planning-field textarea {
  min-height: 40px;
  overflow-y: hidden;
  resize: none;
}

.planning-field-value {
  color: var(--text);
  display: block;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 7px;
  white-space: pre-wrap;
}

.custom-planning-heading {
  padding-right: 42px;
}

.custom-planning-heading input {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  min-height: 0;
  padding: 0;
}

.custom-planning-heading input:focus {
  border-color: transparent;
  box-shadow: none;
}

.custom-planning-question-row {
  align-items: baseline;
  color: var(--text);
  display: flex;
  font-size: 16px;
  font-weight: 700;
  gap: 0.42em;
  line-height: 1.35;
}

.custom-planning-question-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.custom-planning-delete {
  align-items: center;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  min-height: 30px;
  padding: 0;
  position: absolute;
  right: 0;
  top: 15px;
  width: 30px;
}

.add-planning-field {
  margin-top: 8px;
}

.formal-planning-custom-summary {
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.outline-card.completed:not(.expanded) .outline-instruction {
  display: none;
}

.locked-workspace-message {
  align-items: center;
  background: #fafaf8;
  color: var(--muted);
  display: none;
  flex: 0 0 auto;
  font-size: 14px;
  justify-content: center;
  min-height: 84px;
  padding: 18px;
  text-align: center;
}

body[data-outline="locked"] .locked-workspace-message {
  display: flex;
}

body[data-outline="locked"] .toolbar,
body[data-outline="locked"] .editor {
  display: none !important;
}

/* Formal planning keeps a lightweight scratch draft below the plan. The same
   document carries into Stage 3, while the full formatting toolbar stays out
   of the way during planning. */
body[data-study-mode="automatic"][data-condition="friction"][data-stage="2"] .outline-card {
  flex: 0 0 48%;
  max-height: none;
  min-height: 120px;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="2"] .toolbar,
body[data-study-mode="automatic"][data-condition="friction"][data-stage="2"] .ideas-notes-card {
  display: none !important;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="2"] .locked-workspace-message {
  background: #f3f5f6;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: flex-start;
  min-height: 0;
  padding: 7px 18px;
  text-align: left;
}

.planning-draft-resizer {
  display: none;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="2"] .planning-draft-resizer {
  align-items: center;
  cursor: row-resize;
  display: flex;
  flex: 0 0 10px;
  justify-content: center;
  outline: none;
  touch-action: none;
  user-select: none;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="2"] .planning-draft-resizer::before {
  background: #c9cfcc;
  border-radius: 999px;
  content: "";
  height: 2px;
  transition: background 120ms ease, width 120ms ease;
  width: 48px;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="2"] .planning-draft-resizer:hover::before,
body[data-study-mode="automatic"][data-condition="friction"][data-stage="2"] .planning-draft-resizer:focus-visible::before,
body[data-study-mode="automatic"][data-condition="friction"][data-stage="2"] .planning-draft-resizer.dragging::before {
  background: var(--blue);
  width: 72px;
}

body.resizing-planning-draft {
  cursor: row-resize;
  user-select: none;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="2"] .editor {
  background: #fff;
  display: block !important;
  flex: 1 1 0;
  height: auto;
  max-height: none;
  min-height: 140px;
  overflow: hidden;
  resize: none;
}

body[data-study-mode="automatic"][data-condition="friction"][data-stage="2"] .ql-editor {
  padding-top: 20px;
}

body[data-stage="1"] .chat-panel {
  opacity: 0.72;
}

body[data-stage="1"] .chat-form textarea,
body[data-stage="1"] .chat-form button {
  cursor: not-allowed;
}

.status-pill,
.mini-label {
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  padding: 7px 9px;
  white-space: nowrap;
}

.status-pill {
  background: #edf0ef;
  color: var(--muted);
}

.sync-status[data-status="connected"] {
  background: var(--green-soft);
  color: var(--green);
}

.sync-status[data-status="offline"] {
  background: var(--red-soft);
  color: var(--red);
}

.identity-backdrop {
  z-index: 100;
}

.identity-modal {
  width: min(460px, calc(100vw - 40px));
}

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

.identity-field span {
  font-size: 12px;
  font-weight: 700;
}

.identity-field input {
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

#roleBadge {
  background: var(--teal-soft);
  color: var(--teal);
}

body[data-role="wizard"] #roleBadge {
  background: var(--blue-soft);
  color: var(--blue);
}

.mini-label {
  background: var(--blue-soft);
  color: var(--blue);
}

body[data-role="user"] .wizard-only,
body[data-role="wizard"] .user-only {
  display: none !important;
}

.toolbar {
  align-items: center;
  border-left: 0 !important;
  border-right: 0 !important;
  display: flex;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.document-word-count {
  margin-left: auto;
}

.editor {
  border: 0 !important;
  flex: 1;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

.selection-action-bar {
  align-items: center;
  background: #f5f8fc;
  border-top: 1px solid #d8e2ef;
  color: var(--blue);
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  justify-content: space-between;
  padding: 8px 14px;
}

.selection-action-bar[hidden] { display: none; }

.selection-action-bar span {
  font-size: 12px;
  font-weight: 700;
}

.editor-utility-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.ql-editor {
  height: 100%;
  font-size: 16px;
  line-height: 1.72;
  overflow-y: auto;
  padding: 28px 34px;
}

/* Quill keeps its placeholder pseudo-element visible during some Chinese IME
   composition states. Formal study pages keep guidance outside the editable
   surface so typed text can never visually overlap a placeholder. */
body[data-study-mode="automatic"] .ql-editor.ql-blank::before {
  display: none !important;
}

body[data-study-mode="automatic"][data-stage="2"] .ql-editor.ql-blank::before {
  display: block !important;
  color: #8b9398;
  font-size: 13px;
  font-style: italic;
  pointer-events: none;
}

/* Quill represents both list types with OL elements and data-list attributes.
   Define the ordered counter locally so browser/CDN differences cannot render
   every numbered item as "1". */
.ql-editor ol {
  counter-reset: writer-list-0;
}

.ql-editor li[data-list="ordered"]:not([class*="ql-indent-"]) {
  counter-increment: writer-list-0;
}

.ql-editor li[data-list="ordered"]:not([class*="ql-indent-"]) > .ql-ui::before {
  content: counter(writer-list-0, decimal) ". ";
}

.intention-card,
.wizard-card,
.review-card,
.notes-section,
.context-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.intention-card {
  background: #fafaf8;
  flex: 0 0 auto;
}

.intention-fields:not(.editing) textarea {
  cursor: text;
  min-height: 64px;
  overflow: auto;
  resize: vertical;
  text-overflow: clip;
  user-select: text;
  white-space: pre-wrap;
}

.structure-card {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid #d8ddd8;
  border-radius: 12px;
  background: #fbfcfa;
}

.structure-card[hidden] { display: none; }

#structureWorkspaceContent {
  overflow: visible;
  padding: 0 0 8px;
}

.structure-explanation,
.structure-instruction {
  line-height: 1.55;
  margin: 7px 0 0;
  text-transform: none;
}

.structure-explanation strong { color: #29382d; }
.structure-instruction { color: #4f6456; }

.structure-columns {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  margin-top: 12px;
}

.structure-check-summary {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #eef3ed;
  color: #304234;
  font-size: 13px;
}

.structure-outline-list,
.structure-block-list {
  display: grid;
  gap: 8px;
  margin-top: 7px;
}

.structure-outline-item,
.structure-block-item {
  border: 1px solid #dde2dc;
  border-radius: 9px;
  background: #fff;
  padding: 9px;
}

.structure-block-item[draggable="true"] { cursor: grab; }
.structure-block-item[draggable="true"]:active { cursor: grabbing; }
.structure-block-item.selected { border-color: #6f9e7b; box-shadow: 0 0 0 2px rgba(111, 158, 123, 0.16); }
.structure-block-item.dragging { opacity: 0.45; }
.structure-block-item.drop-before { box-shadow: 0 -3px 0 #4e8b60; }
.structure-block-item.drop-after { box-shadow: 0 3px 0 #4e8b60; }

.structure-block-main {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
}

.structure-drag-handle {
  border: 0;
  background: transparent;
  color: #6b796e;
  cursor: grab;
  font-size: 18px;
  line-height: 1;
  padding: 1px 0;
}

.structure-outline-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 2px 7px;
}

.structure-outline-item > span,
.structure-block-copy > span {
  color: #657064;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.structure-outline-item p,
.structure-block-copy p {
  display: block;
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
}
.structure-outline-item small { grid-column: 2; color: #758074; }
.structure-outline-item.unmatched { border-color: #dfc7a3; background: #fffaf2; }
.structure-outline-item.matched { border-color: #bfd4c2; }

.structure-link-picker {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  grid-column: 1 / -1;
  margin-top: 5px;
}

.structure-link-picker > span {
  color: #758074;
  font-size: 10px;
  font-weight: 700;
  margin-right: 2px;
}

.structure-link-picker label {
  align-items: center;
  background: #f4f7f3;
  border: 1px solid #d5ddd4;
  border-radius: 5px;
  color: #405044;
  display: inline-flex;
  font-size: 11px;
  gap: 3px;
  padding: 3px 5px;
}

.structure-link-picker input { width: auto; }

.structure-link-picker.formal-link-input {
  align-items: stretch;
  display: grid;
  gap: 5px;
}

.structure-link-picker.formal-link-input label {
  background: transparent;
  border: 0;
  color: #758074;
  display: block;
  font-size: 10px;
  font-weight: 700;
  padding: 0;
}

.structure-link-picker.formal-link-input input {
  min-height: 36px;
  padding: 7px 9px;
  width: 100%;
}

.structure-link-picker.formal-link-input input[aria-invalid="true"] {
  border-color: #b94040;
  box-shadow: 0 0 0 2px rgba(185, 64, 64, 0.12);
}

.structure-link-error {
  color: #a33232;
  font-size: 10px;
  line-height: 1.35;
}

.structure-block-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.structure-block-actions button {
  border: 1px solid #cfd6cf;
  border-radius: 7px;
  background: #f5f7f4;
  padding: 5px 7px;
  color: #344238;
  font-size: 11px;
  cursor: pointer;
}

.structure-block-actions button:disabled { cursor: not-allowed; opacity: 0.4; }

@media (max-width: 1100px) {
  .structure-columns { grid-template-columns: 1fr; }
}

.wizard-card {
  background: #fbfcff;
  flex: 0 0 auto;
}

.review-card {
  background: #fffaf1;
  flex: 0 1 36vh;
  min-height: 150px;
  overflow: auto;
}

.section-helper {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin: 4px 0 0;
}

.review-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.detection-scope-label {
  align-items: center;
  display: flex;
  gap: 6px;
}

.detection-scope-label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.toggle-label {
  align-items: center;
  display: flex;
  gap: 6px;
}

.toggle-label input {
  width: auto;
}

.toggle-label span {
  font-weight: 600;
}

.suggestion-queue {
  display: grid;
  gap: 9px;
}

.wizard-chat-review.has-waiting-request {
  border-color: #d8a63f;
  box-shadow: 0 0 0 3px rgba(216, 166, 63, 0.16);
}

.wizard-chat-request-queue {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.wizard-chat-request-card {
  background: #fffaf0;
  border: 1px solid #ead3a2;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.wizard-chat-request-text {
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
}

.wizard-chat-recommendation {
  color: var(--amber);
  font-size: 12px;
  margin: 0;
}

.wizard-chat-actions {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wizard-chat-actions button {
  min-height: 34px;
}

.chat-message.loading {
  color: var(--muted);
}

.chat-message.loading .chat-message-content {
  align-items: baseline;
  display: flex;
  min-height: 24px;
}

.chat-loading-label {
  color: var(--text);
  font-weight: 400;
}

.chat-loading-dots::after {
  animation: chat-loading-dots 1.2s steps(4, end) infinite;
  content: "";
}

@keyframes chat-loading-dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

.suggestion-card {
  background: #fff;
  border: 1px solid #ead8b7;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

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

.wizard-primary-field,
.suggestion-primary-field {
  display: grid;
  gap: 5px;
}

.wizard-advanced-settings {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.wizard-advanced-settings summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.wizard-advanced-settings:not([open]) summary {
  margin-bottom: 0;
}

.suggestion-rejection-fields {
  background: #faf8f1;
  border: 1px solid #eadfca;
  border-radius: 7px;
  display: grid;
  gap: 8px;
  padding: 9px;
}

.suggestion-context {
  background: #faf8f1;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  padding: 7px;
}

.suggestion-review-error {
  background: #fff0ed;
  border-radius: 6px;
  color: #9d3328;
  font-size: 12px;
  line-height: 1.4;
  padding: 7px;
}

.suggestion-stale-notice {
  background: #fff0ed;
  border: 1px solid #edc5bd;
  border-radius: 7px;
  color: #8b3027;
  display: grid;
  font-size: 12px;
  gap: 3px;
  line-height: 1.4;
  padding: 8px;
}

.stale-suggestion-card {
  border-color: #edc5bd;
  gap: 9px;
  padding: 12px;
}

.stale-suggestion-summary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.stale-suggestion-actions {
  margin-top: 0;
}

.stale-suggestion-actions .primary-button {
  width: 100%;
}

.candidate-reanalysis {
  background: #f4f7fb;
  border: 1px solid #cbd8e7;
  border-radius: 8px;
  display: grid;
  gap: 7px;
  padding: 10px;
}

.candidate-reanalysis > p,
.candidate-reanalysis > span {
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.candidate-reanalysis-message {
  background: #fff;
  border-left: 3px solid var(--blue);
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px;
}

body[data-role="wizard"] .wizard-card {
  max-height: 44vh;
  overflow: auto;
}

body[data-role="wizard"] .friction-panel {
  overflow-y: auto;
}

body[data-role="wizard"] .review-card {
  flex: 0 0 auto;
  max-height: 42vh;
}

body[data-role="wizard"] .notes-section {
  flex: 0 0 auto;
  max-height: 36vh;
}

.context-card {
  background: #f7faf9;
  flex: 0 0 auto;
  max-height: 190px;
  overflow: auto;
}

body[data-stage="2"] .context-card,
body[data-stage="2"] #activeContextBadge {
  display: none;
}

.intention-fields {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.intention-fields[hidden] {
  display: none;
}

.intention-actions {
  align-items: center;
  display: flex;
  gap: 6px;
}

.intention-fields textarea {
  min-height: 40px;
}

.intention-fields textarea[readonly] {
  background: #f8faf8;
  cursor: text;
}

.intention-fields textarea[readonly]:focus {
  border-color: var(--line);
  box-shadow: none;
}

.intention-fields.editing textarea {
  background: #fff;
  resize: vertical;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-fields textarea:not([readonly]),
body[data-study-mode="automatic"][data-role="user"] .intention-fields.editing textarea,
body[data-study-mode="automatic"][data-role="user"] .outline-fields textarea:not([readonly]) {
  min-height: 84px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-fields textarea,
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-fields textarea:not([readonly]) {
  min-height: 40px;
}

label,
.stacked-field {
  display: grid;
  gap: 5px;
}

label:not(.choice-option) > span,
.stacked-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

textarea,
select,
input:not([type="radio"]):not([type="checkbox"]) {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  outline: none;
  padding: 8px 9px;
  resize: vertical;
  width: 100%;
}

textarea:focus,
select:focus,
input:not([type="radio"]):not([type="checkbox"]):focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49, 91, 143, 0.14);
}

.selected-snippet,
.active-context {
  background: #fff;
  border: 1px dashed #c9d1ce;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 10px 0;
  max-height: 92px;
  overflow: auto;
  padding: 9px;
}

.form-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 9px;
}

.stacked-field {
  margin-bottom: 9px;
}

.compact-select {
  max-width: 172px;
  min-height: 30px;
  padding: 5px 8px;
}

.notes-list,
.chat-messages {
  display: grid;
  gap: 9px;
}

.notes-heading {
  align-items: center;
  display: flex;
  gap: 7px;
}

.notes-heading h3 {
  margin: 0;
}

.notes-new-badge {
  background: var(--blue-soft);
  border-radius: 999px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  padding: 4px 6px;
}

.note-description {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.note-how-to {
  background: #f8faf8;
  border: 1px solid #e0e7e1;
  border-radius: 7px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  padding: 6px 8px;
}

.note-how-to summary {
  color: var(--teal);
  cursor: pointer;
  font-weight: 700;
}

.note-how-to p { margin: 7px 0 0; }

.notes-section {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.notes-group {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  min-width: 0;
}

.notes-group[hidden],
.notes-list[hidden] {
  display: none !important;
}

.notes-group-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 2px 6px;
}

.notes-group-title {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
}

.notes-group-count {
  align-items: center;
  background: var(--blue-soft);
  border-radius: 999px;
  color: var(--blue);
  display: inline-flex;
  font-size: 10px;
  min-height: 20px;
  justify-content: center;
  min-width: 20px;
  padding: 2px 6px;
}

.notes-group-toggle.disclosure-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  display: inline-flex;
  font-size: 0;
  height: 32px;
  justify-content: center;
  min-height: 32px;
  padding: 0;
  width: 32px;
}

.notes-group-toggle.disclosure-toggle::before {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  content: "";
  display: block;
  height: 12px;
  transform: rotate(-45deg);
  transition: transform 140ms ease;
  width: 12px;
}

.notes-group-toggle.disclosure-toggle[aria-expanded="true"]::before {
  transform: rotate(45deg);
}

/* The formal participant column owns its scrolling at the panel level. Let
   Revision Focus size to its real content so its header and actions can never
   overflow a flex-shrunk card and overlap Writing Intention below it. */
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .notes-section {
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .notes-list {
  flex: 0 0 auto;
  overflow: visible;
}

.notes-heading-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

body[data-role="wizard"] .notes-section {
  min-height: 140px;
}

body[data-stage="3"][data-role="user"] #noteCount {
  display: none;
}

.notes-list {
  flex: 1 1 auto;
  margin-top: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.notes-group-list {
  margin-top: 0;
}

.note-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--note-taxonomy-color, var(--blue));
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.note-card.active {
  box-shadow: 0 0 0 3px rgba(49, 91, 143, 0.14);
}

.note-topline {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: space-between;
}

.taxonomy-badge {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 7px;
}

.note-card .taxonomy-badge {
  background: var(--note-taxonomy-soft, var(--blue-soft));
  color: var(--note-taxonomy-color, var(--blue));
}

.taxonomy-badge.protected_core {
  background: var(--taxonomy-protected-soft);
  color: var(--taxonomy-protected-color);
}

.taxonomy-badge.negotiable_substance {
  background: var(--taxonomy-negotiable-soft);
  color: var(--taxonomy-negotiable-color);
}

.taxonomy-badge.delegatable_surface {
  background: var(--taxonomy-delegatable-soft);
  color: var(--taxonomy-delegatable-color);
}

.taxonomy-badge.accountability_critical {
  background: var(--taxonomy-accountability-soft);
  color: var(--taxonomy-accountability-color);
}

.note-snippet {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.note-anchor-status {
  color: var(--muted);
  font-size: 12px;
  margin: -2px 0 0;
}

.note-message {
  font-size: 14px;
  line-height: 1.45;
}

.note-response-hint {
  background: #f7f8f6;
  border-left: 3px solid var(--line-strong, #aeb5ac);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  padding: 7px 9px;
}

.note-response-hint strong {
  color: var(--text);
}

.note-candidate {
  background: #f8faf8;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  padding: 8px;
}

body[data-role="user"] .note-candidate {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 0;
}

.note-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 6px;
}

.issue-chain-summary {
  align-items: center;
  background: #f4f5f3;
  border: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 11px;
  gap: 8px;
  padding: 6px 8px;
}

.note-presentation-control {
  align-items: center;
  background: #f4f5f3;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  gap: 5px;
  padding: 3px 5px;
}

.note-presentation-control span {
  font-size: 10px;
  font-weight: 700;
}

.note-presentation-control select {
  border: 0;
  min-height: 24px;
  padding: 1px 20px 1px 3px;
}

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

.note-action-group {
  display: flex;
  gap: 6px;
  width: 100%;
}

.note-action-group-secondary {
  flex-wrap: wrap;
}

.note-action-group-decision {
  flex-wrap: nowrap;
}

.note-action-group-decision button {
  font-size: 12px;
  min-height: 28px;
  padding: 4px 7px;
  white-space: nowrap;
}

.note-actions button,
.prompt-chips button {
  background: #f7f8f6;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  min-height: 30px;
  padding: 5px 8px;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chat-panel {
  min-height: 0;
}

.chat-messages {
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.chat-message {
  border-radius: 0;
  line-height: 1.5;
  padding: 4px 2px 12px;
}

.chat-message.user {
  align-self: end;
  background: #f0f1f0;
  border: 1px solid #e7e9e8;
  border-radius: 16px;
  margin-left: auto;
  max-width: 88%;
  padding: 9px 12px;
}

.chat-message.assistant {
  background: transparent;
  border: 0;
  margin-right: 0;
}

.chat-message.user .role {
  display: none;
}

.chat-message .role {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.chat-message-content {
  min-width: 0;
  overflow-wrap: anywhere;
}

.chat-message-quote {
  border-left: 3px solid var(--blue);
  color: var(--muted);
  margin-bottom: 8px;
  padding-left: 10px;
}

.chat-message-quote-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 3px;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.chat-draft-preview {
  background: #f5f7f6;
  border-left: 3px solid var(--blue);
  border-radius: 7px;
  margin-top: 12px;
  padding: 9px 11px;
}

.chat-draft-preview-label {
  color: var(--blue);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
}

.chat-draft-preview > div > :last-child {
  margin-bottom: 0;
}

.markdown-body p {
  margin: 0 0 10px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  line-height: 1.3;
  margin: 16px 0 7px;
}

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

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

.markdown-body h3,
.markdown-body h4 {
  font-size: 14px;
}

.markdown-body ul,
.markdown-body ol {
  margin: 7px 0 11px;
  padding-left: 22px;
}

.markdown-body ol {
  list-style-type: decimal;
}

.markdown-body li + li {
  margin-top: 4px;
}

.markdown-body blockquote {
  border-left: 3px solid #c6cfcb;
  color: var(--muted);
  margin: 10px 0;
  padding: 2px 0 2px 11px;
}

.markdown-body code {
  background: #eef1ef;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  padding: 2px 4px;
}

.markdown-body pre {
  background: #252a2d;
  border-radius: 8px;
  color: #f4f6f5;
  margin: 10px 0;
  max-width: 100%;
  overflow: auto;
  padding: 11px 12px;
}

.markdown-body pre code {
  background: transparent;
  color: inherit;
  display: block;
  line-height: 1.5;
  padding: 0;
  white-space: pre;
}

.markdown-body a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 13px 0;
}

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

.markdown-body table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
}

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

.markdown-body th {
  background: #f5f7f6;
  font-weight: 700;
}

.chat-form {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.chat-friction-gate {
  background: #fff9e8;
  border: 1px solid #e8cf91;
  border-radius: 10px;
  display: grid;
  gap: 9px;
  padding: 11px;
}

.chat-friction-gate[hidden] {
  display: none;
}

.friction-gate-heading,
.friction-gate-heading-actions,
.revision-check-header,
.revision-check-actions,
.submission-actions {
  align-items: center;
  display: flex;
  gap: 9px;
  justify-content: space-between;
}

.friction-gate-skip-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: #806b3d;
  cursor: pointer;
  display: inline-flex;
  font-size: 22px;
  height: 26px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 26px;
}

.friction-gate-skip-button:hover,
.friction-gate-skip-button:focus-visible {
  background: rgba(201, 144, 37, 0.14);
  color: var(--text);
}

.chat-friction-gate > p {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.friction-gate-scaffold {
  background: rgba(255, 255, 255, 0.72);
  border-left: 3px solid #c99025;
  border-radius: 6px;
  color: #654a17;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 9px;
}

.your-turn-override {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #dfca98;
  border-radius: 7px;
  display: grid;
  gap: 8px;
  padding: 9px;
}

.your-turn-override[hidden] {
  display: none;
}

.your-turn-override label {
  align-items: flex-start;
  display: flex;
  gap: 7px;
}

.your-turn-override input {
  flex: 0 0 auto;
  margin-top: 2px;
  width: auto;
}

.your-turn-override span {
  font-size: 12px;
  line-height: 1.45;
}

.chat-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.chat-message-actions button {
  font-size: 12px;
  min-height: 28px;
  padding: 4px 8px;
}

.chat-knowledge-sources {
  border-top: 1px solid #e5e9e7;
  margin-top: 12px;
  padding-top: 10px;
}

.chat-knowledge-heading {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 7px;
}

.chat-knowledge-list {
  display: grid;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.chat-knowledge-item {
  align-items: baseline;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.chat-knowledge-index,
.chat-knowledge-publisher {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 10px;
}

.chat-knowledge-link {
  color: var(--blue);
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-decoration: underline;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-knowledge-link:hover { text-decoration-thickness: 2px; }
.chat-knowledge-publisher::before { content: "· "; }

.chat-integration-hint {
  background: var(--blue-soft, #eef4fb);
  border-left: 3px solid var(--blue, #5876a6);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 8px 0 0;
  padding: 8px 10px;
}

.chat-change-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.chat-change-summary span {
  background: #f1f4f2;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  padding: 4px 7px;
}

.revision-check-popover {
  background: #fff;
  border: 1px solid #d8bd74;
  border-radius: 14px;
  bottom: 22px;
  box-shadow: 0 24px 68px rgba(31, 37, 40, 0.26);
  display: grid;
  gap: 12px;
  max-height: min(84vh, 820px);
  overflow: auto;
  padding: 18px 20px 16px;
  position: fixed;
  right: 22px;
  width: min(720px, calc(100vw - 44px));
  z-index: 30;
}

.revision-check-popover[hidden] { display: none; }

.revision-check-header {
  align-items: flex-start;
  background: #fff;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding-bottom: 3px;
  position: sticky;
  top: -18px;
  z-index: 2;
}

.revision-check-header h3 { margin: 2px 0 0; }

.revision-check-header-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.revision-check-close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 19px;
  height: 28px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 28px;
}

.revision-check-close:hover,
.revision-check-close:focus-visible {
  background: #f1f3f2;
  color: var(--text);
  outline: none;
}

.revision-check-helper,
.submission-summary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

#revisionCheckContent {
  display: grid;
  gap: 12px;
}

.pending-text-comparison {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 9px;
  padding: 14px 0 0;
}

#revisionCheckContent .inline-diff {
  background: transparent;
  border: 0;
  border-radius: 0;
  min-height: 0;
  padding: 2px 0;
}

.revision-section-heading {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.revision-section-helper {
  color: var(--muted);
  font-size: 11px;
  margin: 0;
  text-align: right;
}

.comparison-label {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
}

.revision-goal-summary,
.revision-change-checks {
  display: grid;
  gap: 8px;
}

.revision-goal-summary {
  padding: 0 0 2px;
}

.revision-change-checks {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.revision-goal-summary p,
.revision-change-row p {
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

.revision-review-group {
  display: grid;
  gap: 8px;
  padding: 2px 0 0;
}

.revision-review-group + .revision-review-group {
  border-top: 1px solid var(--line);
  margin-top: 5px;
  padding-top: 12px;
}

.revision-review-group-header {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.revision-review-group-header span {
  color: var(--muted);
  font-size: 11px;
}

.revision-review-group.complete .revision-review-group-header span {
  color: #347047;
  font-weight: 700;
}

.revision-empty-check {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

.revision-change-row {
  align-items: start;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding-top: 10px;
}

.revision-change-row.meaning-level {
  border-left: 3px solid #df9e93;
  padding-left: 10px;
}

.revision-change-copy > span {
  color: var(--text);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 2px;
}

.revision-choice-pair {
  align-items: center;
  display: flex;
  gap: 6px;
}

.revision-choice {
  align-items: center;
  background: #fff;
  border: 1px solid #d9ddda;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  gap: 5px;
  padding: 5px 8px;
  white-space: nowrap;
}

.revision-choice.selected {
  background: var(--blue-soft, #eef4fb);
  border-color: #9eb5d1;
  color: #35587d;
}

.revision-choice input {
  flex: 0 0 auto;
  margin: 0;
  width: auto;
}

.revision-decision-preview {
  border-left: 2px solid #d8ddda;
  grid-column: 1 / -1;
  padding: 2px 0 2px 10px;
}

.revision-decision-preview.reject { border-left-color: #dca9a1; }
.revision-decision-preview.accept { border-left-color: #95c3a4; }

.revision-decision-preview-label {
  color: var(--muted);
  font-size: 11px !important;
  font-weight: 800;
  margin-bottom: 6px !important;
}

.revision-structure-followup {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
  margin-top: 9px;
  padding-top: 9px;
}

.revision-structure-followup > p,
.revision-structure-chat-hint {
  color: var(--muted);
  font-size: 11px !important;
}

.revision-structure-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.revision-structure-actions .selected {
  background: var(--blue-soft, #eef4fb);
  border-color: #9eb5d1;
  color: #35587d;
}

.revision-check-error {
  background: #fff4df;
  border-radius: 7px;
  color: #76520c;
  font-size: 12px;
  line-height: 1.45;
  padding: 8px;
}

.revision-check-actions {
  align-items: center;
  background: #fff;
  border-top: 1px solid #ecefed;
  bottom: -16px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 11px 0 0;
  position: sticky;
  z-index: 2;
}

@media (max-width: 760px) {
  .revision-check-popover {
    bottom: 12px;
    left: 12px;
    max-height: calc(100dvh - 24px);
    padding: 15px;
    right: 12px;
    width: auto;
  }

  .revision-change-row { grid-template-columns: 1fr; }
  .revision-choice-pair { justify-content: flex-start; }
  .revision-section-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .revision-section-helper { text-align: left; }
}

.modal-backdrop {
  align-items: center;
  background: rgba(20, 26, 28, 0.46);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 50;
}

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

.submission-modal {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 72px rgba(20, 26, 28, 0.28);
  display: grid;
  gap: 12px;
  max-height: min(80vh, 760px);
  overflow: auto;
  padding: 20px;
  width: min(620px, 100%);
}

.friction-presentation-modal {
  border-top: 5px solid var(--amber);
  inline-size: fit-content;
  max-inline-size: 100%;
}

.presentation-snippet {
  background: #faf8f2;
  border-left: 4px solid var(--amber);
  border-radius: 0 7px 7px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
  padding: 10px 12px;
}

.submission-issue-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.submission-issue-list article {
  background: #fafaf8;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 7px;
  padding: 9px;
}

.submission-issue-list article.protected_core {
  border-left-color: var(--amber);
}

.submission-issue-list article.negotiable_substance {
  border-left-color: var(--teal);
}

.submission-issue-list article.delegatable_surface {
  border-left-color: var(--green);
}

.submission-issue-list article.accountability_critical {
  border-left-color: var(--red);
}

.submission-issue-list article.pending {
  border-left-color: var(--blue);
}

.submission-issue-list article .submission-issue-label {
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.submission-issue-list article .taxonomy-badge {
  display: inline-block;
}

.submission-issue-snippet {
  background: #fff;
  border-left: 3px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 6px;
  padding: 7px 9px;
}

.submission-issue-list article.protected_core .submission-issue-snippet {
  border-left-color: var(--amber);
}

.submission-issue-list article.negotiable_substance .submission-issue-snippet {
  border-left-color: var(--teal);
}

.submission-issue-list article.delegatable_surface .submission-issue-snippet {
  border-left-color: var(--green);
}

.submission-issue-list article.accountability_critical .submission-issue-snippet {
  border-left-color: var(--red);
}

.submission-issue-list article.pending .submission-issue-snippet {
  border-left-color: var(--blue);
}

.submission-issue-list article p {
  font-size: 13px;
  line-height: 1.45;
  margin: 4px 0 0;
}

.submission-acknowledgement {
  background: var(--blue-soft);
  border-radius: 8px;
  padding: 10px;
}

.submission-acknowledgement span {
  color: var(--text);
}

#submitDraftButton.submitted {
  background: var(--green);
  border-color: var(--green);
}

.chat-composer-shell {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.chat-composer-shell:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49, 91, 143, 0.14);
}

.composer-context {
  padding: 8px 8px 0;
}

.composer-context[hidden] {
  display: none;
}

.composer-context-quote {
  align-items: flex-start;
  background: #f5f7f6;
  border-left: 3px solid var(--blue);
  border-radius: 7px;
  display: flex;
  gap: 8px;
  padding: 7px 7px 7px 9px;
}

.composer-context-content {
  display: grid;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
}

.composer-context-label {
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.composer-context-text {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--text);
  display: -webkit-box;
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
}

.context-remove-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 18px;
  height: 24px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 24px;
}

.context-remove-button:hover {
  background: #e5e9e7;
  color: var(--text);
}

.composer-context .prompt-chips {
  flex-wrap: nowrap;
  margin: 6px 0 0;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.composer-context .prompt-chips::-webkit-scrollbar {
  display: none;
}

.composer-context .prompt-chips button {
  flex: 0 0 auto;
  font-size: 11px;
  max-width: 240px;
  min-height: 27px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-input-shell {
  align-items: center;
  border: 0;
  display: flex;
  gap: 10px;
  padding: 8px 9px 8px 12px;
}

.chat-input-shell textarea {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  line-height: 1.4;
  max-height: 132px;
  min-height: 40px;
  overflow-y: hidden;
  padding: 9px 2px;
  resize: none;
}

.chat-input-shell textarea:focus {
  border-color: transparent;
  box-shadow: none;
}

.chat-input-feedback {
  color: #9c3e3a;
  font-size: 12px;
  margin: 0 12px 8px;
}

.chat-send-button {
  align-items: center;
  background: #315b8f;
  border: 1px solid #315b8f;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 600;
  height: var(--icon-control-size);
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: var(--icon-control-size);
}

.chat-send-button svg {
  fill: none;
  height: 17px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 17px;
}

#activeContextBadge,
.composer-context .prompt-chips {
  display: none !important;
}

.chat-send-button:hover:not(:disabled),
.chat-send-button:focus-visible {
  background: #244a79;
  border-color: #244a79;
}

.chat-send-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(49, 91, 143, 0.22);
  outline: none;
}

.chat-send-button:disabled {
  background: #a8b1bb;
  border-color: #a8b1bb;
  cursor: not-allowed;
}

.chat-send-button[data-busy="true"] { cursor: wait; }

.empty-state {
  border: 1px dashed #c9d1ce;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  padding: 12px;
}

.style-basis-panel {
  background: #f5f2ff;
  border: 1px solid #d8cff8;
  border-radius: 8px;
  color: #342b57;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.style-basis-panel dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.style-basis-panel dl div {
  display: grid;
  gap: 2px;
  grid-template-columns: minmax(120px, 0.32fr) 1fr;
}

.style-basis-panel dt {
  color: #665b8d;
  font-size: 11px;
  font-weight: 700;
}

.style-basis-panel dd {
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.note-card.voice-style-note {
  border-left: 4px solid #8875d1;
}

.voice-style-note .taxonomy-badge {
  background: #e9e3ff;
  color: #443579;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .workspace {
    gap: 14px;
    grid-template-columns: 1fr !important;
    overflow: visible;
  }

  .column-resizer {
    display: none;
  }

  body[data-study-mode="automatic"][data-condition="friction"][data-stage="2"] #editorFrictionResizer {
    display: none !important;
  }

  .editor {
    min-height: 480px;
  }

  .friction-panel,
  .chat-panel {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .system-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .system-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .system-title-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-prompt-popover {
    width: calc(100vw - 40px);
  }

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

  .ql-editor {
    padding: 18px;
  }
}
.ql-snow .ql-picker.ql-header .ql-picker-label::before,
.ql-snow .ql-picker.ql-header .ql-picker-item::before {
  content: "正文";
}

.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before {
  content: "标题 1";
}

.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before {
  content: "标题 2";
}

.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before {
  content: "标题 3";
}

body[data-locale="en"] .ql-snow .ql-picker.ql-header .ql-picker-label::before,
body[data-locale="en"] .ql-snow .ql-picker.ql-header .ql-picker-item::before {
  content: "Body";
}

body[data-locale="en"] .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before,
body[data-locale="en"] .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before {
  content: "Heading 1";
}

body[data-locale="en"] .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
body[data-locale="en"] .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before {
  content: "Heading 2";
}

body[data-locale="en"] .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
body[data-locale="en"] .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before {
  content: "Heading 3";
}

.ql-snow .ql-tooltip::before {
  content: "链接地址：";
}

.ql-snow .ql-tooltip a.ql-action::after {
  content: "编辑";
}

.ql-snow .ql-tooltip a.ql-remove::before {
  content: "移除";
}

.ql-snow .ql-tooltip.ql-editing a.ql-action::after {
  content: "保存";
}

body[data-locale="en"] .ql-snow .ql-tooltip::before {
  content: "Visit URL:";
}

body[data-locale="en"] .ql-snow .ql-tooltip a.ql-action::after {
  content: "Edit";
}

body[data-locale="en"] .ql-snow .ql-tooltip a.ql-remove::before {
  content: "Remove";
}

body[data-locale="en"] .ql-snow .ql-tooltip.ql-editing a.ql-action::after {
  content: "Save";
}

.ql-snow .ql-tooltip[data-mode="link"]::before {
  content: "输入链接：";
}

.ql-snow .ql-tooltip[data-mode="formula"]::before {
  content: "输入公式：";
}

.ql-snow .ql-tooltip[data-mode="video"]::before {
  content: "输入视频地址：";
}

/* Formal participant plan: the adjacent AI and planning areas are flat,
   separated only by a rule—not an empty resize gutter or nested cards. */
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .workspace {
  gap: 0;
  grid-template-columns:
    minmax(420px, var(--planning-editor-column, 1fr)) 12px
    minmax(320px, var(--planning-chat-column, 1fr));
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .editor-panel {
  background: #eef0ee;
  grid-column: 1;
  grid-row: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .chat-panel {
  background: #fff;
  grid-column: 3;
  grid-row: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] #editorFrictionResizer {
  background: #eef0ee;
  display: flex !important;
  grid-column: 2;
  grid-row: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] #frictionChatResizer {
  display: none !important;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-card {
  background: transparent;
  border: 0;
  flex: 0 0 48%;
  max-height: none;
  min-height: 120px;
  padding: 10px 16px 14px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .toolbar,
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .ideas-notes-card {
  display: none !important;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .editor {
  background: transparent;
  display: block !important;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-summary-item {
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(93, 84, 73, 0.2);
  border-radius: 0;
  padding: 7px 0;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] #outlineCard > .section-title-row {
  display: none !important;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-instruction {
  margin: 4px 0 7px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-fields {
  gap: 4px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .formal-planning-field {
  padding: 8px 0;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .formal-planning-field:first-child {
  border-top: 0;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-summary {
  gap: 3px;
  margin-top: 4px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .formal-planning-item {
  gap: 3px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .formal-planning-item textarea,
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .formal-planning-field textarea {
  min-height: 40px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-summary-item textarea {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(93, 84, 73, 0.24);
  box-shadow: none;
}

/* Formal participant drafting: the document is the visual centre, while
   intent and notes collapse into compact, secondary controls. */
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card .section-title-row {
  gap: 12px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card h3,
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card .intention-actions > #collapseIntentButton {
  display: none;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-summary {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .editor {
  background: #eef0ee;
  flex: 1 1 0;
  min-height: 180px;
  overflow: hidden;
  padding: 32px 24px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .editor-panel {
  min-height: 0;
  overflow: hidden;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] #editor.editor.ql-container {
  background: #eef0ee;
  border: 0;
  margin: 0;
  flex: 1 1 0;
  min-height: 180px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] #editor .ql-editor {
  background: #fff;
  box-shadow: 0 1px 4px rgba(31, 37, 40, 0.08);
  height: auto;
  margin: 0 auto;
  max-width: 800px;
  min-height: 100%;
  overflow: visible;
  padding: 48px clamp(48px, 7vw, 64px);
  width: min(800px, 100%);
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .toolbar {
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .ideas-notes-card.formal-notes-collapsed {
  padding-bottom: 10px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .ideas-notes-card.formal-notes-collapsed .section-helper,
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .ideas-notes-card.formal-notes-collapsed textarea {
  display: none;
}

/* Formal planning returns to the study's cool gray and white surfaces. The
   two divider tracks are deliberately draggable, but read visually as rules
   instead of unused empty space. */
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-card {
  background: #eef0ee;
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-color: #98a29f #e4e8e5;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-card::-webkit-scrollbar {
  width: 10px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-card::-webkit-scrollbar-track {
  background: #e4e8e5;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-card::-webkit-scrollbar-thumb {
  background: #98a29f;
  border: 2px solid #e4e8e5;
  border-radius: 999px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-summary-item {
  border: 0;
  padding: 12px 0;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-summary-item textarea {
  background: #fff;
  border-color: var(--line);
}

/* Keep the planning surface on one restrained type scale. The section title
   remains a heading, while instructions, questions, answers and custom items
   all read at the same body size instead of jumping between several sizes. */
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-instruction,
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .planning-field-question,
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .formal-planning-field textarea,
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .custom-planning-question-row,
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .custom-planning-heading input {
  font-size: 14px;
  line-height: 1.5;
}

/* System controls stay visually secondary to the planning content. */
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .add-planning-field,
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-actions button,
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .status-pill {
  font-size: 12px;
  line-height: 1.35;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-actions {
  align-items: center;
  background: rgba(238, 240, 238, 0.98);
  border-top: 1px solid var(--line);
  bottom: -14px;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  justify-content: flex-end;
  margin: 12px -14px -14px;
  padding: 8px 14px;
  position: sticky;
  z-index: 3;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-next-hint {
  color: var(--muted);
  flex: 1 1 auto;
  font-size: 11px;
  line-height: 1.35;
  min-width: 0;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .outline-actions button {
  min-height: 32px;
  padding: 6px 11px;
  white-space: nowrap;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] #outlineEditButton,
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] #outlineAiButton {
  display: none !important;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .planning-dimension {
  font-size: 12px;
  line-height: 1.4;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] #editorFrictionResizer::before {
  background: var(--line);
  border-radius: 0;
  height: 100%;
  width: 1px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .planning-draft-resizer {
  background: #fff;
  display: flex !important;
  flex: 0 0 12px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .planning-draft-resizer::before {
  background: var(--line);
  border-radius: 0;
  height: 1px;
  width: 100%;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .locked-workspace-message {
  align-items: baseline;
  background: #f3f5f4;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: flex !important;
  gap: 8px;
  justify-content: flex-start;
  min-height: 0;
  padding: 9px 16px;
  text-align: left;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .locked-workspace-message strong,
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .locked-workspace-message span {
  display: inline;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .locked-workspace-message strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .locked-workspace-message span {
  color: var(--muted);
  font-size: 14px;
  margin-top: 0;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .editor {
  background: #fff;
  border-top: 0;
  display: block !important;
  flex: 1 1 0;
  height: auto;
  max-height: none;
  min-height: 140px;
  overflow: hidden;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="2"] .chat-form {
  margin: 0 clamp(18px, 2vw, 36px) 16px;
}

body[data-study-mode="automatic"][data-role="user"] .chat-composer-shell:focus-within {
  border-color: #5877a2;
  box-shadow:
    0 1px 2px rgba(31, 37, 40, 0.08),
    0 6px 16px rgba(31, 37, 40, 0.10),
    0 0 0 2px rgba(83, 111, 153, 0.16);
}

/* Reuse the tutorial's soft, natural elevation on the formal participant
   surfaces only. WoZ deliberately keeps its frozen visual treatment. */
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .editor-panel {
  box-shadow: 0 20px 48px rgba(23, 31, 35, 0.12);
  position: relative;
  z-index: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .chat-composer-shell {
  box-shadow: 0 12px 30px rgba(23, 31, 35, 0.11);
  transition: box-shadow 160ms ease, border-color 160ms ease;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .chat-composer-shell:focus-within {
  box-shadow:
    0 16px 34px rgba(23, 31, 35, 0.15),
    0 0 0 2px rgba(83, 111, 153, 0.16);
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .chat-form {
  margin: 0 clamp(18px, 2vw, 36px) 16px;
}

/* Formal drafting keeps the three semantic areas in place while restoring
   their directly manipulable, hairline dividers. */
body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace {
  grid-template-columns:
    minmax(260px, var(--formal-stage3-friction, 300px)) 12px
    minmax(520px, var(--formal-stage3-editor, 1fr)) 12px
    minmax(300px, var(--formal-stage3-chat, 380px));
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .friction-panel {
  grid-column: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] #editorFrictionResizer {
  background: #eef0ee;
  display: flex !important;
  grid-column: 2;
  grid-row: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .editor-panel {
  grid-column: 3;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .editor-panel > .panel-header .editor-header-actions {
  display: none;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] #frictionChatResizer {
  background: #eef0ee;
  display: flex !important;
  grid-column: 4;
  grid-row: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .chat-panel {
  grid-column: 5;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="baseline"][data-stage="3"] .workspace {
  grid-template-columns:
    minmax(520px, var(--formal-stage3-editor, 1fr)) 12px
    minmax(300px, var(--formal-stage3-chat, 380px));
}

body[data-study-mode="automatic"][data-role="user"][data-condition="baseline"][data-stage="3"] .editor-panel {
  grid-column: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="baseline"][data-stage="3"] #frictionChatResizer {
  background: #eef0ee;
  display: flex !important;
  grid-column: 2;
  grid-row: 1;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="baseline"][data-stage="3"] .chat-panel {
  grid-column: 3;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .column-resizer::before {
  background: var(--line);
  border-radius: 0;
  height: 100%;
  width: 1px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-friction-panel-collapsed {
  grid-template-columns:
    52px 12px
    minmax(520px, var(--formal-stage3-editor, 1fr)) 12px
    minmax(300px, var(--formal-stage3-chat, 380px));
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-chat-panel-collapsed {
  grid-template-columns:
    minmax(260px, var(--formal-stage3-friction, 300px)) 12px
    minmax(520px, var(--formal-stage3-editor, 1fr)) 12px 52px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-friction-panel-collapsed.formal-chat-panel-collapsed {
  grid-template-columns: 52px 12px minmax(520px, var(--formal-stage3-editor, 1fr)) 12px 52px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="baseline"][data-stage="3"] .workspace.formal-chat-panel-collapsed {
  grid-template-columns: minmax(520px, var(--formal-stage3-editor, 1fr)) 12px 52px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .note-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--note-taxonomy-color, var(--blue));
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(31, 37, 40, 0.04);
  padding: 12px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-fields textarea,
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-fields textarea[readonly] {
  background: #fff;
}

/* The formal writing-plan overview is deliberately compact by default, but
   can be expanded and vertically resized without changing the draft itself. */
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card h3,
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card .intention-actions > #collapseIntentButton {
  display: inline-flex;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card {
  overflow: auto;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card.formal-overview-collapsed {
  background: #f2f6fb;
  border-bottom: 1px solid #d7e1ec;
  border-top: 1px solid #e2e9f1;
  flex-basis: auto;
  min-height: 46px;
  padding: 8px 16px;
}

/* The overview-to-document separator is an interaction surface, not merely a
   hairline. Give it a generous hit area so the writer can reliably drag from
   anywhere along the divider, while keeping the visible grip understated. */
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] #planningDraftResizer {
  align-items: center;
  background: #f8f9f8;
  cursor: row-resize;
  display: flex !important;
  flex: 0 0 18px;
  justify-content: center;
  min-height: 18px;
  outline: none;
  position: relative;
  touch-action: none;
  user-select: none;
  z-index: 3;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] #planningDraftResizer::before {
  background: #aeb8b5;
  border-radius: 99px;
  content: "";
  height: 3px;
  transition: background 140ms ease, width 140ms ease;
  width: 44px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] #planningDraftResizer:hover::before,
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] #planningDraftResizer:focus-visible::before,
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] #planningDraftResizer.dragging::before {
  background: var(--blue);
  width: 64px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card.formal-overview-collapsed + #planningDraftResizer {
  display: none !important;
}

body[data-study-mode="automatic"][data-role="user"] .chat-panel {
  background: #fff;
}

/* The panel header already names this area "修改提醒".  Repeating the near
   synonym "修改重点" above the cards makes the narrow formal sidebar feel
   needlessly labelled twice; keep a single, clear section title. */
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .notes-section #notesTitle {
  display: none;
}

/* Formal headings remain informational, but sit on a clean white surface.
   This keeps the writing, reminder, and AI areas visually continuous without
   changing any of their labels. */
body[data-study-mode="automatic"][data-role="user"] .system-bar,
body[data-study-mode="automatic"][data-role="user"] .panel-header {
  background: #fff;
}

/* In the drafting workspace the writing-intention bar has one compact
   disclosure affordance. Keep it at the far right so the title reads as the
   left anchor of the bar instead of visually merging with the control. */
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card .section-title-row {
  justify-content: space-between;
  width: 100%;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card .intention-actions {
  gap: 2px;
  margin-left: auto;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card #collapseIntentButton {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  display: inline-flex;
  font-size: 0;
  height: 32px;
  justify-content: center;
  min-height: 28px;
  padding: 0;
  width: 32px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card #collapseIntentButton::before,
.tutorial-app #intention-toggle::before {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  content: "";
  display: block;
  height: 12px;
  transform: rotate(-45deg);
  transition: transform 140ms ease;
  width: 12px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card #collapseIntentButton[aria-expanded="true"]::before,
.tutorial-app #intention-toggle[aria-expanded="true"]::before {
  transform: rotate(45deg);
}

.tutorial-app #intention-toggle {
  align-items: center;
  display: inline-flex;
  font-size: 0;
  height: 32px;
  justify-content: center;
  padding: 0;
  width: 32px;
}

/* Keep the assistant name on one line. The wider formal assistant column and
   a shrinkable conversation control leave the title readable at all sizes. */
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .chat-panel .panel-header > :first-child {
  flex: 0 0 auto;
  min-width: max-content;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] #chatPanelTitle {
  white-space: nowrap;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .chat-header-actions {
  flex: 1 1 0;
  flex-wrap: nowrap;
  min-width: 0;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .chat-conversation-select {
  flex: 1 1 0;
  min-width: 0;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace {
  grid-template-columns:
    minmax(260px, var(--formal-stage3-friction, 300px)) 12px
    minmax(480px, var(--formal-stage3-editor, 1fr)) 12px
    minmax(360px, var(--formal-stage3-chat, 420px));
}

body[data-study-mode="automatic"][data-role="user"][data-condition="baseline"][data-stage="3"] .workspace {
  grid-template-columns:
    minmax(480px, var(--formal-stage3-editor, 1fr)) 12px
    minmax(360px, var(--formal-stage3-chat, 420px));
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-friction-panel-collapsed {
  grid-template-columns:
    52px 12px
    minmax(480px, var(--formal-stage3-editor, 1fr)) 12px
    minmax(360px, var(--formal-stage3-chat, 420px));
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-chat-panel-collapsed {
  grid-template-columns:
    minmax(260px, var(--formal-stage3-friction, 300px)) 12px
    minmax(480px, var(--formal-stage3-editor, 1fr)) 12px 52px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="friction"][data-stage="3"] .workspace.formal-friction-panel-collapsed.formal-chat-panel-collapsed {
  grid-template-columns: 52px 12px minmax(480px, var(--formal-stage3-editor, 1fr)) 12px 52px;
}

body[data-study-mode="automatic"][data-role="user"][data-condition="baseline"][data-stage="3"] .workspace.formal-chat-panel-collapsed {
  grid-template-columns: minmax(480px, var(--formal-stage3-editor, 1fr)) 12px 52px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .note-message {
  font-size: 14px;
  line-height: 1.45;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .note-actions button {
  font-size: 13px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .note-action-group-decision button {
  font-size: 12px;
}

/* The confirmation call-to-action is secondary to the participant's own
   wording: keep its label compact while retaining a comfortably readable
   input field. */
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .chat-friction-gate .primary-button {
  font-size: 13px;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .chat-friction-gate textarea {
  font-size: 16px;
}

/* Post-writing surfaces fill the viewport because the system bar is hidden
   during review / survey / completion. Do not apply this sizing to the
   drafting workspace, which must fill only the remaining app-shell height. */
.friction-review-workspace.application-surface:not([hidden]) {
  flex: 1 1 100%;
  min-height: 100dvh;
}

.choice-option {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 10px;
}

.choice-option input[type="radio"],
.choice-option input[type="checkbox"] {
  flex: 0 0 auto;
  height: 16px;
  margin: 0;
  padding: 0;
  width: 16px;
}

.choice-option > span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.friction-review-workspace {
  box-sizing: border-box;
  padding-block: clamp(28px, 5dvh, 64px) 48px;
}

.friction-review-header,
.friction-review-list,
.friction-review-footer {
  width: min(100%, 960px);
}

.friction-review-list {
  gap: 22px;
}

.timeline-item {
  border-radius: 12px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  overflow: visible;
  position: relative;
}

.timeline-item::before {
  background: var(--line);
  content: "";
  left: 26px;
  position: absolute;
  top: 54px;
  bottom: -24px;
  width: 1px;
}

.timeline-item:last-child::before { display: none; }

.timeline-marker {
  align-items: center;
  background: var(--text);
  border: 4px solid var(--bg);
  border-radius: 50%;
  color: #fff;
  display: flex;
  font-size: 11px;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  letter-spacing: .03em;
  margin-top: 18px;
  position: relative;
  width: 44px;
  z-index: 1;
}

.timeline-item-content {
  min-width: 0;
  padding: 20px 22px 0;
}

.timeline-item-header {
  align-items: baseline;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.timeline-item-header h2 {
  color: var(--text);
  font-size: 18px;
  letter-spacing: 0;
  margin: 0;
  text-transform: none;
}

.timeline-item-header time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.timeline-prompt {
  background: var(--amber-soft);
  border-left: 3px solid var(--amber);
  line-height: 1.65;
  margin: 14px 0 18px;
  padding: 12px 14px;
  white-space: pre-wrap;
}

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

.review-summary-block h3 {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  margin: 0 0 7px;
  text-transform: uppercase;
}

.review-summary-block blockquote,
.inline-diff {
  background: #f7f8f6;
  border: 1px solid #e3e7e4;
  border-radius: 8px;
  line-height: 1.65;
  margin: 0;
  min-height: 48px;
  padding: 11px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.review-document-button {
  margin-top: 14px;
}

.diff-deletion {
  background: #fde3e1;
  color: #8c2c27;
  text-decoration: line-through;
}

.diff-addition {
  background: #dff4e9;
  color: #176b46;
}

.diff-unchanged { color: var(--muted); }
.diff-truncation { color: var(--muted); }

.friction-review-response {
  margin-top: 20px;
  padding: 18px 0 22px;
}

.friction-review-options {
  gap: 7px;
}

.friction-review-option {
  align-items: flex-start;
  background: #fff;
  padding: 11px 12px;
}

.friction-review-option input[type="radio"] {
  margin-top: 3px;
}

.friction-review-option > span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.task-complete-workspace .friction-review-header {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100dvh - 96px);
  text-align: center;
}

.task-complete-workspace .primary-button {
  margin-top: 22px;
}

.task-complete-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}

.task-complete-actions .primary-button,
.task-complete-actions .submitted-draft-review-button {
  margin-top: 0;
}

.document-evidence-modal {
  max-width: 900px;
  width: min(900px, calc(100vw - 32px));
}

.document-evidence-header {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.document-evidence-header h2 { margin-bottom: 0; }

.document-evidence-tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 4px;
  margin-top: 22px;
}

.document-evidence-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 10px 12px;
}

.document-evidence-tab.active {
  border-bottom-color: var(--blue);
  color: var(--blue);
  font-weight: 700;
}

.document-evidence-meta {
  color: var(--muted);
  font-size: 12px;
  margin: 14px 0 8px;
}

.document-evidence-surface {
  background: #f7f8f6;
  border: 1px solid #e3e7e4;
  border-radius: 10px;
  line-height: 1.8;
  max-height: min(58dvh, 600px);
  overflow: auto;
  padding: 20px;
  white-space: pre-wrap;
  word-break: break-word;
}

.submitted-draft-review-surface {
  cursor: text;
  min-height: min(42dvh, 420px);
  user-select: text;
}

.document-viewer-highlight {
  background: #fff0a8;
  border-radius: 3px;
  box-shadow: 0 0 0 2px rgba(219, 167, 24, .24);
  color: inherit;
  padding: 2px 0;
}

.document-viewer-deleted-marker {
  background: #fde3e1;
  border: 1px dashed #c85c55;
  border-radius: 4px;
  color: #8c2c27;
  display: inline-block;
  font-size: 13px;
  padding: 2px 6px;
}

.document-viewer-empty { color: var(--muted); }

/* All semantic disclosure controls use the same hit area and the same
   right-when-collapsed / down-when-expanded chevron. */
.disclosure-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  display: inline-flex;
  font-size: 0;
  height: 32px;
  justify-content: center;
  min-height: 32px;
  padding: 0;
  width: 32px;
}

.disclosure-toggle::before {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  content: "";
  display: block;
  height: 12px;
  transform: rotate(-45deg);
  transition: transform 140ms ease;
  width: 12px;
}

.disclosure-toggle[aria-expanded="true"]::before {
  transform: rotate(45deg);
}

@media (max-width: 760px) {
  .timeline-item { grid-template-columns: 40px minmax(0, 1fr); }
  .timeline-item::before { left: 19px; }
  .timeline-marker { height: 34px; margin-top: 20px; width: 34px; }
  .timeline-item-content { padding-inline: 14px; }
  .review-summary-grid { grid-template-columns: 1fr; }
  .timeline-item-header { align-items: flex-start; flex-direction: column; gap: 4px; }
}
/* Task-local behavior adaptation notifications are detached from the reminder
   sidebar so they never participate in its layout or scrolling. */
.behavior-adaptation-toast-region {
  display: grid;
  gap: 8px;
  max-height: calc(100dvh - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: none;
  position: fixed;
  right: 18px;
  scrollbar-gutter: stable;
  top: 72px;
  width: min(318px, calc(100vw - 32px));
  z-index: 40;
}

.behavior-adaptation-toast-region:empty {
  display: none;
}

.behavior-adaptation-toast {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(31, 37, 40, 0.12);
  border-radius: 11px;
  box-shadow: 0 7px 24px rgba(20, 26, 28, 0.12);
  opacity: 0;
  padding: 10px 11px;
  pointer-events: auto;
  transform: translateX(18px);
  transition: opacity 160ms ease, transform 180ms ease;
}

.behavior-adaptation-toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.behavior-adaptation-toast.is-leaving {
  opacity: 0;
  transform: translateX(12px);
}

.behavior-adaptation-toast-header {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.behavior-adaptation-toast-header strong {
  color: #2d3235;
  font-size: 12px;
  font-weight: 650;
}

.behavior-adaptation-toast-close {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #737a7e;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 16px;
  height: 22px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 22px;
}

.behavior-adaptation-toast-close:hover,
.behavior-adaptation-toast-close:focus-visible {
  background: #f0f2f2;
  color: #2d3235;
}

.behavior-adaptation-toast-body {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.behavior-adaptation-toast-body p {
  color: #555d61;
  display: grid;
  font-size: 11px;
  gap: 6px;
  grid-template-columns: 48px minmax(0, 1fr);
  line-height: 1.45;
  margin: 0;
}

.behavior-adaptation-toast-body .behavior-adaptation-toast-message {
  display: block;
}

.behavior-adaptation-toast-label {
  color: #8a9094;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .02em;
}

.behavior-adaptation-toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 6px;
}

.behavior-adaptation-toast-actions button {
  min-height: 30px;
  padding: 5px 10px;
}

@media (max-width: 760px) {
  .behavior-adaptation-toast-region {
    max-height: calc(100dvh - 82px);
    right: 12px;
    top: 62px;
    width: min(300px, calc(100vw - 24px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .behavior-adaptation-toast {
    transition: none;
  }
}
/* Writing-profile popover shared by the formal workspace and tutorial mock. */
.profile-settings-heading { align-items: flex-start; }
.profile-settings-heading > div, .profile-settings-section-heading { display: grid; gap: 4px; }
.profile-settings-heading p { max-width: 680px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.profile-settings-fields, .profile-explicit-section, .profile-settings-text-list, .profile-summary-natural-list { display: grid; gap: 12px; }
.profile-settings-fields { gap: 16px; }
.profile-settings-section-heading strong, .profile-summary-heading strong { font-size: 15px; }
.profile-settings-section-heading span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.profile-settings-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.profile-settings-readonly-entry { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid #dfe3e4; border-radius: 8px; background: #f8f9f9; }
.profile-settings-readonly-entry > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.profile-settings-readonly-entry p, .profile-summary-natural-entry p { margin: 0; font-size: 13px; line-height: 1.55; }
.profile-settings-readonly-entry.compact { align-items: center; grid-template-columns: minmax(116px, .9fr) minmax(0, 1.1fr); }
.profile-settings-readonly-entry.compact p { font-weight: 600; }
.profile-settings-edit-field { display: grid; gap: 6px; }
.profile-settings-edit-field > span { font-size: 12px; font-weight: 700; }
.profile-settings-edit-field textarea, .profile-settings-edit-field select { width: 100%; box-sizing: border-box; border: 1px solid #cfd6d9; border-radius: 8px; color: #1f2528; background: #fff; font: inherit; }
.profile-settings-edit-field textarea { min-height: 76px; padding: 9px 10px; resize: vertical; }
.profile-settings-edit-field select { min-height: 42px; padding: 8px 10px; }
.profile-summary-natural-entry { padding: 9px 10px; border: 1px solid #e4deef; border-radius: 8px; background: #fff; }
.profile-settings-actions, .profile-settings-confirmation > div { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.profile-settings-actions { margin-top: 16px; }
.profile-settings-confirmation { margin-top: 12px; padding: 12px; border: 1px solid #cdd8e5; border-radius: 8px; background: #f3f6fa; }
.profile-settings-confirmation p { margin: 0 0 10px; line-height: 1.5; }
@media (max-width: 760px) { .profile-settings-choice-grid { grid-template-columns: 1fr; } }

/* Persistent writing-task reference -------------------------------------------------
   The task is persistent context rather than an alert. The inline dock is the
   participant's only task-reference affordance in the formal study workspace. */
.task-prompt-dock {
  display: none;
}

body[data-study-mode="automatic"][data-role="user"] #taskPromptButton {
  display: none !important;
}

body[data-study-mode="automatic"][data-role="user"] .task-prompt-dock {
  background: #f6f7f6;
  border-bottom: 1px solid var(--line);
  display: block;
  flex: 0 0 auto;
}

body[data-study-mode="automatic"][data-role="user"] .task-prompt-dock-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: #202426;
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  min-height: 46px;
  padding: 8px 16px;
  text-align: left;
  width: 100%;
}

body[data-study-mode="automatic"][data-role="user"] .task-prompt-dock-toggle:hover,
body[data-study-mode="automatic"][data-role="user"] .task-prompt-dock-toggle:focus-visible {
  background: #eef1ef;
}

body[data-study-mode="automatic"][data-role="user"] .task-prompt-dock-toggle:focus-visible {
  outline: 2px solid #7890b2;
  outline-offset: -2px;
}

.task-prompt-dock-label {
  color: #5b666b;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.task-prompt-dock-title {
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-prompt-dock-action {
  color: #66747a;
  font-size: 12px;
  white-space: nowrap;
}

.task-prompt-dock-chevron {
  border-bottom: 2px solid #66747a;
  border-right: 2px solid #66747a;
  display: inline-block;
  height: 8px;
  margin-right: 2px;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 120ms ease;
  width: 8px;
}

.task-prompt-dock.expanded .task-prompt-dock-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

/* Expanded task content is intentionally plain: bold heading + normal text. */
.task-prompt-dock-details {
  background: #fff;
  border-top: 1px solid #e1e5e2;
  max-height: min(260px, 34vh);
  overflow: auto;
  padding: 14px 16px 16px;
}

.task-prompt-dock-details[hidden] {
  display: none !important;
}

.task-prompt-dock-section {
  display: grid;
  gap: 6px;
}

.task-prompt-dock-section + .task-prompt-dock-section {
  margin-top: 14px;
}

.task-prompt-dock-heading {
  color: #202426;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.task-prompt-dock-section p,
.task-prompt-dock-assignment p {
  color: #303638;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  margin: 0;
}

/* Compact disclosure controls ------------------------------------------------------
   The three large icon-only arrows in the drafting workspace use the same
   low-priority text + small chevron pattern as the task dock. */
.compact-disclosure-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #66747a;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  gap: 7px;
  justify-content: center;
  min-height: 30px;
  padding: 4px 6px;
  white-space: nowrap;
  width: auto;
}

.compact-disclosure-button::after {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  content: "";
  display: inline-block;
  flex: 0 0 auto;
  height: 7px;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 120ms ease;
  width: 7px;
}

.compact-disclosure-button[aria-expanded="true"]::after {
  transform: rotate(225deg) translate(-1px, -1px);
}

.compact-disclosure-button:hover,
.compact-disclosure-button:focus-visible {
  background: #eef1ef;
  color: #3f4a4f;
}

.compact-disclosure-button:focus-visible {
  outline: 2px solid #7890b2;
  outline-offset: 1px;
}

/* Override legacy icon-only geometry/pseudo arrows only for the converted controls. */
body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card #collapseIntentButton,
.notes-group-toggle.compact-disclosure-button {
  background: transparent;
  border: 0;
  color: #66747a;
  display: inline-flex;
  font-size: 12px;
  height: auto;
  min-height: 30px;
  padding: 4px 6px;
  width: auto;
}

body[data-study-mode="automatic"][data-role="user"][data-stage="3"] .intention-card #collapseIntentButton::before,
.notes-group-toggle.compact-disclosure-button::before {
  content: none !important;
}

@media (max-width: 900px) {
  body[data-study-mode="automatic"][data-role="user"] .task-prompt-dock-toggle {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  body[data-study-mode="automatic"][data-role="user"] .task-prompt-dock-action {
    display: none;
  }
}

/* Formal participant controls use one compact type scale everywhere.
   The 12px label size matches the dominant navigation/control treatment and
   prevents modal, conversation, and utility controls from jumping back to the
   browser's 16px inherited default. Icon-only controls keep their own sizes. */
body[data-study-mode="automatic"][data-role="user"] button:not(#toolbar button):not(.chat-send-button):not(.friction-gate-skip-button):not(.context-remove-button):not(.formal-panel-toggle):not(.structure-drag-handle):not(.disclosure-toggle),
body[data-study-mode="automatic"][data-role="user"] select:not(#toolbar select) {
  font-size: var(--formal-control-font-size);
}

/* Secondary card headings sit just above controls instead of competing with
   the main panel titles. */
body[data-study-mode="automatic"][data-role="user"] #intentionCard h3 {
  font-size: 12px;
  line-height: 1.35;
}

/* Persistent navigation keeps the same compact geometry as its type scale. */
body[data-study-mode="automatic"][data-role="user"] #formalBackStageButton,
body[data-study-mode="automatic"][data-role="user"] #studyHomeButton,
body[data-study-mode="automatic"][data-role="user"] #submitDraftButton,
body[data-study-mode="automatic"][data-role="user"] #outlineNextButton,
body[data-study-mode="automatic"][data-role="user"] #postWritingSurveyBackButton,
body[data-study-mode="automatic"][data-role="user"] #postWritingSurveyNextButton,
body[data-study-mode="automatic"][data-role="user"] #completePostWritingSurveyButton,
body[data-study-mode="automatic"][data-role="user"] #completeFrictionReviewButton,
body[data-study-mode="automatic"][data-role="user"] #taskCompleteReturnButton {
  border-radius: 6px;
  font-weight: 650;
  line-height: 1.2;
  min-height: 32px;
  padding: 5px 10px;
}

body[data-study-mode="automatic"][data-role="user"] .system-actions {
  gap: 6px;
}

@media (max-width: 720px) {
  body[data-study-mode="automatic"][data-role="user"] #postWritingSurveyBackButton,
  body[data-study-mode="automatic"][data-role="user"] #postWritingSurveyNextButton,
  body[data-study-mode="automatic"][data-role="user"] #completePostWritingSurveyButton,
  body[data-study-mode="automatic"][data-role="user"] #completeFrictionReviewButton {
    min-height: 32px;
    padding: 5px 10px;
  }
}

/* A single, user-facing description of observable AI work. This is not
 * model chain-of-thought. */
.chat-process-status {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: 6px;
  line-height: 1.4;
  margin: 0 0 8px;
}

.chat-process-status.active {
  color: var(--text);
}

.chat-process-status.complete {
  opacity: 0.78;
}

.chat-process-icon {
  display: inline-flex;
  flex: 0 0 12px;
  justify-content: center;
}

.chat-streaming-text {
  min-height: 20px;
}

.revision-current-result {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding-top: 14px;
}

.revision-current-result > strong {
  font-size: 13px;
}

.revision-current-result-copy,
.revision-current-result-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
}
