body {
  background: #f7f6fb;
}
.brand {
  text-decoration: none;
  color: var(--ink);
}
header {
  border-bottom: 1px solid var(--line);
  max-width: none;
  padding-left: max(28px, calc((100vw - 1180px) / 2));
  padding-right: max(28px, calc((100vw - 1180px) / 2));
  background: white;
}
main {
  max-width: 1240px;
}
.app-home {
  font-size: 13px;
  text-decoration: none;
}
.workspace-label {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 1.5px;
  color: var(--muted);
  padding-top: 30px;
}
.progress {
  padding: 16px 0 30px;
}
.app-intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 0 0 25px;
}
.app-intro h1 {
  font-size: 36px;
  letter-spacing: -1.3px;
  margin-bottom: 12px;
}
.app-intro p {
  margin-bottom: 0;
}
.sample-context {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
  font-size: 13px;
}
.uploads {
  gap: 24px;
}
.uploads .panel {
  padding: 25px;
}
.drop {
  padding: 22px;
}
.drop:before {
  display: none;
}
.upload-thumb {
  width: 105px;
  height: 120px;
  object-fit: cover;
  object-position: top;
  border: 1px solid #ddd6ed;
  box-shadow: 0 4px 15px #2a21450d;
  margin: 0 auto 16px;
  display: block;
  border-radius: 3px;
}
.drop p {
  margin-bottom: 14px;
}
.file {
  font-size: 12px;
}
.toolbar {
  padding-top: 12px;
}
.design {
  margin-top: 40px;
}
.review > div:first-child {
  position: sticky;
  top: 20px;
}
.app-intro button {
  white-space: nowrap;
}
@media (max-width: 700px) {
  header {
    padding: 18px 20px;
  }
  .app-intro {
    align-items: flex-start;
    flex-direction: column;
  }
  .app-intro h1 {
    font-size: 32px;
  }
  .workspace-label {
    padding-top: 22px;
  }
  .sample-context {
    gap: 9px;
  }
  .sample-context .muted {
    flex-basis: 100%;
  }
  .uploads .panel {
    padding: 20px;
  }
  .review > div:first-child {
    position: static;
  }
  .toolbar .primary {
    width: 100%;
  }
}

/* Keep optional setup information out of the main input path. */
.sample-options {
  align-self: flex-start;
  max-width: 360px;
}
.sample-options summary,
.sample-downloads summary,
.usage-details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
}
.sample-options .actions {
  margin: 12px 0;
}
.sample-downloads,
.usage-details {
  margin: 12px 0;
}
.sample-downloads .sample-context {
  margin-bottom: 8px;
}

/* Match the simple intake shown on the homepage. */
body {
  background: #f7f6fb;
}
main {
  max-width: 1120px;
  padding-top: 48px;
}
.intake-workspace {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
}
.intake-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.intake-title h1 {
  font-size: 23px;
  letter-spacing: -0.5px;
  margin: 0;
}
.intake-workspace .drop {
  padding: 40px 20px;
  background: #faf8ff;
}
.intake-workspace .drop:before {
  display: block;
}
.intake-workspace .drop h2 {
  font-size: 19px;
  margin: 0 0 12px;
}
.intake-workspace .drop p {
  min-height: 20px;
}
.intake-run {
  margin: 20px 0 0;
  gap: 20px;
}
.sample-options {
  max-width: none;
  margin-top: 20px;
}
.sample-options summary,
.usage-details summary,
.job-options summary,
.package-panel > summary,
.placement-controls > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}
.usage-details {
  margin-bottom: 0;
}
.job-options {
  margin: 24px 0;
}
.job-options footer {
  margin-top: 20px;
  padding: 16px 0;
  font-size: 12px;
}
.package-panel {
  margin: 20px 0;
  padding: 16px;
}
.package-panel[open] > summary {
  margin-bottom: 16px;
}
#message:empty {
  display: none;
}
#message {
  margin: 0 0 20px;
}
.placement-controls:not([open]) {
  padding: 12px;
  margin-bottom: 16px;
}
@media (max-width: 700px) {
  main {
    padding-top: 24px;
  }
  .intake-workspace {
    padding: 20px;
  }
  .intake-title {
    align-items: flex-start;
  }
  .intake-workspace .drop {
    padding: 26px 16px;
  }
  .intake-run {
    align-items: flex-start;
  }
  .intake-run .primary {
    width: auto;
    margin-left: auto;
  }
}

