/* Approved two-step converter. All colours inherit the current workspace theme. */
#convert.reconstruct-stage { border: 0; background: transparent; box-shadow: none; }
#convert .overview-upload-card { padding: 0; overflow: hidden; }
#convert .reconstruct-upload-stack,
#convert .overview-upload-details,
#convert .overview-reveal { gap: 0; }
#convert .convert-card-step { padding: 20px 24px 22px; }
#convert .convert-step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
#convert .convert-step-number {
  display: inline-flex; width: 22px; height: 22px; flex: 0 0 22px; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 11.5px; font-weight: 600;
}
#convert .convert-step-title { margin: 0; color: var(--ink); font: 600 15px/1.4 var(--sans); letter-spacing: 0; }

#convert .convert-drop {
  display: flex; min-height: 84px; align-items: center; gap: 18px; padding: 16px 20px;
  border: 1px dashed var(--dash-hover); border-radius: 12px; background: var(--dz-hover);
  color: var(--ink); text-align: left; text-decoration: none;
}
#convert .convert-drop .overview-upload-badge {
  display: inline-flex; width: 44px; height: 44px; flex: 0 0 44px; align-items: center; justify-content: center;
  margin: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--accent-ink);
}
#convert .convert-drop .overview-upload-badge svg { width: 22px; height: 22px; }
#convert .convert-drop-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; align-items: flex-start; }
#convert .convert-drop-title-row { display: block; min-width: 0; color: var(--ink); font-size: 16px; line-height: 1.3; }
#convert .convert-drop [data-drop-title] { font-size: inherit; font-weight: 600; }
#convert .convert-drop .drop-or { color: var(--ink); font-weight: 600; }
#convert .convert-drop .browse-link {
  display: inline; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent;
  color: var(--accent); font-size: inherit; font-weight: 600; line-height: inherit;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
#convert .convert-drop .browse-link:hover { background: transparent; color: var(--accent-ink); }
#convert .convert-drop .dh,
#convert .convert-drop .file-status { display: block; max-width: 100%; color: var(--muted); font-size: 12.5px; text-align: left; }
#convert .convert-drop .dh { margin-top: 3px; }
#convert .convert-drop .file-status { margin-top: 2px; color: var(--faint); font-size: 11.5px; overflow-wrap: anywhere; }
#convert .convert-drop.has-file { border-style: solid; border-color: var(--line); background: var(--card); }
#convert .convert-drop.has-file .overview-upload-badge { border-color: var(--ok-bg); background: var(--ok-bg); color: var(--ok-fg); }
#convert .convert-drop.has-file .convert-drop-title-row,
#convert .convert-drop.has-file .dh { display: none; }
#convert .convert-drop.has-file .file-status { margin: 0; color: var(--ink); font-size: 15px; font-weight: 600; }
#convert .convert-drop.is-invalid { border-color: var(--fail-fg); }

#convert .convert-style-step { margin: 0; border-top: 1px solid var(--line-mid); }
.convert-style-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.convert-style-choice {
  display: flex; min-width: 0; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-align: left;
}
.convert-choice-icon-tile {
  display: inline-flex; width: 36px; height: 36px; flex: 0 0 36px; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink);
}
#convert .convert-choice-icon { width: 18px; height: 18px; margin: 0; color: inherit; }
.convert-choice-copy { display: block; min-width: 0; flex: 1; }
.convert-style-choice h3 { margin: 0; color: var(--ink); font: 600 14px/1.35 var(--sans); }
.convert-style-choice p { margin: 2px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.convert-choice-hint { display: block; margin-top: 2px; color: var(--muted-2); font-size: 11px; line-height: 1.35; white-space: nowrap; }
/* The saved-style card names the quiet default in a full sentence; let it wrap rather than clip. */
#convert .convert-style-choice p[data-saved-style-summary] { white-space: normal; overflow: visible; text-overflow: clip; }
#convert .convert-style-choice .btn {
  min-height: 34px; margin: 0 0 0 auto; padding: 0 12px; border-color: var(--btn-line); border-radius: 9px;
  background: transparent; box-shadow: none; color: var(--ink-2); font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
#convert .convert-style-choice .btn:hover { background: var(--btn-ghost-hover); color: var(--ink-2); transform: none; }
.convert-example-drop { border-style: dashed; border-color: var(--dash-hover); background: var(--dz-hover); }
.convert-example-drop.is-dragging { background: var(--accent-soft); border-color: var(--accent); }
#convert .convert-style-step:has([data-style-confirm]:not([hidden])) .convert-style-choices { display: none; }
#convert [data-style-confirm] {
  display: flex; min-width: 0; flex-direction: row; align-items: center; gap: 14px; margin: 0; padding: 14px 16px;
  border: 1px solid var(--accent); border-radius: 12px; background: var(--accent-soft);
}
#convert [data-style-confirm] .convert-choice-icon-tile { background: var(--card); }
#convert .style-confirm-copy { display: block; min-width: 0; flex: 1; }
#convert [data-style-confirm-name] {
  display: block; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 600;
  text-overflow: ellipsis; white-space: nowrap;
}
#convert .style-confirm-meta { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }
#convert .style-confirm-selftest { color: inherit; font-size: inherit; }
#convert [data-style-confirm] .style-confirm-change {
  flex: 0 0 auto; margin-left: auto; padding: 0; border: 0; background: transparent;
  color: var(--accent-ink); font-size: 12.5px; font-weight: 500; cursor: pointer;
}
#convert .convert-finish-row {
  display: flex; align-items: center; gap: 16px; margin: 0; padding: 14px 24px;
  border-top: 1px solid var(--line-mid); background: var(--card-alt);
}
#convert .convert-finish-row .trust { align-items: center; gap: 8px; flex: 1; margin: 0; padding: 0; border: 0; background: transparent; }
#convert .convert-finish-row .trust svg { width: 14px; height: 14px; flex-basis: 14px; color: var(--accent); }
#convert .convert-finish-row .trust .t { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
#convert .convert-finish-row .hero-cta { flex: 0 0 auto; gap: 10px; margin: 0; }
#convert .convert-finish-row .btn { min-height: 37px; padding: 0 16px; border-radius: 9px; font-size: 13.5px; font-weight: 500; }
#convert .convert-finish-row .btn.ghost { border-color: var(--btn-line); color: var(--ink-2); }
/* Two submit actions. The house-style button is first in the DOM so Enter submits it,
   and shown on the right as the primary action; plain Reconstruct sits beside it. */
#convert .conversion-mode-actions .btn[data-convert-mode="ai"] { order: 2; }
#convert .conversion-mode-actions .btn[data-convert-mode="beta"] { order: 3; font-weight: 700; }
#convert .convert-mode-hint {
  margin: 0; padding: 10px 24px 12px; border-top: 1px dashed var(--line-mid); background: var(--card-alt);
  color: var(--muted); font-size: 12.5px; line-height: 1.5; text-align: center;
}
/* Shown only while no house style is chosen, so the primary button explains itself. */
#convert .convert-needs-style {
  margin: 0; padding: 8px 24px; border-top: 1px solid var(--line-mid);
  background: var(--lf-warning-soft); color: var(--lf-warning);
  font-size: 12.5px; line-height: 1.5; text-align: center;
}
#convert .convert-needs-style::before {
  content: "!"; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: 8px;
  border: 1.5px solid currentColor; border-radius: 50%; vertical-align: -3px;
  font-size: 10px; font-weight: 700; line-height: 1;
}
#convert .convert-needs-style b { font-weight: 600; }
#convert .conversion-mode-actions .btn[data-convert-mode="ai"][data-needs-style] { opacity: .72; }