/* Fluid workspace and explicit single/multiple file intake. */
main {
  width: 100%;
  max-width: none;
  padding: 32px clamp(20px, 3vw, 56px);
}
.upload-column {
  min-width: 0;
}
.intake-workspace .drop {
  height: auto;
  min-height: 300px;
}
.file-support {
  margin: 10px 2px 0;
  font-size: 12px;
  line-height: 1.7;
}
.upload-list {
  margin-top: 20px;
  text-align: left;
  color: var(--muted);
}
.upload-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid #e5ddf1;
}
.upload-file > div {
  min-width: 0;
}
.upload-file strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
}
.upload-file span {
  display: block;
  font-size: 11px;
  margin-top: 4px;
}
.upload-file button {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--line);
  box-shadow: none;
}
.intake-run button:disabled {
  background: #e4dfed;
  color: #8a819a;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}
@media (max-width: 700px) {
  main {
    padding: 20px 14px;
  }
  .intake-workspace {
    padding: 20px 16px;
  }
  .intake-workspace .drop {
    min-height: 0;
    padding: 24px 16px;
  }
  .uploads {
    gap: 24px;
  }
  .upload-file {
    align-items: flex-start;
  }
}

/* Persistent workflow navigation and one primary action per step. */
body {
  padding-bottom: 130px;
}
.workflow-dock {
  position: fixed;
  z-index: 30;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #ded7eb;
  box-shadow: 0 -6px 28px #30204a09;
  padding: 14px clamp(20px, 3vw, 56px) max(14px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 32px;
}
.workflow-steps {
  display: flex;
  flex: 1;
  max-width: 780px;
  min-width: 0;
}
.workflow-steps button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  transform: none;
}
.workflow-steps button + button:before {
  content: "";
  position: absolute;
  right: calc(100% - 2px);
  width: 22px;
  height: 2px;
  background: var(--line);
}
.workflow-steps button:disabled {
  opacity: 1;
  color: #9992a6;
  cursor: default;
}
.step-marker {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: 1px solid #ddd6e8;
  border-radius: 50%;
  font-size: 12px;
  background: #fff;
}
.workflow-steps .current {
  color: var(--accent);
  font-weight: 700;
}
.workflow-steps .current .step-marker {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.workflow-steps .complete .step-marker {
  background: #eee9fb;
  color: var(--accent);
  border-color: #d7caef;
}
.workflow-action {
  margin-left: auto;
  display: flex;
  gap: 20px;
  align-items: center;
}
.workflow-action > span {
  max-width: 260px;
  font-size: 12px;
}
.workflow-action button,
.workflow-action a {
  white-space: nowrap;
}
.intake-run {
  padding: 0;
  margin-top: 20px;
}
.intake-run p {
  margin: 0;
}
.workflow-action #run:disabled {
  background: #e4dfed;
  border-color: #e4dfed;
  color: #8a819a;
  opacity: 1;
  box-shadow: none;
}
.workflow-action #download {
  display: inline-block;
  padding: 11px 20px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
}
#review > .toolbar:last-child {
  margin-bottom: 12px;
}
@media (max-width: 900px) {
  .workflow-dock {
    gap: 12px;
  }
  .workflow-action > span {
    display: none;
  }
  .workflow-steps button {
    padding: 8px;
    gap: 6px;
  }
  .workflow-steps button + button:before {
    display: none;
  }
}
@media (max-width: 600px) {
  body {
    padding-bottom: 170px;
  }
  .workflow-dock {
    flex-wrap: wrap;
    padding: 10px 14px max(12px, env(safe-area-inset-bottom));
    gap: 8px;
  }
  .workflow-steps {
    flex-basis: 100%;
    max-width: none;
  }
  .workflow-steps button {
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    padding: 3px;
  }
  .step-marker {
    width: 25px;
    height: 25px;
  }
  .workflow-action {
    width: 100%;
    justify-content: space-between;
    min-height: 44px;
  }
  .workflow-action > span {
    display: block;
    max-width: 65%;
    font-size: 11px;
  }
  .workflow-action button,
  .workflow-action #download {
    padding: 9px 16px;
    font-size: 13px;
  }
}
@media print {
  .workflow-dock {
    display: none;
  }
  body {
    padding-bottom: 0;
  }
}
/* React review controls keep numeric placement out of the main workflow. */
.placement-tools {
  margin-top: 12px;
}
.placement-tools > button {
  padding: 6px 9px;
  font-size: 12px;
  margin: 4px 6px 4px 0;
  background: transparent;
  box-shadow: none;
}
.placement-tools summary {
  font-size: 12px;
  color: var(--muted);
}
.placement-tools details {
  margin-top: 8px;
}
.selected-field {
  outline: 2px solid #c8b5f0;
  border-radius: 6px;
}
.placement-box.selected {
  outline: 3px solid #6549db;
  outline-offset: 3px;
}
.approved-note {
  font-size: 12px;
  color: #25805c;
  align-self: center;
}
.drawing-instruction {
  padding: 12px;
  background: #eee8fb;
  border-radius: 8px;
  font-size: 13px;
}
.drawing-instruction button {
  padding: 4px 8px;
  font-size: 12px;
}
.field input {
  width: 100%;
}
.field input[type="checkbox"] {
  width: auto;
}
.pdf-page {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #ddd5ee;
  margin-bottom: 12px;
}
.intake-run #run {
  white-space: nowrap;
}
.intake-run #run:disabled {
  background: #e4dfed;
  border-color: #e4dfed;
  color: #8a819a;
  opacity: 1;
  box-shadow: none;
}
.placement-box:hover {
  transform: none;
}
/* Keep long previews reachable above the fixed workflow navigation. */
.review > div:first-child {
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.review > div:first-child:has(.drawing) {
  position: static;
  max-height: none;
  overflow: visible;
}
.form-page {
  scroll-margin-top: 20px;
  scroll-margin-bottom: 150px;
}
@media (max-width: 700px) {
  .review > div:first-child {
    max-height: none;
    overflow: visible;
    scrollbar-gutter: auto;
  }
}
/* Back/Next sit beside the tracker and never replace Run or Finalize. */
.workflow-history {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.workflow-history button {
  font-size: 12px;
  padding: 9px 12px;
  white-space: nowrap;
}
.workflow-history button:disabled {
  box-shadow: none;
  transform: none;
}
.workflow-dock {
  gap: 20px;
}
@media (max-width: 600px) {
  .workflow-dock {
    gap: 8px 12px;
  }
  .workflow-history {
    gap: 6px;
  }
  .workflow-history button {
    padding: 9px 10px;
  }
  .workflow-action {
    width: auto;
    min-width: 0;
    flex: 1;
    margin-left: auto;
    justify-content: flex-end;
  }
  .workflow-action > span {
    display: none;
  }
  .workflow-action #download {
    padding: 9px 10px;
    font-size: 12px;
  }
}
.processing-choice {
  margin-top: 20px;
}
.processing-choice label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.processing-choice p {
  margin: 6px 0 0;
  max-width: 760px;
  font-size: 12px;
}
.processing-choice input {
  width: auto;
}

/* Processing remains visibly active without inventing completion percentages. */
.analysis-progress {
  max-width: 760px;
  margin: 28px auto;
}
.analysis-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.analysis-heading h2 {
  margin: 0;
  font-size: 22px;
}
.elapsed {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.analysis-spinner {
  width: 25px;
  height: 25px;
  border: 3px solid #e5def6;
  border-top-color: #6549db;
  border-radius: 50%;
  animation: analysis-spin 1s linear infinite;
}
@keyframes analysis-spin {
  to {
    transform: rotate(360deg);
  }
}
.analysis-stages {
  padding-left: 24px;
}
.analysis-stages li {
  padding: 12px 8px;
  color: var(--muted);
}
.analysis-stages li.current {
  color: #5138a0;
  font-weight: 600;
  background: #f3effb;
  border-radius: 8px;
}
.analysis-stages li.complete {
  color: #25805c;
}
.analysis-stages small {
  display: block;
  margin-top: 5px;
  font-weight: 400;
  line-height: 1.5;
}
.placement-box[data-movable="true"] {
  cursor: grab;
  touch-action: none;
}
.placement-box[data-movable="true"]:active {
  cursor: grabbing;
}
@media (prefers-reduced-motion: reduce) {
  .analysis-spinner {
    animation-duration: 3s;
  }
}

/* The preview shows proposed text immediately; color communicates review needs. */
.form-page {
  container-type: inline-size;
}
.placement-box.answer-supported {
  border-color: #25805c;
  background: #edf9f0d9;
}
.placement-box.answer-check {
  border-color: #c28a1b;
  background: #fff5dbd9;
}
.placement-box.answer-conflict {
  border-color: #bb3939;
  background: #ffe8e6e6;
}
.placement-box.answer-omitted {
  border-color: #aaa;
  background: #f5f5f5b0;
}
.placement-box .preview-answer {
  position: static;
  display: block;
  background: transparent;
  max-width: none;
  width: 100%;
  height: 100%;
  padding: 1px 2px;
  text-align: left;
  color: #242137;
  font-size: max(9px, 1.8cqw);
  line-height: 1.15;
  white-space: pre-wrap;
  overflow: hidden;
  text-overflow: clip;
}
.answer-options {
  border-bottom: 0;
  padding: 10px 0 0;
}
.answer-options > summary {
  color: var(--muted);
  font-size: 12px;
}
.field > details > summary {
  font-size: 12px;
  color: var(--muted);
}
.field > details {
  padding: 10px 0;
  border: 0;
}

/* Source documents flow into one target form. */
.intake-workspace .drop {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 430px;
  padding: 22px;
}
.intake-workspace .drop::before {
  display: none;
}
.intake-workspace .drop h2 {
  margin: 0 0 16px;
}
.upload-direction {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  color: var(--accent);
  margin: 18px auto;
}
.upload-prompt {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.intake-workspace .drop > button {
  align-self: center;
  margin-top: 12px;
}
.intake-workspace .drop p {
  min-height: 0;
}
.target-thumbnail {
  flex: 1;
  min-height: 210px;
  height: 240px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eeeaf5;
}
.target-thumbnail img {
  display: block;
  width: 100%;
  height: 240px;
  object-fit: contain;
  object-position: top;
}
.target-thumbnail p {
  padding: 20px;
}
.intake-workspace .upload-list {
  margin-top: 18px;
  max-height: 230px;
  overflow-y: auto;
}
.intake-title > button {
  white-space: nowrap;
  font-size: 13px;
}
@media (max-width: 700px) {
  .intake-workspace .drop {
    min-height: 350px;
  }
}

.upload-column {
  display: flex;
  flex-direction: column;
}
.upload-column > .drop {
  flex: 1;
}
.processing-choice input[type="checkbox"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.processing-choice input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.usage-details > .processing-choice {
  padding: 16px;
  margin: 16px 0;
  background: #f7f4fd;
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* Keep the normal desktop Upload path above the persistent tracker. */
@media (min-width: 701px) {
  body:has(#inputs:not([hidden])) {
    padding-bottom: 82px;
  }
  body:has(#inputs:not([hidden])) main {
    padding-top: 16px;
    padding-bottom: 12px;
  }
  body:has(#inputs:not([hidden])) #message:empty {
    display: none;
  }
  body:has(#inputs:not([hidden])) #message {
    min-height: 0;
    margin: 0 0 8px;
    font-size: 12px;
  }
  #inputs.intake-workspace {
    padding: 18px 22px;
  }
  #inputs .intake-title {
    margin-bottom: 12px;
  }
  #inputs .intake-title > button {
    padding: 9px 14px;
  }
  #inputs .drop {
    min-height: 0;
    height: clamp(260px, calc(100dvh - 425px), 410px);
    padding: 16px 20px;
  }
  #inputs .drop h2 {
    margin-bottom: 8px;
    font-size: 18px;
  }
  #inputs .target-thumbnail {
    min-height: 0;
    height: auto;
    flex: 1;
  }
  #inputs .target-thumbnail img {
    height: 100%;
    max-height: clamp(110px, calc(100dvh - 510px), 270px);
  }
  #inputs .drop > button {
    padding: 7px 14px;
    margin-top: 8px;
    font-size: 13px;
  }
  #inputs .upload-list {
    margin-top: 8px;
    flex-shrink: 0;
    max-height: 100px;
  }
  #inputs .upload-file {
    padding: 8px 0;
  }
  #inputs .file-support {
    margin-top: 6px;
    line-height: 1.4;
  }
  #inputs .intake-run {
    margin: 12px 0 0;
    padding-top: 0;
  }
  #inputs .intake-run > p {
    margin: 0;
  }
  #inputs .intake-run > button {
    padding: 10px 20px;
  }
  #inputs .usage-details {
    margin: 8px 0 0;
    padding: 8px 0;
  }
  body:has(#inputs:not([hidden])) .job-options {
    margin: 8px 0 0;
    padding: 6px 0;
  }
}