/* The recent list mirrors the compact approved table while keeping its live row renderer. */
.current-jobs { overflow: hidden; }
.current-jobs-state {
  display: inline-flex; align-items: center; min-height: 0; padding: 1px 7px; border: 0; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent-ink); font: 600 11px/1.4 var(--sans);
  font-variant-numeric: tabular-nums; letter-spacing: 0; white-space: nowrap;
}
.current-jobs-state.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.overview-jobs-table td:nth-child(1) .lnk { color: var(--ink); font-size: 13px; font-weight: 500; }
.overview-jobs-table .current-job-meta { margin-top: 2px; color: var(--muted-2); font-size: 11.5px; }
.overview-jobs-table th:nth-child(2),
.overview-jobs-table td:nth-child(2) { text-align: right; font-variant-numeric: tabular-nums; }
.overview-jobs-table td:nth-child(5) { text-align: right; }
.overview-jobs-table .current-job-download,
.overview-jobs-table .current-job-details-link {
  display: inline-flex; height: 30px; min-height: 30px; align-items: center; justify-content: center;
  padding: 0 11px; border: 1px solid var(--btn-line); border-radius: 8px; background: transparent;
  color: var(--ink-2); font-size: 12.5px; font-weight: 500; line-height: 1; text-decoration: none; white-space: nowrap;
}
.overview-jobs-table .current-job-download:hover,
.overview-jobs-table .current-job-details-link:hover { background: var(--btn-ghost-hover); color: var(--ink-2); text-decoration: none; transform: none; }
.convert-activity { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 20px 24px; margin-top: 20px; }
.convert-activity-head { display: flex; align-items: center; gap: 12px; }
.convert-activity-heading { min-width: 0; flex: 1; }
.convert-activity-head h2 { margin: 0; font: 500 15px/1.4 var(--sans); }
.convert-activity-head .convert-activity-file { margin-top: 3px; }
.convert-activity .convert-spinner { width: 25px; height: 25px; flex: 0 0 25px; border-width: 3px; border-color: var(--ok-fg); border-left-color: var(--line); }
.convert-activity-head a { margin-left: auto; white-space: nowrap; font-size: 13px; }
.convert-activity p { margin: 10px 0 0; font-size: 13px; }
.convert-activity .convert-activity-file, .convert-activity .convert-activity-note { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.convert-stage-track { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 22px 0 18px; }
.convert-stage-track span { min-width: 0; color: var(--muted); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.convert-stage-track span::before { content: ''; display: block; height: 4px; margin-bottom: 8px; border-radius: 3px; background: var(--line); }
.convert-stage-track .is-complete::before { background: var(--ok-fg); }
.convert-stage-track .is-current { color: var(--accent-ink); font-weight: 500; }
.convert-stage-track .is-current::before { background: var(--accent); }
.overview-jobs-table th:nth-child(4), .overview-jobs-table td:nth-child(4) { width: 216px; }
.overview-jobs-table .current-job-status { display: grid; grid-template-columns: 17px minmax(0, 1fr); column-gap: 8px; align-items: center; }
.overview-jobs-table .current-job-dial { grid-column: 1; grid-row: 1; width: 17px; height: 17px; border-color: var(--ok-fg); border-left-color: var(--line); }
.overview-jobs-table .current-job-status .overview-status-pill { grid-column: 2; grid-row: 1; justify-self: start; font-size: 11px; font-weight: 500; line-height: 1.4; }
.overview-jobs-table .current-job-status:not(:has(.current-job-dial)) { grid-template-columns: minmax(0, 1fr); }
.overview-jobs-table .current-job-status:not(:has(.current-job-dial)) .overview-status-pill { grid-column: 1; }
.overview-jobs-table .current-job-stage-count { grid-column: 2; margin-top: 3px; font-size: 11px; line-height: 1.4; }
.overview-jobs-table .current-job-status:not(:has(.current-job-dial)) .current-job-stage-count { grid-column: 1; }
.overview-jobs-table .is-processing .overview-status-pill { background: var(--ok-bg); color: var(--ok-fg); }
.overview-jobs-table .current-job-review-icon { display: inline-grid; place-items: center; flex: 0 0 13px; width: 13px; height: 13px; border: 1px solid currentColor; border-radius: 50%; font-size: 10px; line-height: 1; }
.convert-template-dialog { color: var(--ink); background: var(--card); padding: 24px; border: 1px solid var(--line); border-radius: 16px; width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; box-shadow: var(--card-shadow); }
.convert-template-dialog::backdrop { background: rgba(18, 14, 10, .58); backdrop-filter: blur(2px); }
.convert-template-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.convert-template-head h2 { margin: 0; font: 400 27px/1.2 var(--serif); }
.convert-template-head button { min-width: 40px; min-height: 40px; font-size: 24px; }
.convert-template-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.convert-template-list { display: flex; flex-direction: column; gap: 8px; max-height: 330px; overflow-y: auto; padding: 3px; }
.convert-template-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px; width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 8px; text-align: left; color: var(--ink); background: var(--card); font: 500 13px/1.5 var(--sans); cursor: pointer; overflow-wrap: anywhere; }
.convert-template-option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.convert-template-option[aria-pressed="true"]::after { content: '✓'; color: var(--accent-ink); flex-shrink: 0; }
/* Saved descriptions and rules are plain text, never a document preview. */
.convert-template-details { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--card-alt); padding: 20px; overflow-wrap: anywhere; }
.convert-template-details h3 { margin: 0 0 8px; font: 600 14px/1.5 var(--sans); }
.convert-template-details p { margin: 0 0 22px; color: var(--ink-2); font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.convert-template-details p:last-child { margin-bottom: 0; }
.convert-template-details ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.65; }
.convert-template-details li { padding-left: 3px; margin: 0 0 8px; white-space: pre-wrap; }
.convert-template-details [hidden] { display: none; }
.convert-template-details [data-template-details-message]:empty { display: none; }
.convert-rules-more { font-size: 12px; margin-top: 8px; }
.convert-template-foot { display: flex; align-items: center; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); margin-top: 22px; }
.convert-template-foot > :first-child { margin-right: auto; font-size: 12px; }
@media (max-width: 650px) {
  #convert .convert-card-step { padding: 18px; }
  .convert-style-choices, .convert-template-grid { grid-template-columns: 1fr; }
  #convert .convert-finish-row { align-items: stretch; flex-direction: column; gap: 12px; padding: 14px 18px; }
  #convert .convert-finish-row .hero-cta { justify-content: flex-end; }
  #convert .convert-mode-hint, #convert .convert-needs-style { padding-left: 18px; padding-right: 18px; }
  .convert-template-list { max-height: 210px; }
  .convert-template-dialog { padding: 18px; }
  .convert-template-foot { flex-wrap: wrap; }
  .convert-template-foot > :first-child { width: 100%; text-align: left; }
  .convert-activity { padding: 18px; }
  .convert-activity-head { flex-wrap: wrap; }
  .convert-stage-track { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 14px; }
  .convert-activity-head a { flex-basis: 100%; margin-left: 0; }
}
@media (max-width: 600px) {
  #convert .convert-drop { align-items: flex-start; flex-direction: column; gap: 12px; padding: 16px; }
  #convert .convert-drop-copy { width: 100%; }
  #convert .convert-drop-title-row { font-size: 15px; }
  .convert-style-choice p,
  .convert-choice-hint { white-space: normal; }
  /* Narrow phones: the action drops under the copy instead of squeezing the title to one word per line. */
  .convert-style-choice { flex-wrap: wrap; }
  #convert .convert-style-choice .btn { flex: 0 0 100%; margin-left: 0; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .convert-activity .convert-spinner, .overview-jobs-table .current-job-dial { animation: none; }
}