@media (min-width: 701px) {
  #inputs .usage-details[open] {
    position: fixed;
    z-index: 30;
    left: clamp(20px, 3vw, 56px);
    right: clamp(20px, 3vw, 56px);
    bottom: 90px;
    max-height: calc(100dvh - 130px);
    overflow-y: auto;
    padding: 18px 22px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 50px #30206326;
  }
}
@media (min-width: 701px) {
  #inputs .upload-column > .drop {
    flex: none;
  }
}

#inputs .upload-prompt {
  min-height: 0;
}
#inputs .target-thumbnail {
  position: relative;
}
#inputs .target-thumbnail img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
}
@media (min-width: 701px) {
  #inputs .upload-direction {
    margin: 6px auto;
  }
  #inputs .upload-direction svg {
    max-height: 32px;
  }
}

#inputs .usage-details {
  border-bottom: 0;
}
#inputs .intake-run {
  justify-content: flex-end;
}

#inputs .drop .file-support {
  flex-shrink: 0;
  margin: 8px 0 0;
  text-align: center;
}

.analysis-stages {
  list-style: none;
  padding: 0;
}
.analysis-stages li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.stage-symbol {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.stage-symbol.analysis-spinner {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}
.analysis-stages li.completed {
  color: #25805c;
}
.analysis-stages li.warning {
  color: #875a18;
  background: #fff8e8;
  border-radius: 8px;
}
.analysis-stages li.failed {
  color: #aa3434;
}
.analysis-stages li.skipped {
  color: var(--muted);
}
.stage-state {
  display: inline-block;
  margin-left: 10px;
  font-size: 11px;
  font-weight: 400;
}

#inputs .settings-section {
  margin: 18px 0 0;
  padding: 16px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
}
#inputs .settings-section h3 {
  margin: 0 0 12px;
  font-size: 14px;
}
#inputs .settings-section .toolbar {
  margin: 8px 0;
  padding: 0;
}

/* Keep the virtual form focused on the question and answer. */
#fields .field {
  border-left: 0;
  padding-left: 0;
}
.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}
#fields .field-heading label {
  margin: 0;
}
#fields .field[data-tone="supported"] > input {
  background: #f1faf4;
  border-color: #76b894;
}
#fields .field[data-tone="check"] > input,
#fields .field[data-tone="missing"] > input {
  background: #fff9ec;
  border-color: #d5af60;
}
#fields .field[data-tone="conflicting"] > input {
  background: #fff1ef;
  border-color: #ce7770;
}
#fields .field[data-tone="omitted"] > input {
  background: #f4f4f5;
  border-color: #c8c8ce;
}
#fields .field > input:focus {
  outline: 2px solid #b6a0ee;
  outline-offset: 2px;
}
.answer-options h4 {
  font-size: 13px;
  margin: 14px 0 8px;
}

.source-carousel {
  margin: 0 0 20px;
}
.source-carousel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.source-carousel-heading h3 {
  font-size: 14px;
  margin: 0;
}
.source-carousel-heading button {
  padding: 5px 12px;
  margin-left: 6px;
}
.source-carousel-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 3px 3px 10px;
}
.source-card {
  flex: 0 0 170px;
  scroll-snap-align: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  text-decoration: none;
}
.source-card-preview {
  height: 85px;
  overflow: hidden;
  background: #f3f0f8;
  border-radius: 5px;
}
.source-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.source-card strong {
  display: block;
  font-size: 12px;
  margin: 7px 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.source-card small {
  font-size: 11px;
  color: var(--accent);
}
.source-text-preview {
  padding: 8px;
  font-size: 9px;
  line-height: 1.4;
  color: var(--muted);
}
.source-text-preview > span {
  font-size: 20px;
  color: var(--accent);
}
.source-text-preview p {
  margin: 3px 0;
}
.source-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#inputs .drop {
  position: relative;
}
.upload-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: #faf8fff2;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 13px;
}
.inline-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #d7ccf3;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: analysis-spin 1s linear infinite;
  margin-right: 8px;
  vertical-align: -2px;
}
.sample-feedback {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  max-width: 310px;
  text-align: right;
}
.upload-file .file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.file-actions a {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 10px;
}
.file-actions a:hover {
  background: #eee8fb;
}
@media (max-width: 700px) {
  .sample-feedback {
    max-width: 210px;
  }
}