#convert [data-convert-action]:not(:disabled), .convert-template-dialog [data-template-use]:not(:disabled) { background: var(--avatar-bg); color: var(--avatar-fg); border-color: var(--avatar-bg); }
#convert [data-convert-action]:not(:disabled):hover, .convert-template-dialog [data-template-use]:not(:disabled):hover { background: var(--accent-ink); }
/* The plain Reconstruct button shares [data-convert-action] with the primary above but stays a
   ghost button: transparent, outlined, ghost hover. Specificity beats the primary fill rule. */
#convert .conversion-mode-actions .btn.ghost[data-convert-action]:not(:disabled) { background: transparent; color: var(--ink-2); border-color: var(--btn-line); box-shadow: none; }
#convert .conversion-mode-actions .btn.ghost[data-convert-action]:not(:disabled):hover { background: var(--btn-ghost-hover); color: var(--ink-2); border-color: var(--btn-line); }

/* The example dialog shares the saved-template dialog's spacing and type. */
[data-style-sheet-root] .style-sheet-modal .sheet-head h3 { font: 400 27px/1.2 var(--serif); }
[data-style-sheet-root] .style-sheet-modal .style-sheet-file-label { margin-top: 0; }
.style-sheet-use-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; border: 0; margin: 22px 0 0; padding: 0; min-width: 0; }
.style-sheet-use-options legend { padding: 0 0 10px; font: 500 13px/1.5 var(--sans); color: var(--ink); }
.style-sheet-use-options label { display: flex; align-items: flex-start; gap: 10px; padding: 15px 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.style-sheet-use-options label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.style-sheet-use-options input { accent-color: var(--accent); margin-top: 4px; flex: 0 0 auto; }
.style-sheet-use-options strong { display: block; font: 600 13px/1.5 var(--sans); }
.style-sheet-use-options small { display: block; color: var(--muted); font: 400 12px/1.5 var(--sans); margin-top: 3px; }
.style-sheet-name-field { margin-top: 20px; }
.style-sheet-name-field[hidden] { display: none; }
.style-sheet-footer-note { color: var(--muted); font-size: 12px; margin-right: auto; }
[data-style-sheet-root] .style-sheet-modal [data-style-sheet-status]:empty { display: none; }
[data-style-sheet-root] .style-sheet-modal [data-style-sheet-upload]:not(:disabled) { background: var(--avatar-bg); color: var(--avatar-fg); border-color: var(--avatar-bg); }
@media (max-width: 420px) { .style-sheet-use-options { grid-template-columns: 1fr; } }

[data-style-sheet-root] .sheet-head { padding: 24px 24px 18px; }
[data-style-sheet-root] .sheet-head h3 { margin: 0; }
[data-style-sheet-root] .style-sheet-name-field { margin-top: 4px; }
[data-style-sheet-root] .style-sheet-name-field .flbl { display: block; margin: 0 0 7px; }
[data-style-sheet-root] .style-sheet-name-field .fin { width: 100%; margin: 0; }
[data-style-sheet-root] .style-sheet-use-options { margin-top: 8px; }
[data-style-sheet-root] .style-sheet-use-options label { transition: none; }