/* Workflow navigation lives at the top; the upload workspace uses the freed height. */
body,
body:has(#inputs:not([hidden])) {
  padding-bottom: 0;
}
.workflow-dock {
  position: sticky;
  top: 0;
  bottom: auto;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 24px;
  padding: 12px clamp(20px, 3vw, 56px);
  border-top: 0;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 18px #30204a08;
}
.workflow-home {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--accent);
  text-decoration: none;
}
.workflow-home:hover {
  background: #f2edfc;
}
.workflow-home:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.workflow-steps {
  width: 100%;
  max-width: none;
}
.workflow-action {
  width: auto;
  min-height: 0;
  margin-left: 0;
}
.workflow-action > span {
  max-width: 230px;
}
.review > div:first-child {
  top: 95px;
  max-height: calc(100dvh - 115px);
}
#fields .field,
.form-page {
  scroll-margin-top: 100px;
}
@media (min-width: 701px) {
  #inputs .drop {
    height: clamp(320px, calc(100dvh - 310px), 700px);
  }
  #inputs .usage-details[open] {
    top: 90px;
    bottom: auto;
    max-height: calc(100dvh - 110px);
  }
  body:has(#inputs:not([hidden])) {
    padding-bottom: 0;
  }
}
@media (max-width: 700px) {
  .workflow-dock {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px;
    padding: 10px 14px;
  }
  .workflow-home {
    width: 32px;
    height: 32px;
  }
  .workflow-steps button {
    flex-direction: column;
    font-size: 11px;
    gap: 3px;
    padding: 3px;
  }
  .workflow-steps button + button:before {
    display: none;
  }
  .workflow-action {
    grid-column: 1 / -1;
    justify-content: flex-end;
    width: 100%;
  }
  .workflow-action:has(#workflow-buttons:empty) {
    display: none;
  }
  .workflow-action > span {
    display: none;
  }
  .review > div:first-child {
    max-height: none;
  }
}
@media print {
  .workflow-dock {
    display: none;
  }
}

.review .source-carousel {
  margin: 0 0 12px;
}
.review .source-carousel-heading {
  margin-bottom: 6px;
}
.review .source-carousel-heading h3 {
  font-size: 12px;
}
.review .source-card {
  flex-basis: 150px;
  padding: 6px;
}
.review .source-card-preview {
  height: 65px;
}

.field-key {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.field-key-label {
  font-weight: 600;
}
.field-key ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.field-key li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.field-key i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}
.key-supported {
  background: #76b894;
}
.key-check {
  background: #d5af60;
}
.key-conflict {
  background: #ce7770;
}
.key-omitted {
  background: #c8c8ce;
}
.key-selected {
  background: white;
  border: 2px solid #a98ae7;
}

.field-key {
  flex-wrap: wrap;
  gap: 6px 12px;
}
.field-key .key-thresholds {
  flex-basis: 100%;
  margin: 2px 0 0;
  font-size: 10px;
  line-height: 1.45;
}

#workflow-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}
.save-progress-dialog {
  width: min(480px, calc(100vw - 36px));
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  box-shadow: 0 15px 80px #30206335;
}
.save-progress-dialog::backdrop {
  background: #25203966;
}
.save-progress-dialog h2 {
  font-size: 22px;
  margin: 0 0 14px;
}
.save-progress-dialog label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}
.save-progress-dialog input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
}
.save-progress-dialog .actions {
  justify-content: flex-end;
  margin-top: 18px;
}

#fields .field[data-tone="human"] > input {
  background: #eef5ff;
  border-color: #80a7db;
}
.placement-box.answer-human {
  border-color: #4174c2;
  background: #edf4ffe6;
}
.key-human {
  background: #80a7db;
}

.workflow-action .delete-data {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #8d4047;
  background: #fff;
  border-color: #e6cfd2;
}
.workflow-action .delete-data:hover:not(:disabled) {
  background: #fff3f3;
}
@media (max-width: 1000px) {
  .workflow-action .delete-data span {
    display: none;
  }
  .workflow-action .delete-data {
    padding: 9px 10px;
  }
}

.stored-job {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.stored-job > div {
  flex: 1;
  min-width: 0;
}
.stored-job strong {
  display: block;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.stored-job small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.stored-job button,
.stored-job a {
  font-size: 12px;
  padding: 6px 10px;
}

.action-dialog{width:min(500px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:32px;border:1px solid var(--line);border-radius:20px;color:var(--ink);background:white;box-shadow:0 24px 90px #29203945}
.action-dialog::backdrop{background:#211a385c;backdrop-filter:blur(4px)}
.action-result{text-align:center}.action-dialog h2{font-size:clamp(26px,5vw,34px);line-height:1.2;margin:16px 0}.action-dialog p{font-size:16px;line-height:1.65;color:var(--muted);margin:0}
.action-symbol{width:64px;height:64px;border-radius:50%;display:grid;place-items:center;margin:auto;background:#eee9ff;color:var(--accent);font-size:34px;font-weight:700}
.action-success .action-symbol{background:#e3f5ed;color:#176b4b}.action-error .action-symbol{background:#ffeded;color:#a82b3b}
.action-buttons{display:flex;gap:12px;justify-content:center;margin-top:28px}.action-buttons button{min-height:46px}.action-danger{background:#a92f45;color:#fff;border-color:#a92f45}.action-danger:hover{background:#90253a;color:white}
.action-spinner{width:29px;height:29px;border:3px solid #cbbff1;border-top-color:var(--accent);border-radius:50%;animation:action-spin .8s linear infinite}@keyframes action-spin{to{transform:rotate(360deg)}}
@media(max-width:500px){.action-dialog{padding:26px 20px}.action-buttons{flex-direction:column}.action-buttons button{width:100%}}
@media(prefers-reduced-motion:reduce){.action-spinner{animation-duration:2s}}

.completion-dialog .completion-price{display:flex;justify-content:space-between;gap:20px;padding:18px;background:#f4f0fb;border-radius:12px}.completion-dialog .completion-price strong{color:#5744ac}.completion-dialog .action-buttons a{text-align:center;text-decoration:none;padding:13px 18px;border-radius:10px;background:#5744ac;color:white}.completion-dialog [role=status]{line-height:1.7}

#output-preview{max-width:900px;margin:auto}#output-preview .pdf-page{width:100%;height:auto}
#output{padding-bottom:150px}
.finalize-footer{position:fixed;bottom:0;left:0;right:0;z-index:25;background:#fff;border-top:1px solid var(--line);box-shadow:0 -5px 20px #30204a08;padding:18px clamp(16px,3vw,56px) max(18px,env(safe-area-inset-bottom))}
.finalize-footer-content{max-width:1100px;margin:auto;display:flex;align-items:center;gap:18px}.finalize-next{margin-right:auto}.finalize-next h3{font-size:17px;margin:0}.finalize-next p{margin:4px 0 0;font-size:13px;color:var(--muted)}.finalize-footer .finalize-delete{border:0;background:transparent;box-shadow:none;color:var(--muted);font-size:12px;padding:8px}.finalize-footer .button-link{text-align:center;text-decoration:none}
@media(max-width:700px){#output{padding-bottom:195px}.finalize-footer{padding:14px 16px}.finalize-footer-content{gap:10px;flex-wrap:wrap}.finalize-next{flex-basis:100%}.finalize-footer .primary{flex:1}.finalize-footer .finalize-delete{flex:0 0 auto}}
/* Compact left-aligned steps with explicit spacing; no overlapping connectors. */
.workflow-dock {display:flex;flex-wrap:nowrap;gap:20px}
.workflow-dock .workflow-steps {flex:0 0 auto;width:auto;max-width:none;gap:6px;padding:5px;border:1px solid #ddd6e9;border-radius:15px;background:#f7f5fb}
.workflow-dock .workflow-steps button {flex:0 0 auto;min-width:0;padding:9px 12px;gap:9px;white-space:nowrap;border-radius:10px}
.workflow-dock .workflow-steps .tracker-step.upcoming{background:transparent;color:#8b8299}.workflow-dock .workflow-steps .tracker-step.upcoming .step-marker{background:#efecf4;border-color:#d9d2e4;color:#8b8299}
.workflow-dock .workflow-steps .tracker-step.complete{background:#e9f4ec;color:#306448}.workflow-dock .workflow-steps .tracker-step.complete .step-marker{background:#387653;border-color:#387653;color:white}
.workflow-dock .workflow-steps .tracker-step.current{background:#ece4fc;color:#583bb0;box-shadow:inset 0 0 0 1px #d8c8f8}.workflow-dock .workflow-steps .tracker-step.current .step-marker{background:#6945cc;border-color:#6945cc;color:white}
.workflow-dock .workflow-steps button+button:before {content:none}
.workflow-dock .workflow-action {margin-left:auto;width:auto;flex:0 0 auto}
.workflow-dock>.identity-host {flex:0 0 auto;margin-left:auto}
.workflow-dock:has(.workflow-action)>.identity-host{margin-left:0}
.workflow-dock .identity-button {box-shadow:none;transform:none;background:#faf8ff;color:#423751;padding:8px 13px}
@media(max-width:1100px) {
 .workflow-dock {display:grid;grid-template-columns:36px auto minmax(0,1fr);gap:12px}
 .workflow-dock .workflow-steps {grid-column:2;justify-self:start}
 .workflow-dock>.identity-host {grid-column:3;grid-row:1;justify-self:end;min-width:0}
 .workflow-dock .workflow-action {grid-column:2 / -1;grid-row:2;justify-self:end;margin-left:0;width:auto}
 .workflow-dock .identity-label {max-width:110px}
}
@media(max-width:700px) {
 .workflow-dock {grid-template-columns:28px auto minmax(0,1fr);gap:6px;padding:10px}
 .workflow-dock .workflow-home {width:28px}
 .workflow-dock .workflow-steps {gap:6px;padding:3px;border-radius:12px}
 .workflow-dock .workflow-steps button {width:48px;padding:3px;flex-direction:column;gap:4px;font-size:10px}
 .workflow-dock .identity-label {max-width:55px}
 .workflow-dock .identity-avatar {display:none}
 .workflow-dock .workflow-steps .step-marker {width:24px;height:24px}
}
